Home » SQL & PL/SQL » SQL & PL/SQL » DBMS_OUTPUT in a for update cursor..
DBMS_OUTPUT in a for update cursor.. [message #8318] Fri, 08 August 2003 13:45 Go to next message
Meenakshi
Messages: 28
Registered: December 2001
Junior Member
Hi,

This is my code:

DECLARE
current_bldg_code varchar2(30) := 'LIB' ;
CURSOR upd_capacity_cursor is select room, capacity from location where bldg_code='LIB'
FOR UPDATE of CAPACITY;
capacity_row upd_capacity_cursor%ROWTYPE;

BEGIN
FOR capcity_row IN upd_capacity_cursor
LOOP
update location set capacity=200 where CURRENT OF upd_capacity_cursor;
DBMS_OUTPUT.PUT_LINE ('The value of capacity is '|| capacity_row.capacity);
END LOOP;
END;
/

It gives the following display:

The value of capacity is
The value of capacity is

PL/SQL procedure successfully completed.

It doesn't display the value 200 here. Could anyone tell me how to fix this code?

Thanks.
Re: DBMS_OUTPUT in a for update cursor.. [message #8319 is a reply to message #8318] Fri, 08 August 2003 13:51 Go to previous messageGo to next message
denni
Messages: 24
Registered: August 2002
Junior Member
look at your spelling of capacity in the
FOR...LOOP statement
Re: DBMS_OUTPUT in a for update cursor.. [message #8322 is a reply to message #8318] Fri, 08 August 2003 15:29 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
The reference to the row variable (capacity_row.capacity) only reflects the before-update value. The capacity was NULL prior to the update.
Previous Topic: Performance Issue with Update Stt. using Subquery
Next Topic: executing another sql script from within a script
Goto Forum:
  


Current Time: Fri Apr 19 01:59:43 CDT 2024