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

From: Jason Tomlins <jason_at_tomlins.net>
Date: 22 Aug 2003 15:53:47 -0700
Message-ID: <6036093e.0308221453.3e1e641d_at_posting.google.com>


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 Received on Sat Aug 23 2003 - 00:53:47 CEST

Original text of this message