pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manso Gomez, Ramon <rmgomez@indra.es>
To: pgsql-sql@postgresql.org
Subject: dinamic sql
Date: Tue, 29 Aug 2006 12:31:22 +0200
Message-ID: <12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es> (raw)

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 = 'a')
l_query := l_query||a_from_clause ||'where ename in '||user_Input
else
if(user_Input = 'b')
l_query := 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=parameter", but If the SQL sentence is  ename in
(parameters). It does not work.

Thanx in Advance.

view thread (2+ messages)  latest in thread

Message-ID: <12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es>
Permalink:  ../12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es/
Also on:    postgresql.org/message-id/12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es

 · 

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: rmgomez@indra.es
  Subject: Re: dinamic sql
  In-Reply-To: <12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es>

* 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