As an SQL newbie, why do I need to define columns prior to getting
column_value when I can fetch_rows(cur_hdl) ?? Does not column_value
get the value at position x at the current cursor position and
fetch_rows gets a row for a given cursor and increment cursor position
? So why define_column ?
Example.
-- describe defines
dbms_sql.define_column(cur_hdl, 1, name, 200);
dbms_sql.define_column(cur_hdl, 2, salary);
-- execute
rows_processed := dbms_sql.execute(cur_hdl);
LOOP
-- fetch a row
IF dbms_sql.fetch_rows(cur_hdl) > 0 then
-- fetch columns from the row
dbms_sql.column_value(cur_hdl, 1, name);
dbms_sql.column_value(cur_hdl, 2, salary);
-- <process data>
ELSE
EXIT;
END IF;
END LOOP;
Thanks for any input.
Jason Tomlins