dinamic sql

From: "Manso Gomez, Ramon" <rmgomez(at)indra(dot)es>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: dinamic sql
Date: 2006-08-29 10:31:22
Message-ID: 12B09E52EF3AEF41AEF3D205BD4DF4651FAE8D@MADARRMAIL3.indra.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2006-08-29 10:38:58 Re: Trigger on Insert to Update only newly inserted fields?
Previous Message Richard Broersma Jr 2006-08-28 19:23:07 Re: Fastest way to get max tstamp