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