在插入语句中将错误记录到错误表中
我在错误表中遇到错误表中的错误无效标识符,即使错误表中的字段存在。以下是我的测试代码以供您参考。任何更新都非常感谢。
Insert into test1
(a,b,e)
Select a,b,c||d e from
(Select c.a, d.b, d.c, c.d
From
(select e.a,e.b, f.c, d.d from
Test2 e, Test 2 f where
e.id = f.id) c ) v
Log errors into test1_err
(‘Batch :’
|| to_char(v.a)
|| to_char(v.b)
|| ‘;’
) Reject Limit Unlimited;
SQL错误:ORA:-00904:“ VA”:Invalid Suntentifier
I came across an error invalid identifier in the error table even though the fields are present in the error table. The below is my test code for your reference. Any update absolutely appreciated.
Insert into test1
(a,b,e)
Select a,b,c||d e from
(Select c.a, d.b, d.c, c.d
From
(select e.a,e.b, f.c, d.d from
Test2 e, Test 2 f where
e.id = f.id) c ) v
Log errors into test1_err
(‘Batch :’
|| to_char(v.a)
|| to_char(v.b)
|| ‘;’
) Reject Limit Unlimited;
SQL Error: ORA:-00904: "v.a": invalid indentifier
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您使用dbms_errlog软件包创建了表,则放入'()'中的表达式可以包含以下内容,按 doc
:
/21/sqlrf/insert.html#guid-903f8043-0254-4ee9-acc1-cb8ac0af3423“ rel = “ 可以在错误记录表中从此语句中识别错误。该表达式可以是文字文字,数字文字或一般SQL表达式,例如绑定变量。如果将函数表达式转换为文本文字,也可以使用函数表达式,例如to_char(sysdate)。
因此,您不能放置列值。这些是由内核添加到表中的,无需自己添加它们。
Supposing you created the table with the dbms_errlog package, the expression you put in the '()' can contain the following as per the doc:
simple_expression
Specify the value to be used as a statement tag, so that you can identify the errors from this statement in the error logging table. The expression can be either a text literal, a number literal, or a general SQL expression such as a bind variable. You can also use a function expression if you convert it to a text literal — for example, TO_CHAR(SYSDATE).
so you cannot put column values. These are added to the table by the kernel, no need to add them yourself.