触发器的PL SQL过程

时间:2019-05-21 23:33:25

标签: oracle stored-procedures plsql

我创建了从学生中选择姓名的GETDEL过程,但是当我尝试在触发器中调用此过程时,它说我给了错误的参数类型来调用

我一直试图将(记录)或(记录OUT SYS_REFCURSOR)作为参数传递,但是它不起作用

CREATE OR REPLACE PROCEDURE GETDEL(records OUT SYS_REFCURSOR) AS 
BEGIN
  OPEN records FOR
    SELECT name FROM  students;
END GETDEL;

CREATE OR REPLACE TRIGGER After_delete_student
AFTER DELETE ON TABLE2
FOR EACH ROW
DECLARE
  rec sys_refcursor;
BEGIN
  GETDELCZL();
END;

1 个答案:

答案 0 :(得分:3)

您的过程包含一个参数,即使它是out参数,调用过程也负责定义它。

create or replace 
trigger after_delete_student
after delete 
 on table2
 for each row 
declare
    result_rec sys_refcursor;
begin 
    getdel(result_rec);
end;