Reputation: 15
I wrote this as creating an Object but keeps giving me errors PLS-00103:
create or replace type employee_ty (
2 emp_num number (10) primary key,
3 name varchar (15),
4 address varchar (15)) not final;
5 /
Upvotes: 0
Views: 33
Reputation: 191275
You said you're creating an object but you haven't included the as object
part of the syntax; you also can't declare an object attribute directly as a primary key:
create or replace type employee_ty as object (
emp_num number (10),
name varchar (15),
address varchar (15)
)
not final
/
You can then create an object table and declare the primary key as part of that:
create table employees of employee_ty (primary key (emp_num));
db<>fiddle showing constraint violation being thrown.
Upvotes: 1