PB 调用Oracle存储过程的奇怪现象

yoan2014 数据库工程师  2015-06-24 08:23:14
CREATE OR REPLACE PROCEDURE T_OK
(
a in varchar2,
b in varchar2,
c in varchar2 ,
d out varchar2
)
AS
BEGIN
d:=a ||'/' || b || '/' || c;
END;

存储过程的代码如上,在PB中的调用的代码如下
String ls_rtn_1 = "          ",ls_rtn_2
string ls_a = "a" , ls_b = "b" , ls_c = "c"
Declare p_pro Procedure For T_OK(:ls_a , :ls_b , :ls_c , :ls_rtn_1);
Execute p_pro;
If sqlca.SQLCode <0 Then
MessageBox('错误',string(sqlca.sqlcode) +sqlca.SQLErrText)
Return
End If
Fetch p_pro Into :ls_rtn_2;
Close p_pro;
MessageBox( '提示',"存储过程返回:" +ls_rtn_2 )


弹出错误讯息:ORA-06550: line 1, column 15:
PLS-00306: wrong number or types of arguments in call to 'T_OK'
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored

通过sqltracker捕捉到的语句与提交的语句不一致
Timestamp: 2015/6/24 20:08:10

BEGIN T_OK( 'a' , 'b' , 'c' , ' ' ,D=>:D); END;

Error occurred: [6550] (ORA-06550: line 1, column 15:
PLS-00306: wrong number or types of arguments in call to 'T_OK'
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored
)

--------------------------------------------------------------------------------
Timestamp: 2015/6/24 20:09:49

commit
不知是否有人遇到过类似的问题

...全文
210 点赞 收藏 4
写回复
4 条回复
WorldMobile 2015年06月25日
或者参考这个 PB 调用存储过程[Oracle] http://www.cnblogs.com/powerbuilder/archive/2011/11/18/2254322.html
回复 点赞
WorldMobile 2015年06月25日
或者参考这个帮助


Given this procedure:

CREATE OR REPLACE PROCEDURE spu_edt_object(

o_id_object OUT NUMBER,
o_message OUT VARCHAR2,
a_id_object NUMBER,
a_param VARCHAR2 := NULL,
a_value VARCHAR2 := NULL
) as
begin
o_id_object := 12345;
o_message := 'Hello World';
end;

The DECLARE statement must use named notation because output parameters are defined to the left of input parameters:

dec{0} o_id_object, id_obiect = 54321

string o_message, param = 'Test'

DECLARE proc_update PROCEDURE FOR spu_edt_object (
a_id_object => :id_object,
a_param => :param
)
USING SQLCA;

EXECUTE proc_update;
if SQLCA.SqlCode 0 then
SQLCA.f_out_error()
RETURN -1
end if

FETCH proc_update INTO :o_id_object, o_message;
if SQLCA.SqlCode 0 then
SQLCA.f_out_error()
CLOSE proc_update;
RETURN -1
end if
回复 点赞
WorldMobile 2015年06月25日
CREATE OR REPLACE PROCEDURE T_OK ( a in varchar2, b in varchar2, c in varchar2 , d in out varchar2 //修改为in out ) AS BEGIN d:=a ||'/' || b || '/' || c; END;
回复 点赞
yoan2014 2015年06月25日
改用subroutine的方式就可以了。
回复 点赞
发动态
发帖子
数据库相关
创建于2007-09-28

494

社区成员

1.2w+

社区内容

PowerBuilder 数据库相关
社区公告
暂无公告