Home » SQL & PL/SQL » SQL & PL/SQL » TYPE VARRAY - Insert
TYPE VARRAY - Insert [message #195741] Mon, 02 October 2006 01:52 Go to next message
Hine
Messages: 16
Registered: October 2006
Junior Member
I'm useing the VARRAY types:
Like:
DECLARE
-- In the varray, we put an upper limit on the number of elements.
TYPE Colors IS VARRAY(10) OF VARCHAR2(16);
rainbow Colors;
BEGIN
-- Since COLORS is declared as VARRAY(10), we can put up to 10 elements in the constructor.
rainbow := Colors('Red','Orange','Yellow','Green','Blue','Indigo','Violet');
END;
/

I would like to instert into varray type gradually.

- 3 data first, like 'Red','Orange','Yellow'
- 2 data second, like 'Green','Blue'
- ....

How can I insert into Varray TYPE gradually and not only ones!

Regards!

Hine
Re: TYPE VARRAY - Insert [message #195750 is a reply to message #195741] Mon, 02 October 2006 02:19 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
There's no way of doing that built into Pl/Sql that I know of.
The nearest thing I cn think of is EXTEND. When used with the syntax
collection.extend(n,i)
it will append n copied of the i'th element to the end of the collection.

It would be a fairly trivial excercise to write a function that would do this for you - you'd just need a function that took two collections and returned one of the same type, and that simply went through the second collection 1 row at a time and appended its data to the first.
Previous Topic: unlock table in oracle 8i sqlplus urgent
Next Topic: optimisation prob
Goto Forum:
  


Current Time: Sat Dec 10 16:36:30 CST 2016

Total time taken to generate the page: 0.09323 seconds