logo       

dynamic queiries: msg#00244

db.postgresql.novice

Subject: dynamic queiries

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.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise