50 likes | 109 Views
Oracle Server. Query, Procedure Call. Result. Sql*Plus. Executing sp…. Package isk_demo { MaxPos() ; PosCount() ; }. Package isk_demo { MaxPos() ; PosCount() ; }. Call isk_demo.PosCount() ;. Call isk_demo . PosCount() ;. Server. Results. Client.
E N D
Oracle Server Query, Procedure Call Result Sql*Plus
Executing sp… Package isk_demo { MaxPos() ; PosCount() ; } Package isk_demo { MaxPos() ; PosCount() ; } Call isk_demo.PosCount() ; Call isk_demo.PosCount() ; Server Results Client
Create Or Replace Package isk_demo As Function MaxPos(t1 Float, t2 Float, t3 Float, t4 Float, t5 Float) Return Integer ; Pragma Restrict_References(MaxPos, WNDS) ; Procedure PosCount ; End isk_demo ; Create Or Replace Package Body isk_demo As <-- Body of package goes here --> End isk_demo ;
Create Or Replace Package Body isk_demo As Function MaxPos(…) Return Integer <-- Body of function goes here --> Procedure PosCount As Cursor rSet Is Select a0, a1, a2, a3, a4 From demo_test ; Type PosCountArrayType Is Varray(5) Of Integer ; PosCountArray PosCountArrayType := PosCountArrayType() ; I Integer ; Begin For rSetRow In rSet Loop I := MaxPos(rSetRow.a0, rSetRow.a1, rSetRow.a2, rSetRow.a3, rSetRow.a4) ; PosCountArray(I) := PosCountArray(I) + 1 ; End Loop ; <-- Return the result --> End PosCount ; End isk_demo ;