John Lee
John Lee

Reputation: 1

oracle pl/sql collection varray

I read a book about oracle pl/SQL. and in the book there is a section which is about how to use the collection, it has some code to introduce varray. and I typed it in my toad the same like the book, but when I compiled it, in line 16 it told me that "column not allowed here." so I am not sure what happened, can anyone help me, please?

create type first_name_t is varray (2) of varchar2(100);
create type child_name_t is varray (1) of varchar2(100);

create table family 
(
  surname varchar2(1000),
  parent_names first_name_t,
  children_name child_name_t
);

declare
 childen child_name_t := child_name_t ();
 parents first_name_t := first_name_t ();

begin
 parents.extend (2);
 parents (1) := 'abc';
 parents (2) := 'elssads';

 childen.extend ;
 childen(1) := 'fea';


 insert into family(surname, parent_names, childen_name )
            values ('Assurty', parents, children);
end;

Upvotes: 0

Views: 317

Answers (1)

Sanjay Radadiya
Sanjay Radadiya

Reputation: 1286

Try this insert statement

insert into family values ('Assurty', parents,childen);

Upvotes: 1

Related Questions