[thelist] a Monday Freebie on Tuesday

Adam Patrick apatrick at oracular.com
Tue Aug 1 08:17:38 CDT 2000


> SQL Server 7 has a function called REPLICATE (I don't know if the function
> is part of ANSI SQL or not, check your documentation to be sure before
> trying it on Oracle) which repeats a character string a definable number of
> times. You can use it to add as many zeros as you want:
> 

<type type="Oracle SQL" author="Adam">
To left pad with zeros (or any other character) in Oracle:

select lpad(SSN, 9, '0') SSN
  from foobar


To right pad:

select rpad(foo, x, '*') foo
  from bar

</tip>
_______________________________________________________________
Get your Private, Free FarmDance at http://farmer.oracular.com/




More information about the thelist mailing list