缺少括号
这是我正在运行的脚本
DROP SEQUENCE S_JobStatus;
CREATE SEQUENCE S_JobStatus
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOMINVALUE
;
--
-- TABLE: JobStatus
--
DROP TABLE JobStatus;
CREATE TABLE JobStatus(
Id NUMBER(10, 0) NOT NULL,
ShortName NUMBER(10, 0) NOT NULL,
Description NUMBER(10, 0) NOT NULL,
CONSTRAINT PK_JobStatus PRIMARY KEY (Id)
)
;
/* DROP TRIGGER JobStatus_SequenceTrigger; */
CREATE TRIGGER JobStatus_SequenceTrigger
BEFORE INSERT
ON JobStatus
FOR EACH ROW
WHEN new.Id IS NULL
BEGIN
SELECT S_JobStatus.nextval into :new.Id from dual
END;
这是 Oracle SQL Developer 中的输出
DROP SEQUENCE S_JobStatus succeeded.
CREATE SEQUENCE succeeded.
DROP TABLE JobStatus succeeded.
CREATE TABLE succeeded.
Error starting at line 22 in command:
CREATE TRIGGER JobStatus_SequenceTrigger
BEFORE INSERT
ON JobStatus
FOR EACH ROW
WHEN new.Id IS NULL
BEGIN
SELECT S_JobStatus.nextval into :new.Id from dual
END;
Error report:
ORA-00906: missing left parenthesis
00906. 00000 - "missing left parenthesis"
*Cause:
*Action:
我在哪里缺少括号?
Here is the script I am running
DROP SEQUENCE S_JobStatus;
CREATE SEQUENCE S_JobStatus
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOMINVALUE
;
--
-- TABLE: JobStatus
--
DROP TABLE JobStatus;
CREATE TABLE JobStatus(
Id NUMBER(10, 0) NOT NULL,
ShortName NUMBER(10, 0) NOT NULL,
Description NUMBER(10, 0) NOT NULL,
CONSTRAINT PK_JobStatus PRIMARY KEY (Id)
)
;
/* DROP TRIGGER JobStatus_SequenceTrigger; */
CREATE TRIGGER JobStatus_SequenceTrigger
BEFORE INSERT
ON JobStatus
FOR EACH ROW
WHEN new.Id IS NULL
BEGIN
SELECT S_JobStatus.nextval into :new.Id from dual
END;
Here is the output in Oracle SQL Developer
DROP SEQUENCE S_JobStatus succeeded.
CREATE SEQUENCE succeeded.
DROP TABLE JobStatus succeeded.
CREATE TABLE succeeded.
Error starting at line 22 in command:
CREATE TRIGGER JobStatus_SequenceTrigger
BEFORE INSERT
ON JobStatus
FOR EACH ROW
WHEN new.Id IS NULL
BEGIN
SELECT S_JobStatus.nextval into :new.Id from dual
END;
Error report:
ORA-00906: missing left parenthesis
00906. 00000 - "missing left parenthesis"
*Cause:
*Action:
Where am I missing the parenthesis?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的触发条件需要括号。
创建触发器语法:
http://download.oracle。 com/docs/cd/B12037_01/server.101/b10759/statements_7004.htm
I think that your trigger condition needs parentheses.
Create trigger syntax:
http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/statements_7004.htm