Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> VARRAYs in Oracle 8.0.3
Hi,
I have a requirement of creating a table where for a given id, i have to either store three cost components (for a given qtr), or store 4 sets of such components (4 * 3 for a year). I'm looking at the possiblity of designing this table with a VARRAY column where each of the elements of VARRAY will store three cost components and the size of the VARRAY will be 4.
Is it possible to directly do a select against such a table and select the cost component values in such a form that it can be directly used by the front end - or will I be forced to use PL/SQL to parse the output of a select against this table to extract the values ?
Here's what I have done so far :
SQL> create or replace type cost_comps_typ as object (b_cost float, t_cost float, m_cost float); 2 /
Type created.
SQL> create or replace type cost_comps_vry_typ as VARRAY(4) of cost_comps_typ; 2 /
Type created.
SQL> create table plist_details (id number, cost cost_comps_vry_typ, ifactor1 float);
Table created.
SQL> desc plist_details
Name Null? Type
1 row created.
SQL> select p.cost from plist_details p;
*
ERROR at line 1:
ORA-00904: invalid column name
How do I get the values for the cost components in a form that I can directly use ? Also, will it be possible to use aggregate functions like SUM against these cost columns ?
Any examples will he very helpful.
Thanks,
Gunjeet Received on Wed Sep 16 1998 - 18:13:30 CDT