Re: How to create Function which retruns username and password - Mailing list pgsql-sql

From A. Kretschmer
Subject Re: How to create Function which retruns username and password
Date
Msg-id 20090902083339.GA31088@a-kretschmer.de
Whole thread Raw
In response to How to create Function which retruns username and password  (venkat <ven.tammineni@gmail.com>)
List pgsql-sql
In response to venkat :
> Dear All,
> 
>     I want to create function which returns username and password from the
> database.I have users table in the database.in that i have username and
> password columns.I need return username and password using functions.it is
> urgent. I am waiting for your great response,

test=# create table usernames (username text, passwort text);
CREATE TABLE
test=*# create or replace function get_usernames() returns setof usernames as $$ begin return query select username,
passwortfrom usernames; end;$$ language plpgsql;
 
CREATE FUNCTION
test=*# insert into usernames values ('user1', 'password1');
INSERT 0 1
test=*# insert into usernames values ('user2', 'password2');
INSERT 0 1
test=*# select * from get_usernames();username | passwort
----------+-----------user1    | password1user2    | password2
(2 rows)

HTH, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


pgsql-sql by date:

Previous
From: venkat
Date:
Subject: How to create Function which retruns username and password
Next
From: Gianvito Pio
Date:
Subject: Min and max element of an array column