创建一个引用不存在的SP的SP [英] Create an SP that references a non existant SP

查看:133
本文介绍了创建一个引用不存在的SP的SP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法创建一个调用另一个尚未创建的存储过程

存储过程?


在MS SQL中我得到一个警告,调用过程不存在,但

新存储


程序无论如何都会被创建。我相信Oracle的工作方式类似。


我无法在DB2中实现这一点吗?


谢谢


I can not create a stored procedure that calls another not yet created
stored procedure?

In MS SQL I get a warning that the calling procedure does not exist but the
new stored

Procedure gets created anyhow. I believe Oracle works similarly.

I can not make this possible in DB2?

Thank you


推荐答案

serge写道:
我无法创建一个调用另一个尚未创建的存储过程存储过程?在MS SQL中,我收到一条警告,说调用程序不存在,但无论如何都会创建新存储的程序。我相信Oracle的工作方式类似。

我不能在DB2中实现这一点吗?
I can not create a stored procedure that calls another not yet created
stored procedure?

In MS SQL I get a warning that the calling procedure does not exist but the
new stored

Procedure gets created anyhow. I believe Oracle works similarly.

I can not make this possible in DB2?



当然可以,只需使用动态语句:

EXECUTE IMMEDIATE CALL ....使用


干杯

Serge


-

Serge Rielau

DB2 SQL编译器开发

IBM多伦多实验室


Sure you can, just use a dynamic statement:
EXECUTE IMMEDIATE CALL .... USING

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab


如果我采用这个例子:


--DROP PROCEDURE proc1;

CREATE PROCEDURE proc1()

LANGUAGE SQL

开始


DECLARE varInput INTEGER;

DECLARE varOutput INTEGER;


SET varInput = 2;


CALL proc2(varInput,varOutput);


END

;


--DROP PROCEDURE proc2;

CREATE PROCEDURE proc2(在myInputVariable INTEGER中,

OUT myOutputVariable INTEGER)

LANGUAGE SQL

BEGIN


SET myOutputVariable = myInputVariable + 5;


EN D $ / $
;


当我运行时我收到错误:


21:01:22.836 DBMS MODEL0 - - 错误:[IBM] [CLI驱动程序] [DB2 / NT] SQL0440N

没有名为PROC2的授权例程类型PROCEDURE找到兼容的

参数。 LINE NUMBER = 11。 SQLSTATE = 42884

您能否告诉我您如何撰写以下声明?


执行即时调用....使用

我有一个重要的问题:如果程序语句有输入和


输出参数


CALL proc2(varInput,varOutput );


将参数的值存在于调用

程序的范围内,


in这个案例proc1?


谢谢


" Serge Rielau" < SR ***** @ ca.ibm.com>在消息中写道

新闻:3a ************* @ individual.net ...
If i take this example:

--DROP PROCEDURE proc1;
CREATE PROCEDURE proc1()
LANGUAGE SQL
BEGIN

DECLARE varInput INTEGER;
DECLARE varOutput INTEGER;

SET varInput = 2;

CALL proc2(varInput, varOutput);

END
;

--DROP PROCEDURE proc2;
CREATE PROCEDURE proc2(IN myInputVariable INTEGER,
OUT myOutputVariable INTEGER)
LANGUAGE SQL
BEGIN

SET myOutputVariable = myInputVariable + 5;

END
;

When i run this I get error:

21:01:22.836 DBMS MODEL0 -- Error: [IBM][CLI Driver][DB2/NT] SQL0440N
No authorized routine named "PROC2" of type "PROCEDURE" having compatible
arguments was found. LINE NUMBER=11. SQLSTATE=42884
Can you please tell me how you write the statement below?

EXECUTE IMMEDIATE CALL .... USING

An important question i have: If the procedure statement has Input and

Output parameters

CALL proc2(varInput, varOutput);

will the values of the parameters exist in the scope of the calling
procedure,

in this case proc1?

Thank you


"Serge Rielau" <sr*****@ca.ibm.com> wrote in message
news:3a*************@individual.net...
serge写道:
我无法创建调用另一个尚未创建的存储过程的存储过程?

在MS SQL中,我收到警告,调用过程不存在但是
新存储的程序无论如何都会被创建。我相信Oracle的工作方式类似。

我不能在DB2中实现这一点吗?
I can not create a stored procedure that calls another not yet created
stored procedure?

In MS SQL I get a warning that the calling procedure does not exist but
the new stored

Procedure gets created anyhow. I believe Oracle works similarly.

I can not make this possible in DB2?


当然可以,只需使用动态语句:
EXECUTE IMMEDIATE CALL .. ..使用

欢呼
Serge

-
Serge Rielau
DB2 SQL编译器开发
IBM多伦多实验室


Sure you can, just use a dynamic statement:
EXECUTE IMMEDIATE CALL .... USING

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab



如果我采用这个例子:


--DROP PROCEDURE proc1;

CREATE PROCEDURE proc1()

语言SQL

开始


DECLARE varInput INTEGER;

DECLARE varOutput INTEGER ;


SET varInput = 2;


CALL proc2(varInput,varOutput);


结束

;


--DROP PROCEDURE proc2;

CREATE PROCEDURE proc2(在myInputVariable INTEGER中,

OUT myOutputVariable INTEGER)

LANGUAGE SQL

BEGIN


SET myOutputVariable = myInputVariable + 5;


结束

;


运行时我收到错误:


21:01:22.836 DBMS MODEL0 - 错误:[IBM] [CLI驱动程序] [DB2 / NT] SQL0440N
没有名为PROC2的授权例程类型PROCEDURE找到兼容的

参数。 LINE NUMBER = 11。 SQLSTATE = 42884

您能否告诉我您如何撰写以下声明?


执行即时调用....使用

我有一个重要的问题:如果程序语句有输入和


输出参数


CALL proc2(varInput,varOutput );


将参数的值存在于调用

程序的范围内,


in这个案例proc1?


谢谢


" Serge Rielau" < SR ***** @ ca.ibm.com>在消息中写道

新闻:3a ************* @ individual.net ...
If i take this example:

--DROP PROCEDURE proc1;
CREATE PROCEDURE proc1()
LANGUAGE SQL
BEGIN

DECLARE varInput INTEGER;
DECLARE varOutput INTEGER;

SET varInput = 2;

CALL proc2(varInput, varOutput);

END
;

--DROP PROCEDURE proc2;
CREATE PROCEDURE proc2(IN myInputVariable INTEGER,
OUT myOutputVariable INTEGER)
LANGUAGE SQL
BEGIN

SET myOutputVariable = myInputVariable + 5;

END
;

When i run this I get error:

21:01:22.836 DBMS MODEL0 -- Error: [IBM][CLI Driver][DB2/NT] SQL0440N
No authorized routine named "PROC2" of type "PROCEDURE" having compatible
arguments was found. LINE NUMBER=11. SQLSTATE=42884
Can you please tell me how you write the statement below?

EXECUTE IMMEDIATE CALL .... USING

An important question i have: If the procedure statement has Input and

Output parameters

CALL proc2(varInput, varOutput);

will the values of the parameters exist in the scope of the calling
procedure,

in this case proc1?

Thank you


"Serge Rielau" <sr*****@ca.ibm.com> wrote in message
news:3a*************@individual.net...
serge写道:
我无法创建调用另一个尚未创建的存储过程的存储过程?

在MS SQL中,我收到警告,调用过程不存在但是
新存储的程序无论如何都会被创建。我相信Oracle的工作方式类似。

我不能在DB2中实现这一点吗?
I can not create a stored procedure that calls another not yet created
stored procedure?

In MS SQL I get a warning that the calling procedure does not exist but
the new stored

Procedure gets created anyhow. I believe Oracle works similarly.

I can not make this possible in DB2?


当然可以,只需使用动态语句:
EXECUTE IMMEDIATE CALL .. ..使用

欢呼
Serge

-
Serge Rielau
DB2 SQL编译器开发
IBM多伦多实验室


Sure you can, just use a dynamic statement:
EXECUTE IMMEDIATE CALL .... USING

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab






这篇关于创建一个引用不存在的SP的SP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆