【发布时间】:2021-03-09 22:38:46
【问题描述】:
SQL查询执行过程中发生错误
Reason:
SQL Error [6550] [65000]: ORA-06550: line 11, column 1:
PLS-00103: Encountered the symbol "IF" when expecting one of the following:
:= . ( % ;
The symbol ";" was substituted for "IF" to continue.
ORA-06550: line 31, column 15:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
, from
------------代码从这里开始--------
DECLARE
TOTALCOUNT int ;
BEGIN
SELECT
count(*) AS cnt
INTO
TOTALCOUNT
FROM
abc;
dbms_output.put_line (TOTALCOUNT) ;
END ;
DECLARE
TOTALPTCOUNT int ;
BEGIN
SELECT
count(*) AS cnt
INTO
TOTALPTCOUNT
FROM
ghi g;
dbms_output.put_line (TOTALPTCOUNT) ;
END ;
DECLARE
TOTALOVERALLCOUNT int ;
BEGIN
SELECT
((TOTALPTCOUNT/TOTALCOUNT) * 100) AS dpc
INTO
TOTALOVERALLCOUNT FROM dual ;
dbms_output.put_line (TOTALOVERALLCOUNT)
IF:
TOTALOVERALLCOUNT >= 10 THEN
"my logic here"
end
if ;
【问题讨论】:
-
您尚未指定您使用的 DBMS。查看您的代码是否应该有“;”在 dbms_output.put_line (TOTALOVERALLCOUNT) 之后??
-
当您遇到 Oracle 错误时,它不是 SQL Server。请只标记一个 RDBMS。
标签: oracle plsql logical-operators declare