From: | Kémeri Lajos <lkemeri(at)metalogic(dot)hu> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Stored Procedure |
Date: | 2001-05-28 06:43:17 |
Message-ID: | 001f01c0e741$7a357c70$0e010101@lajos |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)metalogic(dot)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'
From | Date | Subject | |
---|---|---|---|
Next Message | Kémeri Lajos | 2001-05-28 06:47:08 | FOR SELECT |
Previous Message | Per-Olof Pettersson | 2001-05-28 06:32:06 | Re: COPY with default values? |