1
我試圖執行或運行以下的PL/SQL腳本:PLS-00103:出現符號「申報」
SET serveroutput on;
CREATE OR REPLACE PROCEDURE findAvg
(p_category IN products.category_id% TYPE, c OUT NUMBER)
AS
BEGIN
SELECT NVL ((SELECT AVG(LIST_PRICE) FROM products
WHERE p_category = category_id), -1) into p_category
from dual;
END findAvg;
DECLARE
cat products.category_id%TYPE;
Price products.List_price%TYPE;
BEGIN
cat := &p_category;
findAvg (cat, price);
if (price = -1) then
dbms_output.put_line('Wrong Category ');
ELSE
dbms_output.put_line('the average price for category' || cat || ' is ' || price);
END IF;
END;
/
show errors
但是當我嘗試運行它,我得到這個錯誤信息(我可以只有在顯示錯誤後才能看到):
PLS-00103: Encountered the symbol "DECLARE"
這個聲明有什麼問題?
http://stackoverflow.com/questions/20334067/pls-00103-encountered-the-symbol-create/20334358#20334358 – Drumbeg