添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Hi Experts.
Such an error (ORA-01741 illegal zero-length identifier) is raised when I execute a dynamic statement with EXECUTE IMMEDIATE. The statement is:
INSERT INTO "T_CRES" ("ID", "VERSION#")
SELECT "ID", "VERSION"
FROM "T_CDET"
MINUS
SELECT "ID", "VERSION"
FROM "T_CDET"
INNER JOIN "T_CRES"
USING("ID")
WHERE "T_CDET"."VERSION" = "T_CRES"."VERSION#"
This SQL statement is collected from many substrings with concatenation operator ||.
When I explore the final_string, which is to be EXECUTEd IMMEDIATE next step, with raise_application_error(-2 0101, final_string), quite functional SQL statement is returned in error message. Moreover, I can copy and paste it into TOAD and execute well! But for EXECUTE IMMEDIATE it's not good.
By the way, when I try to remove quotes from "T_CRES" in INSERT INTO "T_CRES", I get another strange error "ORA-00928: missing SELECT keyword". Worth no mentioning, in TOAD it executes just fine either...
Thank you for your ideas. With best regards - Koala
Is this what your variable has or what you believe it has? That is did you cut and paste this from an inspection of the content of the statement before execute
immediate was called?
Avatar of Koala
Koala

ASKER

Exactly. This is the error message, raised in result of code "raise_application_error(- 20101, final_string)"
Avatar of Koala
Koala

ASKER

Hi Experts.
I found the problem, it was related to application logic outside the PL/SQL routine. There I fell into loop, and first pass brought correct substrings (that's why raise_application_error(.. .) returned functional statement), and the second pass brought empty values (that's why the error occured ORA-01741). After the error occured, the transaction was automatically rolled back, and I had no chance to see that rows are already inserted after first pass, and to catch unexpected second pass in this way.
Thank you for thinking about. Now please stop, as long as I found the problem myself, so the points will not assigned.
Avatar of Koala
Koala

ASKER

2 MODERATOR:
Please do not assign points for this question, as long as noone made even a guess before I found problem myself.
Thanks
Avatar of Koala
Koala

ASKER

2 MODERATOR:
Please do not assign points for this question, as long as noone made even a guess before I found problem myself.
Thanks
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ/Refund - The author has found and pasted the solution
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!