Using the command Fetch Into, is there a way to fetch selected fields into variables, when you do not know how may fields are in a select statement.
In the future I plan on using whatever script I create, so I am trying to get the Fetch Into statement as generic as possible. Could I do this using a Type Record:
TYPE rec1_t IS RECORD (field1 VARCHAR2(16), field2 NUMBER, field3 DATE);
But then again, the type record has a fixed number of fields. I will sometimes need more or less. I need something like field1.....fieldn, where n can be determined somehow.
For example my select could have field1, field2, field3 and
another time it could have field1, field2.
I plan on using the following loop:
OPEN myCursor;
LOOP
FETCH myCursor INTO ???????;
EXIT WHEN myCursor%NOTFOUND;
UTL_FILE.put_line(myFile,myFileLine);
END LOOP;
CLOSE myCursor;
Thanks.
getjbb
In the future I plan on using whatever script I create, so I am trying to get the Fetch Into statement as generic as possible. Could I do this using a Type Record:
TYPE rec1_t IS RECORD (field1 VARCHAR2(16), field2 NUMBER, field3 DATE);
But then again, the type record has a fixed number of fields. I will sometimes need more or less. I need something like field1.....fieldn, where n can be determined somehow.
For example my select could have field1, field2, field3 and
another time it could have field1, field2.
I plan on using the following loop:
OPEN myCursor;
LOOP
FETCH myCursor INTO ???????;
EXIT WHEN myCursor%NOTFOUND;
UTL_FILE.put_line(myFile,myFileLine);
END LOOP;
CLOSE myCursor;
Thanks.
getjbb