PLS-00231 function name may not be used in SQL
2018-03-20 12:33
645 查看
在存储过程或函数的声明部分,定义一个局部函数,结果在select中使用时报PLS-00231错误。
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.改成赋值操作,aa:=f()
2.把主程序改成包,将函数定义在包里
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.改成赋值操作,aa:=f()
2.把主程序改成包,将函数定义在包里
相关文章推荐
- PLS-00231错误:function name may not be used in SQL
- Compilation Error:function 'NAME_IN' may not be used in SQL
- [PLSQL]Two small function utilities that could be used in dynamic SQL (sqlchar and correct_sql_name)
- CoovaChilli-1.3.0编译时出现main-opt.c:781: error: ‘ptr’ may be used uninitialized in this function的解决方法
- MS-SQL 错误: The offset specified in a OFFSET clause may not be negative
- " 'this' may not be used in this context"
- gcc warning: warning: 'tick' may be used uninitialized in this function
- CoovaChilli-1.3.0编译时出现main-opt.c:781: error: ‘ptr’ may be used uninitialized in this function的解决方法
- warning: ‘p’ may be used uninitialized in this function
- LLVM ERROR: Program used external function '___dso_handle' which could not be resolved!的解决方案
- 关于The function equals must be used with a prefix when a default namespace is not specified解决
- SQL Error:An aggregate may not appear in the set list of an UPDATE statement.
- FAIL - Context /SsmApp is defined in server.xml and may not be undeployed
- warning: the gets function is dangerous and should not be used.
- jqGrid ---Grid can not be used in this ('quirks...
- codeblocks中Error:new types may not be defined in a return type错误
- 错误记录--Multiple constructor definitions found. Constructor may not be defined in
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- PLS-00642: local collection types not allowed in SQL statements
- 关于The function equals must be used with a prefix when a default namespace is not specified解决