Differences between calling stored procedures in DB2 and calling in Oracle

Source: Internet
Author: User

You can use exec or call to call a written stored procedure in Oracle data, but you can only use call to call the stored procedure in db2. Pay attention to parameter issues and parameter issues.

 

Exec proc_pay_idv ('20140901 ',?);

The execution reports an error. exec db2 does not contain keywords.

But if you use call

Call proc_pay_idv ('20140901 ',?);

Because call is a keyword

 

Below is a test stored procedure I wrote in db2 (you can check it)

Set schema DB2ADMIN;

Set current path = "SYSIBM", "SYSFUN", "SYSPROC", "SYSIBMADM", "DB2ADMIN ";

Create procedure "DB2ADMIN". "PROC_PAY_ORG"
(IN "IS_DATE" VARCHAR (10 ),
OUT "RET" INTEGER
)
SPECIFIC "DB2ADMIN". "sql140401092424900"
LANGUAGE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL ACTION
OLD SAVEPOINT LEVEL
MODIFIES SQL DATA
INHERIT SPECIAL REGISTERS
BEGIN

COMMIT;
Truncate table DB2ADMIN. PAY_ORG IMMEDIATE;

Insert into DB2ADMIN. PAY_ORG
SELECT
B. OU_CODE,
'',
IS_DATE,
A .*
FROM DB2ADMIN. BDW_ORG a inner join DB2ADMIN. BDW_DIM_OU B on a. open_ou_ip_id = B. ou_ip_id;

Set ret = 1;

END;

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.