----- Original Message ----- From: "Zitan Broth" <[EMAIL PROTECTED]>
To: "Michael Fuhr" <[EMAIL PROTECTED]>
Cc: <pgsql-general@postgresql.org>
Sent: Friday, April 01, 2005 9:00 PM
Subject: Re: [GENERAL] SELECT INTO Array?



Hi Michael,

Good question :-)

I am writing a function that has a row of data passed into it as variables
and an ID.  The function needs to pull out the appropriate row of data and
compare each data item which those passed in.  For each found difference a
log row is written somewhere else and if there are *any* differences the
whole row is updated.

I was building an array from the passed in parameters with ||, then I wanted
to build an array from a query (with SELECT INTO) and then compare each
value with a loop:


FOR i IN 1..17 LOOP
     -- compare current with new data
     if CurrentData[i] is not NewData[i] then
      ChangeFound := true;
      -- load change into log table

Make sense? Thanks again,

I think other folks hinted at this before, but you might consider using pl/perl or pl/python for this. Array support and manipulation is more advanced in these languages than in pl/pgsql, at least for manipulation within the function.




---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply via email to