用户shoppingdba ,,表空间为tpshopping,,,,
sqlplus /nolog
conn / as sysdba
1、create table shoppingdba.t_user(
uiid char(6) primary key,
uname varchar2(20) not null,
ubirthday date, ;
usex char(1 char) check(usex='女'OR usex='男'),
uaddress varchar2(50),
utelephone varchar2(20)
)tablespace tpshopping;
2、create table shoppingdba.t_type(
gtid char(6) primary key,
gtname varchar2(20) not null
)tablespace tpshopping;
3、create table shoppingdba.t_goods(
gid char(6) primary key,
gname varchar2(20) not null,
gtid varchar2(6),
gprice number(12,3) check( gtid>0),
gdiscount number(5,2) ,
gstocks number(7,2) check( gstocks >0),
gmaxstocks number(7,2) check( gmaxstocks>=0),
gminstocks number(7,2) check(gminstocks >=0),
foreign key(gtid) references shoppingdba.t_type(gtid)
)tablespace tpshopping;建第三个表的时候,,出现了错误:
第10行出现错误:
ORA-02438:列检查约束条件无法引用其他列
sqlplus /nolog
conn / as sysdba
1、create table shoppingdba.t_user(
uiid char(6) primary key,
uname varchar2(20) not null,
ubirthday date, ;
usex char(1 char) check(usex='女'OR usex='男'),
uaddress varchar2(50),
utelephone varchar2(20)
)tablespace tpshopping;
2、create table shoppingdba.t_type(
gtid char(6) primary key,
gtname varchar2(20) not null
)tablespace tpshopping;
3、create table shoppingdba.t_goods(
gid char(6) primary key,
gname varchar2(20) not null,
gtid varchar2(6),
gprice number(12,3) check( gtid>0),
gdiscount number(5,2) ,
gstocks number(7,2) check( gstocks >0),
gmaxstocks number(7,2) check( gmaxstocks>=0),
gminstocks number(7,2) check(gminstocks >=0),
foreign key(gtid) references shoppingdba.t_type(gtid)
)tablespace tpshopping;建第三个表的时候,,出现了错误:
第10行出现错误:
ORA-02438:列检查约束条件无法引用其他列
解决方案 »
- 语句报错,非法的零长度标识符
- 今天星期6 我要求上个月 几个星期6的平均值
- 求ORACLE资料抓取的问题
- SQL的效率问题
- 求oracle 8.1.7 for linux
- 怎么实现将oracle数据文件存放在网络存储上
- oracle9.0客户端连接oracle8.0数据库 exp时出错
- 我的机器Oracle9.0能安装成功,9.2版本就不行,点击setup.exe一点反应都没有啊,急求帮助!
- 想开始学oracle7i请问有什么好的电子书可下载
- 请问那位兄弟真正的试过,用ASP连接ORACLE后,是不是RECORDCOUNT,PAGECOUNT的属性都没有了
- Suse linux 11g sp1+Oracle 11 g R2+RAC的EM配置问题
- ORACLE-》EM按键显示为□□□□
gprice number(12,3) check( gprice>0),
gid char(6) primary key,
gname varchar2(20) not null,
gtid varchar2(6) check( gtid>0),
gprice number(12,3),
gdiscount number(5,2) ,
gstocks number(7,2) check( gstocks >0),
gmaxstocks number(7,2) check( gmaxstocks>=0),
gminstocks number(7,2) check(gminstocks >=0),
foreign key(gtid) references shoppingdba.t_type(gtid)
)tablespace tpshopping;
第10行出现错误:
ORA-02438:列检查约束条件无法引用其他列
3、 商品信息表(T_GOODS)
列名 中文名 数据类型 长度 约束 备注
GID 商品ID CHAR 6 主键
GNAME 商品名称 VARCHAR2 20 非空
GTID 类型ID VARCHAR2 6 外键参考商品类型表
GPRICE 商品标价 NUMBER 12,3 >0
GDISCOUNT 折扣 NUMBER 5,2
GSTOCKS 库存量 NUMBER 7,2 大于零
GMAXSTOCKS 最高库存量 NUMBER 7,2 大于等于零
GMINSTOCKS 最低库存量 NUMBER 7,2 大于等于零
GMEMO 商品备注 VARCHAR2 50
foreign key(gtid) references t_type(gtid)
改成
foreign key(gid) references t_type(gtid)