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'