cursor with dinamic string

From: Luca Santaniello <luca(dot)santaniello(dot)81(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: cursor with dinamic string
Date: 2011-03-25 12:07:25
Message-ID: 4D8C857D.1070502@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I need use dinamic string for my cursor... My code is:

query varchar := 'field1, field2 from ''' || tableName ||''' ........;
//has dinamic params

then I create cursor...

myCursor CURSOR FOR SELECT query;

I compile my function but when i run it I obtain error...

ERROR: invalid input syntax for integer: ......
CONTEXT: PL/pgSQL function "my_function" line 72 at FETCH

If I use static string, I don't have problems!!!

Can I solve it?

Thanks in advance

--
Luca Santaniello
email: luca(dot)santaniello(dot)81(at)gmail(dot)com
skype: luca.santaniello
msn: luketto81(at)hotmail(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2011-03-25 12:37:24 Re: cursor with dinamic string
Previous Message Marc Mamin 2011-03-25 11:36:19 ERROR: type "foo_20110307_id_seq" already exists (expected relation "foo_20110307_id_seq" already exists)