--There 4 actions in working with cursor
--declare the cursor
--open the cursor
--fetch the data from cursor and use the data in program statements
--close the cursor
create or replace function printtestbst()
returns void as $$
declare
c_testbst scroll cursor for
select id, parentId, value from testbst;
rw testbst%rowtype;
begin
open c_testbst;
loop
fetch c_testbst into rw;
exit when not found;
raise notice 'print : % % %', rw.id, rw.parentId, rw.value;
end loop;
close c_testbst;
end $$language plpgsql;
No comments:
Post a Comment