错误(36,1):PLS-00103:遇到符号"SET". [英] Error(36,1): PLS-00103: Encountered the symbol "SET"

查看:93
本文介绍了错误(36,1):PLS-00103:遇到符号"SET".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Here is my sql script, my friend can run and compile it just fine, but for some reason I cannot. I keep getting the compiler error you see in the title. I ran through it a couple of times and can't seem to find the issue.

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?

Have you tried removing SET SERVEROUTPUT on?

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

Open another sql worksheet, paste the calling block and press f5

BEGIN
   EX5B_MEMBERSHIP_DURATION2();
END;

SELECT EX5B_MEMBERSHIP_DURATION2() FROM DUAL;

这篇关于错误(36,1):PLS-00103:遇到符号"SET".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆