你能告诉我这段代码有什么问题吗?它得到错误编译错误
错误:
PL/SQL: ORA-00933: SQL 命令未正确结束
文本:
IF iCnt > 0 THEN
WITH S600 AS (
Prod_KEY NUMBER;
iCount NUMBER;
BEGIN
WITH TEMP_All AS
(SELECT * FROM TEMP1
UNION ALL
SELECT * FROM TEMP2
UNION ALL
SELECT * FROM TEMP3)
SELECT COUNT(*)
INTO iCount
FROM TEMP_ALL
IF iCount > 0 THEN
TEMP_OUT AS(
SELECT Key1, count(*) as cnt
FROM TEMP_ALL),
TempKey AS(
SELECT BarSuid FROM TEMP_OUT
WHERE cnt = (SELECT MAX(cnt) FROM TEMP_OUT));
ELSE
TempKey AS(
SELECT Key1 FROM PRODUCT
WHERE Key1 NOT IN ( SELECT Key1 FROM PRODUCT_DET));
END IF;
SELECT key2
INTO PROD_KEY
FROM PRODUCT,TempKey
WHERE PRODUCT.Key1 = TempKey.Key1
AND TempKey.Key1 IS NOT NULL;
EXCEPTION
WHEN OTHERS
THEN
dbms_output.put_line(SQLCode);
END;