Home » RDBMS Server » Server Administration » Re: Lpad
Re: Lpad [message #369162] Fri, 31 March 2000 09:30
Chris Ruel
Messages: 6
Registered: March 2000
Junior Member
Sylvia,

LPAD is a option you can use when returning data in a SQL query to format your output a little bit.
For example:

select lpad(description,20,'.') description
from test_1
/

will yield:

DESCRIPTION
--------------------
...............Chris
.........CHRISTOPHER
................Lois
..............CARRIE
...........CHRISTIAN
...........Christian
..............Mother
.................Car
.................LOG
..............LOGGER

10 rows selected.

SQL>

To use it, you enclose the column you are selecting from in (). Also, after the column name, you use a comma(,) and then a number. The number signifies how many characters you wish to return from the data. The next option is what you want to "pad" the empty spaces with. I chose a period. It will pad that period on to the LEFT of the output to make the output = 20 characters. You can do the same thing with RPAD but it works off of the right side.
Does that help?
Previous Topic: ORA-01578 and ORA-01110
Next Topic: Performance Tuning HUGE queries running WHERE UPPER fn
Goto Forum:
  


Current Time: Wed Oct 28 06:59:14 CDT 2020