Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 41DE5475CEA; Wed, 5 Jun 2002 00:19:06 -0400 (EDT) Received: from vreach.net (unknown [203.200.123.27]) by postgresql.org (Postfix) with ESMTP id 9C747475CD7; Wed, 5 Jun 2002 00:17:36 -0400 (EDT) Received: from lokhi [194.168.2.19] by vreach.mzi.net [194.168.2.30] with SMTP (MDaemon.PRO.v5.0.5.R); Wed, 05 Jun 2002 09:46:11 +0530 Message-ID: <00b101c20c47$67d48ef0$1302a8c2@multicast.com> From: "Sandeep Chibber" To: "Bruce Momjian - CVS" Cc: , , , , References: <20020605040127.D5D3B4760C9@postgresql.org> Subject: Postgres Function Proble Date: Wed, 5 Jun 2002 09:43:53 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 1 X-MSMail-Priority: High X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-MDRemoteIP: 194.168.2.19 X-Return-Path: sandeep@vreach.net X-Archive-Number: 200206/36 X-Sequence-Number: 8001 Hi, I am Sandeep Chibber from vReach Solutions. We are using postgres functions with java beans. There is no problem with simple postgres functions which have Simple select statements WITHOUT where clause. But when we have sql statements in the postgres function in which WHERE clause is used ,then we have problem of passing values to the WHERE clause.Like in the following function,how to pass values to $1 an $2 through my java program. In DB2 we use CallableStatement.setString(1,"user_id) to set values to user_id of string(varchar) datatype. Postgres has some other way ,which we are not able to locate. CREATE FUNCTION tester7 ( varchar, varchar ) returns setof ICDN_EVENTREG as ' SELECT * FROM ICDN_EVENTREG WHERE ICDN_EVENTREG.USER_ID = $1 AND ICDN_EVENTREG.PASSWORD = $2 ;' LANGUAGE SQL The table structure is as follows CREATE TABLE ICDN_EVENTREG ( USER_ID VARCHAR(30) NOT NULL , PASSWORD VARCHAR(16) , EMAIL VARCHAR(80) , DEPARTMENT VARCHAR(30) , FIRST_NAME VARCHAR(30) , LAST_NAME VARCHAR(30) , DESIGNATION VARCHAR(30) , TYPE VARCHAR(15) , STATUS VARCHAR(15) DEFAULT 'Pending') ; So kindly guide us how to pass values to the $1,$2 in WHERE clause through our java beans and also how to execute this function in the pgAdmin II Thanking in anticipation Sandeep Chibber