ORA-00984 此处不允许列
我收到错误 “执行-984 ORA-00984:此处不允许列” 当我使用 Pro*C 在我的表 Registred_Customer 中插入值时,
Registred_Customer 被定义为
CREATE TABLE Registred_Customer (
Cust_id NUMBER(6) PRIMARY KEY,
Name VARCHAR2(20) NOT NULL,
Age NUMBER,
Sex CHAR,
Addr VARCHAR2(50),
Contact NUMBER(10)
);
在 Pro*C 方法中使用 pro*c 方法插入值
addCustomer(i, name,age, gender, address,contectNo);
,我使用以下代码在此处插入
EXEC SQL INSERT INTO REGISTRED_CUSTOMER VALUES
(cust_id, cust_name, age, sex, addr, contact);
cust_name 和 addr 是 char *;性是 char 其余为 int;
它在使用变量时报告错误,但使用直接值可以正常工作 就像 EXEC SQL INSERT INTO REGISTRED_CUSTOMER VALUES (10, 'Pankaj', 23, 'M', 'asdfs', 45875);
我尝试更改几行但徒劳。
提前致谢。
I am getting error
"Execute-984 ORA-00984: column not allowed here"
while I am inserting values in my table Registred_Customer using Pro*C
Registred_Customer is defined as
CREATE TABLE Registred_Customer (
Cust_id NUMBER(6) PRIMARY KEY,
Name VARCHAR2(20) NOT NULL,
Age NUMBER,
Sex CHAR,
Addr VARCHAR2(50),
Contact NUMBER(10)
);
Inserting values using a pro*c method
addCustomer(i, name,age, gender, address,contectNo);
in Pro*C method I use following code to insert
EXEC SQL INSERT INTO REGISTRED_CUSTOMER VALUES
(cust_id, cust_name, age, sex, addr, contact);
here cust_name and addr are char *; and sex is char rest as int;
It reports error while using variable but works fine using direct values
like EXEC SQL INSERT INTO REGISTRED_CUSTOMER VALUES (10, 'Pankaj', 23, 'M', 'asdfs', 45875);
I tried changing few lines but in vain.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我看对了,你正在尝试插入到列中,列?
“执行 SQL 插入 REGISTRED_CUSTOMER VALUES(cust_id、cust_name、年龄、性别、地址、联系人);”?
如果您发布完整的程序会更有帮助。
问候
If im seeing correct you are trying to insert into the columns, the columns??
"EXEC SQL INSERT INTO REGISTRED_CUSTOMER VALUES (cust_id, cust_name, age, sex, addr, contact);"??
it would be more helpful if you post your procedure complete.
Regards
正如先生提到的,您正在尝试使用列作为输入值。当您提供实际值时,它就会起作用。您是否打算使用 PL/SQL 变量或过程参数?在这种情况下,无论您的过程参数被调用什么,您都应该将其放在值部分中。
即如果 addCustomer 看起来像
那么你会做类似的事情
但是如果你要插入到所有列中,你可以省略列定义并只提供值
As Mr. mentioned, you are trying to use the columns as input values. When you provide actual values it works. Are you perhaps meaning to use PL/SQL variables or the procedure arguments? In this case, whatever your procedure parameters are called is what you should put in the values section.
i.e if addCustomer looks like
Then you'd do something like
But if you are inserting into all columns you can leave out the column definition and just provide values
我还在执行插入的存储过程中收到此错误消息。我在 Values 子句中拼错了一个参数名称,Oracle 解释器将拼错的名称视为列名称并发出 00984。
I also got this error message in a stored procedure doing an insert. I misspelled a parameter name in the values clause and the oracle interpreter saw the misspelled name as a column name and issued the 00984.
您的 Pro*C 代码基本上缺少冒号(假设您的形式参数称为
cust_id
、cust_name
、age
等):显式指定列名称会更加稳健。否则,对表架构的更改可能会导致难以发现错误:
Your Pro*C code is basically missing the colons (assuming that your formal parameters are called
cust_id
,cust_name
,age
etc.):And it would be more robust to explicitly specify the columns name. Otherwise a change to the table schema can result in difficult to find bugs: