pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is there a type like a growable array, similar Vector at Java language in postgreSQL?
2+ messages / 2 participants
[nested] [flat]

* Is there a type like a growable array, similar Vector at Java language in postgreSQL?
@ 2005-07-22 06:30  Dongsoo Yoon <dsyoon@metasoftworks.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Dongsoo Yoon @ 2005-07-22 06:30 UTC (permalink / raw)
  To: pgsql-sql


In Oracle, there is a type like a growable array, similar Vector at Java language.

In postgreSQL, is there any type like bellow type?


---------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE test(
   p_size       in  number
  ,p_proccode  out varchar2
  ,p_procmesg  out varchar2
)
IS

  v_count                 number default 0;
  v_dayIndex              number default 0;
  v_size                  number default 0;
  
  type tb_NumTable is table of number(2) index by binary_integer;------------>like a growable array
  t_modifiedTimes tb_NumTable;----------------------------------------------->declare a variable using above defined type.
 
  ....

BEGIN 

....

  v_size := nvl(p_size, 0);

  for v_count in 1..v_size loop

     v_dayIndex := v_dayIndex + 1;

     t_modifiedTimes[v_dayIndex ] := v_count;


   end loop; 

  ....
 
  p_proccode := 0;
  p_procmesg := 'OK';
      
EXCEPTION
 
  WHEN OTHERS THEN
    p_proccode := SQLCODE;
    p_procmesg := SUBSTR(SQLERRM, 1, 255);

end test;

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Is there a type like a growable array, similar Vector at
@ 2005-07-23 09:46  Richard Huxton <dev@archonet.com>
  parent: Dongsoo Yoon <dsyoon@metasoftworks.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2005-07-23 09:46 UTC (permalink / raw)
  To: Dongsoo Yoon <dsyoon@metasoftworks.com>; +Cc: pgsql-sql

Dongsoo Yoon wrote:
> In Oracle, there is a type like a growable array, similar Vector at
> Java language.


I always find the manuals good for this information. Looking in the
section on "Arrays", in "Data Types"

BEGIN QUOTE
A stored array value can be enlarged by assigning to an element adjacent
to those already present, or by assigning to a slice that is adjacent to
or overlaps the data already present. For example, if array myarray
currently has 4 elements, it will have five elements after an update
that assigns to myarray[5]. Currently, enlargement in this fashion is
only allowed for one-dimensional arrays, not multidimensional arrays.
END QUOTE

Is that helpful?
-- 
  Richard Huxton
  Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-07-23 09:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-22 06:30 Is there a type like a growable array, similar Vector at Java language in postgreSQL? Dongsoo Yoon <dsyoon@metasoftworks.com>
2005-07-23 09:46 ` Re: Is there a type like a growable array, similar Vector at Richard Huxton <dev@archonet.com>

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