You should considder a variation as Volkan suggested.
Otherwise the EXECUTE command might be what you are looking for.
Execute a sql made up in a string
|-----Original Message-----
|From: bandeng [mailto:postgredb@gmail.com]
|Sent: Donnerstag, 19. Mai 2005 04:11
|To: pgsql-sql@postgresql.org
|Subject: [SQL] postgre variable
|
|
|hello all,
|
|i want to make dynamic sql query like this
|
|select * from tb_cust where name='erick' and age='20'
|
|to
|
|select * from tb_cust $1
|
|i have tried but error comeup
|
|any suggestion?
|
|thanks
|Ricky
|--
|Gutten Aben Sugeng Sonten, Jangane Kurang Santen
|bandeng....................
|
|---------------------------(end of
|broadcast)---------------------------
|TIP 9: the planner will ignore your desire to choose an index
|scan if your
| joining column's datatypes do not match
|