Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Newline in plpgsql

Status
Not open for further replies.

iteration9x

Programmer
May 1, 2007
3
0
0
US
Hi I'm trying to concatenate to strings together with a newline.

CREATE OR REPLACE FUNCTION concat() RETURNS TEXT AS '

DECLARE
str text;
strn text = E'\n' <- This breaks.

BEGIN

str = ''number of completed'' || strn;
str = str || str;
RETURN str;

END
' Language plpgsql;

Thanks for your help!
Patrick
 
Weirdly, it didn't work if I did this

strn text = chr(10);

str = ''something'' || strn;


but it did work if I did this,

str = ''something'' || chr(10);

So thanks alot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top