aiaiDBA

加微信获取免费职业规划+学习资料,了解年薪50万的DBA是如何练成的

13718043309

010-86462881

PLS-00231: function 'string' may not be used in SQL

PLS-00231: function 'string' may not be used in SQL
Cause: A proscribed function was used in a SQL statement. Certain functions such as SQLCODE and SQLERRM can be used only in procedural statements.
Action: Remove the function call from the SQL statement. Or, replace the function call with a local variable. For example, the following statement is illegal: INSERT INTO errors VALUES (SQLCODE, SQLERRM); However, you can assign the values of SQLCODE and SQLERRM to local variables, then use the variables in the SQL statement, as follows: err_num := SQLCODE; err_msg := SQLERRM; INSERT INTO errors VALUES (err_num, err_msg);

请先 登录 后评论

1 个回答

小智
PLS-00231:函数' string '可能不会在SQL中使用,
.原因:在SQL语句中使用了被禁止的函数。某些功能(如SQLCODE和SQLERRM)只能在程序语句中使用。,
.操作:从SQL语句中删除函数调用。或者,使用局部变量替换函数调用。例如,以下语句是非法的:INSERT INTO errors VALUES(SQLCODE,SQLERRM); 但是,您可以将SQLCODE和SQLERRM的值分配给本地变量,然后使用SQL语句中的变量,如下所示:err_num:= SQLCODE; err_msg:= SQLERRM; INSERT INTO errors VALUES(err_num,err_msg);,
.
请先 登录 后评论