Home » SQL & PL/SQL » SQL & PL/SQL » update query (10g)
update query [message #321234] Mon, 19 May 2008 08:43 Go to next message
sudhir1582
Messages: 17
Registered: December 2007
Junior Member
HI

I have following table with value:
SQL> select * from seq;

ID SEQ
---------- --------------------
1 000000000000001



i want to update SEQ column in such a way that it should look like in following way:

000000000000001
000000000000002
000000000000003
000000000000004
.....
000000000000010
000000000000011

I tried but i'm unable to do the same, pls send the query if anybody has.

Regards,
Sudhir

Re: update query [message #321235 is a reply to message #321234] Mon, 19 May 2008 08:44 Go to previous messageGo to next message
BlackSwan
Messages: 25039
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above
Re: update query [message #321237 is a reply to message #321234] Mon, 19 May 2008 08:47 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You'll need to make the SEQ column a Varchar2(15), and add a Before Insert trigger to LPAD the value entered into the column with '0'
Re: update query [message #321239 is a reply to message #321237] Mon, 19 May 2008 08:49 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ot use TO_CHAR with the correct format model.

Regards
Michel
Re: update query [message #321246 is a reply to message #321234] Mon, 19 May 2008 09:32 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
sudhir1582 wrote on Mon, 19 May 2008 15:43

SQL> select * from seq;

        ID SEQ
---------- --------------------
         1 000000000000001



i want to update SEQ column in such a way that it should look like in following way:

000000000000001


I might be missing something very obvious, but didn't you just show us that you already HAVE this value in your seq column?!
Re: update query [message #321338 is a reply to message #321246] Mon, 19 May 2008 23:18 Go to previous messageGo to next message
sudhir1582
Messages: 17
Registered: December 2007
Junior Member
HI Frank,

Every time i want to update the SEQ column with value 1.

So whenever i update it should give me the value in following way only.

000000000000001
000000000000002
000000000000003
000000000000004
.....
000000000000010
000000000000011


Pls reply.

Regards
Sudhir
Re: update query [message #321356 is a reply to message #321338] Tue, 20 May 2008 00:59 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Mon, 19 May 2008 15:49
use TO_CHAR with the correct format model.

Regards
Michel


[Updated on: Tue, 20 May 2008 00:59]

Report message to a moderator

Re: update query [message #321380 is a reply to message #321356] Tue, 20 May 2008 02:12 Go to previous messageGo to next message
sudhir1582
Messages: 17
Registered: December 2007
Junior Member
Thanks All of You,

I have done with using lpad.

Regards
Sudhir
Re: update query [message #321490 is a reply to message #321338] Tue, 20 May 2008 08:01 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
You really do not know how to ask a question so that anyone will understand.

sudhir1582 wrote on Tue, 20 May 2008 00:18

Every time i want to update the SEQ column with value 1.


update table set column=1;
answers that questions.

Quote:

So whenever i update it should give me the value in following way only.

000000000000001
000000000000002
000000000000003
000000000000004
.....
000000000000010
000000000000011



This is a different question completely unrelated to the first.
Previous Topic: insert query results into a table
Next Topic: database link
Goto Forum:
  


Current Time: Mon Dec 05 20:59:08 CST 2016

Total time taken to generate the page: 0.14551 seconds