From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to create Function which retruns username and password |
Date: | 2009-09-02 08:33:39 |
Message-ID: | 20090902083339.GA31088@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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, passwort from 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 | password1
user2 | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Gianvito Pio | 2009-09-02 10:58:08 | Min and max element of an array column |
Previous Message | venkat | 2009-09-02 08:05:23 | How to create Function which retruns username and password |