Обсуждение: quotes in pl/pgsql

Поиск
Список
Период
Сортировка

quotes in pl/pgsql

От
Najm Hashmi
Дата:
Hi all, I just want to know how to put quotes around a string. Is there a
function to do so?
If not how can I escape  a single quote.
Thank you in advance.

Вложения

Re: quotes in pl/pgsql

От
clayton cottingham
Дата:
Najm Hashmi wrote:
> 
> Hi all, I just want to know how to put quotes around a string. Is there a
> function to do so?
> If not how can I escape  a single quote.
> Thank you in advance.
> 
>   ------------------------------------------------------------------------
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

single qutoe escaping :

'here''s johnny'


Re: quotes in pl/pgsql

От
Justin Clift
Дата:
Hi Najm,

Is this what you mean?

CREATE FUNCTION foobar(int4) returns int4 as 'DECLARE
 textbuf   varchar(120);

BEGIN
   textbuf := ''Example Text '';
   insert into sometable (something) values (textbuf);
   RETURN 0; END;'
LANGUAGE 'plpgsql';


Najm Hashmi wrote:
> 
> Hi all, I just want to know how to put quotes around a string. Is there a
> function to do so?
> If not how can I escape  a single quote.
> Thank you in advance.
> 
>   ------------------------------------------------------------------------
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


Re: quotes in pl/pgsql

От
Roberto Mello
Дата:
On Thu, Mar 08, 2001 at 05:54:38PM -0500, Najm Hashmi wrote:
> Hi all, I just want to know how to put quotes around a string. Is there a
> function to do so?
> If not how can I escape  a single quote.
Others have answered how to quote a single string. I wrote an entire
section on quotes on the PL/SQL-to-PL/pgSQL-HOWTO. It's called "Quote me
on that" and mentions several cases on quote usage in PL/pgSQL and what to
do about it.http://www.brasileiro.net/roberto/howto
-Roberto

-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club|------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net     http://www.sdl.usu.edu - Space Dynamics Lab, Web Developer    
 
DOS = Damned Old Software


Re: quotes in pl/pgsql 0n variable type text or varchar

От
Najm Hashmi
Дата:
Roberto Mello wrote:

> On Thu, Mar 08, 2001 at 05:54:38PM -0500, Najm Hashmi wrote:
> > Hi all, I just want to know how to put quotes around a string. Is there a
> > function to do so?
> > If not how can I escape  a single quote.
>
>         Others have answered how to quote a single string. I wrote an entire
> section on quotes on the PL/SQL-to-PL/pgSQL-HOWTO. It's called "Quote me
> on that" and mentions several cases on quote usage in PL/pgSQL and what to
> do about it.
>         http://www.brasileiro.net/roberto/howto
>
>         -Roberto
>
> --
> +----| http://fslc.usu.edu USU Free Software & GNU/Linux Club|------+
>   Roberto Mello - Computer Science, USU - http://www.brasileiro.net
>       http://www.sdl.usu.edu - Space Dynamics Lab, Web Developer
> DOS = Damned Old Software

Hi,  I  just want to know is there way to put single quotes around the  value
of  var type text or varchar.
Thanks in advance.
Regards.

Вложения