Hi All,
Am trying to insert 50As if the column is null
e.g
select decode('','',rpad('',50,'A'),'') from dual
Need help, above code is not working, any idea.
Thanks in advance.
Printable View
Hi All,
Am trying to insert 50As if the column is null
e.g
select decode('','',rpad('',50,'A'),'') from dual
Need help, above code is not working, any idea.
Thanks in advance.
You need the column name, compare:
select decode(dummy,NULL,rpad(dummy,50,'A'),dummy) from dual;
select decode(dummy,'X',rpad(dummy,50,'A'),dummy) from dual;
Hi,
Still not working,
for example
if dname is null then I need to add 5 As.
select decode(dname,null,rpad(dname,5,'A') from dept;
Thanks.
select decode(dname,null,rpad('A',5,'A'), dname) from dept;
Excellent jmodic, it works..
Thanks
Nvl(dname,'AAAAA') might be more intuitive.
Nvl(dname,rpad('A',50,'A')) would save counting 50 of them. (Most probably wrongly if I were doing it).
Is it "5", or "50"? Seems to be some confusion. if 50, then RPAD('A',50,'A') is indeed more robust.