我是 Oracle 資料庫的新手。我使用 oracle 資料庫 19c。我嘗試通過宣告游標來創建程序。但由于語法錯誤,我得到檔案結束錯誤。該程序在執行程序中也是無效的。提前致謝 !
代碼:
kIsH@Xhydra<>create or replace procedure sw as
cursor cevent
IS
select sw.sid,sw.seq#,sw.event,sw.p1text,
sw.p1,sw.p1raw,sw.p2text,sw.p2,
sw.p2raw,sw.p3text,sw.p3,sw.p3raw,
sw.wait_time,sw.seconds_in_wait,
sw.state,s.serial#,s.username,
s.osuser,s.paddr,s.logon_time,
s.process,s.sql_hash_value,s.saddr,
s.module,s.row_wait_obj#,s.row_wait_file#,
s.row_wait_block#,s.row_wait_row#
from v$session_wait sw, v$session s
where sw.sid = s.sid
and s.username is not null
and s.type <> 'BACKGROUND';
/
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Warning: Procedure created with compilation errors.
執行:
kIsH@Xhydra<>exec sw;
BEGIN sw; END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00905: object SYS.SW is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
錯誤:
LINE/COL ERROR
-------- -----------------------------------------------------------------
16/29 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
uj5u.com熱心網友回復:
與該程序當前沒有功能這一事實無關,該程序的主體是不完整的。您必須至少有一個空的開始/結束塊。
create or replace procedure sw as
cursor cevent
IS
select sw.sid,sw.seq#,sw.event,sw.p1text,
sw.p1,sw.p1raw,sw.p2text,sw.p2,
sw.p2raw,sw.p3text,sw.p3,sw.p3raw,
sw.wait_time,sw.seconds_in_wait,
sw.state,s.serial#,s.username,
s.osuser,s.paddr,s.logon_time,
s.process,s.sql_hash_value,s.saddr,
s.module,s.row_wait_obj#,s.row_wait_file#,
s.row_wait_block#,s.row_wait_row#
from v$session_wait sw, v$session s
where sw.sid = s.sid
and s.username is not null
and s.type <> 'BACKGROUND';
begin
null;
end;
/
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/506866.html
