Re: Help with a very newbie question...

From: Jan Poslusny <pajout(at)gingerall(dot)cz>
To: Cristian Prieto <cristian(at)clickdiario(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help with a very newbie question...
Date: 2005-02-23 12:44:59
Message-ID: 421C7ACB.8090005@gingerall.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think that sql-functions may serve as parametrized views for you...

http://www.postgresql.org/docs/8.0/static/xfunc-sql.html

Cristian Prieto wrote:

> I want to create a view or a sp which returns NULL if nothing is found
> and a recordset if the user is found
>
> I wrote something like:
>
> CREATE sp_getuser(name, pass) RETURNS record AS
> $body$
> DECLARE
> retval RECORD;
> BEGIN
> SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass;
> IF NOT FOUND THEN
> RETURN NULL;
> ELSE
> RETURN retval;
> END;
> $body$
> LANGUAGE plpgsql;
>
> What is wrong with that function? I guess I could create it as a View
> but I don't know how to pass parameters in a view, somebody could help
> me with this?
>
> Thanks a lot!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kai Hessing 2005-02-23 13:43:25 Advanced SELECT
Previous Message Sean Davis 2005-02-23 12:06:31 Re: Help with a very newbie question...