简体   繁体   中英

Oracle 11g creating table

hi i'm using oracle 11g to create a table with Object-Relational Features but its not creating the table for some reason

here what i have

create type Name as object (
  firstname varchar2(20),
  surname varchar2(20))
  final
create type Address as object (
  street varchar2(20),
  city varchar2(20),
  postal_code varchar2(8))
  not final

and for the table

create table people (
  (pname Name,
  paddress Address,
  dateOfBirth date);

yet its not creating the table, i know its probably something simple and straight forward but i just cant seam to get it to create the table, if somebody could point me in the right direction to get it to create the table that would be great

also when i try create the table i get the following error

 ORA-00904: "%s: invalid identifier"
 *Cause:
 *Action:
 Vendor code 904Error at line:2 colimn:2

You can try this:

CREATE TYPE Name as object (firstname varchar2(20), surname varchar2(20)) FINAL;

CREATE TYPE Address as object (street varchar2(20), city varchar2(20), postal_code varchar2(8)) NOT FINAL;

CREATE TABLE people (pname Name, paddress Address, dateOfBirth date);

DEMO

try this

create type Name as object (
firstname varchar2(20),
surname varchar2(20))
final );


create type Address as object (
street varchar2(20),
city varchar2(20),
postal_code varchar2(8))
not final);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM