Same Query returning different result (Different execution plan)
Hi all,
To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
The query :
SELECT *
FROM schema.table@database a
WHERE column1 IN ('3')
AND column2 = '101'
AND EXISTS
(SELECT null
FROM schema.table2 c
WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
Rows Row Source Operation
0 NESTED LOOPS (cr=31 r=0 w=0 time=4894659 us)
4323 SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
4336 TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
0 REMOTE (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
Rows Row Source Operation
3702 HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
22556 REMOTE (cr=0 r=0 w=0 time=401176 us)
4336 TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
It'is a bug or i have missed somthing ?
PS: The two table are no subject to insert or update statement.
Oracle version : 9.2.0.2.0
System version : HP-UX v1
Thanks.
H.Mahmoud wrote:
Oracle version : 9.2.0.2.0
System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version)
Similar Messages
-
Same query returns differenent result sets in oracle 9i and 10g
Could anyone please clarify the issue i am having on a query. I have query that is returning around 2000 records in oracle db 9.2.0.8.0, at the same time with same data if run on 10.2.0.1.0 is returning only 12 records.
what might be the reason for this descrepancy, is something in 9i is considered differently in 10g?
Here is the query.
SELECT
0
,ot_req_head.rh_sys_id
,ot_req_head.rh_comp_code
,ot_req_head.rh_txn_code
,ot_req_head.rh_no
,ot_req_head.rh_appr_uid
,'Action to be taken' action
,ot_req_head.rh_appr_dt
,NULL AUTH_TO_UID
,NULL
,NULL
,NULL from_remarks
,NULL
,NULL
,'REQ'
,ot_req_head.rh_amd_no
,ot_req_head.rh_amd_dt
,ot_req_head.rh_cr_uid
,DECODE(ot_req_head.rh_charge_area_num,6,ot_req_head.rh_locn_code,1,ot_req_head.rh_charge_code,NULL)
,ot_req_head.rh_cr_dt
,NULL
FROM
orioni.om_txn_setup,
orioni.ot_req_head,
iscoit.isco_txn_auth,
SELECT DISTINCT rh_sys_id
FROM orioni.pending_mr
)pending_mr
WHERE
ot_req_head.rh_txn_code=txns_txn_code
AND
auth_comp_code(+)=ot_req_head.rh_comp_code
AND
auth_action_to_type(+) IS NULL
AND
auth_head_sys_id(+)=ot_req_head.rh_sys_id
AND
auth_txn_code(+)=ot_req_head.rh_txn_code
AND
ot_req_head.rh_clo_status IS NULL
AND
ot_req_head.rh_comp_code='001'
AND
txns_txnp_code='PURREQ'
AND
txns_values='N'
AND
ot_req_head.rh_appr_status=3
AND
ot_req_head.rh_sys_id = pending_mr.rh_sys_id
AND NOT EXISTS
SELECT 'X'
FROM
iscoit.isco_txn_auth A
WHERE
a.auth_head_sys_id = isco_txn_auth.auth_head_sys_id
AND
a.auth_action_from_uid = ot_req_head.rh_appr_uid
AND
a.auth_action_from_type = 'Action to be taken'
AND
a.auth_action_from_dt = ot_req_head.rh_appr_dt
AND
NVL(a.auth_txn_amend_no,0) = NVL(ot_req_head.rh_amd_no,0)
AND
a.auth_action_to_type = 'REJECT'
AND
ot_req_head.rh_cr_dt > TO_DATE('16-MAR-2008','DD-MON-YYYY')
Edited by: unus on Oct 19, 2009 3:56 AM
Edited by: unus on Oct 19, 2009 4:18 AMHere's what I got on 9i and 10G:
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> CREATE TABLE T_1(VAL1 NUMBER,VAL2 VARCHAR2(10));
Table created.
SQL> CREATE TABLE T_2(VAL1 NUMBER,VAL2 VARCHAR2(10));
Table created.
SQL> INSERT INTO T_1 VALUES(1,'FIRST');
1 row created.
SQL> INSERT INTO T_1 VALUES(2,'SECOND');
1 row created.
SQL> INSERT INTO T_2 VALUES(1,'FIRST');
1 row created.
SQL> INSERT INTO T_2 VALUES(2,'SECOND');
1 row created.
SQL> INSERT INTO T_1 VALUES(3,'THIRD');
1 row created.
SQL> INSERT INTO T_1 VALUES(4,'FOURTH');
1 row created.
SQL> INSERT INTO T_1 VALUES(5,'FIFTH');
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1;
VAL1 VAL1
1 1
2 2
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1(+);
VAL1 VAL1
1 1
2 2
3
4
5
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1(+)
4 AND
5 NOT EXISTS (SELECT 'X' FROM t_2 C WHERE c.val1=b.val1);
VAL1 VAL1
3
4
5
SQL> select name, value from v$parameter where name like '%optimizer%' or name like '%cursor_sharing
NAME VALUE
cursor_sharing EXACT
optimizer_features_enable 9.2.0
optimizer_mode CHOOSE
optimizer_max_permutations 2000
optimizer_index_cost_adj 100
optimizer_index_caching 0
optimizer_dynamic_sampling 1
-- 10G
Verbonden met:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1;
VAL1 VAL1
1 1
2 2
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1(+);
VAL1 VAL1
1 1
2 2
5
4
3
SQL> SELECT A.VAL1,B.VAL1 FROM
2 T_1 A,T_2 B
3 WHERE A.VAL1=B.VAL1(+)
4 AND
5 NOT EXISTS (SELECT 'X' FROM t_2 C WHERE c.val1=b.val1);
VAL1 VAL1
3
4
5( Please use the tag before and after your example, so we're sure we're looking at your complete example ) -
Execute the same query twice, get two different results
I have a query that returns two different results:
Oracle Version : 10.2.0.1.0
I am running the following query on the Oracle server in SQL*Plus Worksheet.
SELECT COUNT(*)
FROM AEJOURNAL_S1
WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
AND DESC2 LIKE '%'
AND DESC1 LIKE '%'
AND DESC2 LIKE '%'
AND ETYPE LIKE '%'
AND MODULE LIKE '%'
AND LEVELL = '11-WARNING'
ORDER BY ORDD DESC;
The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
This query runs against a view. The view does a transpose of data from a table.
Below is the view AEJOURNAL_S1
SELECT
CHAR_TIME,
CHAR_INST,
BATCH_ID,
MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
FROM CHAR_BATCH_DATA
WHERE subbatch_id = 1774
GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
Thanks for looking,
Danuser2188367 wrote:
I have a query that returns two different results:
Oracle Version : 10.2.0.1.0
I am running the following query on the Oracle server in SQL*Plus Worksheet.
SELECT COUNT(*)
FROM AEJOURNAL_S1
WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
AND DESC2 LIKE '%'
AND DESC1 LIKE '%'
AND DESC2 LIKE '%'
AND ETYPE LIKE '%'
AND MODULE LIKE '%'
AND LEVELL = '11-WARNING'
ORDER BY ORDD DESC;
The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
This query runs against a view. The view does a transpose of data from a table.
Below is the view AEJOURNAL_S1
SELECT
CHAR_TIME,
CHAR_INST,
BATCH_ID,
MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
FROM CHAR_BATCH_DATA
WHERE subbatch_id = 1774
GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
Thanks for looking,
DanIn fact you the first time you ran the query the data has been retrived from disk to memory , in the second time the data is already in memory so the respnse time should be faster ,but if you chagne any condition or column or letter case the optimizer will do the first step (data will be retrived from disk to memory ) -
Query returning zero results for yesterdays same hour
I have the following query:
SELECT
d_dtm,
BTS_ID,
CASE WHEN D_DTM = (D_DTM-24/24)
THEN sum(V_ATT_CNT)
END AS "LASTATT",
sum(V_ATT_CNT) as "V_ATT_CNT",
CASE WHEN D_DTM = D_DTM
THEN sum(V_ATT_CNT)
END AS "ATT"
FROM
DMSN.DS3R_FH_1XRTT_FA_LVL_KPI
WHERE
to_date(D_DTM, 'DD/MM/yyyy') >= (SELECT TO_DATE(max(D_DTM),'DD/MM/YYYY') FROM DMSN.DS3R_FH_1XRTT_FA_LVL_KPI)-2
GROUP BY
d_dtm,
BTS_ID
having
CASE WHEN D_DTM = (D_DTM-24/24)
THEN sum(V_ATT_CNT)
END > 0
But it is not returning any results because of the "having" clause. I know it should return results because all I want it to do is in one column have the V_ATT for the current time period, and in the 2nd column, have the V_ATT 24 hours ago. I've checked the data and I should get results back but can't seem to figure out why this is not working...
Edited by: k1ng87 on Apr 22, 2013 1:03 PMHi,
k1ng87 wrote:
I have the following query:
SELECT
d_dtm,
BTS_ID,
CASE WHEN D_DTM = (D_DTM-24/24)
THEN sum(V_ATT_CNT)
END AS "LASTATT",
...You may have noticed that this site normally doesn't display multiple spaces in a row.
Whenever you post formatted text (including, but not limited to, code) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
That's just one of many useful things found in the forum FAQ {message:id=9360002}
But it is not returning any results because of the "having" clause. You're right:HAVING CASE
WHEN d_dtm = (d_dtm - 24/24)
THEN SUM (v_att_cnt)
END > 0
Whatever d_dtm is, it's not d_dtm - 24/24, so the WHEN condition will never be TRUE. That means the CASE expression will always return NULL, and NULL is not greater than 0, so the HAVING condition will never be TRUE.
k1ng87 wrote:
confused on what I'm missing here...I'm using version 11g, not sure if that matters for this ? though....There is no version 11f or 11h, so it's kind of silly to say you're using 11g. Why not give your actual version number, like 11.2.0.2.0? Sometimes, the part after 11 makes a huge difference.
But probably not in this case, as you said. What's more important is for you to post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that sample data.
No kidding; see the forum FAQ {message:id=9360002}. -
Simple query returns wrong results in Sql 2012
On my Windows 8 box running Sql 2012 11.0.3128, this query returns an IncludeCount of 0 and an ExcludeCount of 1.
On my Windows 7 box running Sql 2008 10.50.2550 this query returns an IncludeCount of 3 and an ExcludeCount of 1, which is correct.
In short, it runs properly on these versions of OS and Sql's:
Windows 2008 R2 + Sql 10.50.2550
Windows 2008 R2 + Sql 10.50.4000
Windows 2012 SP1 + Sql 11.0.3000
Windows 7 + Sql 11.0.2100
And gives incorrect results on these OS's and Sql's (so far, tested):
Windows 8 Enterprise + Sql 11.0.3128
Windows 2008 R2 + Sql 10.50.2550
I wondered if anyone else can reproduce this? I can't figure out the magic combination of OS and SQL version this breaks on.
In all scenarios, the resulting @filters table is populated correctly, and the [Include] column is properly set to a 1 or a 0, so why aren't the other variables being properly set?
If I change the [ID] column to NONCLUSTERED, it works fine, too. It doesn't matter if @filters is a TVP or a temp table or an actual table, same (incorrect) results in each case.
DECLARE @filters TABLE([ID] bigint PRIMARY KEY, [Include] bit)
DECLARE @excludecount int = 0
DECLARE @includecount int = 0
DECLARE @id bigint
INSERT INTO @filters ([ID])
VALUES (1), (3), (4), (-7)
UPDATE @filters SET
@id = [ID],
@includecount = @includecount + (CASE WHEN @id > 0 THEN 1 ELSE 0 END),
@excludecount = @excludecount + (CASE WHEN @id < 0 THEN 1 ELSE 0 END),
[Include] = CASE WHEN @id > 0 THEN 1 ELSE 0 END,
[ID] = ABS(@id)
SELECT @includecount as IncludeCount, @excludecount as ExcludeCount
SELECT * FROM @filtersWhat part is undocumented?
http://technet.microsoft.com/en-us/library/ms177523.aspx
The above link states I can update variables inside an UPDATE statement ...
But it does not say what the correct result of what you are trying to would be. Variable assignment in UPDATE only makes sense if the UPDATE hits one row. If the UPDATE matches several rows, which value you the variable is set to is not defined.
It gets even more complicated when you have the variable on both sides of the expression. But I'd say that the only two values that makes as the final value of @includecount 0. An UPDATE statement, like other DML statements in SQL, is logically defined
as all-at-once. There are no intermediate results. Therefore the only possible values are the initial value of @includecount plus the value of the CASE statement, which always should returns 0, since @id is NULL when the UPDATE statement starts to execute.
I'm afraid that what you have is nonsense from a language perspective, and the result is undefined. Whenever you get different results from a query depending on whether you have certain indexes in place, you know that the query is indeterministic. There
are certainly part of SQL that are indeterministic, for instance ORDER BY on a non-unique columns. But in this particular case you have also wandered out into the land that is also undefined.
I'm not sure what you are trying to achieve, but I can only advice you to go back to the drawing board.
Erland Sommarskog, SQL Server MVP, [email protected] -
Query returning unexpected results.
Hi,
One of our query which use to run successfully is suddenly failing in one of the environment. Oracle Version: 11.2.0.2.0. Can someone please suggest me why the query is not behaving as expected and works fine when using hint?
The below query doesn't return any rows.
select ctran.* from f_transaction_released tran, F_CHARGE_CODE_RELEASED CTRAN where
id_liability_cif in ('727873','141515') and TRAN.ID_TRANSACTION_RELEASED = CTRAN.ID_TRANSACTION_RELEASED The same query with hint return rows.
select /*+ optimizer_features_enable('9.2.0.8') */ ctran.* from f_transaction_released tran, F_CHARGE_CODE_RELEASED CTRAN where
id_liability_cif in ('727873','141515') and TRAN.ID_TRANSACTION_RELEASED = CTRAN.ID_TRANSACTION_RELEASED Explain plan of both the queries are:
1st Query:
Plan hash value: 196119809
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 750 | 96000 | 551 (1)| 00:00:07 | | | | | |
| 1 | PX COORDINATOR | | | | | | | | | | |
| 2 | PX SEND QC (RANDOM) | :TQ10001 | 750 | 96000 | 551 (1)| 00:00:07 | | | Q1,01 | P->S | QC (RAND) |
|* 3 | HASH JOIN | | 750 | 96000 | 551 (1)| 00:00:07 | | | Q1,01 | PCWP | |
| 4 | BUFFER SORT | | | | | | | | Q1,01 | PCWC | |
| 5 | PX RECEIVE | | 444 | 5328 | 330 (0)| 00:00:04 | | | Q1,01 | PCWP | |
| 6 | PX SEND BROADCAST | :TQ10000 | 444 | 5328 | 330 (0)| 00:00:04 | | | | S->P | BROADCAST |
| 7 | PARTITION RANGE ALL | | 444 | 5328 | 330 (0)| 00:00:04 | 1 | 96 | | | |
| 8 | INLIST ITERATOR | | | | | | | | | | |
| 9 | TABLE ACCESS BY LOCAL INDEX ROWID| F_TRANSACTION_RELEASED | 444 | 5328 | 330 (0)| 00:00:04 | 1 | 96 | | | |
| 10 | BITMAP CONVERSION TO ROWIDS | | | | | | | | | | |
|* 11 | BITMAP INDEX SINGLE VALUE | F_TRANSACTION_RELEASE_BMX9 | | | | | 1 | 96 | | | |
| 12 | PX BLOCK ITERATOR | | 7579K| 838M| 219 (1)| 00:00:03 | 1 | 3 | Q1,01 | PCWC | |
|* 13 | TABLE ACCESS FULL | F_CHARGE_CODE_RELEASED | 7579K| 838M| 219 (1)| 00:00:03 | 1 | 3 | Q1,01 | PCWP | |
Predicate Information (identified by operation id):
3 - access("TRAN"."ID_TRANSACTION_RELEASED"="CTRAN"."ID_TRANSACTION_RELEASED")
11 - access("ID_LIABILITY_CIF"=141515 OR "ID_LIABILITY_CIF"=727873)
13 - filter(SYS_OP_BLOOM_FILTER(:BF0000,"CTRAN"."ID_TRANSACTION_RELEASED"))2nd query:
Plan hash value: 4037684686
| Id | Operation | Name | Rows | Bytes | Cost | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 2 | 256 | 299 | | | | | |
| 1 | PX COORDINATOR | | | | | | | | | |
| 2 | PX SEND QC (RANDOM) | :TQ10002 | 2 | 256 | 299 | | | Q1,02 | P->S | QC (RAND) |
|* 3 | HASH JOIN BUFFERED | | 2 | 256 | 299 | | | Q1,02 | PCWP | |
| 4 | BUFFER SORT | | | | | | | Q1,02 | PCWC | |
| 5 | PX RECEIVE | | 1 | 12 | 203 | | | Q1,02 | PCWP | |
| 6 | PX SEND HASH | :TQ10000 | 1 | 12 | 203 | | | | S->P | HASH |
| 7 | PARTITION RANGE ALL | | 1 | 12 | 203 | 1 | 96 | | | |
| 8 | INLIST ITERATOR | | | | | | | | | |
| 9 | TABLE ACCESS BY LOCAL INDEX ROWID| F_TRANSACTION_RELEASED | 1 | 12 | 203 | 1 | 96 | | | |
| 10 | BITMAP CONVERSION TO ROWIDS | | | | | | | | | |
|* 11 | BITMAP INDEX SINGLE VALUE | F_TRANSACTION_RELEASE_BMX9 | | | | 1 | 96 | | | |
| 12 | PX RECEIVE | | 7579K| 838M| 96 | | | Q1,02 | PCWP | |
| 13 | PX SEND HASH | :TQ10001 | 7579K| 838M| 96 | | | Q1,01 | P->P | HASH |
| 14 | PX BLOCK ITERATOR | | 7579K| 838M| 96 | 1 | 3 | Q1,01 | PCWC | |
| 15 | TABLE ACCESS FULL | F_CHARGE_CODE_RELEASED | 7579K| 838M| 96 | 1 | 3 | Q1,01 | PCWP | |
Predicate Information (identified by operation id):
3 - access("TRAN"."ID_TRANSACTION_RELEASED"="CTRAN"."ID_TRANSACTION_RELEASED")
11 - access("ID_LIABILITY_CIF"=141515 OR "ID_LIABILITY_CIF"=727873)
Note
- cpu costing is off (consider enabling it)Hence my questions, which you didn't address:
1) It might very well be a bug, did you check MetaLink/MyOracleSupport already?
I didn't check that yet'Suddenly failing' is often a synonym for 'something has changed'.
2)Are you absolutely sure nothing has changed?
Nothing has changed unless some stats or index got corrupted which we are assuming.3)What made you decide to use that hint anyway?
We read somewhere there is a bug with Oracle 11G hash joins and trying with 9i does help. 4)And are the tables 'normal, ordinary tables' or does the F_ prefix indicate something special?
It's fact tablesAnd to add another one:
5) Did you or your DBA noticed strange errors or messages in the alert.log?
Have to check on that. -
Different result different node
THrer are two weblogic nodes.both are giving different results for same jsp change after restarting both
let me know how to solve through weblogic console adminHi
Can you tell more details like what is difference in the jsp. Do you mean the contents in the JSP like some data that comes from backend. Or the JSP itself like the ui elements not refreshed etc.
If so, there may be some caching stuff involved for your issue. Stop all the servers in all the nodes. Go to each server and delete folders named cache, tmp. Restart the servers and redeploy the code.
Unfortunately this is the only clean and gaurantee way to clear any cache, tmp files. You can do them from admin console or when servers are up and running.
Thanks
Ravi Jegga -
Hi,
I installed Oracle Express Edition 10g in my system.
I ran a very simple query:
Select * from person where status = 100
where status is NUMBER(9) NOT NULL but it does not returning any result.
Any Idea? Is this because of Express Edition version?
Thank You.You've been asked twice to show us a copy/paste of a query which you've not done.
Fire up SQLPlus, run the command asked of you, and copy and then paste the results into a post (enclosing it in the tags to preserve formatting).
It's much easier to help you when you try and help us by following along with suggestions. -
Query returning wrong result set
I am running the following query on 8.1.7 database. The query is
SELECT Y.*, TEVStatus.lEndStatusFlag ENDSTATUSFLAG
FROM
(SELECT ROWNUM RANK, X.* FROM (SELECT lExceptionID ID,
TEVException.sMonitorName MONNAME, sExcpStatus STATUS
FROM TEVException WHERE (TEVException.lExceptionID IN
(SELECT lExceptionID FROM TEVException WHERE
sUserName_AssignedTo = 'vadmin')) ORDER BY
TEVException.lExceptionID DESC) X)
Y, TEVStatus WHERE (Y.RANK > 0 AND Y.RANK < 0 + 51 + 1) AND
(STATUS = TEVStatus.sStatusName);
The result is
RANK ID MONNAME STATUS ENDSTATUSFLAG
51 29 Type09B Open 0
50 30 Type09A Open 0
49 31 Type09E Open 0
48 32 Type09F Open 0
47 33 Type09G Open 0
46 34 Type09I Open 0
45 35 Type09C Open 0
44 36 Type10A Open 0
43 37 Type04A Open 0
39 41 Type08A Open 0
38 42 Type08C Open 0
RANK ID MONNAME STATUS ENDSTATUSFLAG
37 43 Type10B Open 0
36 44 Type10E Open 0
35 45 Type10C Open 0
34 46 Type10F Open 0
33 47 Type10D Open 0
32 48 Type08B Open 0
31 49 Type04B Open 0
29 51 Type08D Open 0
28 52 Type11E Open 0
27 53 Type11A Open 0
26 54 Type11D Open 0
RANK ID MONNAME STATUS ENDSTATUSFLAG
25 55 Type11C Open 0
24 56 Type11B Open 0
23 57 Type12A Open 0
22 58 Type12B Open 0
21 59 Type12C Open 0
20 60 Type12E Open 0
19 61 Type12A Open 0
18 62 Type12B Open 0
17 63 Type12E Open 0
16 64 Type12C Open 0
15 65 Type12D Open 0
RANK ID MONNAME STATUS ENDSTATUSFLAG
14 66 Type12D Open 0
4 80 Type01A_Ravi Open 0
3 83 Type01A_Ravi Open 0
2 84 Type01A_Ravi Open 0
1 87 Type01A_Ravi Open 0
42 38 Type06E Closed 8500
41 39 Type06A Closed 8500
40 40 Type06B Closed 8500
30 50 Type06C Closed 8500
13 68 Type01A Closed 8500
12 69 Type01A Closed 8500
RANK ID MONNAME STATUS ENDSTATUSFLAG
11 70 Type01A Closed 8500
10 71 Type01A Closed 8500
9 72 Type01A Closed 8500
8 73 Type01A Closed 8500
7 75 Type01A Closed 8500
6 77 Type01A Closed 8500
5 78 Type01A Closed 8500
51 rows selected.
In the above result, the RANK is not sorted properly and I
expected ID in descending order. The table which I was querying
had only about 100 records. I ran the same query on a larger
record set and the result is fine. I get ID in descending order
which I was expecting.
Could someone please tell me whether any bug in this case or
something wrong in the queryHi...
Took a quick look at tour SQL and....
SELECT Y.*
, TEVStatus.lEndStatusFlag ENDSTATUSFLAG
FROM ( SELECT ROWNUM RANK
, X.*
FROM ( SELECT lExceptionID ID
, TEVException.sMonitorName MONNAME
, sExcpStatus STATUS
FROM TEVException
WHERE ( TEVException.lExceptionID IN
( SELECT lExceptionID
FROM TEVException
WHERE sUserName_AssignedTo
= 'vadmin'
ORDER BY TEVException.lExceptionID DESC
) X
) Y
, TEVStat us
WHERE ( Y.RANK > 0
AND
Y.RANK < 0 + 51 + 1
AND STATUS = TEVStatus.sStatusName ;
Should "FROM ( SELECT ROWNUM RANK" be "FROM ( SELECT ROWNUM,
RANK"?
RANK is a reserved word, an analytic function.
Is "ORDER BY TEVException.lExceptionID DESC" doing anything? I
would drop it..
Hope this helps. Good Luck. -
CAML Query returning no result
I have this CAML query running fine on my local dev machine, but on live production machine, it returns zero result.
<Where>
<And>
<Geq><FieldRef Name='Created' /><Value Type='DateTime'>[Today-60Day(s)]</Value></Geq>
<And>
<Contains><FieldRef Name='Author' /><Value Type='User'>Phil Smith</Value></Contains>
<And>
<IsNotNull><FieldRef Name='Customer' /></IsNotNull>
<Or>
<IsNotNull><FieldRef Name='_x0031_Quantity' /></IsNotNull>
<Or>
<IsNotNull><FieldRef Name='_x0032_Quantity' /></IsNotNull>
<Or>
<IsNotNull><FieldRef Name='_x0033_Quantity' /></IsNotNull>
<IsNotNull><FieldRef Name='_x0034_Quantity' /></IsNotNull>
</Or>
</Or>
</Or>
</And>
</And>
</And>
</Where>
I even run it in CAML Query builder on Live machine and it does return result, but it's just in code, it's not returning anything. The code is as follow:
spQuery.Query = String.Format("<Where>" +
"<And>" +
"<Geq>" +
"<FieldRef Name='Created' />" +
"<Value Type='DateTime'>[Today-60Day(s)]</Value>" +
"</Geq>" +
"<And>" +
"<Contains>" +
"<FieldRef Name='Author' />" +
"<Value Type='User'>{0}</Value>" +
"</Contains> " +
"<And>" +
"<IsNotNull><FieldRef Name='Customer' /></IsNotNull>" +
"<Or>" +
"<IsNotNull><FieldRef Name='_x0031_Quantity' /></IsNotNull>" +
"<Or>" +
"<IsNotNull><FieldRef Name='_x0032_Quantity' /></IsNotNull>" +
"<Or>" +
"<IsNotNull><FieldRef Name='_x0033_Quantity' /></IsNotNull>" +
"<IsNotNull><FieldRef Name='_x0034_Quantity' /></IsNotNull>" +
"</Or>" +
"</Or>" +
"</Or>" +
"</And>" +
"</And>" +
"</And>" +
"</Where>", myWeb.CurrentUser.Name);
SPListItemCollection result = oPriceList.GetItems(spQuery);
if (result.Count > 0)Instead of "<Value Type='DateTime'>[Today-60Day(s)]</Value>", Could you try with the following:
<Value Type='DateTime'><Today OffsetDays="-60"/></Value>"
Also,
it is better to debug the code and see the value of caml string during runtime (rather than seeing the values in caml buider).
Thanks Arut -
Same query returning different result set
hi all,
i am using db 10g.
i have a query like below
SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
FROM EMP_INC_HEADER,EMP_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
AND EIH_EFF_DATE = EIH_EFF_DATE
AND EIH_STATUS = 'P'
AND EID_EMP_CODE = '003848'
GROUP BY EID_INCR_CODE,EIH_EFF_DATE
ORDER BY EID_INCR_CODE,EIH_EFF_DATE;which is leading to the output
AMT EID_INCR_CODE EIH_EFF_D
2000 BASIC 21-SEP-10
2000 BASIC 23-SEP-10
2000 BASIC 15-OCT-10
2000 BASIC 21-OCT-10
1200 HTRAN 21-SEP-10
1200 HTRAN 23-SEP-10
1200 HTRAN 15-OCT-10
1200 HTRAN 21-OCT-10
800 OTHERS 21-SEP-10
800 OTHERS 23-SEP-10
800 OTHERS 15-OCT-10
800 OTHERS 21-OCT-10i have query
SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EID_EFF_DATE
FROM EMP_INC_HEADER,EMP_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
AND EIH_EFF_DATE = EID_EFF_DATE
AND EIH_STATUS = 'P'
AND EID_EMP_CODE = '003848'
GROUP BY EID_INCR_CODE,EID_EFF_DATE
ORDER BY EID_INCR_CODE,EID_EFF_DATE;
leading to
AMT EID_INCR_CODE EID_EFF_D
500 BASIC 21-SEP-10
500 BASIC 23-SEP-10
500 BASIC 15-OCT-10
500 BASIC 21-OCT-10
300 HTRAN 21-SEP-10
300 HTRAN 23-SEP-10
300 HTRAN 15-OCT-10
300 HTRAN 21-OCT-10
200 OTHERS 21-SEP-10
200 OTHERS 23-SEP-10
200 OTHERS 15-OCT-10
200 OTHERS 21-OCT-10
12 rows selected.what second query is returning is correct. as per the table.
but my question what is the difference between my first and second query.
in what way it is different(i am not getting any idea).
if any one is having any clue please share with me.
Thanks..what is the difference between my first and second queryLook like there's no difference.
I think you really meant something like
SELECT SUM(EID_AMOUNT) amt,EID_INCR_CODE,EIH_EFF_DATE
FROM EMP_INC_HEADER EIH,
EMP_INC_DETAILS EID
WHERE EIH.EMP_CODE = EID.EMP_CODE
AND EIH.EFF_DATE = EIH.EFF_DATE
AND EIH.STATUS = 'P'
AND EID.EMP_CODE = '003848'
GROUP BY EID.INCR_CODE,EIH.EFF_DATE
ORDER BY EID.INCR_CODE,EIH.EFF_DATERegards
Etbin -
SSIS query returns no results - same query in SQL management studio works
Hello,
I'm running a very simple join to get a result set:
SELECT dbo.sap_contracts.svc_id, dbo.sap_contracts.svc_code, dbo.sap_contracts.quantity, dbo.sap_contracts.start_date, dbo.sap_contracts.end_date
FROM dbo.sap_contracts
INNER JOIN dbo.contracts
ON dbo.contracts.contract_id=dbo.sap_contracts.contract_id
where customer_name='XXXXXXXXX'
When I run this in SQL management studio it works fine and returns the list of existing "SAP contracts" in the DB (to compare to the customer's contracts actually in SAP).
In SSIS (SQL 2012) I'm using an Execute SQL task to run this query and putting the full results set into a variable of type "object". I've done very similar things before and it worked fine. With this query in SSIS I get no results at all. Changing
the variable type to "string" throws an error showing that the type being written to the variable is "DBNull" - so it seems that the query in SSIS returns no records, when in SQL management studio I get the 15 records that should be returned.
Does anyone have any ideas of what could be wrong?
Cheers
MarkThere are several connections to the DB in tasks before this one, and the task after this is a whole load of C# in a script task doing SOAP communications to the SAP ERP system to compare the result set from this SQL with the contracts in SAP ERP for the
specific customer.
Input variables are all correct (I've checked them about 15 times now with breakpoints on just about every task in the whole package) and I'm at the point of having to test everything in an attempt to see exactly what query is being sent to the SQL server
and anything else I can do to see why nothing comes back. There is a almost complete lack of debugging tools in SSIS which doesn't make life any easier (something I've heard quite a few times in various forums).
I'm tearing my hair out on this for half a day now and it's not funny any more, so apologies if I come across as a little frustrated.
Cheers
Mark -
Query returning inconsistent result at each execution
Hi All,
Does any 1 have an idea?.I have 2 tables with more than 60 lac records.In a query i have to inner join the 2 tables and there is a where clause.
select dsp.col2, s.col3
from table1 dsp inner join table2 s
on dsp.col1=s.col1
where dsp.col2='30-Jan-2009'
The query output used to work earlier but nowadays it seems the where clause is not working.The o/p is varied resultset.What is your Oracle version?
It is working - (Off course in a small environment i've tested it. ;) )
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.00
satyaki>
satyaki>ed
Wrote file afiedt.buf
1 select e.ename, d.loc
2 from emp e inner join dept d
3 on ( e.deptno = d.deptno)
4* where e.hiredate < sysdate
satyaki>/
ENAME LOC
WARD
MARTIN
SCOTT NY
KING KOLKATA
TURNER
ADAMS NY
JAMES
FORD NY
MILLER KOLKATA
Smith KOLKATA
Glen KOLKATA
11 rows selected.
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>Regards.
Satyaki De. -
Union_all query returns wrong results
I have 6 individual queries that combine together using "union_all". If I run it, it returns 6084 records, see example 1.
Example 1:
sql1
union_all
sql2
unionl_all
sql3
sql6;
if I do it this way, example2, I get only 3821 records. Is there a bug in Oracle 11g? I select everything from 6084 records, I should get them all, correct?
Example 2:
select * from
sql1
union_all
sql2
unionl_all
sql3
sql6
note that I use "union_all" because the computer does not take it without the underscore.user557594 wrote:
Your queries do not deal with thousand of rows. My queries worked ok before the upgrade to 11g. I just want to know if there is a bug related to union all in 11g.If you believe that you are encountering a bug, you really should be posting this over on Metalink (My Oracle Support). When you do, you'll want to specify at a minimum the 4 digit Oracle version you are using (11g could mean either of two major releases and a few different patchsets).
I'm sure if you search My Oracle Support, you'll find at least one bug in whatever version of 11g you're using that occurs when UNION ALL is used (though I'll wager that you need two or three other conditions to be true as well). If you open a ticket, however, Oracle Support can determine whether you are actually encountering an error and/or whether you've encountered any of the published bugs, an unpublished bug, or a new bug. Once you know that, Oracle Support may or may not have a patch for you.
Unfortunately, if you can't post a test case that would allow us to reproduce the problem locally, it's going to be hard for us to provide much assistance. Of course, Oracle Support will also need a reproducible test case, but they can probably help you work through the process of putting one together complete with sample data and a query plan.
Justin -
Simple Query returns no result
We have a problem with a simple query on a "old" Table in our Database. The Table has following Structure:
CREATE TABLE <table_name>
ROLE_ID INTEGER NOT NULL,
ROLE_NAME VARCHAR (99) ascii NOT NULL,
OBJECTDATA LONG BYTE,
UNIQUE (ROLE_NAME)
The table containts two rows and following querys get these results:
select role_id, role_name from <schema>.<table_name>
--> 2 rows
select role_id, role_name from <schema>.<table_name>
order by role_id
--> 2 rows
select role_id, role_name from <schema>.<table_name>
order by role_name
--> 0 rows ?? confusion
When we create a "new" table with the same structure, and insert the same content to this new table, the queries are working correctly.
What happened with our "old" table, so that these simple queries don't function anymore?
(Database Kernel 7.6.05 Build 009-123-191-997)
thx
gerri
Edited by: Gerfried on Jul 17, 2009 11:42 AMOk, Gerfried send me the dump file and this is what was in it:
INV ROOT/LEAF 15857 perm entries : 0 [block 0]
bottom : 81 filevers: dummy convvers: 9
writecnt: 1
00001 nodepage.pno: 15857 nodepage.pt : data
00006 nodepage.pt2: inv nodepage.chk: checksumData
00008 nodepage.mde: empty
08181 nd_checksum : 61937 nodepge2.pno: 15857
08189 nodepge2.pt : data nodepge2.pt2: inv
08191 nodepge2.chk: checksumData
08192 nodepge2.mde: empty
00009 nd_bottom : 81 nd_rec_cnt : 0
00017 nd_level : 0
00019 nd_filestate: empty
00020 nd_sorted : false nd_root : 15857/F13D0000
00025 nd_right : nil_pno nd_left : nil_pno
00033 nd_last : nil_pno nd_conv_vers: 9
00045 nd_str_vers : nil_pno nd_file_vers: dummy
00052 ndPageVersio: 0 nd_inv_usage: 0
00057 nd_leaf_cnt : 1 nd_treeleavs: nil
00065 nd_trans_id : nil ndInvRoot : nil_pno
00077 nd_write_cnt: 1
END OF FILE
Obviously the reason for not delivering any data for the query is: this index is empty.
See "nd_filestate: empty" !
For some reasons (that I really don't know - sorry about that) this index had not been maintained anymore, since a very long time.
"nd_conv_vers: 9" tells us that it was the 9th savepoint that wrote down this page to the disks and that it had not been touched since then.
To view the current converter version you may just use the db_restartinfo command in dbmcli.
If you were a SAP customer the next thing I'd check would be with which database version these indexes had been created, what the internal file state is etc. - just to figure out the root cause.
As such an analysis is basically not possible via this forum all I can propose is to look for those indexes (containing 0 entries although the table has more rows) and rebuild them.
This statement should do the trick:
select i.owner, i.indexname, i.tablename, if.*
from files if join files tf on if.primaryfileid=tf.fileid
join indexes i on if.fileid=i.fileid
where if.entrycount =0
and if.type ='INDEX'
and tf.entrycount >0
best regards,
Lars
Maybe you are looking for
-
Why not all fields dimmed or show in display mode after system status TECO and CLSD for Project
Dear All, When Sets the system status TECO or even CLSD all fields for WBS Elements are not goes to Display mode. User can still edit them or change then. The fields are: 1. WBS Element Description, technical name: PRPS-POST1 2. Person responsible nu
-
I need to know if my wireless & networks setting is correct
I was changing/customizing the different areas since I just got this replacement phone and I had an app say it had to have roaming turned on to work a few days ago when I was having problems with it freezing up and not working. I thought this was odd
-
Commerce Server and Visual Age 3.5
I tried and was unsuccessful getting the Commerce server (3.11) to run under Visual Age 3.5. I can get it to start up correctly, but if I test a commerce application, Visual Age disappears with no messages. From my experiments, I think it is a proble
-
How do I reset a MacBook Air?
My MacBook Air is frozen. I cannot type or login. Does anyone know how to reset?
-
Deploying a STRUTS Web Application
X-Posted to weblogic.developer.interest.jsp weblogic.developer.interest.servlet Hi, for those of you who are familiar with STRUTS JSP/Servlet framework: I'm desparately trying to deploy a web application