Postgres Function Proble

From: "Sandeep Chibber" <sandeep(at)vreach(dot)net>
To: "Bruce Momjian - CVS" <momjian(at)postgresql(dot)org>
Cc: <pgsql-sql-owner(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>, <pgsql-odbc-owner(at)postgresql(dot)org>, <pgsql-jdbc-owner(at)postgresql(dot)org>, <pgsql-general-owner(at)postgresql(dot)org>
Subject: Postgres Function Proble
Date: 2002-06-05 04:13:53
Message-ID: 00b101c20c47$67d48ef0$1302a8c2@multicast.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-sql

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Dave Cramer 2002-06-05 19:12:02 pgsql/src/interfaces/jdbc/org/postgresql test/ ...
Previous Message Bruce Momjian - CVS 2002-06-05 04:01:27 pgsql/doc/TODO.detail mmap

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-06-05 16:33:48 Re: Further info : Very high load average but no cpu utilization
Previous Message Bruce Momjian - CVS 2002-06-05 04:01:27 pgsql/doc/TODO.detail mmap