I am trying to create a table in my data base with object publisher
defined as
create type publisher as object
( pname varchar(20),
branch varchar(20)
)
and then a book
object as
create type book as object(
title varchar(20),
pub_date date,
publisher publisher array[3],
keywordset varchar(20) multiset
)
and finally a table from book object as
create table Books of book
But, I am getting an error while creating object of book
as follows
Error at line 4: PLS-00103: Encountered the symbol "ARRAY" when expecting one of the following:
:= . ( ) , @ % not null range default external character
- title varchar(20),
- pub_date date,
- publisher publisher array[3],
- keywordset varchar(20) multiset
- )
Please help me resolve it.
You have to create an array sub type before using it. It should be outside the object. and i don't know why you are using MULTISET
in their.
You can create equivalent table using following code.
create type publisher as object
( pname varchar(20),
branch varchar(20)
)
create type t_publisher as varray(3) of publisher
create type book as object(
title varchar(20),
pub_date date,
publishr t_publisher,
keywordset varchar(20)
)
create table Books of book
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.