Issue "ORA-01722: invalid number" error at many places has been created
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: 17开发者_开发问答22
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).
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:
where base.fid in (23, 42, 69)
Alas, what it actually generates is this:
where base.fid in ('23, 42, 69')
... which logically is the same as:
where base.fid = to_number('23, 42, 69')
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 :-)
精彩评论