dynamic queiries - Mailing list pgsql-novice

From Correia, Carla
Subject dynamic queiries
Date
Msg-id 0F232CC93A58D6119C1600B0D0799B81015CBDF8@hamsrvmx03.logica.co.uk
Whole thread Raw
List 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,
retainedor used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and
anyattachment and all copies and inform the sender.  Thank you. 

pgsql-novice by date:

Previous
From: Robert Prather
Date:
Subject: User Problem In PostgreSQL On Mac OS X
Next
From: glenn
Date:
Subject: problem returning setof records