SQL Replicate function ORACLE equivalent
Hi,
Im converting replicate function from sql to oracle.
SQL:
select convert(char(7), replicate('0',(7-datalength(ltrim(rtrim(convert(char(7),@name)))))) + ltrim(rtrim(convert(char(7),@name))))
when i converted it to oracle as follows:
SELECT CAST(LPAD('',(7 - LENGTHB(LTRIM(RTRIM(CAST(v_name AS CHAR(7)))))),'0') || LTRIM(RTRIM(CAST(v_name AS CHAR(7)))) AS CHAR(7))
if i let my variable as anne
i got the word itself, theres no '000' in the result.
Please help...