Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 6F36E19670C4 for ; Sat, 11 Feb 2012 15:53:52 -0400 (AST) Received: from nm36-vm1.bullet.mail.ne1.yahoo.com ([98.138.229.113]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1RwJ14-0007Zq-NY for pgsql-sql@postgresql.org; Sat, 11 Feb 2012 19:53:52 +0000 Received: from [98.138.90.50] by nm36.bullet.mail.ne1.yahoo.com with NNFMP; 11 Feb 2012 19:53:37 -0000 Received: from [98.138.89.232] by tm3.bullet.mail.ne1.yahoo.com with NNFMP; 11 Feb 2012 19:53:37 -0000 Received: from [127.0.0.1] by omp1047.mail.ne1.yahoo.com with NNFMP; 11 Feb 2012 19:53:37 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 471329.46196.bm@omp1047.mail.ne1.yahoo.com Received: (qmail 57599 invoked by uid 60001); 11 Feb 2012 19:53:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1328990017; bh=mQZL2NpPkNZET8fXvNzlfO1vAZei3UK7j+tI7BlSQuQ=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=NgfU4+If9FLlmtn6vO8cBmzT3QRIl6CloSZfNP6uP9rCDL64L86obN2C6AOTTIQmDsw3ceWTbo5SYcSGtAcTOVJManGeojSGbCgE4p6X/5Hai38mmFxpBF551r9I3Lbrw37jxFNR744vmZIO4HBz2xwmIkQzN4a/eQTAjEwaUA8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=bPru5Nwz77xD2XhFt/dID/FOgCJEiiEi7iVg3LQxmwMguH5Z+898YiD3DeKY4vURVOAM4xMbeCS2vf6rt8TzDbJ2oK5hD80Pw7Z60yqcq+QDtMojCcR2rs1O9U6JkCu4FHDJnXnEEgPxzKC9v/cCVDH9YzIHbtDQE1PwmrdloFo=; X-YMail-OSG: 2fRj_isVM1lqquMoPajQy.2aFOYX8aUAmPEyIpGminuPtwX 0FFz3BkFz_UJRzCApTYL0SmhWm6TIBYOLxVNqwUAVyyZikHbYkvqtoasgMfE s9P.mLY8D9rdj6hiBWikYtLl9eaC3ClVxVofGMxpoklgJ0eUPcLPNWTubPmk MvWJyR.O16CgfezQ_blQoHVaZGCDAiZe1J9xgjTlH545VaIZ7pO09sr1.77. f5HLbvjDW4iLViFgHhabx9PKCGsb8rqwNQYWlLEDaPY0m7aqTAQ10.gd_fEQ hxxCjswHsMq8xGK7H_GZ1IajBMBUxDL9Z8j081pRhtk568FUpGlKfe7cGNy9 JfbsuXptVuqfbilxdlacaw7PErXXjFoFtOl2t5ye2iu11JxQS_W9kvOJ4nOD oY6mBgqPjTOKH6eUWxJ.EXG4j9vX2JQ9R35XeNALX98118JnbG1TwSA-- Received: from [119.152.50.191] by web121603.mail.ne1.yahoo.com via HTTP; Sat, 11 Feb 2012 11:53:37 PST X-Mailer: YahooMailWebService/0.8.116.338427 Message-ID: <1328990017.24868.YahooMailNeo@web121603.mail.ne1.yahoo.com> Date: Sat, 11 Feb 2012 11:53:37 -0800 (PST) From: Rehan Saleem Reply-To: Rehan Saleem Subject: Calling Postgresql Function to delete user data To: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1682663710-776680069-1328990017=:24868" X-Pg-Spam-Score: 0.0 (/) X-Archive-Number: 201202/38 X-Sequence-Number: 36331 ---1682663710-776680069-1328990017=:24868 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi ,=0AI have created this function to remove UserDataAccountid=0Afrom both= tables=0AUserAccountDetails and UserAC =0ACREATE OR REPLACE FUNCTION Delet= eUserData(ACDetailsID int[])=0ARETURNS void AS $$=0ADECLARE _id int;=0ABEGI= N=0A=A0 -- postgresql has no table type, use a int array instead=0A=A0 FOR = _id IN array_lower(ACDetailsID,1) .. array_upper(ACDetailsID,1)=0A=A0 LOOP= =0A=A0 =A0 =A0 DELETE FROM UserAccountDetails WHERE UserDataAcountId=3D=0A_= id;=0A=A0 =A0 =A0 DELETE FROM UserAC WHERE UserDataAcountId=3D _id;=0A=A0 = =A0 END;=0A=A0 END LOOP;=0A=A0 EXCEPTION WHEN OTHERS THEN=0A=A0 =A0 RAISE W= ARNING 'some issue %', SQLERRM;=0AEND;=0A$$ LANGUAGE plpgsql;=0A=A0=0ANow I= am calling this function to delete userdataacountid=0Afrom both tables, sa= y i have a user with userdataacountid '5', how can i delete=0Athis user by = calling this function , i have tried =0A=0Aselect DeleteUserData(5);=0Aand= =0Aselect * from DeleteUserData(5);=0A=0Aits not working ,=0Athanks ---1682663710-776680069-1328990017=:24868 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
= =0A=0A
Hi ,
=0A=0A
I have created this function to remove UserDataAccountid=0Afrom both tab= les
=0A=0A
UserAccountDetails and UserAC =0A=0A
CREATE OR REPLACE FUNCTION DeleteUserData(A= CDetailsID int[])
=0ARETURNS void AS $$
=0ADECLARE _id int;
=0ABEG= IN
=0A  -- postgresql has no table type, use a int array instead=0A  FOR _id IN array_lower(ACDetailsID,1) .. array_upper(ACDetailsID= ,1)
=0A  LOOP
=0A      DELETE FROM UserAccountDet= ails WHERE UserDataAcountId=3D=0A_id;
=0A      DELETE FRO= M UserAC WHERE UserDataAcountId=3D _id;
=0A    END;
=0A&nbs= p; END LOOP;
=0A  EXCEPTION WHEN OTHERS THEN
=0A    RA= ISE WARNING 'some issue %', SQLERRM;
=0AEND;
=0A$$ LANGUAGE plpgsql;<= /div>=0A=0A
 
=0A=0A
Now I am calling this function to delete userdataacountid=0Afrom both t= ables, say i have a user with userdataacountid '5', how can i delete=0Athis= user by calling this function , i have tried
=0A
=0Aselect DeleteUs= erData(5);
=0Aand
=0Aselect * from DeleteUserData(5);
=0A
=0Ait= s not working ,
=0Athanks
=0A=0A
---1682663710-776680069-1328990017=:24868--