X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B8C569FA68D for ; Tue, 29 Aug 2006 07:31:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 07285-09 for ; Tue, 29 Aug 2006 10:31:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 643E79FA4D0 for ; Tue, 29 Aug 2006 07:31:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mailhost5.indra.es (mailhost1.indra.es [213.170.46.15]) by svr4.postgresql.org (Postfix) with SMTP id 327E15AF8F5 for ; Tue, 29 Aug 2006 10:31:28 +0000 (GMT) Received: from MADARRMAIL3.indra.es ([192.168.10.13]) by mailhost5.indra.es with Microsoft SMTPSVC(6.0.3790.1830); Tue, 29 Aug 2006 12:31:25 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6CB56.477532C9" Subject: dinamic sql Date: Tue, 29 Aug 2006 12:31:22 +0200 Message-ID: <12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: dinamic sql Thread-Index: AcbLVkW0YJlH/n1aTjyj8zzw+gwgCw== From: "Manso Gomez, Ramon" To: X-OriginalArrivalTime: 29 Aug 2006 10:31:25.0367 (UTC) FILETIME=[477D7C70:01C6CB56] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.016 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, SPF_SOFTFAIL X-Spam-Level: ** X-Archive-Number: 200608/226 X-Sequence-Number: 26184 This is a multi-part message in MIME format. ------_=_NextPart_001_01C6CB56.477532C9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi I need to write a Postgres function which executes a cursor. Query of this cursor however is created on the basis of parameters passed by user. if(user_Input =3D 'a') l_query :=3D l_query||a_from_clause ||'where ename in '||user_Input else if(user_Input =3D 'b') l_query :=3D l_query||b_from_clause||'where ename in '||user_Input OPEN csr FOR l_query; How do we do it is postgres. My problem I know how to pass parameters like "ename=3Dparameter", but If the SQL sentence is ename in (parameters). It does not work. Thanx in Advance. ------_=_NextPart_001_01C6CB56.477532C9 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi

I need to write a Postgres function = which=20 executes a cursor. Query of this cursor however is created on the basis = of=20 parameters passed by user.


if(user_Input =3D 'a')
l_query = :=3D=20 l_query||a_from_clause ||'where ename in = '||user_Input
else
if(user_Input =3D=20 'b')
l_query :=3D l_query||b_from_clause||'where ename in '||user_Input

OPEN csr FOR=20 l_query;


How do we do it is postgres.=20 My problem I know how to pass parameters like "ename=3Dparameter", but = If the SQL=20 sentence is  ename in (parameters). It does not=20 work.

Thanx in Advance.
------_=_NextPart_001_01C6CB56.477532C9--