Hi all,
i would like to build a select statement for a cursor and want to
provide the column name for which the value is to be extracted as a
parameter. All provided fields are NUMBERs. So I do something like:
CURSOR c_data (sField VARCHAR2)
IS
SELECT sField
FROM <tablename>
WHERE <condition>
;
when I call the cursor with some value for sField, let's say
open c_data('COSTS');
...
FETCH c_data INTO value_field; -- value_field is NUMBER
I get an error. When I switch value_field to VARCHAR2, I get:
COSTS (just the name in varchar!)
as selected value from the select statement and not the value in the
column 'COSTS' just as if the column didn't exist in the table....
what's wrong?
(i would even prefer to read all fields from the table at once and
then address them by using something like c_data.column_name, looping
over the column_names... but this doesn't work either :-( )