【发布时间】:2019-04-15 07:17:59
【问题描述】:
连接三个表查询的sql错误enter code hereing common value to get reserved books by a student using cursor for iteration
我试图以相反的顺序加入他们
MEMBER PROCEDURE display_check_out(id varchar2)
IS
cursor curss
IS
select * from memberstable AS m JOIN reserv AS r ON m.member_id= r.membs
JOIN bookstable AS b ON r.bookid=b.isbn
where r.membs= id;
begin
for curs in curss
loop
DBMS_OUTPUT.PUT_LINE('Student Id: '||curs.m.member_id);
DBMS_OUTPUT.PUT_LINE(' Name: ' || curs.m.full_name||' Gender: '||curs.m.gender);
DBMS_OUTPUT.PUT_LINE(' Tel:'||'mobile: '||curs.m.telephone.mobile||'office: '|| curs.m.telephone.office);
` FOR j IN 1..curs.b.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('-------------------CheckedOutBooks--------------------------');
DBMS_OUTPUT.PUT_LINE('ISBN: '||curs.b.isbn);
DBMS_OUTPUT.PUT_LINE('Publication Date:
'||curs.b.date_of_publication);
FOR k IN 1..curs.b.authors.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('Authors: '||curs.b.authors(k));
END LOOP;
DBMS_OUTPUT.PUT_LINE('Checked out time: '||curs.checkout);
END LOOP;
END LOOP;
END display_check_out;
end;
/
我希望列出用户详细信息和 用户保留的书籍列表
【问题讨论】:
-
Oracle 不使用
AS作为表别名(尽管它确实接受它作为列别名)。
标签: oracle join plsql database-cursor