MS-SQL Store Procedure to Postgresql Function

From: Rehan Saleem <pk_rehan(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: MS-SQL Store Procedure to Postgresql Function
Date: 2012-01-30 06:42:51
Message-ID: 1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi , how i can convert this store procedure to PostgreSQL function, especially I really dont know how to set type to readonly in PostgreSQL.
thanks

ALTERPROCEDURE [dbo].[sp_DeleteUserData]
      @ACDetailsID dbo.ACdetailsID_type READONLY
     
AS
 
DECLARE(at)ID int
begintry
begintransaction
 
 DECLARE c_ACDetailsID CURSOR FOR SELECT id FROM @ACDetailsID
 OPEN c_ACDetailsID
 FETCH NEXT FROM c_ACDetailsID INTO @ID
 WHILE (@@FETCH_STATUS = 0) BEGIN
 
      delete from UserAccountDetails  where UserDataAcountId=(at)ID
      delete from UserAC where UserDataAcountId=(at)ID
     
 FETCH NEXT FROM c_ACDetailsID INTO @ID
End--end of while loop      
 
committransaction     
CLOSEc_ACDetailsID
DEALLOCATEc_ACDetailsID
endtry
 
begincatch
      rollback transaction;
      print error_message(

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Anson Abraham 2012-01-30 15:00:14 querying a column w/ timestamp with timezone datatype
Previous Message Lew 2012-01-27 19:04:25 Re: Query question