我正在尝试解决一个简单地调用其中一个Oracle过程的PHP代码。现在,我不知道有关Oracle过程的事情,我只需要使用2个参数调用此过程并返回硬编码值。我开始创建一个包和一个虚拟过程:
CREATE OR REPLACE
PACKAGE TESTAPI1 AS
PROCEDURE GETTEST;
END EMAILAPI1;
CREATE OR REPLACE PROCEDURE GETTEST(p1 IN VARCHAR, p2 IN CLOB) AS
BEGIN
NULL;
END GETTEST;
调用此过程的PHP代码如下所示:
$stid = oci_parse($this->conn, "begin testapi1.gettest(:p1, :p2); end;");
$clob = oci_new_descriptor($this->conn, OCI_D_LOB);
oci_bind_by_name($stid, ':p1', "some string", 4000, SQLT_CHR);
oci_bind_by_name($stid, ':p2', $clob, -1, SQLT_CLOB);
$r = oci_execute($stid);
运行此代码后,我收到此错误:
[code] => 6550
[message] => ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GETTEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
[offset] => 6
[sqltext] => begin testapi1.gettest(:p1, :p2); end;
有人能告诉我这段代码有什么不对吗?
答案 0 :(得分:0)
我注意到一些我希望能帮到你的问题:
请参阅下面的更改。此代码现在编译没有错误。
CREATE OR REPLACE
PACKAGE TESTAPI1 AS
PROCEDURE GETTEST(p1 VARCHAR, p2 CLOB);
END TESTAPI1;
/
CREATE OR REPLACE PROCEDURE GETTEST(p1 IN VARCHAR, p2 IN CLOB) AS
BEGIN
NULL;
END GETTEST;
/