Newbie question: How to CREATE FUNCTION
От | Steven Chau |
---|---|
Тема | Newbie question: How to CREATE FUNCTION |
Дата | |
Msg-id | 00b501c31a86$6a6a3130$4706050a@stevenc обсуждение исходный текст |
Ответы |
Re: Newbie question: How to CREATE FUNCTION
Re: Newbie question: How to CREATE FUNCTION |
Список | pgsql-sql |
Hi, I am new to PostgreSQL. So, please forgive my ignorane. 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? Pointers to learning pgsql will also be appreciated. Thanks a lot in advance! Steven
В списке pgsql-sql по дате отправления: