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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Tomlins

    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.execut e(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
Working...