I have the following SELECT statement:
SELECT AUDITORID
FROM SOL.GROUPS WHERE STATUS = 1;
I need for each AUDITORID that returns the statemnet to call the procedure INSERT_LD_PER_AUDITOR (VAUDITORID)
how to do that?
You cant call procedure via SQL statement And you have at least 2 ways how to resolve it. 1) Create pl_sql function and set call procedure into function
create or replace function F_INSERT_LD_PER_AUDITOR (VAUDITORID NUMBER)
return NUMBER
is
begin
NSERT_LD_PER_AUDITOR (VAUDITORID);
return 0;
end;
/
and call it function
SELECT F_INSERT_LD_PER_AUDITOR(AUDITORID)
FROM SOL.GROUPS WHERE STATUS = 1;
2) wirte pl/sql and use LOOP as in previous comment
insert_ld_per_auditordoes? I suspect you would be much better off changing the procedure to execute on a whole data set at once instead of individual "auditors". That way, you can avoid cursors all together, which would be much better.