我是SQL的新手,但当我将巡回演出的持续时间作为一个持续一个半小时的整数时,我一直在尝试制作这个表。然而,它一直显示为红色,并给出错误消息,即它是";缺少右括号";。我只教过如何使用整数,但不确定在这种情况下使用整数是否正确。
对于将要从该表中引用的表,它说没有什么可引用的,这是理所当然的,因为我还没有制作该表。但如果有人能帮助解决这个问题,我们将不胜感激!
create table qualification
( tour_id varchar2(8) not null
, guide varchar2(8) null
, date_passed date null
, primary key (tour_id, guide)
, foreign key (guide) references guide(guide_no)
, foreign key (tour_id) references tour(tour_id)
);
create table tour
( tour_id varchar2(8) primary key
, tour_name varchar2(20) not null
, duration_of_tour integer (180) null
, standard_cost integer (6,2) not null
);
Oracle的数据类型为NUMBER。
整数(n,m(在任何地方都不起作用
那么标准SQL将是DECIMAL(n,m(。
所以这句话对有效
create table tour
( tour_id varchar2(8) primary key
, tour_name varchar2(20) not null
, duration_of_tour number(38,0) null
, standard_cost number(6,2) not null
);
但巡回演出的持续时间可能太大了。
据我所知,不能定义具有with精度的整数类型的列。";int";或";整数";只是具有已定义精度的类型号的别名。我几乎可以肯定这是max allowed的别名;数字(38(";
所以,它要么是";整数";或";数字(x;
然而,如果您将col类型从integer(180(更新为number(180(,您将遇到另一个错误,因为number不能是180位长。
查看这份文档,也许你会在那里找到有用的