- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help with RPAD.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 04:02 AM
тАО10-30-2003 04:02 AM
Help with RPAD.
RPAD(cell_id,10,' ')
If cell_id = 'AB' , then its RPADing with 8 spaces to right. But if cell_id is completely NULL , nothing is been added . I mean it return nothing.I tried the following too,
RPAD(NVL(cell_id,' '),10,' ')
Even this doesnt help.
Any thoughts / Help ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 04:22 AM
тАО10-30-2003 04:22 AM
Re: Help with RPAD.
-
I don't have a database at hand to test it right now...
-
can you try replacing '' with chr(0)
i.e.
rpad(cell_id,10,chr(0))
-
revert
-
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 04:24 AM
тАО10-30-2003 04:24 AM
Re: Help with RPAD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 04:39 AM
тАО10-30-2003 04:39 AM
Re: Help with RPAD.
with a space between the single quotes...
does this help?
can't help any further till i get back to my books and db....
regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 04:53 AM
тАО10-30-2003 04:53 AM
Re: Help with RPAD.
-
did you know that:
A ZERO length varchar is treated as NULL.
-
'' is not treated as NULL.
-
-
'' when assigned to a char(1) becomes ' ' (char types are blank padded strings).
-
-
'' when assigned to a varchar2(1) becomes '' which is a zero length string and a zero length string is NULL in Oracle (it is no long '')
-
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 05:58 AM
тАО10-30-2003 05:58 AM
Re: Help with RPAD.
but its not working.
My requirement is in spool file there should be 10 blank space if the cell id is NULL.
any method is ok for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 10:14 AM
тАО10-30-2003 10:14 AM
Re: Help with RPAD.
nvl(rpad(cell_id,' '),' ');
Thanks,
brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 03:00 PM
тАО10-30-2003 03:00 PM
Re: Help with RPAD.
What you were doing was correct.
Your command RPAD(NVL(cell_id,''),10,'') works as you want it if you gave space between the single quotes.
Here is an example I tried. Instead of space I gave '*' so that you can see.
The table has ename of varchar2(10) and has the value 'aaa', 'ccc', null and spaces for the four records.
Select eno, ename from tab1.
101 aaa
102 ccc
103
104
Now I want the ename to be filled with '*' for the reamining 7 spaces, including the columns that are null and spaces.
SQL> select eno, rpad(nvl(ename,' '),10,'*') from tab1;
ENO RPAD(NVL(E
---------- ----------
101 aaa*******
102 ccc*******
102 *********
102 *********
I hope this helps.
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2003 08:48 PM
тАО10-30-2003 08:48 PM
Re: Help with RPAD.
*
As IA showed above, it works!
see below: (please replace '_' with
*
yd@MYDB.MU> create table ydtab (cell_id varchar2(10));
*
Table created.
*
Elapsed: 00:00:00.40
yd@MYDB.MU> insert into ydtab values(null);
*
1 row created.
*
Elapsed: 00:00:00.00
yd@MYDB.MU> commit;
*
Commit complete.
*
Elapsed: 00:00:00.01
yd@MYDB.MU> select '|'||rpad(cell_id,10,'_')||'|' from ydtab;
*
'|'||RPAD(CE
____________
||
*
Elapsed: 00:00:00.00
yd@MYDB.MU> select '|'||rpad(nvl(cell_id,'_'),10,'_')||'|' from ydtab;
*
'|'||RPAD(NV
____________
|__________|
*
Elapsed: 00:00:00.00
yd@MYDB.MU>
*
regards
Yogeeraj