pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rehan Saleem <pk_rehan@yahoo.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: MS-SQL Store Procedure to Postgresql Function
Date: Sun, 29 Jan 2012 22:42:51 -0800 (PST)
Message-ID: <1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com> (raw)

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@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=@ID 
      delete from UserAC where UserDataAcountId=@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(

view thread (4+ messages)  latest in thread

Message-ID: <1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com>
Permalink:  ../1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com/
Also on:    postgresql.org/message-id/1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pk_rehan@yahoo.com
  Subject: Re: MS-SQL Store Procedure to Postgresql Function
  In-Reply-To: <1327905771.73991.YahooMailNeo@web121606.mail.ne1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox