<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<BR>hello and thanks for your usefull replay<BR><BR> <BR><BR>the following function goes through foo table rows and fetch it to a variable rowtype using cursor<BR><BR>i need to use the variable of one of the column to be pased to another function... if result is null i need to do insert and delete on tables if result is not null i need the function to continue loop through the rest of rows. untill the rows are finished.<BR><BR> <BR><BR>the function tw if it is not null it adds value to the table foo... how i can make the loop updated automaticlly so the function c5c will continue run untill the table foo is emptey <BR><BR> <BR><BR>Kind regards<BR><BR> <BR><BR>ihab<BR><BR> <BR><BR>CREATE OR REPLACE FUNCTION c5c()RETURNS boolean AS'<BR> <BR>declare<BR><BR>mycursor cursor for select *from foo;<BR><BR>pre foo%rowtype;<BR><BR>begin <BR>open mycursor; <BR>loop<BR>fetch mycursor into pre;<BR>exit when not found;<BR>if select from tw(pre.fooid) is null then<BR>insert into end(id) select id from foo where id=pre.fooid;<BR>delete from foo(id) select id from foo where id=pre.fooid;<BR>end if;<BR>end loop;<BR><BR>close mycursor;<BR>return true;<BR>end;<BR>' LANGUAGE 'plpgsql' <BR><BR><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>