dynamic queiries

From: "Correia, Carla" <Carla(dot)Correia(at)logicacmg(dot)com>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: dynamic queiries
Date: 2003-02-20 14:26:47
Message-ID: 0F232CC93A58D6119C1600B0D0799B81015CBDF8@hamsrvmx03.logica.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

A am trying to execute following query..:

strSelectString := ''SELECT OBJID2 as strPersonnummer FROM '' ||
strRollentab || ''
where qualitaet = ''|| QUALITAETNR ||''
AND OBJID2 = '' || NEW.ID || '''';

How do I go about it?
I tried with normal execute, but no luck..

EXECUTE ''SELECT OBJID2 as strPersonnummer FROM '' ||
strRollentab || ''
where qualitaet = ''||
quote_literal(referrer_keys.QUALITAETNR) ||''
AND OBJID2 = '' || NEW.ID || '''';

and i tried with For-in-execute, as stated in the docus, but no luck either.
I receive an error message stating that the sql statement is missing
something.

FOR ROW IN EXECUTE strSelectString LOOP
Raise NOTICE ''result: % '',strPersonnummer;
END LOOP;

How can I do this then??

Thanks!!

Carla Correia

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Browse pgsql-novice by date

  From Date Subject
Next Message glenn 2003-02-21 01:42:47 help with select * from functionname() ?
Previous Message Robert Prather 2003-02-19 21:44:23 User Problem In PostgreSQL On Mac OS X