All Items in my table are 7 digits. If I input something with 6 digits should show 0 at the beginning. (output should be 7 digits.)
For example:
Input= 123456 Output= 0123456
How can I write it in Oracle SQL?
I've tried that. But it does not work.
cursor c1 is
into art_no_tmp1
select art_no
from barticles b
where b.ean_no_1 = '789546584587';
cursor checklength is
into len_number
select length(art_no_tmp1)
from dual;
if(len_number = 6) then
return '0'+art_no_tmp1;
else
return art_no_tmp1;
end if;
does anyone have an idea?
||, not+- thus, you'd want to writereturn '0' || ART_NO_TMP1;. Share and enjoy.