Home > Database > Mysql Tutorial > body text

DB2 下面调用存储过程与Oracle调用的区别

WBOY
Release: 2016-06-07 16:47:26
Original
860 people have browsed it

在Oracle数据下调用写好的存储过程可以用exec 或者用call 都可以 但是在db2下面只能使用call 来调用存储过程还得注意参数的问题

在Oracle数据下调用写好的存储过程可以用exec 或者用call 都可以 但是在db2下面只能使用call 来调用存储过程还得注意参数的问题 还有注意参数的问题

 

exec proc_pay_idv('20140303',?);

执行会报错 exec db2 里面不是关键字

但是你要是用call 就可以

call proc_pay_idv('20140303',?);

因为call 是关键字

 

下面是个我在db2 写的测试的存储过程(大家可以看看)

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"."SQL140404172424900"
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;

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!