tags:

views:

1859

answers:

1

In T-SQL, SPACE() function is used to add spaces to a string. For e.g.

@s = 'He' + space(5) + 'llo'

Output

He     llo

So is there any function in PL/SQL that is equivalent to SPACE()?

Thank you.

+3  A: 

You can use RPAD or LPAD functions

select 'He'  || rpad(' ',5,' ') || 'llo'
from dual;
/

or in PL/SQL it would be:

declare
  x varchar2(20);
begin
  x:= 'He'  || rpad(' ',5,' ') || 'llo';
end;
/
IK