Connect By Query Level is becaming 0
Hi
I am using a sub query as below and I started to get ORA-01428 errors randomly in one schema.
Then while debugging I found out that level is getting value 0 in that schema and this is freaking out INSTR.
Both databases are on the same patch level and this is happening randomly.
Why does the value of level become 0? How can I avoid it ?
I realized that CBO is taking a different path to execute the query when it doesn't work..
Thanks a lot.
--sfnc is a logging function that I added to see the value of level, I don't have this in the actual query. It returns back what it gets.
With selected_dates As (
Select to_date(SUBSTR(:p_dates,
INSTR('|' || :p_dates, '|', 1, sfnc(level)),
INSTR(:p_dates || '|', '|', 1, sfnc(level)) - INSTR('|' || :p_dates, '|', 1, sfnc(level))),'DD/MM/YYYY') dt
From dual
Connect By Level <= LENGTH(:p_dates) - LENGTH(Replace(:p_dates, '|')) + 1
ANd Prior dbms_random.Value Is Not Null
-Edited by: Muhammed Soyer on Aug 28, 2009 10:31 AM
Hi,
You may be a victim of "Bug 6679575 Wrong results from CONNECT BY and WITH clause" (see Metalink):
Versions confirmed as being affected
* 10.2.0.3
* 10.2.0.4
Wrong results can be returned for an inlined WITH clause within
a view using a CONNECT BY "LEVEL" pseudo column.
Workaround:
Ensure that the WITH clause is materialized.
eg: MATERIALIZE hint
Note:
Also see bug 6643093 as materialized WITH clauses can also
give wrong results without that fix.
or "Bug 6643093 Wrong results from CONNECT BY and WITH clause":
>>
Versions confirmed as being affected
* 10.2.0.3
Wrong results may be returned for materialized WITH clauses .
The plan output shows predicates of the form
NULL IS NOT NULL
Workaround
Use a stored view instead of a WITH clause.Hope this helps,
Vincent
Edited by: user10285933 on 28 août 2009 13:47
Similar Messages
-
[8i] Need help with hierarchical (connect by) query
First, I'm working in 8i.
My problem is, I keep getting the error ORA-01437: cannot have join with CONNECT BY.
And, the reason I get that error is because one of the criteria I need to use to prune some branches with is in another table... Is there anyway to work around this? I tried an in-line view (but got the same error). I thought about using the connect by query as an in-line view and filtering off what I don't want that way, but I'm not sure how to filter out an entire branch...
Here is some simplified sample data:
CREATE TABLE bom_test
( parent CHAR(25)
, component CHAR(25)
, qty_per NUMBER(9,5)
INSERT INTO bom_test
VALUES ('ABC-1','101-34',10);
INSERT INTO bom_test
VALUES ('ABC-1','A-109-347',2);
INSERT INTO bom_test
VALUES ('ABC-1','ABC-100G',1);
INSERT INTO bom_test
VALUES ('ABC-1','1A247G01',2);
INSERT INTO bom_test
VALUES ('ABC-100G','70052',18);
INSERT INTO bom_test
VALUES ('ABC-100G','M9532-278',5);
INSERT INTO bom_test
VALUES ('1A247G01','X525-101',2);
INSERT INTO bom_test
VALUES ('1A247G01','1062-324',2);
INSERT INTO bom_test
VALUES ('X525-101','R245-9010',2);
CREATE TABLE part_test
( part_nbr CHAR(25)
, part_type CHAR(1)
INSERT INTO part_test
VALUES ('ABC-1','M');
INSERT INTO part_test
VALUES ('101-34','P');
INSERT INTO part_test
VALUES ('A-109-347','P');
INSERT INTO part_test
VALUES ('ABC-100G','M');
INSERT INTO part_test
VALUES ('1A247G01','P');
INSERT INTO part_test
VALUES ('70052','P');
INSERT INTO part_test
VALUES ('M9532-278','P');
INSERT INTO part_test
VALUES ('X525-101','M');
INSERT INTO part_test
VALUES ('1062-324','P');
INSERT INTO part_test
VALUES ('R245-9010','P');This is the basic query (with no pruning of branches):
SELECT LEVEL
, b.component
, b.parent
, b.qty_per
FROM bom_test b
START WITH b.parent = 'ABC-1'
CONNECT BY PRIOR b.component = b.parentThe query above gives the results:
LEVEL COMPONENT PARENT QTY_PER
1.000 101-34 ABC-1 10.000
1.000 A-109-347 ABC-1 2.000
1.000 ABC-100G ABC-1 1.000
2.000 70052 ABC-100G 18.000
2.000 M9532-278 ABC-100G 5.000
1.000 1A247G01 ABC-1 2.000
2.000 X525-101 1A247G01 2.000
3.000 R245-9010 X525-101 2.000
2.000 1062-324 1A247G01 2.000
9 rows selected....but I only want the branches (children, grandchildren, etc.) of part type 'M'.
e.g.:
LEVEL COMPONENT PARENT QTY_PER
1.000 101-34 ABC-1 10.000
1.000 A-109-347 ABC-1 2.000
1.000 ABC-100G ABC-1 1.000
2.000 70052 ABC-100G 18.000
2.000 M9532-278 ABC-100G 5.000
1.000 1A247G01 ABC-1 2.000Any suggestions?Hi,
user11033437 wrote:
First, I'm working in 8i.
My problem is, I keep getting the error ORA-01437: cannot have join with CONNECT BY.
And, the reason I get that error is because one of the criteria I need to use to prune some branches with is in another table... Is there anyway to work around this? I tried an in-line view (but got the same error). Post your query. It's very hard to tell what you're doing wrong if we don't know what you're doing.
...but I only want the branches (children, grandchildren, etc.) of part type 'M'.
e.g.:
LEVEL COMPONENT PARENT QTY_PER
1.000 101-34 ABC-1 10.000
1.000 A-109-347 ABC-1 2.000
1.000 ABC-100G ABC-1 1.000
2.000 70052 ABC-100G 18.000
2.000 M9532-278 ABC-100G 5.000
1.000 1A247G01 ABC-1 2.000
You mean you want don't want the descendants (children, grandchildren, etc.) of any component whose part_type is not 'M'.
The part_type of the component itself doesn't matter: component '101-34' is included, even though its part_type is 'P', and component 'X525-101' is excluded, even though its part_type is 'M'.
>
Any suggestions?Sorry, I don't have an Oracle 8.1 database at hand now. All three of the queries below get the correct results in Oracle 10.2, and I don't believe they do anything that isn't allowed in 8.1.
You can't do a join and CONNECT BY in the same query on Oracle 8.1.
I believe you can do one first, then the other, using in-line views. The frist two queries do the join first.
-- Query 1: Join First
SELECT LEVEL
, component
, parent
, qty_per
FROM ( -- Begin in-line view to join bom_test and part_test
SELECT b.component
, b.parent
, b.qty_per
, p.part_type AS parent_type
FROM bom_test b
, part_test p
WHERE p.part_nbr = b.parent
) -- End in-line view to join bom_test and part_test
START WITH parent = 'ABC-1'
CONNECT BY parent = PRIOR component
AND parent_type = 'M'
;Query 2 is very much like Query 1, but it does more filtering in the sub-query, returning only rows hose part_type or whose parent's part_type is 'M". Your desired result set will be a tree taken entirely from this set. Query 2 may be faster, because the sub-query is more selective, but then again, it may be slower because it has to do an extra join.
{code}
-- Query 2: Join first, prune in sub-query
SELECT LEVEL
, component
, parent
, qty_per
FROM ( -- Begin in-line view to join bom_test and part_test
SELECT b.component
, b.parent
, b.qty_per
, p.part_type AS parent_type
FROM bom_test b
, part_test p
, part_test c
WHERE p.part_nbr = b.parent
AND c.part_nbr = b.component
AND 'M' IN (c.part_type, p.part_type)
) -- End in-line view to join bom_test and part_test
START WITH parent = 'ABC-1'
CONNECT BY parent = PRIOR component
AND parent_type = 'M'
{code}
Query 3, below, takes a completely different approach. It does the CONNECT BY query first, then does a join to see what the parent's part_type is. We can easily cut out all the nodes whose parent's part_type is not 'M', but that will leave components like 'R245-9010' whose parent has part_type 'M', but should be excluded because its parent is excluded. To get the correct results, we can do another CONNECT BY query, using the same START WITH and CONNECT BY conditions, but this time only looking at the pruhed results of the first CONNECT BY query.
{code}
-- Query 3: CONNECT BY, Prune, CONNECT BY again
SELECT LEVEL
, component
, parent
, qty_per
FROM ( -- Begin in-line view of 'M' parts in hierarchy
SELECT h.component
, h.parent
, h.qty_per
FROM ( -- Begin in-line view h, hierarchy from bom_test
SELECT component
, parent
, qty_per
FROM bom_test
START WITH parent = 'ABC-1'
CONNECT BY parent = PRIOR component
) h -- End in-line view h, hierarchy from bom_test
, part_test p
WHERE p.part_nbr = h.parent
AND p.part_type = 'M'
) -- End in-line view of 'M' parts in hierarchy
START WITH parent = 'ABC-1'
CONNECT BY parent = PRIOR component
{code}
I suspect that Query 3 will be slower than the others, but if the CONNECT BY query is extremely selective, it may be better.
It would be interesting to see your findings using the full tables. Please post your observations and the explain plan output.
As usual, your message is a model of completeness and clarity:
<ul>
<li>good sample data,
<li> posted in a way people can use it,
<li>clear results,
<li> good explanation
<li> nciely formatted code
</ul>
Keep up the good work! -
What is the difference between BO Designer connect BW QUERY and BW CUBEuFF1F
HI friend,
What is the difference between BO Designer connect BW QUERY and BW CUBE?
which one is better?
Best regards.
HowardHi Howard,
You can use autorization variables in SAP BW and maitain the security there, using that you can apply diferent security not only at Infoobject levet you can apply security per BEX Query.
Here is some informaion about BEX and SAP BusinessObjects
BI metadata feature _______SAP OLAP BAPI support level
Characteristics (incl. Time and Unit)_______ InfoCube/BEx Query
Hierarchies_______ InfoCube/BEx Query
Basic Key Figures_______ InfoCube/BEx Query
Navigational Attributes_______ BEx Query only
Display Attributes_______ InfoCube/BEx Query
Calculated Key Figures / Formulas_______ BEx Query only
Restricted Key Figures_______ BEx Query only
Custom Structures_______ BEx Query only
Variables_______ BEx Query only
I hope this help you.
BEst regards,
Fede -
Query level filter not working in Webi report
Hi All,
I am using BOXI R3.1 (SP3), m facing one problem when refreshing Webi report on daily basis. I am using three query level filter as a prompt, but i checked one filter is not working then i need to reapply this filter and rest 2 filter is working fine.
Can anyone suggest me why problem is coming?
Regards,Hi,
Prompts are interactive, and come from the query panel. Filters are not interactive, and are set on the report or block. There are also input controls, which are interactive filters
1. Select the universe in the list of universes to open the Query Panel.
2. Drag the Year object to the Result Objects pane.
3. Drag the Number of Guests object to the Query Filters pane and create a report filter that restricts Number of Guests to greater than n.
4. Click Combined Query.
The Combined Query pane appears in the bottom left of the Query panel with the two queries joined by UNION.
5. Click on the second query and remove the Year and Number of Guests objects.
6. Drag the Reservation Year object to the Result Objects pane.
7. Drag the Future Guests object to the Query Filters pane and create a report filter that restricts the future guests to greater than n.
8. Click Run Query.
Best Regards
Naveen -
Date to Month Conversion at Query Level.
Hi,
I have Net due date in the Info provider.
At query level i have to create a restricted keyfigure based on Net Due Month.
Is there any way i can calculate Net due month at runtime and then create the restricted keyfigure using the net due month instead of using net due date directly(linke 01-10-2010 to 31 -10-2010 for october 2010).
Thanks and Regards,
MuraliManohar.Hi,
Is there any way i can calculate Net due month at runtime and then create the restricted keyfigure using the net due month instead of using net due date directly(linke 01-10-2010 to 31 -10-2010 for october 2010).
you can calculate , but as he said you can add in cube , may be for cal month you are taking som eother date field.
in this case write one customer exist code .
create one varaibel on netdue date with customer not ready input (if user wants to enter input then ct=reate user entry varaible with reday input by using customer exit).
in routine wriet the code as when that varaible .
l_s_range - high , low and give then take the month form that date
like netdue date +0(6)-- gives month and year
netdue date +0(2)-- gives month
then rtestrict that variable with your keyfigure.
Thanks & Regards,
sathish -
Logical Formula at query level?
I have requirment like if D = 0 then ' ' (SAPCE) else E / F.
I dont know how to get space ?
please help me to create this formula at query level?hi Hari,
I am not really sure ,but u can try this...
if D = 0 then ' ' (SPACE) else E / F.
use the same formula and make it Zero instead of space and then in the Query properties replace Zero with Blank or Space Values.
Rgds
SVU123
Edited by: svu123 on Sep 30, 2010 6:53 AM -
Infoset resulting multiple results at query level
Hi,
I have joined 1 DSO and 1 Infocube in Infoset.. Mapped Plant, Material and Batch
DSO
Plant Material Batch Caldate Qty
P1 M1 B101 01/02/2014 1000
P2 M2 B102 05/02/2014 2000
Infocube
Plant Material Batch Caldate %
P1 M1 B101 02/02/2014 20
P1 M1 B101 05/01/2014 20
P2 M2 B102 07/02/2014 15
I'm considering date only on DSO and ignoring Infocube date. When I execute the report for the month of February, report output is as follows.
Plant Material Batch DSODate Qty %
P1 M1 B101 01/02/2014 1000 40 (Summing up with January Date)
P2 M2 B102 05/02/2014 2000 15
I want data % value to be 20%.
Is there any possibility to change at query level or join level.
If we have one line item, data is correct but not the case with multiple line items.
Kindly do the needful!
Thanks
SSHi,
When you join the two infoproviders in the infoset ignoring infocube date, you are creating as many records for each record in DSO. That means for the first record the infoset creates :
Plant Material Batch Caldate Qty %
P1 M1 B101 01/02/2014 1000 20 (for first row in infocube)
P1 M1 B101 01/02/2014 1000 20 (for second row in infocube)
I also think same as Anshu, you have all the common characteristics, you can as well use a multiprovider.
regards
Yasemin... -
How to use Designer connect BW Query?
HI friend,
My BO Designer connect BW Query, Can't connt my custom cube's query ( my cbue save on "IA_InfoArea" InfoArea), I find one standard cube "0SD_C01" Cube's query could connt .
Why custom CUBE of the QUERY can not display and connect?
How to solve that?
My bo server is BO XI3.1 SP1.
BW server is " SAPKW70019 SAP NetWeaver BI 7.0 ".
My question means the same as following Posts :
BEx Query is not shown
" I am facing problem in creating universe on SAP BW BEx Query, here the problem: SAP BW version is 7.0 SP 11 and BusinessObjects version is XI 3.0 and SAP Integration Kit 3.0
I created a new InfoCube in SAP BW under some InfoArea and I created a BEx query on that InfoCube. Now in Universe Designer i am trying to create a new connection on that BEx query, but in the list of objects while creating connection i can see my InfoCube under folder $InfoCube but i can not see my own InfoArea or even Query i created on that InfoCube. Along those i can see some folders like Sales Overview (0SD_C03) and BEx queries under that folder of target 0SD_C03. My doubt is why it is not showing InfoArea and Query which created in BW. "
Thank you very much.
Best Regards,
Howard.
pho:
[http://file.itpub.net/attachment/day_091216/20091216_21a7d983a9bfcd34a0c9eMTYbB9zDfnM.jpg|http://file.itpub.net/attachment/day_091216/20091216_21a7d983a9bfcd34a0c9eMTYbB9zDfnM.jpg]
Edited by: flying on Dec 16, 2009 12:48 PMHI Ingo Hilgefort ,
Thank you very much.
I often see your BLOG, you are very well written.
BO connection CUBE / QUERY. What is the difference then?
Thank you very much.
Regards,
Hoard. -
Currency Conversion at Query Level
Guys,
Can some one tell me step by step procedure to do Currency conversion from USD to Mexican PESO at query level in BI 7.0. I have read lot of threads but not clear in maintaining the Exchange rates and also in creating the variables.
Thank you,
KumarHi Kumar ,,
You're able to convert the currency amount on the routine ...
Using this function :
CONVERT_TO_LOCAL_CURRENCY
Sample:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = " current date.
FOREIGN_AMOUNT = " local currency amount (peso)
FOREIGN_CURRENCY = " local currency
LOCAL_CURRENCY = 'USD'
IMPORTING
LOCAL_AMOUNT = RESULT " result.
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
OTHERS = 5.
To maintain the exchange rate, you can go to tcode: OB08
Hopefully it can help you a lot..
Regards,
Niel
thanks for the points you choose to assign. -
Query level formula is not working for all the amounts
Hi Friends,
In my production system I found new thing that in my query level I done some calculation (as per my requirement I done amount devide by 100 to get correct values)
It is working for all the amounts except 1or 2 amounts, im uploading same source file for all the amountsu2026 why it is happening like this u2026and is there any availability to change those 1 or 2 values at data base tables level or at any pleace (I hope in SAP it is may not possible)u2026can any body tell me why it is happening like this. u2026 because of this issue only my report is pending to sign off u2026.please can any body find the solution ASAP.
Regards,
VENKATAre they non decimal currencies?
If yes, create RKF1 on amount field excluding the currencies for which you are not getting currect values then in CKF or formula as RKF1 / 100. Similarrly create another RKF2 on amount only including the currencies which are excluded in RKF1, create a CKF or formula as RKF2/10000. Then created another formula wich adding CKF1 and CKF2. -
CONNECT BY query doesn't return any results...
Hi All
I am trying to execute this CONNECT BY query...but it does not return any result.
Could anyone please suggests what am I doing wrong. Or how should I modify the query to get the results.
SELECT Distinct dt.DID FROM DEPT dt left outer join EMPLOYEE emp on dt.DID = emp.DID WHERE dt.parentid in (SELECT DEPT.DID FROM DEPT CONNECT BY PRIOR DEPT.DID = DEPT.PARENTID START WITH DEPT.PARENTID in (2000,-2000)) or dt.parentid=2000
Any help would be really really appreciated.
Thanks and Regards
-JosefTake the nested query and run it in SQL developer (or SQL Plus) against the database directly. Does it give any results? That query returning no results is the most likely cause of the problem.
-
WEB BEx Analyzer Comments on Query level
I would like to enable BW users to create comments for some queries an enable other user to read them. System BW 7.01.
Issues and questions:
-how to create comment on query level - it's always on data (KYF), Metadata or Master data level
-I would like to show the document icon - next to the query title (it's relevant for the query)
-when I create Comments (with the button in the standard template), it's on the data level (combination of KYF) - and when I
switch to icon display (settings) I get icons in every line. If this would be just at KYF header??
-where can I edit, delete, ... recorded comments
Thanks, TomHi Tom,
1) If you want to create comments on query level, you need to create metadata documents, object type 'ELEM', object name is the technical name of the query.
2) Document icons are always shown in the data table. Thus it will be hard to show a document icon for a document on query level. If you are using web templates, you can insert a single document item on metadata documents to display the comment on the query.
3) Where the document is displayed depends on the document properties. If a characteristic is document property depends on the infoobject setting -> transaction RSD1 -> enter the characteristic -> tab 'general'.
To see the document properties you can execute the query for example in RSRT (html mode) -> create a new document on any cell. On the bottom you will see the document assignment. Compare this assignment with the cell next to it. If its the same the document will be displayed in both cells. The same can be done for example in java web -> create a new document and switch to the second tab ('BI').
4) Documents can be edited and deleted in the document browser itself, when you open the document in the executed query or in transaction RSA1 -> documents.
Best regards,
Janine -
How to find the date difference in query level?
Hi All,
I have to find the difference between Delivery Date and Posting Date in the query level. Canyou please let me know whether it is possible or not?
Thanks in advance!!
Regards,
Ramanathan.RHello,
If both infoobjects are key figures , then you can do the calculations. Create new formula and do the calculations.
If infoobjects are characteristics, then also you can perform the calculations but you can do this by creating a formula variable using replacement path.
Thanks,
Praveen Tati -
Getting Java error while connect BEx query to WebI report (SAP BI4.0 )
Not able to connect BEx query to WebI report (SAP BI4.0 ) . Below is the error I get while creating a new BEx connection to BOBJ WebI report .
Please find the below error and help me ,
"Select a BW Bex query window box " displayed "Nothing to display " and server error as mentioned below
Java.uti.concurrent.executionException: Com.sap.sl.sdk.repository.service.repositor******
at Java.uti.concurrent.futuretask (Unknown source )
at java.swing.swing.timer.fireactionperformed(Unknown source )
at java.awt.event.invocationEvent.dispatch(Unknown Source)
Thanks ,
Pradeep GorpaduHi,
I am on BO 4.0 SP05 Patch 6. Webi reports are just showing processing but not giving results. When I try to create new report it is throwing java security error.
Tried applet patch upgrade(From link : https://websmp207.sap-ag.de/~sapidb/011000358700000902752013E) for webi certificate but didn't help.
Please suggest what could be done.
Thanks and Regards,
Ankit Sharma -
Good Afternoon everyone,
data is loaded correctly in my infocube thru flat file.but wen i create query on this provider n drill down on one of the object i see different data then cube(field is 'assigned to' which actually store the person's name who the ticket is assigned to but in query it is showing some data which look as some date in single quotes.ex- '20080101').wat can be possible reson for this?
Regards,
DeepikaHi,
You are trying to see a assignne name but u are getting a date.
Thats only possible if the mappings are wrong(identifications) in multicube or u are giving different restrictions at the cube level and at the query level.
The cube is defenately going to contain the values shown in the report for that infoobject.
Again go through the restrictions and filters in the query.
Query will show whatever is in the cube based on the restrictions.
It will not do the conversions as u have said in your case.
If it is a multicube check for the identifications again in the multicube for this charactritics.
It is possible that update rules are correct but the identification in the multicube is incorrect and assignne is mapped to some date.
Thanks
Ajeet
Maybe you are looking for
-
So I keep getting this error when I try to sign in to check my email. It says continue or stop script. i have tried both. I never get to my email. Is there a fix to this problem,
-
URGENT: How to allow ACTIVE X on a particular site?
I am currently troubleshooting a problem for my company. Due to security reasons, we block active X on our proxy server (Sun ONE Web Proxy Server 3.6 UNIX version). We are now blocking ACTIVE X by HTML tags filtering (OBJECT TAG). Is there any way I
-
HT202428 Migrating from iPhoto on iPhone 6
my photo stream and camera roll photos are gone! All my new photos from my Mac won't upload on my cloud either! Grrrr HELP
-
How can i write code for close my application
Hi, I m doing one apps in which i have 2 option and Agree and Quit. When user press Quit then my apps should be close and direct to main page of iphone. My apps should terminate. So anyone know that how can i do that? Thanks.
-
Hello I'm developing a java class that creates a folder in oracle files. The folder is created but i cannot uoload any files into the new folder. even in the oracle files browser interface the "upload file" button and the "create new folder" button a