CREATE TABLE OT_PAY (
PAB_ITEM_ID CHAR(5 BYTE) NOT NULL,
HOLIDAY_MULTIPLIER NUMBER(4,2) NOT NULL,
CONSTRAINT OT_PAY_PK PRIMARY KEY(PAB_ITEM_ID),
CONSTRAINT OT_PAY_FK1
FOREIGN KEY(PAB_ITEM_ID)
REFERENCES OT_PAY(PAB_ITEM_ID),
CONSTRAINT HOLIDAY_MULTIPLIER CHECK (HOLIDAY_MULTIPLIER <='1.00' and >='3.50')
);
Error starting at line : 77 in command -
CREATE TABLE OT_PAY (
PAB_ITEM_ID CHAR(5 BYTE) NOT NULL,
HOLIDAY_MULTIPLIER NUMBER(4,2) NOT NULL,
CONSTRAINT OT_PAY_PK PRIMARY KEY(PAB_ITEM_ID),
CONSTRAINT OT_PAY_FK1
FOREIGN KEY(PAB_ITEM_ID)
REFERENCES OT_PAY(PAB_ITEM_ID),
CONSTRAINT HOLIDAY_MULTIPLIER CHECK (HOLIDAY_MULTIPLIER <='1.00' and >='3.50')
)
Error report -
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
答案 0 :(得分:4)
好的,检查有几个问题。
1 - 您不应将数字与字符串进行比较,以便
HOLIDAY_MULTIPLIER <='1.00' and >='3.50'
应该是:
HOLIDAY_MULTIPLIER <=1.00 and >=3.50
2 - Sintaxis错误,你不能以这种方式写条件,你需要:
HOLIDAY_MULTIPLIER <=1.00 and HOLIDAY_MULTIPLIER >=3.50
3 - 范围没有意义,因为HOLIDAY_MULTIPLIER
不能同时小于1且大于3.50,所以你需要反转<=
或使用{{ 1}}
OR
最后,您可以使用 HOLIDAY_MULTIPLIER >=1.00 and HOLIDAY_MULTIPLIER <=3.50
代替
between
答案 1 :(得分:2)
HOLIDAY_MULTIPLIER BETWEEN 1.00 and 3.50
=&gt; HOLIDAY_MULTIPLIER <='1.00' and >='3.50'
使用数字文字而不是字符串 - HOLIDAY_MULTIPLIER <='1.00' and HOLIDAY_MULTIPLIER >='3.50'