SELECT COUNT (*)
FROM rps2_workflow
WHERE workflow_added > TO_DATE ( 01.09.2011 , dd.mm.yyyy )
AND workflow_finished < TO_DATE ( wtf , dd.mm.yyyy )
AND workflow_status IN (7, 12, 17)
AND workflow_worker = 159
由于日期无效,我预计这一询问会失败,但结果为零。
查询计划显示,第8步,无效条款is。 处理:
8 TABLE ACCESS BY INDEX ROWID TABLE RPS2.RPS2_WORKFLOW Object Instance: 1 Filter Predicates: ("WORKFLOW_STATUS"=7 OR "WORKFLOW_STATUS"=12 OR "WORKFLOW_STATUS"=17) AND SYS_EXTRACT_UTC("WORKFLOW_FINISHED")<SYS_EXTRACT_UTC(TO_DATE( wtf , dd.mm.yyyy )) Cost: 11 Bytes: 33 Cardinality: 1 CPU Cost: 8 M IO Cost: 10 Time: 1
如果我们在<代码>AND workflow_status IN(7、12、17)的条件下发表评论,那么预期我们会收到ORA-01858:发现非数字性质,届时会发现有数字
。
If we comment out AND workflow_finished < TO_DATE ( wtf , dd.mm.yyyy )
then we get amount of records that fit that conditions (> 0)
如何做到这一点?
www.un.org/Depts/DGACM/index_spanish.htm
The hint /*+no_index(rps2_workflow) */
doesn t change anything (whereas in the plan we see that fullscan is performed)
SELECT STATEMENT ALL_ROWSCost: 254 Bytes: 31 Cardinality: 1 CPU Cost: 34 M IO Cost: 248 Time: 4
2 SORT AGGREGATE Bytes: 31 Cardinality: 1
1 TABLE ACCESS FULL TABLE RPS2.RPS2_WORKFLOW Object Instance: 1 Filter Predicates: "WORKFLOW_WORKER"=159 AND ("WORKFLOW_STATUS"=7 OR "WORKFLOW_STATUS"=12 OR "WORKFLOW_STATUS"=17) AND SYS_EXTRACT_UTC("WORKFLOW_ADDED")>SYS_EXTRACT_UTC(TIMESTAMP 2011-09-01 00:00:00 ) AND SYS_EXTRACT_UTC("WORKFLOW_FINISHED")<SYS_EXTRACT_UTC(TO_DATE( wtf , dd.mm.yyyy )) Cost: 254 Bytes: 31 Cardinality: 1 CPU Cost: 34 M IO Cost: 248 Time: 4