Oracle 10gR2 触发器错误
我有 Oracle 10gR2。我正在尝试创建自动增量触发器。 这是示例:
CREATE SEQUENCE TEST_SEQ
INCREMENT BY 1
START WITH 1
NOMAXVALUE
/
CREATE TABLE TESTER (
ID_TESTER INTEGER NOT NULL,
VAL VARCHAR2(20) NOT NULL
)
/
CREATE OR REPLACE TRIGGER TIB_TESTER BEFORE INSERT
ON TESTER FOR EACH ROW
BEGIN
SELECT TEST_SEQ.NEXTVAL
INTO :NEW.ID_TESTER
FROM DUAL;
END;
/
触发器创建给出警告:
警告:ORA-24344:成功 编译错误
当我得到错误值时:
select OCI_SUCCESS_WITH_INFO;
/
它给出错误:
错误:ORA-00923:FROM 关键字不存在 找到了预期的地方
I have Oracle 10gR2. I am trying to create autoincrement trigger.
Here is the sample:
CREATE SEQUENCE TEST_SEQ
INCREMENT BY 1
START WITH 1
NOMAXVALUE
/
CREATE TABLE TESTER (
ID_TESTER INTEGER NOT NULL,
VAL VARCHAR2(20) NOT NULL
)
/
CREATE OR REPLACE TRIGGER TIB_TESTER BEFORE INSERT
ON TESTER FOR EACH ROW
BEGIN
SELECT TEST_SEQ.NEXTVAL
INTO :NEW.ID_TESTER
FROM DUAL;
END;
/
Trigger creation gives warning:
warning : ORA-24344: success with
compilation error
And when I get error value:
select OCI_SUCCESS_WITH_INFO;
/
It gives error:
error : ORA-00923: FROM keyword not
found where expected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用什么客户端来发出这些命令? ORA-24344 是一个特殊错误。
在 SQL*PLus 中,我们可以获得更多有关编译错误的信息,如下所示:
至于 ORA-00923 错误,那是因为在 Oracle 版本的 SQL 中,我们总是必须从表中进行选择。所以你应该执行
我不确定这有多大意义,但至少你不会得到错误。
这并不让我感到惊讶,因为我针对我的数据库运行了你的代码并且它构建得很顺利。
What client are you using to issue these commands? ORA-24344 is a perculiar error.
In SQL*PLus we can get more information about compilation errors like this:
As for the ORA-00923 error, that is because in Oracle's version of SQL we always have to select from a table. So you should execute
I'm not sure how much sense that makes, but at least you won't get the error.
That doesn't surprise me, as I ran your code against my database and it built without a hitch.
也许这对某人有用:
如果您使用 Oracle 10g 和 OCI 驱动程序,ORA-24344 会显示触发器何时在代码中包含回车符 (\r),例如。文件是使用 Windows 行尾样式创建的。
Maybe it will be useful for somebody:
If you are using Oracle 10g and OCI driver, ORA-24344 shows when trigger have carriage return sign (\r) in code eg. file was created with Windows end of line style.