Hi experts,
I am new to PostgreSQL. Can anyone tell me how to create a FUNCTION in PostgreSQL that performs the same duty as the following MsSQL stored procedure?
**************************
**********
**********
**********
*
Create PROCEDURE AddEmployee
@Name NVARCHAR(255)
,@Title NVARCHAR(255)
,@strErr VARCHAR(255) OUTPUT
AS
BEGIN
/* ~~~ Add the employee into the Employees table ~~~ */
INSERT INTO Employees
( name
,title
)
VALUES
( @Name
,@Title
)
/* ~~~ Error checking ~~~ */
IF( @@rowcount = 0 )
BEGIN
SELECT @strErr = 'Errors adding the new employee.\n'
RETURN -1
END
/ * ~~
/* ~~~ Return the auto id through the OUTPUT parameter ~~~ */
SELECT @strErr = CONVERT(VARCHAR(255), @@IDENTITY)
RETURN 0
END
**************************
**********
**********
**********
*
Can you also tell me how to add a new language (if necessary) like pgsql into PostgreSQL?
Thanks a lot!
Start Free Trial