Recursive WITH (Recursive Subquery Factoring) Never Returns
11.2.0.2 database on Windows, SQL Developer Version 3.2.20.09, build MAIN-09.87 (Database and SQL Developer are on the same machine. I have also tried connecting to a Linux 11.2 database and have the same results.)
I've been doing some simple testing with recursive WITH (Recursive Subquery Factoring) and when I run this following statement in SQL*Plus it returns instantly. However when running in SQL Developer it never returns, I've let it run for quite a long time (172 seconds) and gotten nothing, I finally kill the statement. Once I ran it and even killing the job didn't come back. I can get an explain plan but if I try to run it, run as script or autotrace it never returns. I have only one plan in the plan_table for this test, and it's only 4 lines long. No errors, no messages.
WITH get_plan (query_plan, id, planlevel) as
select ' '||operation||' '||options||' '||object_name query_plan, id, 1 planlevel
from plan_table
where id = 0
union all
select lpad(' ',2*planlevel)||p.operation||' '||p.options||' '||p.object_name query_plan, p.id, planlevel+1
from get_plan g, plan_table p
where g.id = p.parent_id
SELECT QUERY_PLAN FROM GET_PLAN ORDER BY PLANLEVEL;
Hi Jeff, using either give the same results. The query is "running", as is the little graphic with the bouncing gray bar is moving back and forth saying either "Query Results" or "Scriptrunner Task" as appropriate.
OK this is odd. I run a count(*) on plan_table in SQL*Plus and get 4, in SQL Developer I get 487. Hun? That makes no sense I'm connect as the same user in each. Where are all these other entries coming from and why can't I see them in SQL Plus? Does SQL Developer have it's own PLAN_TABLE?
**EDIT --- Yes that seems to be the case. The PLAN_ID I see in SQL Plus doesn't even exist in the SQL Deveropler version of the table. OK that's good to know. I assume the plan_table for SQL Developer is local to it somehow? It's not in the database as best I can see.
Edited by: Ric Van Dyke on Feb 7, 2013 5:19 PM
Similar Messages
-
Bug in WITH clause (subquery factoring clause) in Oracle 11?
I'm using WITH to perform a set comparison in order to qualify a given query as correct or incorrect regarding an existing solution. However, the query does not give the expected result - an empty set - when comparing the solution to itself in Oracle 11 whereas it does in Oracle 10. A minimal example os posted below as script. There are also some observations about changes to the tables or the query that make Oracle 11 returning correct results but in my opinion these changes must not change the semantics of the queries.
Is this a bug or am I getting something wrong? The Oracle versions are mentioned in the script.
-- Bug in WITH clause (subquery factoring clause)
-- in Oracle Database 11g Enterprise Edition 11.2.0.1.0?
DROP TABLE B PURGE;
DROP TABLE K PURGE;
DROP TABLE S PURGE;
CREATE TABLE S (
m number NOT NULL,
x varchar2(30) NOT NULL
CREATE TABLE K (
k char(2) NOT NULL,
x varchar2(50) NOT NULL
CREATE TABLE B (
m number NOT NULL ,
k char(2) NOT NULL ,
n number
INSERT INTO S VALUES(1, 'h');
INSERT INTO S VALUES(2, 'l');
INSERT INTO S VALUES(3, 'm');
INSERT INTO K VALUES('k1', 'd');
INSERT INTO K VALUES('k2', 'i');
INSERT INTO K VALUES('k3', 'm');
INSERT INTO K VALUES('k4', 't');
INSERT INTO K VALUES('k5', 't');
INSERT INTO K VALUES('k6', 's');
INSERT INTO B VALUES(1, 'k1', 40);
INSERT INTO B VALUES(1, 'k2', 30);
INSERT INTO B VALUES(1, 'k4', 50);
INSERT INTO B VALUES(3, 'k1', 10);
INSERT INTO B VALUES(3, 'k2', 20);
INSERT INTO B VALUES(3, 'k1', 30);
INSERT INTO B VALUES(3, 'k6', 90);
COMMIT;
ALTER TABLE S ADD CONSTRAINT S_pk PRIMARY KEY (m);
ALTER TABLE K ADD CONSTRAINT K_pk PRIMARY KEY (k);
ALTER TABLE B ADD CONSTRAINT B_S_fk
FOREIGN KEY (m) REFERENCES S(m) ON DELETE CASCADE;
CREATE OR REPLACE VIEW v AS
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC;
-- Query 1: Result should be 0
WITH q AS
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
SELECT COUNT(*)
FROM
SELECT * FROM q
MINUS
SELECT * FROM v
UNION ALL
SELECT * FROM v
MINUS
SELECT * FROM q
-- COUNT(*)
-- 6
-- 1 rows selected
-- Query 2: Result set should be empty (Query 1 without counting)
WITH q AS
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
SELECT *
FROM
SELECT * FROM q
MINUS
SELECT * FROM v
UNION ALL
SELECT * FROM v
MINUS
SELECT * FROM q
-- M N
-- null 10
-- null 30
-- null 40
-- 1 40
-- 3 10
-- 3 30
-- 6 rows selected
-- Observations:
-- Incorrect results in Oracle Database 11g Enterprise Edition 11.2.0.1.0:
-- Query 1 returns 6, Query 2 returns six rows.
-- Correct in Oracle Database 10g Enterprise Edition 10.2.0.1.0.
-- Correct without the foreign key.
-- Correct if attribute x is renamed in S or K.
-- Correct if attribute x is left out in S.
-- Correct without the ORDER BY clause in the definition of q.
-- Only two results if the primary key on K is left out.
-- Correct without any change if not using WITH but subqueries (see below).
-- Fixed queries
-- Query 1b: Result should be 0
SELECT COUNT(*)
FROM
SELECT * FROM
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
MINUS
SELECT * FROM v
UNION ALL
SELECT * FROM v
MINUS
SELECT * FROM
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
-- COUNT(*)
-- 0
-- 1 rows selected
-- Query 2b: Result set shoud be empty (Query 1b without counting)
SELECT *
FROM
SELECT * FROM
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
MINUS
SELECT * FROM v
UNION ALL
SELECT * FROM v
MINUS
SELECT * FROM
SELECT S.m, B.n
FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
WHERE K.x='d'
ORDER BY B.n DESC
-- M N
-- 0 rows selectedYou're all gonna love this one.....
The WITH clause works. But not easily.
Go ahead, build the query, (as noted in a recent thread, I, too, always use views), set the grants and make sure DISCOVERER and EULOWNER have SELECT privs.
1. Log into Disco Admin as EULOWNER. Trust me.
2. Add the view as a folder to the business area.
3. Log into Disco Desktop as EULOWNER. Don't laugh. It gets better.
4. Build the workbook and the worksheet (or just the worksheet if apropos)
5. Set the appropriate "sharing" roles and such
6. Save the workbook to the database.
7. Save the workbook to your computer.
8. Log out of Desktop.
9. Log back into Desktop as whatever, whoever you usually are to work.
10. elect "open existing workbook"
11. Select icon for "open from my computer". See? I told you it would get better!
12. Open the save .dis file from your computer.
13. Save it to the database.
14. Open a web browser and from there, you're on your own.
Fortran in VMS. Much easier and faster. I'm convinced the proliferation of the web is a detriment to the world at large...On the other hand, I'm also waiting for the Dodgers to return to Brooklyn. -
With clause - subquery factoring
I've got a script that looks like this:
with X as (select * from atable)
select x1.*, x2.*
from X x1,
X x2
This works perfectly well in SQL*Plus, in PL/SQL, etc. Yet when I try to add it as "New Folder from Database" to an existing Business area in Discoverer, I get the infamous "ORA-03001 Unimplemented Feature".
What am I doing wrong?
Oracle 9i, Disco 9.0.4You're all gonna love this one.....
The WITH clause works. But not easily.
Go ahead, build the query, (as noted in a recent thread, I, too, always use views), set the grants and make sure DISCOVERER and EULOWNER have SELECT privs.
1. Log into Disco Admin as EULOWNER. Trust me.
2. Add the view as a folder to the business area.
3. Log into Disco Desktop as EULOWNER. Don't laugh. It gets better.
4. Build the workbook and the worksheet (or just the worksheet if apropos)
5. Set the appropriate "sharing" roles and such
6. Save the workbook to the database.
7. Save the workbook to your computer.
8. Log out of Desktop.
9. Log back into Desktop as whatever, whoever you usually are to work.
10. elect "open existing workbook"
11. Select icon for "open from my computer". See? I told you it would get better!
12. Open the save .dis file from your computer.
13. Save it to the database.
14. Open a web browser and from there, you're on your own.
Fortran in VMS. Much easier and faster. I'm convinced the proliferation of the web is a detriment to the world at large...On the other hand, I'm also waiting for the Dodgers to return to Brooklyn. -
Recursive subquery factoring datatypes?
Hi all,
using 11.2.0.2.0
just mucking around with Recursive Subquery Factoring, trying to get my head around it.
I can do this fine:
SQL> with numlist (num) AS (SELECT 1 num
2 from dual
3 UNION ALL
4 SELECT numlist.num + 1
5 FROM numlist
6 where numlist.num < 10)
7 SELECT *
8 from numlist;
NUM
1
2
3
4
5
6
7
8
9
10
10 rows selected.but not with dates:
SQL> WITH datelist (dte) AS (SELECT to_date('01-01-2011','dd-mm-yyyy') Dte
2 FROM dual
3 UNION ALL
4 SELECT datelist.dte + 1
5 FROM datelist
6 WHERE datelist.dte < trunc(SYSDATE))
7 select *
8 from datelist;
SELECT datelist.dte + 1
ERROR at line 4:
ORA-01790: expression must have same datatype as corresponding expressionI'm not sure what I need to do.....
I'm sure it's a fairly straightforwardHemant K Chitale wrote:
I don't have an 11.2.0 environment to test this.
Try with a CAST at line 4 ? CAST X.DTE to a Date ?
Hemant K Chitaleahh, that's a little bit better.... it seems a little bit funky though:
15:38:58 SQL> WITH x (dte) AS (SELECT cast (to_date('01-01-2011','dd-mm-yyyy') as date) Dte
15:39:02 2 FROM dual
15:39:02 3 UNION ALL
15:39:02 4 SELECT cast(x.dte + 1 as date)
15:39:02 5 FROM x
15:39:02 6 WHERE x.dte < to_date('01-02-2011','dd-mm-yyyy'))
15:39:02 7 select *
15:39:02 8 from x;
DTE
01-JAN-11
31-DEC-10
30-DEC-10
29-DEC-10
28-DEC-10
27-DEC-10
26-DEC-10
25-DEC-10
24-DEC-10
23-DEC-10
22-DEC-10
21-DEC-10
20-DEC-10
19-DEC-10
18-DEC-10
17-DEC-10
16-DEC-10
15-DEC-10
14-DEC-10
13-DEC-10
12-DEC-10
11-DEC-10
10-DEC-10
09-DEC-10
08-DEC-10
07-DEC-10
06-DEC-10
05-DEC-10
04-DEC-10
03-DEC-10
02-DEC-10
01-DEC-10
30-NOV-10
29-NOV-10
28-NOV-10
27-NOV-10
26-NOV-10
25-NOV-10
24-NOV-10
23-NOV-10
22-NOV-10
21-NOV-10
20-NOV-10
...looks like it's going backwards.
if I cast it like the below, it only gives me one record...
15:39:03 SQL> WITH x (dte) AS (SELECT cast (to_date('01-01-2011','dd-mm-yyyy') as date) Dte
15:40:52 2 FROM dual
15:40:52 3 UNION ALL
15:40:52 4 SELECT cast(x.dte as date) + 1
15:40:52 5 FROM x
15:40:52 6 WHERE x.dte < to_date('01-02-2011','dd-mm-yyyy'))
15:40:52 7 select *
15:40:52 8 from x;
DTE
01-JAN-11
1 row selected.This is bizarre.... -
Analitical functions in recursive subquery factoring
Hi,
I have a problem with analitical functions in recursive subquery factoring.
My version:
>
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
>
When I run following query it runs fine:
with a (num, total) as
(select
1 num
,1 total
from
dual
union all
select
num + 1 num
,total + num + 1 total
from
a
where
num < 10
select
from
a
NUM TOTAL
1 1
2 3
3 6
4 10
5 15
6 21
7 28
8 36
9 45
10 55
10 rows selected When I run the following query it generates an error:
with a (num, total) as
(select
1 num
,1 total
from
dual
union all
select
num + 1 num
,sum(num) over () total
from
a
where
num < 10
select
from
a
Error:
ORA-32486: unsupported operation in recursive branch of recursive WITH clause The manual states:
>
Oracle® Database
SQL Language Reference
11g Release 2 (11.2)
E17118-04
October 2010
The recursive member cannot contain any of the following elements:
- The DISTINCT keyword or a GROUP BY clause
- The model_clause
- An aggregate function. However, analytic functions are permitted in the select list.
- Subqueries that refer to query_name.
- Outer joins that refer to query_name as the right table.
>
According to this it should be posible to have an analitical function in here.
Also on this form I see samples of it used as such.
eg.:
Re: Seat Distribution-Can we do this in SQL?
Can anybody tell me if this is a problem with my version of oracle?
Or is there some other problem here?
Thanks,
PeterWorks ok in 11.2.0.3
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> with a (num, total) as
2 (select
3 1 num
4 ,1 total
5 from
6 dual
7 union all
8 select
9 num + 1 num
10 ,sum(num) over () total
11 from
12 a
13 where
14 num < 10
15 )
16 select
17 *
18 from
19 a
20 ;
NUM TOTAL
1 1
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
10 rows selected. -
Recursion with Return instruction without parameter
Please I have a doubt about following code:
public void solveTowers( int disks, int sourcePeg, int destinationPeg,
int tempPeg )
if ( disks == 1 )
System.out.printf( "\n%d --> %d", sourcePeg, destinationPeg );
return;
solveTowers( disks - 1, sourcePeg, tempPeg, destinationPeg );
System.out.printf( "\n%d --> %d", sourcePeg, destinationPeg );
If I enter witch amount variable DISK = 3
I'd like to known: Why ouput after perform the code is
1--->3
2--->3
1--->3 ?
I didn't get it about the mechanism logical of RETURN instruction !!!
Please, some could me help and explain about with mechanism
OBS: An draw or design it will be helpfull for me understant
A lot of thanks
GmouradYou didn't mention other parameters of your recursive method, so I am not guessing but here is an easier example.
public class Test{
public void resursive(int num) {
if (num == 1) {
System.out.println(num);
return;
resursive(--num);
System.out.println(num);
public static void main(String[] args) {
int num = 3;
Test myTest = new Test();
a.resursive(num);
1
1
2
recursive(3) -> recursive(2) // print 2
recursive(2) -> recursive(1) // print 1
recursive(1) -> // print 1It would print the last one first because the upper one would call itself first before print out the value. -
DNS won't resolve SRV records with recursion disabled
I have DNS installed on a Windows Server 2008 R2 server. I have a standard zone created (no AD integration). I have recursion disabled. When I use NSLookup to lookup any of the A records or CName Records the results are returned as
expected. However, if I attempt to lookup any SRV or MX Records, the list of root hints are returned (which is what I would expect if I was attempting to lookup a domain not hosted on this server). Now I enable recursion and run the same exact
commands and I get the results I'm expecting.
I'm stumped.....
DBReader's digest version: Putting a period at the end of my record, resolved the issue. This seems to be a difference between Windows 2003 and Windows 2008R2
Long version:
Thanks for the debug tip. That confirms the issue. So to backup a little, I had a Windows 2003 box running DNS. I planned on decommissioning this box; therefore, I stood up the second server, made a secondary DNS zone, once all records
transferred, I flipped the primary and secondary roles.
The real problem is this zone cannot find any of the TXT records such as SRV and MX. When I run NSLookup with recursion disabled, my results are:
HEADER:
opcode = QUERY, id = 18, rcode = NOERROR
header flags: response, want recursion
questions = 1, answers = 0, authority records = 13, additional = 3
That makes perfect sense why recursion is working. If I run the same results on the secondary DNS server (the original server) the results are expected:
HEADER:
opcode = QUERY, id = 20, rcode = NOERROR
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 4, authority records = 0, additional = 4
SO THE REAL QUESTION is why can't the new server find these records, especially since it's a copy of the zone from the old server. I flipped the servers back, deleted the DNS zone (and files) on the new server, restarted DNS service, created the zone
again, and allowed the content to copy over from the old server and I STILL get the same results.
The last thing I did was created a new SRV record on the new server and performed another NSLookup, but still get the same results.
So then I remembered
MuhammadUmar's post about putting a period at the end of my nslookup command. I honestly didn't that that was going to change the results, but BAM. I was wrong. When I put in the request with a period at the end of the record, I get the
results I'm expecting.
Thanks all for helping me on this one!
DB -
WITH Subquery Factoring OR "Scalar SubqueriesRun Another Query per row
Hi Experts
Please suggest
which one query is better
Involved table p is of size 2GB and c1/c2 of size 800M.
And we have to run a report on p which will do FTS (no where clause on p)
So FTS on 2 GB table and then running Another Query per row .. so results job very slow
1) Select p.id,
(select sum(q1) from c1 where c1.id = p.id) c1_sum1,
(select sum(q2) from c2 where c2.id = p.id) c2_sum2
from p
2)
WITH Subquery Factoring
with c1_vw as
(select id, sum(q1) c1_sum1
from c1
group by id),
c2_vw as
(select id, sum(q2) c2_sum2
from c2
group by id),
c1_c2 as
(select c1.id, c1.c1_sum1, c2.c2_sum2
from c1_vw c1, c2_vw c2
where c1.id = c2.id )
select p.id, c1_sum1, c2_sum2
from p, c1_c2
where p.id = c1_c2.id
/ 10.2..0.4
AIX 5.3
Thanks In Advance
ivwivw wrote:
which one query is betterThe better query IMHO is the one that returns the the correct results in the shortest amount of time using the least system resources (the last two items usually happen at the same time). Maintainability is an issue too. Which one do you like best?
Its hard to say which query will run best without running both, getting execution plans, and run-time statistics. At a pure guess I would think all things being equal they would have similar performance but do not really know. -
Hallo,
I have to write a method that get's two String type strings (s1, s2) and returns the length of the the biggest continuous sub matrix in the matrix s2 that's all it's digits are present in matrix s1.
For example: if s1 is "xyz" and s2 is "abxyryxzycx" the method will return 4 because the length of sub matrix "yxzy" is 4 and it's the largest sub matrix of s2 that contains only digits from s1(the sub matrices are: "xy", "yxzy", "x").
I have to write this method with recursion and I'm not allowed to use any strings.
When I'm using the defined methods of the String class I can use only the following one's:
public char charAt (int i)
public int indexOf (int ch)
public int length()
public String substring (int i)
I can's see right now how I use "if" conditions with the String methods I'm allowed to use and I can't see the process of solving the problem(should I use linear search?).
Thank's to everybody that can help.
Edited by: ArikG on Jan 26, 2009 10:38 AMI suppose I have to use linear search, but I can't use it here because I'm not allowed to use loops.
My idea is that if the linear search in s2 a digit from s1 is found so I use the method: public char charAt(int i) and from this point I don't know what to do, and I don't know if it's possible to use linear search in recursion(I know how to do it with loops) and how to write everything here(I am familiar only with the String length methods because we weren't taught in the course about the other Sting methods) -
WITH vs INNER QUERY on 11g (100% CPU & Never Return vs 2-3 Seconds)
I cannot figure out why this is happening. We have an 11g database and a pipelined stored function. The following will never return. The db cpu goes up to about 100%.
FOR myRow IN (
WITH subquery AS (
SELECT ...
SELECT
FROM subqery
LOOP
PIPE ROW(...);
END LOOP;If it's formatted the following way, it behaves the same way...:
FOR myRow IN (
SELECT
FROM (
SELECT ...
LOOP
PIPE ROW(...);
END LOOP;However, using the SELECT * FROM (...) method, without the procedure, returns fine:
SELECT * FROM (
SELECT * FROM (
)But this never returns:
WITH subquery AS (
SELECT ...
SELECT
FROM subqueryI have no idea how to diagnose this. It's as if one method tries to store results one way, while the other does not. Any thoughts would be greatly appreciated!!This is the explain for the /*+materialize*/ and subquery form:
Plan hash value: 2761872157
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 130 | | 3427 (2)| 00:00:42 |
| 1 | TEMP TABLE TRANSFORMATION | | | | | | |
| 2 | LOAD AS SELECT | | | | | | |
|* 3 | HASH JOIN | | 5 | 1090 | | 3425 (2)| 00:00:42 |
| 4 | TABLE ACCESS FULL | U_MASTER | 579 | 4632 | | 5 (0)| 00:00:01 |
|* 5 | HASH JOIN RIGHT OUTER | | 83280 | 16M| 4152K| 3418 (2)| 00:00:42 |
| 6 | VIEW | | 83280 | 3171K| | 857 (2)| 00:00:11 |
|* 7 | HASH JOIN | | 83280 | 4066K| | 857 (2)| 00:00:11 |
|* 8 | TABLE ACCESS FULL | U_MASTER | 246 | 1722 | | 5 (0)| 00:00:01 |
| 9 | VIEW | | 83280 | 3497K| | 851 (2)| 00:00:11 |
|* 10 | HASH JOIN | | 83280 | 3903K| 2704K| 851 (2)| 00:00:11 |
|* 11 | TABLE ACCESS FULL | T_MASTER | 78886 | 1771K| | 377 (2)| 00:00:05 |
|* 12 | TABLE ACCESS FULL | T_CONTAINER_IN | 84469 | 2062K| | 191 (3)| 00:00:03 |
|* 13 | HASH JOIN OUTER | | 83280 | 13M| 1048K| 1634 (2)| 00:00:20 |
| 14 | TABLE ACCESS FULL | C_MASTER | 16742 | 850K| | 127 (2)| 00:00:02 |
| 15 | VIEW | | 83280 | 9678K| | 937 (2)| 00:00:12 |
|* 16 | HASH JOIN | | 83280 | 9678K| | 937 (2)| 00:00:12 |
|* 17 | TABLE ACCESS FULL | U_MASTER | 246 | 2706 | | 5 (0)| 00:00:01 |
| 18 | VIEW | | 83280 | 8783K| | 931 (2)| 00:00:12 |
|* 19 | HASH JOIN | | 83280 | 5530K| 2704K| 931 (2)| 00:00:12 |
|* 20 | TABLE ACCESS FULL| T_MASTER | 78886 | 1771K| | 377 (2)| 00:00:05 |
|* 21 | TABLE ACCESS FULL| T_CONTAINER_IN | 84469 | 3712K| | 191 (3)| 00:00:03 |
| 22 | VIEW | | 1 | 130 | | 2 (0)| 00:00:01 |
| 23 | TABLE ACCESS FULL | SYS_TEMP_0FD9D670A_23115C | 1 | 103 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("A"."PICKUP_LOC_UNIT"="B"."U_ID")
filter(("A"."STATUS"=1 OR "A"."STATUS"=2) AND "B"."FAC_ID"=161 AND
"from$_subquery$_008"."TO_UNIT_ID" IS NULL AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("A"."ORIGIN_DATETIME"))
<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) OR "B"."FAC_ID"=161 AND "from$_subquery$_008"."PREV_T_ID" IS NULL
AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TASK_DATE_TIME"))>SYS_EXTRACT_UTC(SYSTIMEST
AMP(6)) AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("A"."ORIGIN_DATETIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6))
AND "from$_subquery$_008"."TO_UNIT_ID" IS NOT NULL OR "from$_subquery$_008"."FAC_ID"=161 AND
"from$_subquery$_014"."TASK_DATE_TIME" IS NULL AND ("from$_subquery$_008"."UNIT_TYPE_ID"=2 OR
"from$_subquery$_008"."UNIT_TYPE_ID"=3) AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TAS
K_DATE_TIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) OR "from$_subquery$_008"."FAC_ID"=161 AND
("from$_subquery$_008"."UNIT_TYPE_ID"=2 OR "from$_subquery$_008"."UNIT_TYPE_ID"=3) AND
SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TASK_DATE_TIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP
(6)) AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_014"."TASK_DATE_TIME"))>SYS_EXTRACT_UTC(SYST
IMESTAMP(6)))
5 - access("from$_subquery$_008"."QCSJ_C000000000600000"="G"."PREV_T_ID"(+) AND
"from$_subquery$_008"."C_ID_IN"="G"."C_ID_IN"(+))
7 - access("H"."TO_UNIT_ID"="I"."U_ID")
8 - filter("I"."UNIT_TYPE_ID"=1 OR "I"."UNIT_TYPE_ID"=2 OR "I"."UNIT_TYPE_ID"=3)
10 - access("G"."T_ID"="H"."T_ID")
11 - filter("H"."STATUS"=1)
12 - filter("G"."REJECT"=0)
13 - access("A"."C_ID"="C"."C_ID_IN"(+))
16 - access("D"."TO_UNIT_ID"="E"."U_ID")
17 - filter("E"."UNIT_TYPE_ID"=1 OR "E"."UNIT_TYPE_ID"=2 OR "E"."UNIT_TYPE_ID"=3)
19 - access("C"."T_ID"="D"."T_ID")
20 - filter("D"."STATUS"=1)
21 - filter("C"."REJECT"=0) This is the explain for the with statement form (the one that never returns):
Plan hash value: 868902620
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5 | 840 | | 1493 (2)| 00:00:18 |
|* 1 | FILTER | | | | | | |
| 2 | NESTED LOOPS OUTER | | 5 | 840 | | 1493 (2)| 00:00:18 |
|* 3 | HASH JOIN | | 83280 | 11M| | 1484 (2)| 00:00:18 |
| 4 | TABLE ACCESS FULL | U_MASTER | 579 | 4632 | | 5 (0)| 00:00:01 |
|* 5 | HASH JOIN OUTER | | 83280 | 10M| 1048K| 1477 (2)| 00:00:18 |
| 6 | TABLE ACCESS FULL | C_MASTER | 16742 | 850K| | 127 (2)| 00:00:02 |
| 7 | VIEW | | 83280 | 6424K| | 937 (2)| 00:00:12 |
|* 8 | HASH JOIN | | 83280 | 6424K| | 937 (2)| 00:00:12 |
|* 9 | TABLE ACCESS FULL | U_MASTER | 246 | 2706 | | 5 (0)| 00:00:01 |
|* 10 | HASH JOIN | | 83280 | 5530K| 2704K| 931 (2)| 00:00:12 |
|* 11 | TABLE ACCESS FULL | T_MASTER | 78886 | 1771K| | 377 (2)| 00:00:05 |
|* 12 | TABLE ACCESS FULL | T_CONTAINER_IN | 84469 | 3712K| | 191 (3)| 00:00:03 |
|* 13 | VIEW PUSHED PREDICATE | | 1 | 29 | | 0 (0)| 00:00:01 |
|* 14 | HASH JOIN | | 845 | 46475 | | 384 (2)| 00:00:05 |
|* 15 | TABLE ACCESS FULL | U_MASTER | 246 | 1722 | | 5 (0)| 00:00:01 |
| 16 | NESTED LOOPS | | | | | | |
| 17 | NESTED LOOPS | | 845 | 40560 | | 378 (2)| 00:00:05 |
|* 18 | TABLE ACCESS FULL | T_MASTER | 78886 | 1771K| | 377 (2)| 00:00:05 |
|* 19 | INDEX RANGE SCAN | IDX_T_CONTAINER_IN_PREV_T_ID | 1 | | | 0 (0)| 00:00:01 |
|* 20 | TABLE ACCESS BY INDEX ROWID| T_CONTAINER_IN | 1 | 25 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter(("A"."STATUS"=1 OR "A"."STATUS"=2) AND "B"."FAC_ID"=161 AND "from$_subquery$_008"."TO_UNIT_ID" IS
NULL AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("A"."ORIGIN_DATETIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) OR
"B"."FAC_ID"=161 AND "from$_subquery$_008"."PREV_T_ID" IS NULL AND
SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TASK_DATE_TIME"))>SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) AND
SYS_EXTRACT_UTC(INTERNAL_FUNCTION("A"."ORIGIN_DATETIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) AND
"from$_subquery$_008"."TO_UNIT_ID" IS NOT NULL OR "from$_subquery$_008"."FAC_ID"=161 AND
"from$_subquery$_014"."TASK_DATE_TIME" IS NULL AND ("from$_subquery$_008"."UNIT_TYPE_ID"=2 OR
"from$_subquery$_008"."UNIT_TYPE_ID"=3) AND SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TASK_DATE_TI
ME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) OR "from$_subquery$_008"."FAC_ID"=161 AND
("from$_subquery$_008"."UNIT_TYPE_ID"=2 OR "from$_subquery$_008"."UNIT_TYPE_ID"=3) AND
SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_008"."TASK_DATE_TIME"))<=SYS_EXTRACT_UTC(SYSTIMESTAMP(6)) AND
SYS_EXTRACT_UTC(INTERNAL_FUNCTION("from$_subquery$_014"."TASK_DATE_TIME"))>SYS_EXTRACT_UTC(SYSTIMESTAMP(6)))
3 - access("A"."PICKUP_LOC_UNIT"="B"."U_ID")
5 - access("A"."C_ID"="C"."C_ID_IN"(+))
8 - access("D"."TO_UNIT_ID"="E"."U_ID")
9 - filter("E"."UNIT_TYPE_ID"=1 OR "E"."UNIT_TYPE_ID"=2 OR "E"."UNIT_TYPE_ID"=3)
10 - access("C"."T_ID"="D"."T_ID")
11 - filter("D"."STATUS"=1)
12 - filter("C"."REJECT"=0)
13 - filter("from$_subquery$_008"."C_ID_IN"="G"."C_ID_IN"(+))
14 - access("H"."TO_UNIT_ID"="I"."U_ID")
15 - filter("I"."UNIT_TYPE_ID"=1 OR "I"."UNIT_TYPE_ID"=2 OR "I"."UNIT_TYPE_ID"=3)
18 - filter("H"."STATUS"=1)
19 - access("G"."PREV_T_ID"="from$_subquery$_008"."QCSJ_C000000000600000")
20 - filter("G"."REJECT"=0 AND "G"."T_ID"="H"."T_ID")Just wanted to say thanks again for any additional help you can provide!
Edited by: asmallgrin on Feb 3, 2010 7:28 AM -
Generic forwarding methods with recursive bounds.
Hello all,
I'm attempting to create a forwarding class assoicated with an interface. The interface has a generic method with recursive bounds. The problem relates to ambiguous method calls as the following code segment should demonstrate:
interface TestInterface
//generic method with recursive bounds. (use of Comparable<T> is
// not relevant, any generic class/interface could have been used.)
<T extends Comparable<T>> T testMethod(T bob);
//Concrete implementation of the TestInterface.
class TestClass implements TestInterface
public <T extends Comparable<T>> T testMethod(T bob)
return bob;
public static void main(String[] args)
TestInterface bob = new TestClass();
bob.testMethod("blah"); //Works fine.
class ForwardingClass implements TestInterface
//Forwarding class composed of a TestClass object. All methods forward calls to this object.
private final TestClass test;
public ForwardingClass(TestClass test)
this.test = test;
//forwarding method.
public <T extends Comparable<T>> T testMethod(T bob)
return test.testMethod(bob); //Ambiguous testMethod call. Both testMethod (T) in TestClass
//and testMethod (T) in TestInterface match. Very annoying...
}Therefore, if you could assist with the following issues, it would be greatly appreciated.
Firstly, I don't think I fully understand why this error is given, so any explanation would be greatly appreciated.
Secondly, is there any way to get around the problem?
Thanks in advance,
Matt.My bad. This appears to be an issue with Intellij 8.0M1. I'll create post on the Intellij forums. It compiles absolutely fine from the command line, and using Intellij 7.04. (Probably should have checked that before my initial post...)
Apologies for wasting your time. Cheers for the replies.
Matt. -
How to use recursion with images
Ok, for this program I'm trying to recursively repeat an image 3 times with varying widths and heights, and I don't know how to do that with images. With rectangles and other shape objects it's easy because all I had to do was override the draw method, but with images I'm not sure what to override to allow me to repeat the drawing of it with a different height and width. Any help would be greatly appreciated.
Would I be able to work that in with recursion? Currently I have a JPanel with the paintComponent method being overridden, and I've tried setting up the paintComponent method to call itself to repaint the image, but I've realized everytime I resize the application's window paintComponent gets called again making the images go out of site. Is there a way to override the drawImage method to allow me to change the width and height of the image without causing the panel to repaint itself?
-
OBIEE 11g "WITH SAWITH0 AS" subquery factoring clause in the generated sql
I've observed that the OBIEE 11g generates in the query log physical query using the WITH (sub-query factoring) clause to make the generated sql elegantly readable. This is great! Thanks for the developers. However I have some questions about this.
__Background__
Oracle Database' default behaviour is that if you have only one sub-query in the WITH section, it executes it as an in-line view and does not materialize it before the main sql is executed. If you have more than one, by default the database engine materializes all of them in the order of the definition. In some cases this can completely blow up the SGA and make the query never ending. To divert this behaviour you can apply two hints that work both in inline views and in sub-queries as well: /*+ MATERIALIZE */ and /*+ INLINE*/, however Analytics 11g does not seem to have hint capabilities at the logical table level, only at physical table level.
If we go with the current defaults, developers not aware of this feature can bump into serious performance issues for the sake of some syntax candy at the generated sql level, I'm afraid.
__Questions__
* Is it possible to turn the Analytics server not to use WITH but use inline views instead?
* Is there any way to sneak in some hints that would put the /*+ INLINE */ hint to the appropriate place in the generated sub-queries if needed
* Does the Oracle Database have any initialization parameter that can influence this sub-query factoring behavior and divert from the default?The WITH statement is not added to make the query more elegant, it's added for performance reasons. If your queries take long to run then you may have a design issue. In a typical DWH DB SGA needs to be seriously increased since the queries ran are much larger and complex than on an OLTP DB. In any case you can disable the WITH statement in the Admin Tool by double clicking on your database object on the physical layer and going to the Features tab. The feature is called WITH_CLAUSE_SUPPORTED.
-
Issue with recursive join and filter records
I am having an issue with recursive join and filtering records for the following rules. The table, sample records, test script and rules are as below
drop table PC_COVKEY_PD;
create table PC_COVKEY_PD (
PC_COVKEY varchar(50),
COVERAGE_NUMBER varchar(3),
SEQUENCE_ALPHA varchar(3),
TRANSACTION_TYPE varchar(3),
COV_CHG_EFF_DATE date,
TIMESTAMP_ENTERED timestamp
delete from PC_COVKEY_PD;
commit;
Insert into PC_COVKEY_PD values ('10020335P8017MT0010012','001','001','02',to_date('01/FEB/2010','DD/MON/RRRR'),to_timestamp('02/JAN/2010 01:55:59.990216 AM','DD/MON/RRRR HH12:MI:SS.FF6 AM'));
Insert into PC_COVKEY_PD values ('10020335P8017MT0050012','005','001','02',to_date('01/FEB/2010','DD/MON/RRRR'),to_timestamp('02/JAN/2010 01:56:00.268099 AM','DD/MON/RRRR HH12:MI:SS.FF6 AM'));
Insert into PC_COVKEY_PD values ('10020335P8017MT0010032','001','003','03',to_date('14/JAN/2011','DD/MON/RRRR'),to_timestamp('14/JAN/2011 04:25:19.018217 PM','DD/MON/RRRR HH12:MI:SS.FF6 AM'));
Insert into PC_COVKEY_PD values ('10020335P8017MT0010042','001','004','03',to_date('21/JAN/2011','DD/MON/RRRR'),to_timestamp('21/JAN/2011 04:00:31.719444 PM','DD/MON/RRRR HH12:MI:SS.FF6 AM'));
Insert into PC_COVKEY_PD values ('10020335P8017MT0050022','005','002','03',to_date('21/JAN/2011','DD/MON/RRRR'),to_timestamp('21/JAN/2011 04:02:48.953594 PM','DD/MON/RRRR HH12:MI:SS.FF6 AM'));
commit;
--select * from PC_COVKEY_PD order by COV_CHG_EFF_DATE,TIMESTAMP_ENTERED;
PC_COVKEY COVERAGE_NUMBER SEQUENCE_ALPHA TRANSACTION_TYPE COV_CHG_EFF_DATE TIMESTAMP_ENTERED
10020335P8017MT0010012 001 001 02 01/FEB/2010 02/JAN/2010 01:55:59.990216 AM
10020335P8017MT0050012 005 001 02 01/FEB/2010 02/JAN/2010 01:56:00.268099 AM
10020335P8017MT0010032 001 003 03 14/JAN/2011 14/JAN/2011 04:25:19.018217 PM
10020335P8017MT0010042 001 004 03 21/JAN/2011 21/JAN/2011 04:00:31.719444 PM
10020335P8017MT0050022 005 002 03 21/JAN/2011 21/JAN/2011 04:02:48.953594 PM
*/Rule;
Every PC_COVKEY, query should recursively join and generate set of records depending on latest SEQUENCE_ALPHA for the coverage number at that point of time. For ex,
for 10020335P8017MT0010042 (4 row) should generate 2 records
1. 10020335P8017MT0010042001004 (PC_COVKEY || COVERAGE_NUMBER || latest SEQUENCE_ALPHA--004 for cover 001), SEQUENCE_ALPHA 001 for cover 001 is not the latest for 10020335P8017MT0010042.
2. 10020335P8017MT0010042005001 (coverage number 005, and latest sequence alpha-001 for cover 005).
SEQUENCE_ALPHA 002 for cover 005 is not the latest for 10020335P8017MT0010042 as it happened later stage.
for 10020335P8017MT0050022 (5 row) should generate 2 records as
1. 10020335P8017MT0050022001004 (PC_COVKEY || COVERAGE_NUMBER || latest SEQUENCE_ALPHA--004 for cover 001),
2. 10020335P8017MT0010042005002 (coverage number 005, and latest sequence alpha-002 for cover 005)
WITH SNAPSHOT_CVR_CTP as (
SELECT pcd1.PC_COVKEY,
pcd1.PC_COVKEY||pcd2.COVERAGE_NUMBER||pcd2.SEQUENCE_ALPHA as cov_key,
pcd2.COVERAGE_NUMBER,
pcd2.SEQUENCE_ALPHA,
pcd2.COVERAGE_NUMBER||pcd2.SEQUENCE_ALPHA as CVRSEQ,
max(pcd2.COVERAGE_NUMBER||pcd2.SEQUENCE_ALPHA) over (partition by pcd1.PC_COVKEY, pcd1.COVERAGE_NUMBER
order by pcd2.COV_CHG_EFF_DATE, pcd2.TIMESTAMP_ENTERED) as MaxSeq,
pcd2.COV_CHG_EFF_DATE,
pcd2.TIMESTAMP_ENTERED
FROM
PC_COVKEY_PD pcd1,
PC_COVKEY_PD pcd2
select * from SNAPSHOT_CVR_CTP SC
WHERE sc.PC_COVKEY = '10020335P8017MT0010042' -- 4 row
--AND COVERAGE_NUMBER||SC.MAXSEQ = COVERAGE_NUMBER||SEQUENCE_ALPHA
ORDER BY TIMESTAMP_ENTERED
PC_COVKEY COV_KEY COVERAGE_NUMBER SEQUENCE_ALPHA CVRSEQ MAXSEQ COV_CHG_EFF_DATE TIMESTAMP_ENTERED
10020335P8017MT0010042 10020335P8017MT0010042001001 001 001 001001 001001 01/FEB/2010 02/JAN/2010 01:55:59.990216 AM
10020335P8017MT0010042 10020335P8017MT0010042005001 005 001 005001 005001 01/FEB/2010 02/JAN/2010 01:56:00.268099 AM
10020335P8017MT0010042 10020335P8017MT0010042001003 001 003 001003 005001 14/JAN/2011 14/JAN/2011 04:25:19.018217 PM
10020335P8017MT0010042 10020335P8017MT0010042001004 001 004 001004 005001 21/JAN/2011 21/JAN/2011 04:00:31.719444 PM
10020335P8017MT0010042 10020335P8017MT0010042005002 005 002 005002 005002 21/JAN/2011 21/JAN/2011 04:02:48.953594 PM
I am trying to filter row using MAXSEQ but at the moment MAXSEQ values are not coming as expected. I expect following value for COV_KEY combination
COV_KEY MAXSEQ
10020335P8017MT0010042001001 001004
10020335P8017MT0010042005001 005001 -- match
10020335P8017MT0010042001003 001004
10020335P8017MT0010042001004 001004 -- match
10020335P8017MT0010042005002 005001Would appreciate if anyone can get MAxSEQ as expected.Something like..
with dist_cov_numbers as
select distinct coverage_number cov_number
from PC_COVKEY_PD
all_data as
select pcd.*,d.cov_number new_coverage_number,
max(decode(coverage_number,d.cov_number,sequence_alpha))
over( partition by d.cov_number
order by COV_CHG_EFF_DATE,TIMESTAMP_ENTERED
) max_seq
from PC_COVKEY_PD pcd,dist_cov_numbers d
select pc_covkey,pc_covkey||new_coverage_number||max_seq new_key,
pc_covkey||coverage_number||sequence_alpha actual_key
from all_data
order by COV_CHG_EFF_DATE, TIMESTAMP_ENTERED;
PC_COVKEY NEW_KEY ACTUAL_KEY
10020335P8017MT0010012 10020335P8017MT0010012001001 10020335P8017MT0010012001001
10020335P8017MT0010012 10020335P8017MT0010012005 10020335P8017MT0010012001001
10020335P8017MT0050012 10020335P8017MT0050012001001 10020335P8017MT0050012005001
10020335P8017MT0050012 10020335P8017MT0050012005001 10020335P8017MT0050012005001
10020335P8017MT0010032 10020335P8017MT0010032001003 10020335P8017MT0010032001003
10020335P8017MT0010032 10020335P8017MT0010032005001 10020335P8017MT0010032001003
10020335P8017MT0010042 10020335P8017MT0010042005001 10020335P8017MT0010042001004
10020335P8017MT0010042 10020335P8017MT0010042001004 10020335P8017MT0010042001004
10020335P8017MT0050022 10020335P8017MT0050022005002 10020335P8017MT0050022005002
10020335P8017MT0050022 10020335P8017MT0050022001004 10020335P8017MT0050022005002
10 rows selected Edited by: jeneesh on Nov 22, 2012 10:54 AM -
This is totally insane!! They took someone's money in a sec by 'MISTAKE' but haven't returned after 10days.
I already have chatted with two staffs about this but different from what they promised, this still has not solved yet!
My devoted time for this was totally wasted and I am still in suffering.
I think this is theft!!! What shall I do more?!I am really sorry to bring this issue to the forum but had no choice. Like I mentioned above, I already have contacted them but never returned me back. Sick of chatting with those staffs who act like answering machine and wasting my time because of their mistake. After I finally decided to post this last night, then they called me this morning that I have to wait 5days more.
Sorry again, and thanks for your reply.
J
Maybe you are looking for
-
Hi friends, I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field But when I am compiling it using JAVAC, I am getting following error message t
-
How do I get an iphone out of my devices besides ejecting it?
A friends iphone keeps showing up in my devices all the time even after I eject it. It always syncs whenever I open itunes. How do I get rid of it permanently? I would like mine to be there always instead of that one.
-
I've made a flash giftcard for a project and I'm trying to import some sound for it, but when I try importing to the library it always refuses every single format of sound I try. wav, mp3, midi, etc. It keeps saying it has a problem reading them.
-
Need help with subscription (IPad retina)
Hi, I can't access the Compute Music apps on my new Ipad. I have no problems with my sold iPad2. I can't gent after the intro screen as my id keeps trying to authenticate. With all my Future Publishing appliacations all is fine. I have contacted Futu
-
Download speed of 0.1mb/s
I've had problems with this for almost two years now but BT have fobbed me off on more than one occasion, saying that it's because I live at the end of an exchange. I think it's outrageous that I pay the same monthly fee as everyone else but get a fr