问题“ORA-01722:无效号码”很多地方都出现了错误
我在使用 Oracle 驱动程序的许多地方都收到错误“ORA-01722:无效编号”。您能指出解决方法/解决方案吗?
PDOException: SELECT base.fid AS fid, base.uid AS uid,
base.filename AS filename, base.uri AS uri, base.filemime AS filemime,
base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp
FROM {file_managed} base
WHERE (base.fid IN (:db_condition_placeholder_0))
(prepared: SELECT base.fid AS fid, base."UID" AS "UID",
base.filename AS filename, base.uri AS uri, base.filemime AS filemime,
base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp
FROM "FILE_MANAGED" base
WHERE (base.fid IN (:db_condition_placeholder_0))
)
e: SQLSTATE[HY000]: General error: 1722
OCIStmtExecute: ORA-01722: invalid number (ext\pdo_oci\oci_statement.c:146)
args: Array ( [:db_condition_placeholder_0] => )
in DrupalDefaultEntityController->load()
(line 196 of C:\xampp\htdocs\new\drupal\includes\entity.inc).
I am getting error "ORA-01722: invalid number" at many places with Oracle driver. Can you point out the workaround/solution?
PDOException: SELECT base.fid AS fid, base.uid AS uid,
base.filename AS filename, base.uri AS uri, base.filemime AS filemime,
base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp
FROM {file_managed} base
WHERE (base.fid IN (:db_condition_placeholder_0))
(prepared: SELECT base.fid AS fid, base."UID" AS "UID",
base.filename AS filename, base.uri AS uri, base.filemime AS filemime,
base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp
FROM "FILE_MANAGED" base
WHERE (base.fid IN (:db_condition_placeholder_0))
)
e: SQLSTATE[HY000]: General error: 1722
OCIStmtExecute: ORA-01722: invalid number (ext\pdo_oci\oci_statement.c:146)
args: Array ( [:db_condition_placeholder_0] => )
in DrupalDefaultEntityController->load()
(line 196 of C:\xampp\htdocs\new\drupal\includes\entity.inc).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有上下文,我们很难确定。但我处于猜测的状态,所以这里是:
base.fid
是一个数字列。在:db_condition_placeholder_0
中,您尝试传递一串标记,例如"23, 42, 69"
。现在您希望 SQL 引擎将其组合在一起以生成如下行:
唉,它实际生成的是:
... 逻辑上与以下内容相同:
显然,字符串不是有效数字因此出现了 ORA-1722。
现在你该怎么做是一件棘手的事情。有几种不同的方法,包括嵌套表或数组、管道函数和动态 SQL。哪一种最适合您取决于您的要求的详细信息。
另外,当然,我还是在猜测你的问题:-)
Without context, it is hard for us to be sure. But I'm in a guessing mood, so here goes:
base.fid
is a numeric column. In:db_condition_placeholder_0
you are attempt to pass a string of tokens such as"23, 42, 69"
.Now what you're hoping is that the SQL engine will munge that together to produce a line like this:
Alas, what it actually generates is this:
... which logically is the same as:
Obviously the string isn't a valid number and hence the ORA-1722.
Now what you do about it is a tricky matter. There are several different approaches, including nested tables or arrays, pipelined functions and dynamic SQL. Which one will suit you best depends on the details of your requirement.
Plus, of course, I'm guessing about your problem anyway :-)