Re: Concatenating - Mailing list pgsql-novice

From Heath Tanner
Subject Re: Concatenating
Date
Msg-id 4724C8A3-EE33-11D7-99A5-0003930C11A0@inligo.com
Whole thread Raw
In response to Concatenating  (Juan Francisco Diaz <j-diaz@publicar.com>)
List pgsql-novice
On Tuesday, September 23, 2003, at 06:08  PM, Juan Francisco Diaz wrote:

> cadena := 'select * from orden where idlibro = ';
> cadena := cadena || Libro;
> cadena := cadena || ' order by idorden limit ';
> cadena := cadena || ''numFin'';
> cadena := cadena || ';';
>
> And I cant get it to wrok. Libro and numFin are variables that are
> received
> in a pgsql function. Libro is char(6) and numFin is numeric.
> I tried this and also doing everything in the same line... With no good
> results... Iam now very confused with this!!!! AHAHHAHAh

Looks like you need to double your quotes, e.g. ''select * from orden
where idlibro = ''.

See "19.11.1.1. Quote Me on That: Escaping Single Quotes":
http://www.postgresql.org/docs/7.3/interactive/plpgsql-porting.html.

-heath


pgsql-novice by date:

Previous
From: Bruno LEVEQUE
Date:
Subject: Re: Referencing multiple primary keys from a single table.
Next
From: Juan Francisco Diaz
Date:
Subject: Badly placed ()'s