473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DBMS_SQL.define_column ---- why ????

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
Jul 19 '05 #1
0 7577

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.