Home » SQL & PL/SQL » SQL & PL/SQL » updating a particular value in a record.
updating a particular value in a record. [message #19592] Sun, 31 March 2002 10:55 Go to next message
ash
Messages: 43
Registered: February 2001
Member
hi.

how can we update a particular value in a record. the problem with using the WHERE clause is as follows:

the table that i have has identical values in all the fields(columns) in all the records(rows). for eg. the table looks like this:

TABLE_A
cloumnA columnB columnC
free free free
free free free
free free free
free free free
free free free

now i just wanst to fill in some value say 'abc' in the first column of the first record.

how can i do that?
Re: updating a particular value in a record. [message #19593 is a reply to message #19592] Sun, 31 March 2002 21:38 Go to previous messageGo to next message
R.SIVAKUMAR
Messages: 48
Registered: February 2002
Member
u can TRY like this

update table_a set cloumnA='abc'
for rownum=1;

***
u can use rownum for this operation

bye
siva
Re: updating a particular value in a record. [message #19606 is a reply to message #19592] Mon, 01 April 2002 08:37 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Actually, it would be:

update table_a
   set columna = 'abc'
 where rownum = 1;
Re: updating a particular value in a record. [message #19634 is a reply to message #19592] Tue, 02 April 2002 01:41 Go to previous message
Srihari
Messages: 22
Registered: October 2000
Junior Member
Hi

Try this query! If the records in ur table is like this TABLE_A
cloumnA columnB columnC
free free free
free free free
free free free
free free free
free free free

and U want to change nth row columnB value to 'costly'

then

update TABLE_A set columnB='costly' where rowid =
(select max(rowid) from TABLE_A where rownum <= n)

here if n=3 then Third row columnB value will be changed

Hope this is useful

Bye

Srihari
Previous Topic: insert Problem
Next Topic: Re: Hierarchial Queries
Goto Forum:
  


Current Time: Wed Apr 24 13:13:05 CDT 2024