Re: Help with a very newbie question... - Mailing list pgsql-general

From Andre Schnoor
Subject Re: Help with a very newbie question...
Date
Msg-id 3836pcF5j9147U1@individual.net
Whole thread Raw
In response to Help with a very newbie question...  ("Cristian Prieto" <cristian@clickdiario.com>)
Responses Re: Help with a very newbie question...
List pgsql-general
>>>
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?
<<<



END IF; is missing after the ELSE statement. I often make this mistake too.

Andre



pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Catching internal error ID's to throw custom errors.
Next
From: Sean Davis
Date:
Subject: Re: Help with a very newbie question...