ccovell
asked on
Referncing Columns In a Cursor By Index
Is there a way to reference columns in a cursor by index rather than by column name? For instance,
DECLARE
CURSOR myCursor IS
SELECT first_name,
last_name
FROM customer;
BEGIN
FOR curRecord IN myCursor LOOP
DBMS_OUTPUT.PUT_LINE(curRe cord(1));
DBMS_OUTPUT.PUT_LINE(curRe cord(2));
END LOOP;
END;
DECLARE
CURSOR myCursor IS
SELECT first_name,
last_name
FROM customer;
BEGIN
FOR curRecord IN myCursor LOOP
DBMS_OUTPUT.PUT_LINE(curRe
DBMS_OUTPUT.PUT_LINE(curRe
END LOOP;
END;
ASKER
ty schwertner,
I've come to the conclusion that this functionality is definitely no available. Kind sad if your in a situation like me where you have a multi union query and there is no consistent name for the same column in each of the union components. I've resided to giving them all the same alias and just using the alias reference in the cursor.
I've come to the conclusion that this functionality is definitely no available. Kind sad if your in a situation like me where you have a multi union query and there is no consistent name for the same column in each of the union components. I've resided to giving them all the same alias and just using the alias reference in the cursor.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So far only this can work
DECLARE
CURSOR myCursor IS
SELECT first_name,
last_name
FROM employees;
BEGIN
FOR curRecord IN myCursor LOOP
DBMS_OUTPUT.PUT_LINE(curRe
DBMS_OUTPUT.PUT_LINE(curRe
END LOOP;
END;