clear an array

From: James Neff <jneff(at)tethyshealth(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: clear an array
Date: 2006-12-16 05:09:45
Message-ID: 45837F99.1090700@tethyshealth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Greetings,

I have a multi-dimensional array (2 dimensions) within a FOR LOOP that I
want to reset for each iteration through the LOOP. The number of rows
in the first dimension of the array may change for each iteration
through the LOOP.

So basically I need to set the rows back to zero for both dimensions in
this array.

Database version is 8.2.0.

Something like:

CREATE OR REPLACE FUNCTION processdata(integer)
RETURNS varchar(99) AS
$BODY$

DECLARE

in_batch_id ALIAS FOR $1;

sp_parameters text[][];

sp_row_data customers%ROWTYPE;

sp_parameter_id text := '';
sp_parameter_value varchar(50) := '';

BEGIN

FOR sp_row_data IN SELECT * FROM customer_rules
WHERE filetypeid = in_batch_id LOOP

-- Get parameter id
sp_parameter_id := sp_row_data.ruleparameterid;

-- Get parameter source
sp_parameter_source := sp_row_data.parametersource;

-- populate array
sp_parameters := array_cat(sp_parameters,
array[sp_parameter_id, sp_parameter_value]);

-- do something with array

-- clear array
-- WHAT IS THE CODE HERE!?!?

END LOOP;

END;

$BODY$
LANGUAGE 'plpgsql' VOLATILE;

Thanks in advance,
James

Browse pgsql-novice by date

  From Date Subject
Next Message Greg Quinn 2006-12-16 17:11:56 Re: VB.NET web applications accessing PostgresSql through ODBC
Previous Message operationsengineer1 2006-12-16 00:46:24 Re: VB.NET web applications accessing PostgresSql through ODBC