pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dongsoo Yoon <dsyoon@metasoftworks.com>
To: pgsql-sql@postgresql.org
Subject: Error when using array variable
Date: Thu, 21 Jul 2005 18:29:29 +0900
Message-ID: <002101c58dd6$b1d8cb60$2d216b3d@notebook04> (raw)

 

I use a function using array variable as following.

The function returns array type.

When array variable is allocated with any value,
allocating is not done.

I can't find why it is.

-------------------------------------------------------

CREATE OR REPLACE FUNCTION arr_test()

RETURNS NUMERIC[] AS $BODY$

DECLARE

  v_count                    NUMERIC default 0;

  v_dayIndex              NUMERIC default 0;

  t_modifiedTimes       NUMERIC[];

  v_testval                   NUMERIC default 0;

  ....

BEGIN 

....



   for v_count in 1..5 loop

      v_dayIndex := v_dayIndex + 1;

      t_modifiedTimes[v_dayIndex ] := v_count;

     

      v_testval   :=  t_modifiedTimes[v_dayIndex ] ;    -------------->¹è¿­¿¡ ÀúÀåµÈ °ª ÀÓ½ÃÀúÀå

      raise exception 'ÀÓÀÇ¿¡·¯»ý¼º  t_modifiedTimes[v_dayIndex ]=',  v_testval  ;

                                                                           -------------->°­Á¦ÀûÀ¸·Î exception ¹ß»ý½ÃÅ´

    end loop; 

   ....

   return t_modifiedTimes;



END; 
$BODY$ LANGUAGE plpgsql; 


view thread (6+ messages)  latest in thread

Message-ID: <002101c58dd6$b1d8cb60$2d216b3d@notebook04>
Permalink:  ../002101c58dd6$b1d8cb60$2d216b3d@notebook04/
Also on:    postgresql.org/message-id/002101c58dd6$b1d8cb60$2d216b3d@notebook04

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dsyoon@metasoftworks.com
  Subject: Re: Error when using array variable
  In-Reply-To: <002101c58dd6$b1d8cb60$2d216b3d@notebook04>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox