0

I have a series of tables and objects I have defined. I have an object nested table that I am trying to insert values into. The values are in the form of a variable array but I don't know how to insert them. my tables and code are as follows.

Table wu.classes

crn number(5)     
department varchar2(8)  
title carchar2(25)  

Table wu.students

student_id char(11)  
name varchar2(10)  
dept varchar2(8)  
advisor varchar(10)  

classes wu.classes_va  

wu.classes_va varray(5) of number (5)  


create type classes_ty as object(crn varchar2(5),department varchar2(8), coursetitle varchar2(25)  
  
create table classes_ot of classes_ty;  
  
insert into classes_ot select crn,department,title from wu.classes;  
  
create or replace type classes_ref_ty as table of ref classes_ty;  
  
create table student_plus(student# varchar2(11),student_name varchar2(10),major varchar2(8), advisor (10), enrolled classes_ref_ty) nested table enrolled store as classes_ref_ty_tab;  

Problem here (I need to loop through to fill the table but I just need to know how to do it for one values and i can figure the rest out):

begin  
insert into student_plus values('700-123-948','Hooker','CS','VanScoy',classes_ref_ty();  
  
insert into table(select enrolled from student_plus where student#='700-123-948')  
select ref(c) from classes_ot c where ???    
end;   
/  

I don't know how to access the variable array and use it with the classes_ref_ty.

Community
  • 1
  • 1

0 Answers0