1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
CREATE OR REPLACE PACKAGE PKG_TEST IS
TYPE TYP_TAB_EMP IS TABLE OF EMP%ROWTYPE ;
FUNCTION Affiche_lignes Return TYP_TAB_EMP ;
END;
/
create or replace package body PKG_test as
FUNCTION Affiche_lignes Return TYP_TAB_EMP
IS
Tlignes PKG_TEST.TYP_TAB_EMP ;
Cursor C_EMP is Select * From EMP ;
Begin
Open C_EMP ;
Fetch C_EMP BULK COLLECT into Tlignes ;
Close C_EMP ;
Return( Tlignes ) ;
End ;
END;
/
Declare
Tlignes PKG_TEST.TYP_TAB_EMP ;
Begin
Tlignes := PKG_TEST.Affiche_lignes ;
For i IN Tlignes.first..Tlignes.last Loop
dbms_output.put_line( Rpad( Tlignes(i).ename, 25 ) || ' --> ' || To_char( Tlignes(i).sal ) ) ;
End loop ;
End ;
/ |
Partager