0
* /我試圖用2個明確的指針,它顯示了這些錯誤使用2個明確的遊標。
{:錯誤在第42行: ORA-06550:第42行,第1列: PLS-00306:錯號碼或類型的參數在調用 'PUT_LINE' ORA-06550:線42,第1列: PL/SQL:語句忽略} */
申報
v_CITY AIRPORT.CITY%TYPE;
v_ARRIVAL_TIME SCHEDULE.ARRIVAL_TIME%TYPE;
v_fnumber FLIGHT.FNUMBER%TYPE;
v_CITY1 AIRPORT.CITY%TYPE;
v_ARRIVAL_TIME1 SCHEDULE.ARRIVAL_TIME%TYPE;
v_fnumber1 FLIGHT.FNUMBER%TYPE;
/* First cursor */
CURSOR get_tables IS
select airp2.CITY , S. ARRIVAL_TIME,S.fnumber
from schedule S, FLIGHT F, airport airp1, airport airp2
where airp1.apcode = DEPARTURE_APCODE and airp2.apcode = ARRIVAL_APCODE AND ARRIVAL_APCODE ='BWI'and S.FNUMBER= F.FNUMBER AND
TO_CHAR(TRUNC(S.DEPARTURE_TIME)) = date'2017-11-12'
ORDER BY airp1.CITY, ARRIVAL_TIME ;
/* Second cursor */
CURSOR get_columns IS
select DISTINCT airp2.CITY , S. DEPARTURE_TIME,S.fnumber
from schedule S, FLIGHT F, airport airp1,FLIGHT_RESERVATION FL, airport airp2
where airp1.apcode = ORIGIN_APCODE and airp2.apcode = DESTINATION_APCODE AND ORIGIN_APCODE ='BWI'and S.FNUMBER= F.FNUMBER AND
TO_CHAR(TRUNC(S.DEPARTURE_TIME)) = date'2017-11-12'
ORDER BY airp2.CITY, DEPARTURE_TIME ;
BEGIN
-- Open first cursor
OPEN get_tables;
LOOP
FETCH get_tables INTO v_CITY, v_ARRIVAL_TIME, v_fnumber;
-- Open second cursor
OPEN get_columns;
LOOP
FETCH get_columns INTO v_CITY1, v_ARRIVAL_TIME1, v_fnumber1;
DBMS_output.put_line(v_CITY1, v_ARRIVAL_TIME1, v_fnumber1);
CLOSE get_tables;
END LOOP;
CLOSE get_columns;
END LOOP;
END;
put_line只有一個參數,而不是三個。 – Mat