并非所有变量都绑定在调用静态过程中
not all variables bound in call static procedure
我在 sql oracle 中定义了一个新类型并定义了一个静态过程。
CREATE OR REPLACE TYPE address AS OBJECT(
house_no VARCHAR2 (10),
street VARCHAR2 (30),
city VARCHAR2 (20),
state VARCHAR2 (10),
pincode VARCHAR2 (10),
STATIC PROCEDURE new_address (house_no VARCHAR2,
street VARCHAR2,
city VARCHAR2,
state VARCHAR2,
pincode VARCHAR2)
);
CREATE OR REPLACE TYPE BODY address
AS
STATIC PROCEDURE new_address (house_no VARCHAR2,
street VARCHAR2,
city VARCHAR2,
state VARCHAR2,
pincode VARCHAR2)
IS
sqlstmt VARCHAR (100);
BEGIN
sqlstmt :=
'insert into university.user_address values(address(:name, :name, :name, :name, :name, :name))';
EXECUTE IMMEDIATE sqlstmt
USING house_no,
street,
city,
state,
pincode;
END;
END;
当我调用函数 user_address 时它显示错误:并非所有变量都绑定。
CREATE TABLE user_address OF address
begin
UNIVERSITY.address.new_address('123', 'nazar', 'isfahan','isfahan','9893');
END;
我改变了这样的实现方式(用数字编辑 sqlstmt),但它再次显示错误。
sqlstmt :=
'insert into university.user_address values(address(:1, :2, :3, :4, :5, :6))';
我该如何解决?
下一行有 6 个绑定变量,而立即执行只有 5 个。
sqlstmt :=
'insert into university.user_address values(address(:name, :name, :name, :name, :name, :name))';
我在 sql oracle 中定义了一个新类型并定义了一个静态过程。
CREATE OR REPLACE TYPE address AS OBJECT(
house_no VARCHAR2 (10),
street VARCHAR2 (30),
city VARCHAR2 (20),
state VARCHAR2 (10),
pincode VARCHAR2 (10),
STATIC PROCEDURE new_address (house_no VARCHAR2,
street VARCHAR2,
city VARCHAR2,
state VARCHAR2,
pincode VARCHAR2)
);
CREATE OR REPLACE TYPE BODY address
AS
STATIC PROCEDURE new_address (house_no VARCHAR2,
street VARCHAR2,
city VARCHAR2,
state VARCHAR2,
pincode VARCHAR2)
IS
sqlstmt VARCHAR (100);
BEGIN
sqlstmt :=
'insert into university.user_address values(address(:name, :name, :name, :name, :name, :name))';
EXECUTE IMMEDIATE sqlstmt
USING house_no,
street,
city,
state,
pincode;
END;
END;
当我调用函数 user_address 时它显示错误:并非所有变量都绑定。
CREATE TABLE user_address OF address
begin
UNIVERSITY.address.new_address('123', 'nazar', 'isfahan','isfahan','9893');
END;
我改变了这样的实现方式(用数字编辑 sqlstmt),但它再次显示错误。
sqlstmt :=
'insert into university.user_address values(address(:1, :2, :3, :4, :5, :6))';
我该如何解决?
下一行有 6 个绑定变量,而立即执行只有 5 个。
sqlstmt :=
'insert into university.user_address values(address(:name, :name, :name, :name, :name, :name))';