How to dynamically call stored procedures in Oracle PL/SQL

Source: Internet
Author: User

Today, a colleague asked me how to dynamically call the stored procedure in Oracle PL/SQL. I think there should be no problem. I just tried OK, mainly using the execute immediate syntax, note that the in and out parameters are specified in using. The test example is as follows:

 

 

Create or replace function fnc_test2 (IP1 integer, ip2 integer) return integer is
Result integer;
Begin
Return (IP1 * ip2 );
End fnc_test2;

 

 

Create or replace function fnc_test1 return integer is
Result integer;
Vsql varchar2 (200 );
Begin
Vsql: = 'in in: Return: = fnc_test2 (: P1,: P2); end ;';
Execute immediate vsql
Using out result, 2, 3;
Return (result );
End fnc_test1;

 

 

SQL> select fnc_test1 () from dual;
 
Fnc_test1 ()
-----------
6
 
SQL>

 

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.