Home » SQL & PL/SQL » SQL & PL/SQL » Sequence Number: Leading Zeroe's
Sequence Number: Leading Zeroe's [message #41798] Mon, 03 February 2003 13:28 Go to next message
Das
Messages: 92
Registered: November 2002
Member
Hi all,
I am getting the NEXTVAL of my sequence number, I believe that when you do this Oracle truncates the leading zeroes and give you the number for example:
Select id.NEXTVAL from dual -> gives me 18

But how do I also get the leading zeroes here, say 00018???

Thanks in advance.
Das
Re: Sequence Number: Leading Zeros [message #41799 is a reply to message #41798] Mon, 03 February 2003 13:42 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Oracle doesn't truncate the leading zeros - a sequence is a number. Here is how you can add the leading zeros:

lpad(seqname.nextval, 5, '0')
Thanks Todd: Re: Sequence Number: Leading Zeros [message #41800 is a reply to message #41798] Mon, 03 February 2003 14:00 Go to previous message
Das
Messages: 92
Registered: November 2002
Member
Re: Sequence Number: Leading Zeros
Previous Topic: Need to escape a char in a Procedure
Next Topic: Text Editor
Goto Forum:
  


Current Time: Sun Aug 31 11:06:12 CDT 2025