Am trying to insert 50As if the column is null
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;
Still not working,
if dname is null then I need to add 5 As.
select decode(dname,null,rpad(dname,5,'A') from dept;
select decode(dname,null,rpad('A',5,'A'), dname) from dept;
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Excellent jmodic, it works..
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.
Click Here to Expand Forum to Full Width