pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Marcin Winkler <qurczak@wolomin.biz>
To: pgsql-sql@postgresql.org
Subject: Re: is this possible in plpgsql ?
Date: Thu, 19 Jun 2003 19:23:24 +0100
Message-ID: <200306191923.24885.dev@archonet.com> (raw)
In-Reply-To: <20030619023832.2fe7ac5b.qurczak@wolomin.biz>
References: <20030619023832.2fe7ac5b.qurczak@wolomin.biz>

On Thursday 19 Jun 2003 1:38 am, Marcin Winkler wrote:
> I have 1 function in pg 7.3.2.
>
> txt string have 1,2,3,.. and i would like to be similar like if 3 in
> (1,2,3..) then, but IF 3 in (''''||txt||'''') THEN doesn't work.
> There is possible to this or not ?

>         txt := '''';
>         for i in 1 .. 10 loop
>                 txt := txt||i||'','';
>         END loop;
>         txt := txt||''0'';
>         IF 3 in (''''||txt||'''') THEN
>                 raise notice ''yep'';

Try something like:

  query:=''SELECT 3 in ('' || txt || '')''
  EXECUTE query;

Then check the result for true/false

-- 
  Richard Huxton



view thread (2+ messages)

Message-ID: <200306191923.24885.dev@archonet.com>
Permalink:  ../200306191923.24885.dev@archonet.com/
Also on:    postgresql.org/message-id/200306191923.24885.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, qurczak@wolomin.biz
  Subject: Re: is this possible in plpgsql ?
  In-Reply-To: <200306191923.24885.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox