我正在創建一個存儲過程,該存儲過程需要輸入一個id和一個開始日期和結束日期,然後返回該範圍內的行程。我一直在尋找在Oracle文檔,我覺得我很接近,但得到了一些錯誤尚未:在Oracle中設置存儲過程
CREATE or replace PROCEDURE chg_per_aircraft
(p_aircraft_id IN RCC_AIRCRAFT.aircraft_id,
p_start_date IN date,
p_end_date IN date,
p_ttl_chg_per_acft OUT INTEGER)
AS
BEGIN
SELECT RCC_AIRCRAFT.aircraft_id,
SUM(RCC_CHARTER.distance * RCC_MODEL.charge_per_mile) ttl_chg
INTO
p_aircraft_id,
p_ttl_chg_per_acft
FROM RCC_AIRCRAFT
full join RCC_CHARTER
on RCC_CHARTER.aircraft_id = RCC_AIRCRAFT.aircraft_id
left join RCC_MODEL
on RCC_MODEL.model_code = RCC_AIRCRAFT.model_code
Where RCC_CHARTER.trip_date > p_start_date and RCC_CHARTER.trip_date < p_end_date
group by RCC_AIRCRAFT.aircraft_id;
SYS.DBMS_OUTPUT.PUT_LINE(ttl_chg);
end;
你會得到什麼錯誤? –
運行此查詢,我的錯誤是:'PL/SQL:編譯單元分析終止'和'PLS-00488:RCC_AIRCRAFT.Aircraft_ID必須爲' – dreamerdiver
SYS.DBMS_OUTPUT.PUT_LINE(ttl_chg);作爲存儲過程運行時不會產生任何輸出。在終端上運行pl/sql時,您可以獲得輸出。 –