Re: [SQL] prepared statements

2011-12-08 Thread David Johnston
-Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Pavel Stehule Sent: Thursday, December 08, 2011 2:40 AM To: Vad N Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] prepared statements Hello 2011/12/8 Vad N : > > Hi. >

Re: [SQL] prepared statements

2011-12-07 Thread Pavel Stehule
Hello 2011/12/8 Vad N : > > Hi. > > How can i pass a set of values to prepared statement? > > example > I have a prepared query: > select * from users in ( $1 ) > > i would like to pass: 1,2,3,4 and get: > > select * from users in ( 1,2,3,4 ) > > Any ideas? use a array parameter, please regards

[SQL] prepared statements

2011-12-07 Thread Vad N
Hi. How can i pass a set of values to prepared statement? example I have a prepared query: select * from users in ( $1 ) i would like to pass: 1,2,3,4 and get: select * from users in ( 1,2,3,4 ) Any ideas?

Re: [SQL] Prepared statements in PGSQL functions

2006-06-14 Thread Milen Kulev
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lane Sent: Wednesday, June 14, 2006 4:35 PM To: Milen Kulev Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Prepared statements in PGSQL functions "Milen Kulev" <[EMAIL PROTECTED]> w

Re: [SQL] Prepared statements in PGSQL functions

2006-06-14 Thread Tom Lane
"Milen Kulev" <[EMAIL PROTECTED]> writes: > I want to use prepared statement in a function. Why? You seem not to be aware that plpgsql implicitly prepares statements behind the scenes. > prepare mystmt( int, int, varchar) as insert into part > values ($1,$2,$3); >

Re: [SQL] Prepared statements in PGSQL functions

2006-06-14 Thread A. Kretschmer
am 14.06.2006, um 15:12:36 +0200 mailte Milen Kulev folgendes: > How to solve my problem ? Is it possible at all to call prepared statement > inside a function at all? Yes, i have a example: create or replace function foo() returns text as $$ declare sql text; begin sql := 'prepare bla(

[SQL] Prepared statements in PGSQL functions

2006-06-14 Thread Milen Kulev
Hi Listers, I want to use prepared statement in a function. Here is my code: create or replace function generate_data ( integer, integer ) returns integer as $BODY$ declare p_count alias for $1; p_max_value_id1 alias for $2;

Re: [SQL] Prepared Statements and large where-id-in constant blocks?

2004-04-19 Thread Tom Lane
James Robinson <[EMAIL PROTECTED]> writes: > where there may be anywhere between 1 and thousands of "(id = N)" > blocks ORed together. These may be transformed to the "WHERE t1.id IN > (X, Y, ...)" form for possibly a little performance gain (possibly -- > I've not yet checked to see if this pla

[SQL] Prepared Statements and large where-id-in constant blocks?

2004-04-19 Thread James Robinson
Howdy: Java middlewares like JBossCMP issue many queries in the general form of: SELECT t1.att1, t1.att2 ... t1.attN FROM t1 WHERE (t1.id = X) or (t1.id = Y) where there may be anywhere between 1 and thousands of "(id = N)" blocks ORed together. These may be transformed to the "WHERE