错误(8,1):PLS-00103:遇到符号“沦为ET”。
技术问答
274 人阅读
|
0 人回复
|
2023-09-12
|
我正在尝试使用它oracle创建一个函数,它应该能够正常工作,但我不断收到以下错误:( T7 C5 B1 s* h1 y
错误(8,1)LS-00103:遇到符号 SET是我的功能:8 o# Y; [3 ]: W! r: B
CREATE OR REPLACE FUNCTION CountViewers(nameofPlay plays.play%TYPE) RETURN NUMBER ASNUM NUMBER; BEGIN SELECT SUM(registerd) INTO num1 FROM plays WHERE play=nameofPlay; return num; END;SET SERVEROUT ON;DECLAREinc integer;res NUMBER;invalid_status EXCEPTION;CURSOR clients2 IS SELECT * FROM plays;name_of_play plays.play%ROWTYPE;play_name plays%TYPE;BEGINinc:=0;name_of_play := '&lay';OPEN clients2;LOOP FETCH clients2 INTO play_name; IF name_of_play != play_name.play and clients2%rowcount>i THEN inc:=inc 1; ELSIF name_of_play = play_name.play THEN EXIT WHEN clients2%found; ELSE RAISE invalid_status; --like throw error END IF;EXIT WHEN clients2%notfound;END LOOP;res:=CountViewers(name_of_play);DBMS_OUTPUT.PUT_LINE(name_of_play ||' | '|| res);EXCEPTION WHEN invalid_status THEN DBMS_OUTPUT.PUT_LINE('The name of play is not found');END;
) ?6 `" v. w- N6 @( s 解决方案: |
|
|
|
|
|