Home » SQL & PL/SQL » SQL & PL/SQL » DBMS_SQL.DEFINE_COLUMN problem
DBMS_SQL.DEFINE_COLUMN problem [message #37325] Thu, 31 January 2002 00:00 Go to next message
Anthony
Messages: 48
Registered: September 2000
Member
Hi all message previously posted in sql but is more pertinent on this board.

I am using a dynamic pl/sql procedure and I am having trouble trying to return a value from the database into a local variable, I am using the define_column procedure from DBMS_SQL, there is no value returned to populate the final table

v_count integer(6);
begin
v_STR_SQL := 'select count(*) XXX from emp';
i_CURSOR := DBMS_SQL.open_cursor;
DBMS_SQL.parse(i_CURSOR, v_STR_SQL, DBMS_SQL.v7);
DBMS_SQL.define_column(i_CURSOR,1,v_count);
i_ROWS_PROCESSED := DBMS_SQL.execute(i_CURSOR);
DBMS_SQL.close_cursor(i_CURSOR);
insert into ants values ('v_count is',v_count);

t.i.a for any advice

regards
Re: DBMS_SQL.DEFINE_COLUMN problem [message #37328 is a reply to message #37325] Thu, 31 January 2002 02:27 Go to previous messageGo to next message
Satish Shrikhande
Messages: 167
Registered: October 2001
Senior Member
You need to add on more step
after defining the column .

DBMS_SQL.COLUMN_VALUE(Id_Cursor, 1,v_vount);

Hope this can help you .
Re: DBMS_SQL.DEFINE_COLUMN problem [message #37330 is a reply to message #37328] Thu, 31 January 2002 03:20 Go to previous message
Anthony
Messages: 48
Registered: September 2000
Member
Thanks a lot Satish, that really helped!!
(Note: I had to use execute_and_fetch not just execute on its own)
Previous Topic: Collecting data from 2 tables - please help
Next Topic: UPDATING with INLINE QUERY
Goto Forum:
  


Current Time: Thu Apr 18 01:55:04 CDT 2024