From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: How to create Function which retruns username and password
Date: Wed, 2 Sep 2009 10:33:39 +0200
Message-ID: <20090902083339.GA31088@a-kretschmer.de> (raw)
In-Reply-To: <79ad14900909020105n41de133es75b7a0457327e3ca@mail.gmail.com>
References: <79ad14900909020105n41de133es75b7a0457327e3ca@mail.gmail.com>
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
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: andreas.kretschmer@schollglas.com
Subject: Re: How to create Function which retruns username and password
In-Reply-To: <20090902083339.GA31088@a-kretschmer.de>
* 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