About calling the oracle stored procedure with the output parameter CURSOR

Source: Internet
Author: User

About calling the oracle stored procedure with the output parameter CURSOR 1. create Procedure with Out parameter of CURSOR type www.2cto.com Java code create or replace package pa_query as type p_cursor is ref cursor; end pa_query;/create or replace procedure p_query (v_cursor out pa_query.p_cursor) is begin open v_cursor for select * from emp; end p_query; 2. call the procedure in PL/SQL Java code declare type search_results is ref cursor; results_out search_results; begin -- Call the procedure package pa_query (results_out); end; or the Java code declare results_out [B] sys_refcursor [/B]; begin -- Call the procedure package pa_query (results_out); end; 3. call the procedure in JDBC java. www.2cto.com Java code cstmt.registeroutparameter(2,oracle.jdbc.oracletypes.cursor?;cstmt.exe cute (); -- convert the referenced cursor type to the result set ResultSet rs = (ResultSet) cstmt. getObject (2 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.