SQL query as a filter in OBIEE
I have a list of student_ID in a table (say A) and its subset in another table (table B)I want a filter so that only the student_ID in table A that are not in table B are selected.
I'm selecting operator "not equal to / is not" of the student_id in table A and choose the option to SQL query to add value.
Select distinct student_id from DatabaseName.B
His does not work. His error after a large number of minor changes.
Can you help how to solve this problem
Try something like
http://www.cool-bi.com/tweaks/JoinsinAnswers.php
Use not exists or not instead of join.
If brand aid
Tags: Business Intelligence
Similar Questions
-
SQL query to dynamically filter the records-need help
Hello
I have a table with the structure as below
Create table T1
(Number (5) ID,)
Action Varchar2 (20)
)
Here's the table of contents at different points in time and please help me with a query that must dynamically discover the results according to the entries in the table.
First Table contents
1 pending
2 waiting
Result of the query must be
1 pending
2 waiting
After an insert the Table of contents
1 pending
2 waiting
3 ignored
Result
Nothing should be displayed
After an insert the Table of contents
1 pending
2 waiting
3 ignored
4 ignored
Result
Nothing should be displayed
After an insert the Table of contents
1 pending
2 waiting
3 ignored
4 ignored
5 in queue
Result
5 in queue
Thanks in advance!
Best regards
SridharHi, Sridhar,
So you want to show t1 lines that come after the last row with action = "Ignored", which means no output at all during the last row has action = "ignored". (A line with a given id is considered as ' after' a line with a lower id. The line with the highest id is considered the "last" line.)
Is this fair?Here's one way:
SELECT * FROM t1 WHERE id > ( SELECT MAX (id) FROM t1 WHERE action = 'Ignored' ) ;
It's not assume this id is whole consecutive.
If the id is not unique, what results do you want? There is a chance that the above query is already doing if this is not the case, it can probably be changed.
-
Need to SQL query to filter records by limited rows and certain condition
Hello guru (s).
I need a SQL query for help.
For an example table t1 as below, I want to find the maximum of 5 larger, but there should be no more than 2 name of the same position. The "BOLD" is the response of desire.
Name Position size
N1 P1 5
N2 P2 50
N3 P3 500
N4 P1 6
N5 P2 60
N6 P3 600
N7 P1 7
N8 P2 70
N9 P3 700
Thank you.not tested!
select name,position,size, from (select name,position,size, row_number() over (order by size desc) a_count from (select name,position,size, row_number() over (partition by position order by size desc) a_count from your_table ) where a_count <= 2 ) where a_count <= 5
Concerning
Etbin
-
Clarification of the SQL query in 2 day + Guide APEX
I worked through the Oracle Database Express Edition 2 day + Application Express Developer's Guide, and try to decipher the SQL query in Chapter 4 (building your app).
The code is:
SELECT d.DEPARTMENT_ID,
d.DEPARTMENT_NAME,
(select count (*) from oehr_employees where department_id = d.department_id)
"Number of employees", he said.
substr (e.first_name, 1, 1) |'. ' || Select 'Name Manager',
c.COUNTRY_NAME 'place '.
OEHR_DEPARTMENTS d,
E OEHR_EMPLOYEES
OEHR_LOCATIONS l,
C OEHR_COUNTRIES
WHERE d.LOCATION_ID = l.LOCATION_ID
AND l.COUNTRY_ID = c.COUNTRY_ID
AND e.department_id = d.DEPARTMENT_ID
AND d.manager_id = e.employee_id
AND instr (superior (d.department_name), superior (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0)
I don't know exactly what is happening in the last line. I think I understand what the different functions but I'm not clear on the use of the: P2_REPORT_SEARCH string.
What does this string? This code simply checking that d.department_name isn't NA?
I have SQL experience but am not very familiar with the Oracle PL/SQL implementation. Can someone please give me a brief breakdown that check is doing in the context of the overall query? The application seems to work even if the conditional statement is not included.
Thank you.
2899145 wrote:
Thanks for the reply. I apologize if the information I added was incomplete. The code came from the day 2 + Application Express (version 4.2) Developer Guide.
In the section 'your own Application of 4 Buuilding' https://docs.oracle.com/cd/E37097_01/doc.42/e35122/build_app.htm#TDPAX04000 , they describe the creation of a report
page that includes the "manager_id" and 'location_id '. The SQL query, I pasted above extracted from the data in other tables to substitute the real 'name of the Manager' and 'rent '.
for the corresponding ID values. It makes sense, and the part of the SQL query that explicitly doing this makes sense.
However, given that the document is a guide for the development of the APEX, I guess the command:
AND instr (upper (d.department_name), upper (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0
done something valuable, and I do not recognize what is exactly the value.
From a practical point of view why would I need to include this conditional statement? Which only added to the application?
Looking at the guide in question, it is clear that the
AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_SEARCH,d.department_name)))>0
the line is completely unnecessary in the context of this tutorial, and it can be removed. The search in the tutorial app page is implemented by using a report filter interactive rather than a P2_REPORT_SEARCH element, which does not seem to exist at all. (It's a quirk of the APEX that bind variable references to non-existent items are replaced with NULL silently rather than exceptions). I thought that perhaps it would be legacy code a version of the tutorial prior to the introduction of interactive reports at the APEX 3.1, but I can't find explicit instructions to create such an element of filter in the 3.0 tutorial. I guess it must have been automatically generated by the application wizard when you create a standard report page.
If you do not want to see the effect he would have (as described in the post above), leave it in the source report, add a text element of P2_REPORT_SEARCH, and a button "submit" on page 2 and experimenting to find different values of the element and clicking on the submit button...
-
SQL QUERY: operator relational invalid
Hi friends,
I created classic report and create the checkbox for the market and create a filter on the box.
Select I.SBU_CODE, I.MKT_CODE, $m.name, MKT_NAME, D.DIV_NAME,
SUM (DECODE (I.INVOICE_TYPE, 'C', (-1 * NVL(I.GROSS_AMT,0)), NVL(I.GROSS_AMT,0))) CURYR_SALEAMT;
PRVYR_SALEAMT 0,
SUM (DECODE (I.INVOICE_TYPE, "C", 0, NVL(I.EFFECTIVE_PAX,0))) CURYR_PAX;
0 PRVYR_PAX
of ar_invoice_mas i, MARKET_MAS M, AC_DIVISION_MAS D
where nvl(i.active_flg,'N') = 'Y '.
AND NVL(I.CANCEL_FLAG,'N') = N
AND M.SBU_CODE = I.SBU_CODE
AND M.CODE = I.MKT_CODE
AND D.SBU_CODE = M.SBU_CODE
AND D.DIV_CODE = M.DIV_CODE
AND I.SBU_CODE =: P23_SBU_CODE
AND TRUNC (I.INVOICE_DATE) BETWEEN: P23_FROM_DATE AND: P23_TO_DATE
AND (1 = (CASE
WHEN (: P23_MARKET NOT NULL AND (: P23_MARKET = 'ALL'))
THEN 1
WHEN (: P23_MARKET NOT NULL AND (INSTR (': ' |: P23_MARKET |': ',' :'||))) I.MKT_CODE: ':', 1) > 0))
THEN 1
ON THE OTHER
0
(END))
I.SBU_CODE, I.MKT_CODE, D.DIV_NAME, $M.NAME GROUP
When I run above sql query I got an error "invalid relational operator.
I tried to find it, but find it not. Any body could help us.
Thank you
Hi Maxence,
CORINE wrote:
When I run above sql query I got an error "invalid relational operator.
I tried to find it, but find it not. Any body could help us.
Missing you IS controls NOT NULL state in CASE block.
Try this:
select I.SBU_CODE , I.MKT_CODE , M.NAME MKT_NAME , D.DIV_NAME , SUM( DECODE(I.INVOICE_TYPE,'C', (-1* NVL(I.GROSS_AMT,0)), NVL(I.GROSS_AMT,0) )) CURYR_SALEAMT , 0 PRVYR_SALEAMT , SUM( DECODE(I.INVOICE_TYPE,'C', 0, NVL(I.EFFECTIVE_PAX,0) )) CURYR_PAX , 0 PRVYR_PAX from ar_invoice_mas i , MARKET_MAS M , AC_DIVISION_MAS D where nvl(i.active_flg,'N') = 'Y' AND NVL(I.CANCEL_FLAG,'N') = 'N' AND M.SBU_CODE = I.SBU_CODE AND M.CODE = I.MKT_CODE AND D.SBU_CODE = M.SBU_CODE AND D.DIV_CODE = M.DIV_CODE AND I.SBU_CODE = :P23_SBU_CODE AND TRUNC(I.INVOICE_DATE) BETWEEN :P23_FROM_DATE AND :P23_TO_DATE AND ( 1 = ( CASE WHEN (:P23_MARKET IS NOT NULL AND (:P23_MARKET= 'ALL')) THEN 1 WHEN (:P23_MARKET IS NOT NULL AND (INSTR(':'|| :P23_MARKET||':',':'||I.MKT_CODE||':',1) > 0 )) THEN 1 ELSE 0 END )) GROUP BY I.SBU_CODE, I.MKT_CODE, D.DIV_NAME, M.NAME
I hope this helps!
Kind regards
Kiran
-
SQL query problem - (internal has not managed to the outer query)
Hi all:
Here is my SQL query:
Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?SELECT RD.SITE, ROUND( (SELECT COUNT (DISTINCT PB.EMP_ID) FROM BOOK PB WHERE PB.EMP_ID IN (SELECT PB.EMP_ID FROM BOOK PB ) ) / (SELECT COUNT (DISTINCT PB.EMP_ID) FROM BOOK PB WHERE PB.EMP_ID IN (SELECT PB.EMP_ID FROM BOOK PB WHERE MO.QUALIFIER > 4 ) )* 100, 2) AS PERCENTAGE FROM BOOK PB LEFT JOIN POSITION MO ON PB.EMP_ID = PO.EMP_ID INNER JOIN PHYS_LOCATION RD ON MO.HOUSED = RD.SITE_ID WHERE MO.ACTUAL_END IS NULL GROUP BY RD.SITE;
Thank you for your help.AquaNX4 wrote:
Hi all:Here is my SQL query:
SELECT RD.SITE, ROUND( (SELECT COUNT (DISTINCT PB.EMP_ID) FROM BOOK PB WHERE PB.EMP_ID IN (SELECT PB.EMP_ID FROM BOOK PB ) ) / (SELECT COUNT (DISTINCT PB.EMP_ID) FROM BOOK PB WHERE PB.EMP_ID IN (SELECT PB.EMP_ID FROM BOOK PB WHERE MO.QUALIFIER > 4 ) )* 100, 2) AS PERCENTAGE FROM BOOK PB LEFT JOIN POSITION MO ON PB.EMP_ID = PO.EMP_ID INNER JOIN PHYS_LOCATION RD ON MO.HOUSED = RD.SITE_ID WHERE MO.ACTUAL_END IS NULL GROUP BY RD.SITE;
Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?
It's what you're asking. Your subquery scalar to get the percentage is not restricted by the current site. Add columns to filter to restrict the values selected for the calculation
Published by: riedelme on May 8, 2013 07:26
-
Can I use session variables in data model BI publisher SQL query?
Hi Experts,
We apply security at the level of the BI Publisher 11g data.
In OBIEE we do so using session variables, so I wanted to just ask if we can use the same session variables in BI Publisher as well
That is, we can include a where clause in the SQL for the sample data as
Where ORG_ID = @{biServer.variables ['NQ_SESSION.]} {[INV_ORG']}
I would like to know your opinion on this.
PS: We implement security EBS r12 in BI Publisher.
Thank youRead this-> OBIEE 11 g: error: "[nQSError: 23006] the session variable, NQ_SESSION.» LAN_INT, has no definition of value. "When you create a SQL query using the session NQ_SESSION variable. LAN_INT in BI Publisher [ID 1511676.1]
Follow the ER - BUG: 13607750 -NEED TO be able TO SET up a SESSION IN OBIEE VARIABLE AND use it IN BI PUBLISHER
HTH,
SVS -
SQL Query + long running.
Dear gurus/masters/All,
I beg you all to help me with the setting of the SQL query that takes more time. DB version: 10.2.0.4
Query SQL WHERE condition:
Query execution plan:select column1, column2, ......... FROM SIEBEL.S_ORG_EXT T1, SIEBEL.S_PROD_INT T2, SIEBEL.S_VOD T3, SIEBEL.S_ORG_EXT T4, SIEBEL.S_ORG_EXT T5, SIEBEL.S_ORG_EXT_X T6, SIEBEL.S_PROD_LN T7, SIEBEL.S_ASSET_OM T8, SIEBEL.S_VOD_VER T9, SIEBEL.S_CTLG_CAT T10, SIEBEL.S_CONTACT T11, SIEBEL.S_PARTY T12, SIEBEL.S_PARTY T13, SIEBEL.S_PROD_INT T14, SIEBEL.S_ASSET_BU T15, SIEBEL.S_CTLG_CAT T16, SIEBEL.S_ORG_EXT T17, SIEBEL.S_ORG_EXT T18, SIEBEL.S_ASSET T19, SIEBEL.S_ADDR_PER T20, SIEBEL.S_ORG_EXT T21, SIEBEL.S_ASSET_X T22, SIEBEL.S_ASSET T23 WHERE T16.PAR_CAT_ID = T10.ROW_ID (+) AND T14.CG_PR_CTLG_CAT_ID = T16.ROW_ID (+) AND T3.ROW_ID = T9.VOD_ID AND T14.CFG_MODEL_ID = T3.OBJECT_NUM AND T23.OWNER_CON_ID = T11.ROW_ID (+) AND T23.OWNER_ACCNT_ID = T6.PAR_ROW_ID (+) AND T23.PER_ADDR_ID = T20.ROW_ID (+) AND T23.PROD_ID = T14.ROW_ID AND T23.OWNER_ACCNT_ID = T21.PAR_ROW_ID (+) AND T14.PR_PROD_LN_ID = T7.ROW_ID (+) AND T23.ROOT_ASSET_ID = T19.ROW_ID (+) AND T19.PROD_ID = T2.ROW_ID (+) AND T23.BILL_ACCNT_ID = T18.PAR_ROW_ID (+) AND T23.RTNG_DLR_ID = T1.PAR_ROW_ID (+) AND T23.PREF_SRV_DLR_ID = T17.PAR_ROW_ID (+) AND T23.DLR_ID = T4.PAR_ROW_ID (+) AND T23.ROW_ID = T22.PAR_ROW_ID (+) AND T23.ROW_ID = T8.PAR_ROW_ID (+) AND T23.PR_CON_ID = T12.ROW_ID (+) AND T23.BU_ID = T15.BU_ID (+) AND T23.ROW_ID = T15.ASSET_ID (+) AND T15.BU_ID = T13.ROW_ID (+) AND T15.BU_ID = T5.PAR_ROW_ID (+) AND ((T23.SERIAL_NUM IS NOT NULL AND T23.PAR_ASSET_ID IS NULL OR T23.X_PHONE_NUMBER IS NOT NULL AND T23.PAR_ASSET_ID IS NOT NULL) AND (T9.VER_NUM = :1));
PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 967177145 -------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 54117 | 92M| 4435K (1)| 01:58:43 | | 1 | NESTED LOOPS OUTER | | 54117 | 92M| 4435K (1)| 01:58:43 | | 2 | NESTED LOOPS OUTER | | 54117 | 87M| 4261K (1)| 01:54:04 | | 3 | NESTED LOOPS OUTER | | 54117 | 86M| 4154K (1)| 01:51:13 | | 4 | NESTED LOOPS OUTER | | 54117 | 85M| 4111K (1)| 01:50:03 | | 5 | NESTED LOOPS OUTER | | 54117 | 84M| 3980K (1)| 01:46:33 | | 6 | NESTED LOOPS OUTER | | 54117 | 83M| 3937K (1)| 01:45:24 | | 7 | NESTED LOOPS OUTER | | 54117 | 81M| 3763K (1)| 01:40:44 | | 8 | NESTED LOOPS OUTER | | 54117 | 81M| 3751K (1)| 01:40:25 | | 9 | NESTED LOOPS OUTER | | 54117 | 80M| 3621K (1)| 01:36:57 | | 10 | NESTED LOOPS OUTER | | 54117 | 73M| 3515K (1)| 01:34:07 | | 11 | NESTED LOOPS OUTER | | 54117 | 71M| 3410K (1)| 01:31:18 | | 12 | NESTED LOOPS OUTER | | 54117 | 69M| 3410K (1)| 01:31:18 | | 13 | NESTED LOOPS OUTER | | 54117 | 67M| 3410K (1)| 01:31:18 | | 14 | NESTED LOOPS OUTER | | 54117 | 66M| 3410K (1)| 01:31:18 | | 15 | NESTED LOOPS OUTER | | 54117 | 64M| 3324K (1)| 01:28:59 | | 16 | NESTED LOOPS OUTER | | 54117 | 62M| 3237K (1)| 01:26:40 | | 17 | NESTED LOOPS | | 54117 | 57M| 3106K (1)| 01:23:10 | | 18 | NESTED LOOPS OUTER | | 71 | 43665 | 381 (2)| 00:00:01 | | 19 | NESTED LOOPS OUTER | | 71 | 42316 | 323 (2)| 00:00:01 | | 20 | NESTED LOOPS OUTER | | 71 | 41322 | 322 (2)| 00:00:01 | | 21 | NESTED LOOPS | | 71 | 24708 | 265 (3)| 00:00:01 | | 22 | NESTED LOOPS | | 77 | 2772 | 141 (4)| 00:00:01 | |* 23 | TABLE ACCESS FULL | S_VOD_VER | 75 | 1350 | 72 (7)| 00:00:01 | | 24 | TABLE ACCESS BY INDEX ROWID| S_VOD | 1 | 18 | 1 (0)| 00:00:01 | |* 25 | INDEX UNIQUE SCAN | S_VOD_P1 | 1 | | 1 (0)| 00:00:01 | | 26 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 312 | 2 (0)| 00:00:01 | |* 27 | INDEX RANGE SCAN | S_PROD_INT_F9 | 1 | | 1 (0)| 00:00:01 | | 28 | TABLE ACCESS BY INDEX ROWID | S_PROD_LN | 1 | 234 | 1 (0)| 00:00:01 | |* 29 | INDEX UNIQUE SCAN | S_PROD_LN_P1 | 1 | | 1 (0)| 00:00:01 | | 30 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 14 | 1 (0)| 00:00:01 | |* 31 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 | | 32 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 19 | 1 (0)| 00:00:01 | |* 33 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 | |* 34 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 760 | 375K| 43753 (1)| 00:01:11 | |* 35 | INDEX RANGE SCAN | S_ASSET_U2 | 55873 | | 312 (3)| 00:00:01 | | 36 | TABLE ACCESS BY INDEX ROWID | S_ASSET_OM | 1 | 94 | 2 (0)| 00:00:01 | |* 37 | INDEX RANGE SCAN | S_ASSET_OM_U1 | 1 | | 2 (0)| 00:00:01 | | 38 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 1 | 39 | 2 (0)| 00:00:01 | |* 39 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 1 | | 1 (0)| 00:00:01 | | 40 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1 | 29 | 2 (0)| 00:00:01 | |* 41 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | 1 (0)| 00:00:01 | | 42 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 43 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 44 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 45 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 46 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 47 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 48 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 36 | 2 (0)| 00:00:01 | |* 49 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 50 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 139 | 2 (0)| 00:00:01 | |* 51 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 52 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 1 | 16 | 2 (0)| 00:00:01 | |* 53 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 1 | | 2 (0)| 00:00:01 | |* 54 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 | | 55 | TABLE ACCESS BY INDEX ROWID | S_ASSET_BU | 1 | 34 | 3 (0)| 00:00:01 | |* 56 | INDEX RANGE SCAN | S_ASSET_BU_U1 | 1 | | 2 (0)| 00:00:01 | |* 57 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 | | 58 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 1 | 37 | 2 (0)| 00:00:01 | |* 59 | INDEX UNIQUE SCAN | S_ASSET_P1 | 1 | | 2 (0)| 00:00:01 | | 60 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 16 | 1 (0)| 00:00:01 | |* 61 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 | | 62 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 14 | 2 (0)| 00:00:01 | |* 63 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 64 | TABLE ACCESS BY INDEX ROWID | S_ASSET_X | 1 | 93 | 3 (0)| 00:00:01 | |* 65 | INDEX RANGE SCAN | S_ASSET_X_U1 | 1 | | 2 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 23 - filter("T9"."VER_NUM"=TO_NUMBER(:1)) 25 - access("T3"."ROW_ID"="T9"."VOD_ID") 27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM") 29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID"(+)) 31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID"(+)) 33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID"(+)) 34 - filter("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL OR "T23"."X_PHONE_NUMBER" IS NOT NULL AND "T23"."PAR_ASSET_ID" IS NOT NULL) 35 - access("T23"."PROD_ID"="T14"."ROW_ID") 37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID"(+)) 39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID"(+)) 41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID"(+)) 43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID"(+)) 45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID"(+)) 47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID"(+)) 49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID"(+)) 51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID"(+)) 53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID"(+)) 54 - access("T23"."PR_CON_ID"="T12"."ROW_ID"(+)) 56 - access("T23"."ROW_ID"="T15"."ASSET_ID"(+) AND "T23"."BU_ID"="T15"."BU_ID"(+)) 57 - access("T15"."BU_ID"="T13"."ROW_ID"(+)) 59 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID"(+)) 61 - access("T19"."PROD_ID"="T2"."ROW_ID"(+)) 63 - access("T15"."BU_ID"="T5"."PAR_ROW_ID"(+)) 65 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID"(+)) Note ----- - dynamic sampling used for this statement 105 rows selected.
Hello
It is not necessary to display the trace file - everything is clear from the plans that you have posted. The optimizer is the selectivity calculation assuming the absence of correlation between the columns. You can do these calculations that yourself and you see that if the entries are correct and if the hypothesis of lack of correlation is also correct, then the results should be correct, too. Since they are not, it's one of two things: optimizer stats are wrong, or the columns are in fact related.
First of all check the optimizer statistics: i.e. take NUM_ROWS and NUM_NULLS of DBA_TAB_COL_STATISTICS and compare them with the actual rowcounts. If they are correct (in a reasonable error margin), then it means that the columns are correlated, and the optimizer will need additional assistance to obtain right of cardinalities.
Best regards
Nikolai -
IOM sql Query to get the status of the failed task
Hello world
We have an obligation as we need to get the status of a particular task (say Create User in OID - Completed\Rejected status resource) for the particular user. We are able to get the status of the provisioed of resources to the user but not the status of the special mission which is trigerred for the user.can someone put some light on it. We must have the SQL query to do this.
Thanks in advance.
Kind regards
MKNHello
Use this query to get the status of the task, also check the coomentsSELECT USR. USR_LOGIN, OSI. SCH_KEY, ANN. SCH_STATUS, STA. STA_BUCKET OF
OSI, CHS, STA, MIL, TOS, PKG, OUEDRAOGO, USR, OBJ, OST
WHERE OSI.MIL_KEY = MIL.MIL_KEY
AND ANN. SCH_KEY = OSI. SCH_KEY
AND STA. STA_STATUS = SCH. SCH_STATUS
AND TOS. PKG_KEY = PKG. PKG_KEY
AND MIL. TOS_KEY = TOS. TOS_KEY
AND OUÉDRAOGO. USR_KEY = USR. USR_KEY
AND OUÉDRAOGO. OST_KEY = OST. OST_KEY
AND OST. OBJ_KEY = OBJ. OBJ_KEY
AND OSI. ORC_KEY = OUEDRAOGO. ORC_KEY
AND OBJ. OBJ_NAME = "User AD".
AND OST. OST_STATUS = "Provisioning" - filter accordinglly
AND STA. STA_BUCKET = 'pending' - filter accordinglly
AND PKG. PKG_NAME = "AD User" - filter accordinglly
AND MIL.MIL_NAME = 'System' - filter accordinglly Validation
;
Thank you
Kuldeep -
How to use SQL above and PARTITION BY in OBIEE expression builder?
Hello
I want to create a new logical column with the following SQL query.
AMOUNT (inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE) /SUM (Inventory Detail.Qty) ON (PARTITION OF the inventory Detail.A Inventory Detail.B, Item.C)
How to use OVER and the SCORE OF OBIEE expression builder?
Thanks in advanceHi Janet,.
We cannot use by in the Expression builder (DB). But use the same formula like this in Fx to responseAMOUNT (inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE) /SUM (Inventory Detail.Qty) > (PARTITION OF the inventory Detail.A Inventory Detail.B, Item.C)
Sum (Inventory Detail.Qty by detail, Item, MyDate) /SUM (qty by detail, item)
First check the numerator if it worked well or not then go with denominator
compare the results with sql you have
Let me know if it works
Thank you
saichand.vPublished by: André Varanasi on 27 July 2010 21:27
Published by: André Varanasi on 27 July 2010 21:28
-
Need help to reduce the cost of my sql Query below 100 to optimize.
Can you please suggest how to reduce the COST of my SQL query? Is it possible to get the < 100 COST?
My goal:
------------------------
To recover the data of length (a column is in normalised_event: table) corresponding to each type of call (which is to extract the column rc.abbreviation in reference_code: table) in a given range of dates. So I wrote the following as SQL below:
------------------------------------------------------------------------------------------------------------------
Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
Since the rc reference_code, normalised_event not
where to_char (rc.reference_code) = ne.full_path
and rc.reference_type_id = 505002 AND
trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
Rc.abbreviation group
-----------------------------------------------------------------------------------------------------------------
IAM using Toad Software which is taken in charge by oracle 9i.
Explain the plan above query is:
explain plan
Set statement_id = "mp01" for
Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
Since the rc reference_code, normalised_event not
where to_char (rc.reference_code) = ne.full_path
and rc.reference_type_id = 505002 AND
trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
Rc.abbreviation group
Select LPad (' ', 2 *(Level-1)). Level | '.' || NVL (position 0). ' ' ||
Operation | ' ' || Options of | ' ' || Object_name | ' ' ||
Object_type | ' ' || Decode (id, 0, Statement_Id |) "Cost = ' | Position)
"Query plan.
From Plan_Table
Start with id = 0 and Statement_Id = 'mp01 ".
Connect Id Parent_Id = prior
And Statement_Id = 'mp01 ";
---------------------------Query Plan explained is----------------------------------------------------------
1.555 INSTRUCTION SELECT mp01 cost = 555
2.1 TYPE GROUP
3.1 FILTER
4.1 HASH JOIN
5.1 TABLE ACCESS BY INDEX ROWID REFERENCE_CODE
6.1 INDEX RANGE SCAN NON-UNIQUE I_REFERENCE_CODE_REF_TYPE
5.2 PARTITION RANGE ALL THE
6.1 TABLE ACCESS FULL NORMALISED_EVENT
-Automatic tracking of the SQl query is:.
recursive calls - 0
DB block gets - 0
compatible gets - 174
physical reads - 0
size - 104
Parse count (hard) - 0
Parse count (chess) - 0
run the County - 2
bytes sent via SQL * Net to dblink - 0
bytes received via SQL * Net from dblink - 0I was wrong. Once again, this shows how it is dangerous to assume (I assumed that FBI was new in 10g because it is when I used them), and the power of the community to ensure that accurate information is provided.
John
-
Œuvres SQL query to MS SQL Server 2008, but not when you use the database kit
I have this SQL query:
DECLARE TABLE (@DataTypeTable)
Name varchar (128).
TypeID INT)-Add comma delimeted type data in the temporary table names
INSERT INTO @DataTypeTable (name)
SELECT * from WhatWeShouldDoRead.func_Split (@DataTypeTrimmed, ',')SELECT the name OF @DataTypeTable
That takes a comma delimited by the string and returns the string as a table. It works correctly in Microsoft SQL Server Management Studio. When I run this as a stored procedure I return nothing. There are no errors, SQL or otherwise. I checked that I am connected to the correct database and the stored procedure is responsible without changing any error chain which is reported of this stored procedure (that code is not shown in the example above). Has anyone seen this problem before, or have experience with SQL/Labview interfaces to tell me what I am doing wrong?
Thanks in advance.
-
HI HI... I'm a student doing a project related to labview. My task is to create a vi, type a user name and password to continue the whole VI.
As I am a newbie to SQL query language, can anyone help me this?... This isn't like the VI with password lock
There is a connection of the user called button in my main façade... u by clicking on it, a pop-up window will come out asking you a user name and a password. If the user name and the password is correct, then you can proceed. The problem is that I'm stuck with database...
Help me pls!with respect,
Ray
Hello
You have two cases:
(1) connect to the database with string (link a string of connection information), and then type something like this:
Driver is SQL Native Client;. Server = IP. Add.re.SS; UID = username; PW = *** ; Database = MyDatabase (depends on your database)(2) use a UDL file (you can configure it to connect to your database, with specific format). Remember that the connection is successful with test button.
There is a UDL file that you can edit here: C:\Program NIUninstaller Instruments\LabVIEW 2010\examples\database\Labview.udl
Edit: The connection dropped, you can set the path to an mdb file, and I think you can give the path of your accdb file.
Kind regards
-
I am trying to execute the following SQl query, SELECT * failure WHERE ID = '123 ' AND RepairAction =' '; using the DB tools run Query.vi. This query never find record in my database. My database contains a record where the registered ID contains the value '123' and the RepairAction field is an empty string. If I remove the declaration 'AND RepairAction' ';' my query text, the record is found. I think my problem is that I do not use the correct syntax to describe and an empty string. I tried the following: "," ",""," "and NULL as empty and none of these work string arguments.
I was hoping someone might be able to tell me what the correct syntax is an empty string or if there is another approach that I take.
Thanks in advance for your help,
Jim
Jim,
Just to be sure, have you used 'is' instead of '=' in this command?
This makes all the difference in this command.
Cerati
-
Support of SQL query: what tasks are Sunday from 07:00 - 12:00
Hello tide Admins.
I need to do a SQL query that can give me a list of jobs that are running on a given (Sunday) day from 07:00 - 12:00. Our environment is not a maintenance window. Therefore, whenever there is application of patches or upgrades, it causes more work and risk of failure of the tide tasks. By moving jobs over the period from 07:00 - 12:00 Sunday, patch can be completed without disrupting the calendar.
Im not the best at the SQL script and can not get my script to work. any help would be great. Here's what I have so far. I get the error ' could not find identifier multi-player jobmst.jobmst_name. IM using Tidal 6.0.3 with SQL for DB Admeral table.
SELECT dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name
FROM dbo.jobdtl INNER JOIN
dbo.jobmst ON dbo.jobdtl.jobdtl_id = dbo.jobmst.jobdtl_id
WHERE (dbo.jobdtl.jobdtl_fromdt > 14 September 2016 06:00 ') AND (dbo.jobdtl.jobdtl_fromdt< '09/11/2016="" 012:00:00="">
GROUP OF dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name
Hi Jeff
The time window from the jobdtl returns only jobs that have an early start time and windows of time from beginning to the end, so there may be some tasks which are not time bound but have dependencies on other jobs, variables, etc.
Here are the 2 SQL queries against the table jobrun and jobmst:
-The list of jobs that took place last Sunday between 07:00 and 12:00
SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_time FROM jobrun
JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
WHERE jobrun.jobrun_time > = 9/11/2016 07:00 ' and jobrun.jobrun_time<= '9/11/2016="" 12:00="">=>
ORDER BY jobrun.jobrun_time-For a list of jobs that are scheduled to run on Sunday to come between 07:00 and 12:00
SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_esttime FROM jobrun
JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
WHERE jobrun.jobrun_esttime > = 9/18/2016 07:00 ' and jobrun.jobrun_esttime<= '9/18/2016="" 12:00="">=>
ORDER BY jobrun.jobrun_esttimeARO
The Derrick
Maybe you are looking for
-
How to get rid of a virus on my computer.
I have a virus on my computer. When I go on a site like Kiva or ebay (sites that sell something), I get a pop up and can not proceed. How can I get rid of this?
-
AT300 - area on the touch screen, pick up ghost keys
Hi people, I'm having a problem with my Tablet AT300 where it that takes the touchscreen touches - many of them - in a place where it is not to be touched. When I turn it on, it starts to go crazy with the vibrations repeated thought to touch screen
-
Is upgrading to Windows 7 for Windows XP
I want to put Windows 7 on my Windows XP desktop. I have Windows 7 on my laptop and need to work together on a network. I read a lot of comments saying that Windows7 Upgrade would be a good choice. Is this true? I don't want to put all that money
-
I do volunteer work for the local United way and trying to get some laptops given to work for health care support under privileged community. The machines are Lenovo T500. The donor wiped hard drives to protect their information and I need to get a
-
Only 200 NAS with 2 drives - maps
Hello I have the 200 NAS with 2 separate drives and turned on for a while now. I recently formatted one of my computers (Windows XP) and built a new machine (WIN7). For some reason when I run the utility on a system drive mapping, that a single playe