任何人都可以帮我解决 FIXME 吗?
-- Task: Get records with given rowid IN STRING from a table.
-- NOTICE: I do not known where the given rowid comes from.
-- OUTPUT 'AAAAB0AABAAAAOhAAA'
SELECT ROWID FROM DUAL;
-- OK, one record
SELECT * FROM DUAL WHERE ROWID IN ('AAAAB0AABAAAAOhAAA');
-- run with no errors, and no records
SELECT INFO_ID FROM TM_INFO_CATALOG WHERE ROWID IN (SELECT ROWID FROM DUAL);
-- ERROR: ORA-01410 invalid ROWID, WHY ?????????? (This is my sql statement)
SELECT INFO_ID FROM TM_INFO_CATALOG WHERE ROWID IN ('AAAAB0AABAAAAOhAAA'); -- FIXME
-- Question: How to check an rowid is exists in a table?
-- The following is my way:
-- FIRST, I need check whether the given rowid is from the table to query.
-- OK, but, low performance, as using function 'ROWIDTOCHAR()' (I think so.)
SELECT 1 FROM TM_INFO_CATALOG WHERE 'AAAAB0AABAAAAOhAAA' IN (SELECT ROWIDTOCHAR(ROWID) FROM TM_INFO_CATALOG);
-- ERROR: ORA-01410
SELECT 1 FROM TM_INFO_CATALOG WHERE 'AAAAB0AABAAAAOhAAA' IN (SELECT ROWID FROM TM_INFO_CATALOG);
-- THEN, select the record using the exist rowid
-- SELECT * from TM_INFO_CATALOG WHERE ROWID = %theGivenRowIdWhichExistInThisTable%
我想我需要强调一点:
如果 rowid 与给定的 rowid 匹配,我只想从表(例如 TABLE_A)中选择记录。
当所有给定的 rowid 都来自 TABLE_A(要查询的)时,就可以了。
但是,只要一个给定的 rowid 来自其他表(TABLE_B 或 DUAL,例如),就会出现“ORA-01410 invalid ROWID”。我想解决这个问题。
我希望有人可以运行第四个 SQL(或具有相同模式的另一个 SQL),然后给我你的解决方案。而且,第三条和第四条 SQL 语句除了一个是 SQLID 类型而另一个是 STRING 类型之外,有什么区别?如何解决第四个 SQL 的问题?