我不知道如何显示游标数据oracle
i don't know how to display the cursor data oracle
我不知道如何显示游标数据我创建了一个 returns 多行的游标,我想查看该行,但我不知道如何
SET SERVEROUTPUT ON;
DECLARE CURSOR CurEscal IS
SELECT
ESCALE.NUMVOL, ( to_number ( to_char ( ESCALE.DATEED, 'MI' ) ) - to_number ( to_char ( ESCALE.DATEEA, 'MI' ) ) ) AS "duree par min", AEROPORT.NOMAER
FROM
ESCALE
JOIN AEROPORT ON ESCALE.REFAER = AEROPORT.REFAER
WHERE
NUMVOL IN ( SELECT ESCALE.NUMVOL FROM ESCALE GROUP BY ESCALE.NUMVOL HAVING Count( ESCALE.NUMESC ) >= 1 );
BEGIN
--Open the CurEscal CURSOR
IF NOT (CurEscal%ISOPEN) THEN
OPEN CurEscal;
END IF;
--FETCH
FOR i IN CurEscal LOOP
DBMS_OUTPUT.PUT_LINE('I don't know how I need your help');
END LOOP;
--Close the CurEscal CURSOR
IF CurEscal%ISOPEN THEN
CLOSE CurEscal;
END IF;
END;
/
谁能帮忙!!
那就是
dbms_output.put_line(i.numvol ||', '|| i."duree par min" ||', '|| i.NOMAER);
不过,如果您使用游标 FOR
循环,一切都会简单一些,因为您不必 declare/open/fetch/close 游标,例如
BEGIN
FOR i
IN (SELECT escale.numvol,
( TO_NUMBER (TO_CHAR (escale.dateed, 'MI'))
- TO_NUMBER (TO_CHAR (escale.dateea, 'MI')))
AS duree_par_min,
aeroport.nomaer
FROM escale JOIN aeroport ON escale.refaer = aeroport.refaer
WHERE numvol IN ( SELECT escale.numvol
FROM escale
GROUP BY escale.numvol
HAVING COUNT (escale.numesc) >= 1))
LOOP
DBMS_OUTPUT.put_line (
i.numvol || ', ' || i.duree_par_min || ', ' || i.nomaer);
END LOOP;
END;
我不知道如何显示游标数据我创建了一个 returns 多行的游标,我想查看该行,但我不知道如何
SET SERVEROUTPUT ON;
DECLARE CURSOR CurEscal IS
SELECT
ESCALE.NUMVOL, ( to_number ( to_char ( ESCALE.DATEED, 'MI' ) ) - to_number ( to_char ( ESCALE.DATEEA, 'MI' ) ) ) AS "duree par min", AEROPORT.NOMAER
FROM
ESCALE
JOIN AEROPORT ON ESCALE.REFAER = AEROPORT.REFAER
WHERE
NUMVOL IN ( SELECT ESCALE.NUMVOL FROM ESCALE GROUP BY ESCALE.NUMVOL HAVING Count( ESCALE.NUMESC ) >= 1 );
BEGIN
--Open the CurEscal CURSOR
IF NOT (CurEscal%ISOPEN) THEN
OPEN CurEscal;
END IF;
--FETCH
FOR i IN CurEscal LOOP
DBMS_OUTPUT.PUT_LINE('I don't know how I need your help');
END LOOP;
--Close the CurEscal CURSOR
IF CurEscal%ISOPEN THEN
CLOSE CurEscal;
END IF;
END;
/
谁能帮忙!!
那就是
dbms_output.put_line(i.numvol ||', '|| i."duree par min" ||', '|| i.NOMAER);
不过,如果您使用游标 FOR
循环,一切都会简单一些,因为您不必 declare/open/fetch/close 游标,例如
BEGIN
FOR i
IN (SELECT escale.numvol,
( TO_NUMBER (TO_CHAR (escale.dateed, 'MI'))
- TO_NUMBER (TO_CHAR (escale.dateea, 'MI')))
AS duree_par_min,
aeroport.nomaer
FROM escale JOIN aeroport ON escale.refaer = aeroport.refaer
WHERE numvol IN ( SELECT escale.numvol
FROM escale
GROUP BY escale.numvol
HAVING COUNT (escale.numesc) >= 1))
LOOP
DBMS_OUTPUT.put_line (
i.numvol || ', ' || i.duree_par_min || ', ' || i.nomaer);
END LOOP;
END;