ORACLE syntax-package, procedure, cursor, and oraclecursor
Example of Chen kichao: Packet Specification
Create or replace package PACK_WMS_YX IS -- Author: CKZ -- Created: 9:52:29 -- Purpose: synchronize data -- Public type declarations, CURSOR retirement order TYPE retCursor is ref cursor; -- RETURN vi_co_co_return % ROWTYPE; -- synchronize the return order and return the returned order list set cursor PROCEDURE sp_syn_returned (errno out number, errtext OUT VARCHAR2, outCursor OUT retCursor); END PACK_WMS_YX;
Package subject
Create or replace package body PACK_WMS_YX IS -- Author: CKZ -- Created: 9:52:29 -- Purpose: synchronize data -- Public variables declarations, execution status v_errorcode failed % TYPE; v_errormsg failed % TYPE; v_exception EXCEPTION; -- custom EXCEPTION -- synchronous return order PROCEDURE sp_syn_returned (errno out number, errtext OUT VARCHAR2, outCursor OUT retCursor) is begin errno: = 0; errtext: = 'success '; -- OPEN the cursor and obtain the OPEN outCursor for select co_num, cust_code, qty_sum, amt_sum, crt_date, born_date FROM cursor; EXCEPTION -- exception when others then rollback; v_errorcode: = SQLCODE; v_errormsg: = substr (SQLERRM, 200); errno: = 1; errtext: = v_errormsg; pack_wms_pub.sp_wms_insertSpErr ('synchronous return order, return order list curl', v_errorcode, v_errormsg ); END sp_syn_returned; BEGIN -- Initialization NULL; END PACK_WMS_YX;
Call example
Right-click the name of the stored procedure to be tested and choose Test.
The page is displayed.
Run Start debugger and Run
View cursor data
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.