How to return a resultset / cursor from a Oracle PL/SQL anonymous block that executes Dynamic SQL?
By : user1719625
Date : March 29 2020, 07:55 AM
wish of those help You can write a PL/SQL function to return that cursor (or you could put that function in a package if you have more code related to this): code :
CREATE OR REPLACE FUNCTION get_allitems
RETURN SYS_REFCURSOR
AS
my_cursor SYS_REFCURSOR;
BEGIN
OPEN my_cursor FOR SELECT * FROM allitems;
RETURN my_cursor;
END get_allitems;
OPEN my_cursor FOR 'SELECT * FROM allitems';
OPEN my_cursor FOR 'SELECT * FROM allitems WHERE id = :id' USING my_id;
|
Why no output when PLSQL Anonymous block completes?
By : Janosch Schobin
Date : March 29 2020, 07:55 AM
this one helps. Viewing the DBMS_OUTPUT depends on the program. SQL*Plus and Oracle SQL Developer code :
SET SERVEROUTPUT ON;
begin
dbms_output.put_line('Testing output');
end;
/
|
SQL Join with Table Alias in PLSQL Cursor
By : user3643393
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Here is how I would do it, I don't see any reason why this wouldn't work. code :
DECLARE
CURSOR c1
IS
SELECT
it.item_title title, r.item_id id
FROM
item it inner join, rental_item r
on it.item_id = r.item_id;
BEGIN
FOR rec IN c1 LOOP
dbms_output.print_line(rec.title||' '||rec.id);
END LOOP;
END;
|
How to pass values in anonymous block with plsql table parameter
By : omes
Date : March 29 2020, 07:55 AM
wish of those help Given the fact that you only want to test, what about just setting the values in the anonymous block: code :
declare
l_Admin varchar2(100) := 'string';
l_approved_ain abc.approved_ain := ???;
begin
abc(l_Admin ,l_approved_ain);
commit;
end;
|
Why anonymous block is executed twice in Toad when it contains output cursor?
By : xul
Date : March 29 2020, 07:55 AM
Hope that helps This is a bug in 12.10 that has been corrected in 12.11. You can find the original report of it here.
|