Hello all.
I'm new to Oracle and PL/SQL although I'm very familiar with MS SQL Server and T-SQL. The problem I'm having is calling a stored procedure which returns mutiple records.
[code=oracle]
CREATE OR REPLACE PACKAGE HR.TYPES AS
TYPE CursorType is ref cursor;
end;
No problems here. Then I create my procedure
CREATE OR REPLACE procedure HR.test_proc
(my_cur out TYPES.CURSORTYP E)
as
begin
open my_cur for select * from employees;
end;
No problems here either.
I would like to know how do I call the procedure
call test_proc()
After reading SAMS teach yourself PL/SQL I'm guessing I need to create a reference cursor
DECLARE
emp_cut ref cursor
BEGIN
call test_proc(emp_c ur);
END;
[/code]
This doesn't work. I'm be very grateful if someone could point out what I'm doing wrong.
Thanks in advance
I'm new to Oracle and PL/SQL although I'm very familiar with MS SQL Server and T-SQL. The problem I'm having is calling a stored procedure which returns mutiple records.
[code=oracle]
CREATE OR REPLACE PACKAGE HR.TYPES AS
TYPE CursorType is ref cursor;
end;
No problems here. Then I create my procedure
CREATE OR REPLACE procedure HR.test_proc
(my_cur out TYPES.CURSORTYP E)
as
begin
open my_cur for select * from employees;
end;
No problems here either.
I would like to know how do I call the procedure
call test_proc()
After reading SAMS teach yourself PL/SQL I'm guessing I need to create a reference cursor
DECLARE
emp_cut ref cursor
BEGIN
call test_proc(emp_c ur);
END;
[/code]
This doesn't work. I'm be very grateful if someone could point out what I'm doing wrong.
Thanks in advance
Comment