gpt4 book ai didi

plsql - 错误(36,1): PLS-00103: Encountered the symbol “SET”

转载 作者:行者123 更新时间:2023-12-02 10:46:45 32 4
gpt4 key购买 nike

这是我的sql脚本,我的 friend 可以正常运行和编译它,但是由于某种原因我不能。我不断收到标题中显示的编译器错误。我经历了几次,似乎找不到问题。

CREATE or replace procedure ex5b_membership_duration2 is
cursor customer_cursor is
select customer.customer_id,
CUSTOMER.FIRST_NAME,
CUSTOMER.LAST_NAME,
CUSTOMER.CITY,
club_membership.club_id,
club_membership.membership_id,
round((sysdate - club_membership.MEMBERSHIP_DATE)/365,2) as time_in_club
from customer
left outer join club_membership
on customer.customer_id = club_membership.CUSTOMER_ID;
customer_row customer_cursor%rowtype;

begin
dbms_output.put_line('Membership_ID' ||' '|| 'first_name' ||' '|| 'last_name' ||' '|| 'city' ||' '|| 'club_name' ||' '|| 'time_in_club');

open customer_cursor;
loop
fetch customer_cursor into customer_row;
exit when customer_cursor%notfound; -- pretty sure its ok till here

if ex5b_check_membership2(customer_row.customer_id) then
dbms_output.put_line(customer_row.membership_id ||' '|| customer_row.first_name ||' '|| customer_row.last_name ||' '|| customer_row.city ||' '|| ex5b_clubname(customer_row.club_id) ||' '|| customer_row.time_in_club);

else
dbms_output.put_line(' '|| customer_row.membership_id ||' '|| customer_row.first_name ||' '|| customer_row.last_name ||' '|| customer_row.city ||' '|| 'No membership yet' );

end if;
end loop;

close customer_cursor;
end;

--Run script
SET serveroutput on;
BEGIN
EX5B_MEMBERSHIP_DURATION2();

END;

最佳答案

您是否尝试过删除SET SERVEROUTPUT?

要么

打开另一个sql工作表,粘贴调用块并按f5

BEGIN
EX5B_MEMBERSHIP_DURATION2();
END;

要么
SELECT EX5B_MEMBERSHIP_DURATION2() FROM DUAL;

关于plsql - 错误(36,1): PLS-00103: Encountered the symbol “SET” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32879339/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com