문제

I got the following sql:

create or replace type MEDIUM_TYPE AS OBJECT
(
me_movie REF MOVIE_TYPE,
me_rating varchar2(2),
me_runtime number(3,0),
me_release_year number(4,0),
me_list_price number(3,2),
me_our_price number(3,2),
me_availability varchar2(128),
me_aspect_ratio varchar2(8),
me_encoding number (1,0),
me_subtitle_language SUBTITLE_LANGUAGE_TYPE,
me_number_of_discs number (1,0)
)not final
/
create table DVD of MEDIUM_TYPE
object id system generated 
/

How can i make sure that me_movie in the dvd table is unique?

And also, how can i do something like this?

mo_release_year number(4,0) BETWEEN 1900 AND 2100,
도움이 되었습니까?

해결책

It's pretty much the same syntax as for relational tables:

create table DVD of MEDIUM_TYPE
   ( me_movie primary key )  
object id system generated 
/

The one problem you have is that you will run into this error:

ORA-02329: column of datatype REF cannot be unique or a primary key

Which admittedly is a bit of a showstopper. You will need to re-think your whole model. Sorry about that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top