0
我是PL/SQL中的新手,我被困在這個查詢中!
當我運行此命令,
SELECT語句在PL/SQL塊中不起作用
SELECT COUNT(*),AVG(SI.TOTALCOST)
FROM S2.CAR C, S2.SERVINV SI
WHERE C.SERIAL = SI.SERIAL
AND MAKE = 'JAGUAR'
AND MODEL = 'PRO';
直接在SQLPLUS提示符下,它的工作原理perfactly罰款和顯示輸出!
但是當我運行相同的查詢爲PL/SQL塊的一部分,這樣
SELECT COUNT(*) INTO v_visits, AVG(SI.TOTALCOST) INTO v_avg
FROM S2.CAR C, S2.SERVINV SI
WHERE C.SERIAL = SI.SERIAL
AND MAKE = '&p_make'
AND MODEL = '&p_model';
這是行不通的!它給了我這個錯誤,
SELECT COUNT(*) INTO v_visits, AVG(SI.TOTALCOST) INTO v_avg
*
ERROR at line 7:
ORA-06550: line 7, column 32:
PL/SQL: ORA-00934: group function is not allowed here
ORA-06550: line 7, column 1:
PL/SQL: SQL Statement ignored
我不明白這裏有什麼問題!
我查看了互聯網,但找不到任何有用的東西!
任何幫助表示讚賞!
謝謝
感謝您的快速回復!這是有幫助的!:) –