Stored Procedure - Mailing list pgsql-general

From Kémeri Lajos
Subject Stored Procedure
Date
Msg-id 001f01c0e741$7a357c70$0e010101@lajos
Whole thread Raw
List pgsql-general
Hi!
I send an example in Interbase, what I would like to do in PostgreSQL:
Please help me, how to do it!
Thank You

Lewis
lkemeri@metalogic.hu

In the Interbase there is this STORED PROCEDURE:

CREATE PROCEDURE LOGIN (
  USER_NAME VARCHAR(16),
  PASSWORD VARCHAR(8)
) RETURNS (
  ID INTEGER,
  FULL_NAME VARCHAR(255),
  LAST_LOGIN DATE
) AS
DECLARE VARIABLE FELFUGGESZTVE INTEGER;
BEGIN
  SELECT ID, FULL_NAME, LAST_LOGIN FROM names
    WHERE UPPER(USER_NAME)=UPPER(:USER_NAME) and
          UPPER(PASSWORD)=UPPER(:PASSWORD)
    INTO ID, FULL_NAME, LAST_LOGIN;
  SUSPEND;
  IF (ID IS NOT NULL) THEN UPDATE names SET LAST_LOGIN = "NOW" WHERE id=:ID;
END;

And I call it: select * from LOGIN ('username', 'password');
Result: 1, 'Lewis'


pgsql-general by date:

Previous
From: Pruner Jan
Date:
Subject: RE: Re: Replace MSSQL by PostgreSQL ?
Next
From: Kémeri Lajos
Date:
Subject: FOR SELECT