Skip to content

Instantly share code, notes, and snippets.

@EvgenJin
Created June 17, 2019 12:28
Show Gist options
  • Save EvgenJin/2b5cdab5497049159759a0ffffd414f1 to your computer and use it in GitHub Desktop.
Save EvgenJin/2b5cdab5497049159759a0ffffd414f1 to your computer and use it in GitHub Desktop.
pl/sql cursor
create or replace package test_pkg is
cursor c_zaj(p#obj_id number ) is
select zaj.id
, zaj.id_cus
, zaj.sum_crd
, zaj.targ
from exp_zaj zaj
where zaj.id = p#obj_id;
end;
create or replace package body test_pkg is
procedure test(p#obj_id number)
is
r#zaj c_zaj%rowtype;
begin
open c_zaj(p#obj_id);
fetch c_zaj into r#zaj;
close c_zaj;
end;
function test(p#obj_id number) return number is
cRes number;
r#zaj c_zaj%rowtype;
begin
test(p#obj_id);
return r#zaj.id;
end;
end test_pkg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment