use*_*419 -2 plsql syntax-error
请求帮我解决plsql中的这个错误.
sqlquery := 'SELECT COUNT(*) FROM V$SESSION WHERE STATUS = 'INACTIVE' AND LAST_CALL_ET > 0';
EXECUTE IMMEDIATE sqlquery into s_count;
Run Code Online (Sandbox Code Playgroud)
以下是错误:
ERROR at line 57:
ORA-06550: line 57, column 66:
PLS-00103: Encountered the symbol "INACTIVE" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol "* was inserted before "INACTIVE" to continue.
ORA-06550: line 79, column 4:
PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
( begin case declare else elsif end exit for goto if loop mod
null pragma raise return select update while with <an identifier> <a double-quoted
ORA-06550: line 81, column 7:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
end not pragma final instantiable order overriding static member constructor map
Run Code Online (Sandbox Code Playgroud)
Rob*_*lie 11
周围的引号INACTIVE将字符串拆分并导致语法错误...
sqlquery := 'SELECT COUNT(*) FROM V$SESSION WHERE STATUS = ''INACTIVE'' AND LAST_CALL_ET > 0';
EXECUTE IMMEDIATE sqlquery into s_count;
Run Code Online (Sandbox Code Playgroud)
当然,如果声明实际上不是动态的,那么你就不需要了,EXECUTE IMMEDIATE而且可以改为:
SELECT COUNT(*)
INTO s_count
FROM V$SESSION
WHERE STATUS = 'INACTIVE'
AND LAST_CALL_ET > 0';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1758 次 |
| 最近记录: |