pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sandeep Chibber <sandeep@vreach.net>
To: pgsql-sql@postgresql.org
To: pgsql-sql-owner@postgresql.org
Cc: pgsql-novice-owner@postgresql.org
Cc: pgsql-odbc-owner@postgresql.org
Cc: pgsql-jdbc-owner@postgresql.org
Cc: pgsql-general-owner@postgresql.org
Cc: pgsql-admin-owner@postgresql.org
Subject: Fw: Postgres function call problems
Date: Tue, 2 Jul 2002 16:10:44 +0530
Message-ID: <01ac01c221b4$ebb93a90$1302a8c2@multicast.com> (raw)


----- Original Message ----- 
From: Sandeep Chibber 
To: barry@xythos.com 
Sent: Friday, May 31, 2002 10:50 AM
Subject: Postgres function call problems


Hi Barry,

I want to have function which will have a query which will accept a parameter from my application and on the basis of the parameter retreive a result set.

Normal call through SELECT gets me an number,i guess some kind of id. In the following function i get ouput as something like 168269272 .If there are three rows in the table then the value will be reapeated three times .I want the value and not an id
 
Table structure is

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') ;


Function body is as bellow

CREATE FUNCTION tester5(varchar, varchar) RETURNS SETOF ICDN_EVENTREG AS
'SELECT user_id,password,email,department,first_name,last_name,designation,type,status FROM    ICDN_EVENTREG        WHERE     ICDN_EVENTREG.USER_ID = $1 AND ICDN_EVENTREG.PASSWORD = $2 ' LANGUAGE 'sql';

I want to Know how
1. How to pass parameter to this function
2. How to call this application
3. In this function i am selecting all the fields , if i want to select only
two or three tuples,then how to go about it
4. If have idea about java bean then how to call his function from a Java
Bean.

Thanks for your prompt reply. You are saving me from lot of trouble.

Thanks again

Sandeep

Message-ID: <01ac01c221b4$ebb93a90$1302a8c2@multicast.com>
Permalink:  ../01ac01c221b4$ebb93a90$1302a8c2@multicast.com/
Also on:    postgresql.org/message-id/01ac01c221b4$ebb93a90$1302a8c2@multicast.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sandeep@vreach.net, pgsql-sql-owner@postgresql.org, pgsql-novice-owner@postgresql.org, pgsql-odbc-owner@postgresql.org, pgsql-jdbc-owner@postgresql.org, pgsql-general-owner@postgresql.org, pgsql-admin-owner@postgresql.org
  Subject: Re: Fw: Postgres function call problems
  In-Reply-To: <01ac01c221b4$ebb93a90$1302a8c2@multicast.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox