Home » SQL & PL/SQL » SQL & PL/SQL » Formatting with null Values
Formatting with null Values [message #9105] Mon, 20 October 2003 01:35 Go to next message
Ivory Williams
Messages: 13
Registered: October 2001
Junior Member
Can somepne pls help, trying to format output with null value.

select
rpad(name,20,' ')||
rpad(addr1,26,' ')||
rpad(addr2,26,' ')
from name, address where name_id =address_id
and addr_typ ='LC'

The output needs to keep the spaces even when value is null.
Re: Formatting with null Values [message #9114 is a reply to message #9105] Mon, 20 October 2003 08:51 Go to previous message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
SELECT RPAD(NVL(name,' '), 20, ' ')
       || RPAD(NVL(addr1,' '), 26, ' ')
       || RPAD(NVL(addr2,' '), 26, ' ')
FROM   name
,      address
WHERE  name_id = address_id 
AND    addr_typ = 'LC'
HTH,

A.
Previous Topic: Removing comments from Stored procedures
Next Topic: Insert and read transaction level
Goto Forum:
  


Current Time: Fri Mar 29 08:49:46 CDT 2024