RegExp in a case of join internal
Hi, I was expecting assistance regarding tent to match values using regexp because currently I seem to get an error. I created a set of dummy tables to give an idea of the problem that I am facing and here is the table create and insert the codes.
CREATE TABLE "BAS_USERS" ( "UID" VARCHAR2(20 BYTE), "FIRSTNAME" VARCHAR2(255 BYTE), "LASTNAME" VARCHAR2(255 BYTE) ) Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('123456789','Humpty','D'); Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('987654321','Mickey','M'); Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('543212345','Minnie','M'); CREATE TABLE "BAS_USERS_LOG" ( "NOTES" VARCHAR2(255 BYTE) ) Insert into BAS_USERS_LOG (NOTES) values ('TASK WAS ASSIGNED BY Humpty D (123456789) TO Mickey M (987654321) '); Insert into BAS_USERS_LOG (NOTES) values ('TASK WAS FETCHED BY Minnie M (543212345) ');
What I'm trying to do is to try to take the name of the value of the field notes in my table of bas_users_log and try then to match it by using the CONCATENATE function to combine the first and last name, but for some reason that I get the following error:
ORA-00920: invalid relational operator 00920. 00000 - "invalid relational operator" *Cause: *Action: Error at Line: 12 Column: 5
The SQL Code I wrote is this:
SELECT * FROM BAS_USERS_LOG B INNER JOIN BAS_USERS D ON CASE WHEN (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 8) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 9))=' ' THEN (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(b.NOTES)),'-',''), '[A-Z]+', 1, 5) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 6)) ELSE (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 8) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 9)) END AS B.PERSONNAME =(trim(UPPER(D.FIRSTNAME))|| ' ' ||trim(UPPER(D.LASTNAME))) ;
Would appreciate it if someone could please advise where I'm wrong.
Thanks in advance.
just get rid of the column alias in your join condition (AS B.PERSONNAME)
HTH
Tags: Database
Similar Questions
-
Help! How to use a join internal?
I like to use Coldfusion, but my coding knowledge is Basic. I do not understand to coding of inner join. By using the code below, I can get (bar code) Column1 and Column2 (quantity). How can I use inner join to get columns with product_name, and the price of another table (inventory - based on the same number of barcodes in both tables) so that I can insert ALL four fields in a new table (cart1)
<!-FIND DUPLICATES AND SUM AMOUNT->
< cfquery name = "CountBarcodesTemp" datasource = "inventory" >
SELECT the barcode, Sum (Quantity) as the quantitysum
TEMP
GROUP BY barcode
< / cfquery >
-Thank you.
Okay, one thing to consider here is that this is a forum for CF, and ask yourself a question of SQL. Is not really to be best place to be direct SQL questions (which is not to say you won't get a response, but it is not really appropriate for these forums).
There is not much use of INNER JOIN. It is simply this:
SELECT [your columns here]
FROM table1 INNER JOIN table2
ON table1.someCol = table2.someOtherCol
Where someCol and someOtherCol represent a relationship between two tables; in your case, it seems that the barcode ID is the column that links the two tables, the join statement so along the lines of
THE INNER JOIN inventory temp
ON temp.barcode = inventory.barcode
That said, it does for SQL more readable if you alias your tables too, for example:
SELECT t.somerCol, i.someOtherCol
I have TEMP t INNER JOIN stock
ON i.barcode = i.barcode
Whenever you want to reference the tables later, you use the alias, not the name of the table.
I think you should probably search the docs online for any DB that you use and give them a reading. Or buy a SQL Tutorial book and through, or something, too much work.
--
Adam
-
Complex Inner Join and outer subquery where clause to join internal?
The DDL for this post was too big and I had to put on my site:
http://www.harbortownsolutions.com/DDLForDORTable.txt
My goal is to create a report of sales data for 116 stores containing daily sales and count of comments in recent years. My challenge is that I am pulling data from the same table, but with different dates to get data from last year and the week in data from date of last year.
The dates used for reports are:
SalesDate = 06/04/2009
SalesDateForLastYear = 2008-06-05
SalesDateBeginningOfWeek = 01/06/2009
SalesDateBginningOFWeekLastYear = 2008-06-02
PSEUDOQUERYS:
Question: Since they all use the same store of nbrs, I specify on each request? Can't I just specify only once on outer query Where clause?---======= DOLLAR VARIANCE = You Said you have $100 worth of meat(inventory) but you only have $50 worth of meat SELECT BUSI_DATE as BusinessDate, ORACLE_KEY as StoreID, FIELD1 as Sales, FIELD2 as GuestCount, FIELD3 as DollarVariance, FIELD4 as Cars FROM MYDAILYTOTALS WHERE Busi_date = SalesDate AND ORACLE_KEY IN (SELECT StoreID From MyStores); -======= ONLY Guest count and Sales are needed in comparisons against last year ---====== Last YEar dates = corresponding dates for this year ie Tuesday of this week matched to Tuesday of last year (except for leap year) SELECT ORACLE_KEY as StoreID FIELD1 as SalesLastYear FIELD2 as GuestCountLastYear FROM MYDAILYTOTALS WHERE Busi_date = SalesDateForLastYear AND ORACLE_KEY IN (SELECT StoreID From MyStores); SELECT ORACLE_KEY as StoreID SUM(FIELD1) as WeekToDateSales SUM(FIELD2) as WeekToDateGuestCount FROM MYDAILYTOTALS WHERE Busi_date BETWEEN SalesDateBeginningOfWeek and SalesDate AND ORACLE_KEY IN (SELECT StoreID From MyStores) GROUP BY ORACLE_KEY --======= SELECT ORACLE_KEY as StoreID SUM(FIELD1) as WeekToDateSalesLastYear SUM(FIELD2) as WeekToDateGuestCountLastYear FROM MYDAILYTOTALS WHERE Busi_date BETWEEN SalesDateBeginningOfWeekLastYear and SalesDateLastYear AND ORACLE_KEY IN (SELECT StoreID From MyStores) GROUP BY ORACLE_KEY
Also, how would fit the following of HOEK script:
See how I put 1 field based on another field value
He reads a record for each store of 116 stores in the database. There are 2 situations that have been addressed by Hoeks code:
For each of the 116 stores in the store table, there must be 1 and only
registration of 1 stock to match the record of MyStoreTotals. However, sometimes there is no record of inventory.
and sometimes there will be 2 (in a case where a manager of database updates)
After daily treatment) files. If so, the record with Is_posted = 1
is the one that should be included in the query. The following text accomplishes this:
-chr (39) is the single quote
Can I put this request on the place where clause of the outer to query I put on a JOIN clause?Select StoreId, DollarVariance from (select store.storeid, case when inv.storeid is null then 'None' when inv.is_posted = 0 then 'NP' else chr(39)||inv.total_dol_var||chr(39) end as DollarVariance, row_number() over (partition by store.storeid order by inv.is_posted desc) rn from myInven inv right outer join mystores store on store.storeid = inv.fk_str_main_id and inv.busi_date = to_date(SalesDate, 'dd-mon-yyyy')) where rn = 1;
So I guess that's why you used the MAX.
That is right.
I used CASES to identify and complete the necessary columns since the first set of results (WITH).
So then I more or less "swivels somehow" lines of this result set to the columns, each store will appear once the most. -
I have the following table.
with the following insert statementcreate table table_g ( zone_id varchar2(30), zone_quantity number(5));
I also have another table called table_gforceinsert into table_g (zone_id, zone_quantity) values ('AA',5); insert into table_g (zone_id, zone_quantity) values ('BB', 6); insert into table_g (zone_id, zone_quantity) values ('CC', 7); insert into table_g (zone_id, zone_quantity) values (' ', 5); insert into table_g (zone_id, zone_quantity) values (v_zone_id, v_zone_quantity);
who has filled with the following insert statementcreate table table_gforce ( gforce_zone_id varchar2(30), describe varchar2(30), user_name varchar2(30));
now, I'm doing an inner join by using the following statementinsert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-range', 'john'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('BB', 'mid-long', 'kris'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('CC', 'mid-short', 'Henry'); insert into table_gforce (gforce_zone_id, describe, user_name) values (' ', 'mid-=field', 'zack'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('DD', 'mid-period', 'melissa'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('VV', 'mid-distance', 'frank'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-location', 'graham'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-vision', 'ethnic'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-class', 'veronica'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-power', 'placement'); insert into table_gforce (gforce_zone_id, describe, user_name) values ('AA', 'mid-keeper', 'rant');
However, even if I have the following question... I need to change my inner join so that she joined on AA with AA, BB with BB, CC with CC and ' ' with everything else. How to do that. Thank you.select p.zone_quantity, y.describe from table_g p inner join table_gforce y on p.zone_id = y.gforce_zone_id;
Published by: user13328581 on August 30, 2010 09:24Hello
Whenever you have a question convcerning an error, display the full error message, including the line number and the complete code I got the error.
Whenever you have any questions, tell what version of Oracle you are using. The statement I posted works in Oracle 10.1.0.2.0.
If you are using a very old version of Oracle, you may need to re - write the WITH clause as a point of view online. In other words, instead ofWITH got_r_num AS ( ... ) SELECT ... FROM got_r_num WHERE ...
say:
SELECT ... FROM ( ... -- what had been in the WITH clause goes here ) WHERE ...
-
In any case to join Microsoft Works Word for e-mail?
I don't have microsoft office. Without a job. Anyway is to attach a Microsoft word document to my email?
If you have a Word on your PC document, even if you don't have Word itself, simply create a new e-mail message and attach the document. Your recipients with Word will be able to read it.
You, too, can read if you download and install the Microsoft Word Viewer free offers. Alternatively, you can change if you want if you download and install OpenOffice. http://www.OpenOffice.org/
Brian Tillman [MVP-Outlook]
-
I run a query that retrieves all the data from the selected use but I want to only show 1 of each.
Example1
Select the activity you want to match to devastate.
Coating - employee training
Printing - Infinity control
Printing - Infinity control
Printing - Infinity control
Example 2
Select the activity you want to match to devastate.
Coating - employee training
Printing - Infinity control
The current query shown in example 1 and my boss wants to example 2 illustrated the ideas?Select distinct
-
The following query returns the results but now I use with a fixed number of id research but now search ID varies. can someone explain me to write this sql statement
Lookup ID may vary and there is no limit. Is there a way to do it and it affect the performance?--search ids 1,6,2 Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 1 and d.id = 6 union Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 1 and d.id = 2 union Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 6 and d.id = 1 union Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 6 and d.id = 2 union Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 2 and d.id = 1 union Select d.name, d.comp, c.name, c.comp, a.model from car_model a, car_Type c, Car_Type d Where c.id = a.carID and d.id = a.CarModelID and c.id = 2 and d.id = 6 --search ids 1,6,2,4 --select statement is same, only select criteria differs c.id = 1 and d.id = 6 c.id = 1 and d.id = 2 c.id = 1 and d.id = 4 c.id = 6 and d.id = 1 c.id = 6 and d.id = 2 c.id = 6 and d.id = 4 c.id = 2 and d.id = 1 c.id = 2 and d.id = 6 c.id = 2 and d.id = 4 c.id = 4 and d.id = 1 c.id = 4 and d.id = 6 c.id = 4 and d.id = 2
Thank you
Published by: user8708731 on Sep 17, 2009 11:54
Published by: user8708731 on Sep 17, 2009 18:09Hello
Sorry, I don't understand something. Please point out where I was wrong.
(a) the data of car_model are the same as you posted it about 52 hours, including these 5 rows?
INSERT INTO "CAR_MODEL" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '1', '6', '12'); INSERT INTO "CAR_MODEL" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '1', '6', '13'); INSERT INTO "CAR_MODEL" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '12'); INSERT INTO "CAR_MODEL" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '34'); INSERT INTO "CAR_MODEL" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '45');
(b) car_model_2 data that you posted in your last message, 24 hours, including
INSERT INTO "CAR_MODEL_2" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '1', '6', '21'); INSERT INTO "CAR_MODEL_2" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '1', '6', '31'); INSERT INTO "CAR_MODEL_2" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '13'); INSERT INTO "CAR_MODEL_2" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '23'); INSERT INTO "CAR_MODEL_2" (GROUPID, CARID, CARMODELID, MODEL) VALUES ('11', '6', '1', '44');
(c) rows in these match two table if they have the same carid and carmodelid.
(d) the output may contain all distinct pairs of matching rows where carid and carmodelid are in the whole of the given parameters.
e the correct output of the examples of data and settings (1, 6) is
corolla Toyota ls350 lexus 12-12 <-- is this really 12-12, or did you mean 12-21? corolla Toyota ls350 lexus 13-31 ls350 lexus corolla Toyota 12-13 ls350 lexus corolla Toyota 34-23 ls350 lexus corolla Toyota 45-44
Where it is clear that I do not understand something. If a, b, c and d above are correct, the output would be:
corolla Toyota ls350 lexus 12-21 corolla Toyota ls350 lexus 12-31 corolla Toyota ls350 lexus 13-21 corolla Toyota ls350 lexus 13-31 ls350 lexus corolla Toyota 12-13 ls350 lexus corolla Toyota 12-23 ls350 lexus corolla Toyota 12-44 ls350 lexus corolla Toyota 34-13 ls350 lexus corolla Toyota 34-23 ls350 lexus corolla Toyota 34-44 ls350 lexus corolla Toyota 45-13 ls350 lexus corolla Toyota 45-23 ls350 lexus corolla Toyota 45-44
You want only one line of output for each row in car_model?
You want only one line of output for each row in car_model_2?
If either is, how do you decide which line in car_model matches car_model_2? In other words, these three ranksls350 lexus corolla Toyota 45-13 ls350 lexus corolla Toyota 45-23 ls350 lexus corolla Toyota 45-44
seems just as valid for me. Why do you want only the last of these three?
-
In case assistance and joins in the update statement
Hi all
I need to update a column in my table... but we must make case and joins... I wrote the application and it does not work
I get a msg of error saying... the command SQL not completed correctly...
I'm not good at SQL... Help, please...
Update t1 a
Set a.name2 =
(case
When "1" then b.msg2 ("bingo")
When b.msg2 in ("andrew"), then "2"
When b.msg2 in ('sam') then "3"
else ' 4'
end)
T1 left outer join t2 b
We a.name1 = b.msg1;
Waiting for the help on this...!
Thanks in advance... :)Please try this one I posted just to the top message from William.
-
all internal matter on the manipulation of join.
Hello all;
I have these two different dataset below
second seriesID test A 20 B 9 C 3 D 8 E 14 F 9
Now I wish that this wholeID Fail_test B 1 C 1 E 1 F 3
I tried to use the join internal ID for both sets, but which will leave a and d... What type of join can use... Any help is appreciated. Thank you.ID Test Fail_test A 20 0 B 9 1 C 3 1 D 8 0 E 14 1 F 9 3
HI - try this:
select id, test, fail_test, (test-fail_test) as Pass from ( select s1.id, s1.test, nvl(s2.fail_test, 0) fail_test from first_set s1 left join second_set s2 on s1.id = s2.id; ) p
Thank you
-
Error "Command not properly ended SQL" CASES
This error is driving me crazy... I have read several threads and google it so much, I am sure its obvious that miss me, but can someone help to point out? I get the not properly completed "SQL command" error and its location the | just before the case statement. Here's my request, I haven't posted a CREATE TABLE because I think it's just my syntax is incorrect?
SELECT
f.CT_ID,
f.BUSINESS,
f.CT_DS,
d.ETL_DT,
d.ACTIVITY_DT,
d.MINUTE_KEY,
d.FCST_CONTACTS_RECEIVED
Of
(LIGHTHOUSE. IEX_CT_DIM b
JOIN INTERNAL LIGHT. D THE IEX_CTACTIVEFORECAST (b.CT_KEY = d.CT_KEY))
JOIN INTERNAL LIGHT. TBL_GEN_CT_BUSINESS f
WE (f.CT_ID = b.CT_ID)
|| CASE WHEN F.CT_DS = END "THI Spanish' THEN 'MODERATE_NR' AND
(f.BUSINESS IN ('THI_PL', 'THI_ESC')) AND
(d.ACTIVITY_DT BETWEEN TO_DATE)
27 January 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")
AND TO_DATE)
27 April 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")) AND
(f.EFF_DT = TO_DATE)
29 January 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")) AND
d.ETL_DT = (SELECT
MAX (ETL_DT)
Of
LIGHTHOUSE. IEX_CTACTIVEFORECAST
WHERE
ACTIVITY_DT = d.ACTIVITY_DT AND
CT_KEY = d.CT_KEY AND
MINUTE_KEY = d.MINUTE_KEY)
Means, you try to select ct_ds. If ct_ds = "Spanish THI", then you must replace that Word with "Moderate_nr". If it is put like this the case statement in the selection as list below
SELECT
f.CT_ID,
f.BUSINESS,
DECODE (F.CT_DS, 'Spanish THI', 'MODERATE_NR',F.CT_DS) ct_ds,.
d.ETL_DT,
d.ACTIVITY_DT,
d.MINUTE_KEY,
d.FCST_CONTACTS_RECEIVED
Of
(LIGHTHOUSE. IEX_CT_DIM b
JOIN INTERNAL LIGHT. D THE IEX_CTACTIVEFORECAST (b.CT_KEY = d.CT_KEY))
JOIN INTERNAL LIGHT. TBL_GEN_CT_BUSINESS f
WE (f.CT_ID = b.CT_ID)
(f.BUSINESS IN ('THI_PL', 'THI_ESC')) AND
(d.ACTIVITY_DT BETWEEN TO_DATE)
27 January 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")
AND TO_DATE)
27 April 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")) AND
(f.EFF_DT = TO_DATE)
29 January 2014 00:00:00 ',
"MM/DD/YYYY hh24:mi:ss")) AND
d.ETL_DT = (SELECT
MAX (ETL_DT)
Of
LIGHTHOUSE. IEX_CTACTIVEFORECAST
WHERE
ACTIVITY_DT = d.ACTIVITY_DT AND
CT_KEY = d.CT_KEY AND
MINUTE_KEY = d.MINUTE_KEY)
Post edited by: 000000
-
Hi, I'm new to OBIEE 10 G.
I have a DimA (dimension), memoirs (fact). I traced the foreign key relationship between DimA and briefs on DimA.A = FactA.A MDB, the relationship is internal and greyed out, so I can't change it to outer join.
So in the report answers, it only shows data for the inner join of the two tables. What I want is to show all items in DimA and associated items FactA or 0 for those not related.
I posted a similar question here before https://forums.oracle.com/thread/2596618
But I can't always change the relationship (still dimmed) even though I opened a deposit in offline mode.
And what I think is is an option in responses to dynamically control the join (internal or external). For example, sometimes I want to show only paired DimA and FactA, sometimes all the DimA and related FactA or 0, so that I do not change the repository MDB every time if the requirement is changed.
What is the best practice in this case?
Thank you.
Try opening the SPR OFFLINE, or to open in mode online and starting then other CASES it would be gray.
If you have trouble sending the RPD to sveerava at gm
-
joins REGEXP_LIKE and indoor/outdoor...
Today, I came across a weird behavior 11 GR 2 (running on AIX).
Please see the text for more details (displayed as follows to the top).
When I performed a join between a table with content based user (integral parts of supply) and a base table (parts available) so that the parties must carry out a special regular expression, he showed that the same query is faster when you use an outer join the join internal (about 0.7 second vs. 20 sec; makes me believe regexp_like malfunction when there is an inner join).
No explanation for this funny behavior?
To get things straight, I tried the same statement with a standard such as (but not fulfilling the same conditions).
This time performance was expected (inner join outperforming outer join).
Thanks in advance for any input.
Published by: stueckl on 30 July 2012 14:22 - Add some requested information
Version information for Oracle
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
-----
Some information about the tables involved:
-both have actual statistics (less then a week old)
-the BundlePart table contains about 19 entries pumped (with a PK of four columns)
-the part table has about 840 entries pumped (with the Teile_Id as PK)
-each entry in BundlePart is a foreign key reference (Part_Id) at the game table
-the column involved in regexp_like has a secondary key (even if it can't be used here, I guess).
Explain the Plans ... I hope that no matter that these are 'old fashioned'..., preferred exit plans SQuirreL SQL-Developer because of easier export (and more information)
left-regexp
Inner-regexp# Operation Options Object Name Mode Cost Bytes Cardinality 0 SELECT STATEMENT ALL_ROWS 2157 25 1 1 SORT AGGREGATE 25 1 2 FILTER 3 HASH JOIN OUTER 2157 387125 15485 4 INDEX FAST FULL SCAN ZCBSPART_BUPA_4X ANALYZED 10 92910 15485 5 TABLE ACCESS FULL ZCBRPART_PART ANALYZED 2142 15896711 836669
As far as I see, the implementation plan for the "inner join" shows not so much cooler than outside (but why everything is an inner join does it cost more?) ...0 SELECT STATEMENT ALL_ROWS 2165 25 1 1 SORT AGGREGATE 25 1 2 HASH JOIN 2165 387125 15485 3 INDEX FAST FULL SCAN ZCBSPART_BUPA_4X ANALYZED 10 92910 15485 4 TABLE ACCESS FULL ZCBRPART_PART ANALYZED 2154 794827 41833
The execution plan for both "dislike" is the same and (surprisingly ;-)) similar to "external-regexp".)
I hope that the sample data are not necessary because it would take a lot...
PS: this is the second time I fell on the phenomenon of "better plan for the worst but the execution time"...: o
-
Get the error invalid identifier in the left outer join
I wrote a query and get the invalid identifier error during execution:
the exact error is: ORA-00904: "D". "" ACCT_NO ": invalid identifier
This query is not able to access the parent table alias in the subquery of the left outer join.
This is the query:
SELECT D.PROD_DESC_TX, BASE. ASSET_NUM, BASE. PROD_ID, BASE.NAME
OF TABLE1 D
LEFT OUTER JOIN
(
SELECT ASSET_NUM, PROD_ID, B.SID
FROM TABLE2 E
JOIN IN-HOUSE TABLE3 HAS IT E.PROD_ID = A.ROW_ID
JOIN INTERNAL TABLE 4 C ON A.PAR_PROD_INT_ID = C.ROW_ID
INTERNAL TABLE5 JOIN B ON C.ROW_ID = B.PAR_ROW_ID
AND B.TYPE = 'VALUE '.
AND B.NAME = 'VALUE '.
WHERE E.ASSET_NUM = ((CASE WHEN LTRIM (RTRIM (D.BANK_NO)) = '021 ' THEN '021' ELSE ' 020' END) |) LTRIM (RTRIM (D.APPL_CD)). LTRIM (RTRIM (D.ACCT_NO)))
) BASE ON ((CASE WHEN LTRIM (RTRIM (D.BANK_NO)) = '021 ' THEN '021' ELSE ' 020' END) |) LTRIM (RTRIM (D.APPL_CD)). LTRIM (RTRIM (D.ACCT_NO))) = BASE. ASSET_NUM
WHERE D.BANK_NO = 'VALUE '.
AND D.APPL_CD = 'VALUE '.
AND D.ACCT_NO = 'VALUE '.
Edited by: user648525 13 Sep, 2011 01:21I can easily look at your request at this time (using my iPhone on a train).
But trying out this line in the WHERE (the one with the invalid reference) clause in the main query.
Who is... in the view of inline, use only the logic of the join (the clauses).
Overflow the filtering logic (WHERE clause) to the main request. You may need to select some additional inline view columns to make these references work.
-
Functions of outer join left as simple join
I created two views SCO_REQGROSSLINES_V and SCO_REQLINESCOMPLETE on Oracle applications tables base. Our company applies the following identity rules: the gross number of rows is always greater than or equal number of demand lines. (Full, I mean delivered.)
Each view has a key named DATESUBINV_KEY built a date of the operation and the code subinventory using this logic:
TO_CHAR (TRUNC (transaction_date), 'YYYYMMDD') | subinventory_code
On 03-SEP-2010 a user has created a demand with a line item for the material of the HEAT subinventory who did not. This row is returned in the result set when I ask about SCO_REQGROSSLINES_V but does NOT return when I ask about SCO_REQLINESCOMPLETE. So far so good.
When I run either of the left outer joins following, I don't get the line for the line for HEAT subinventory 03-SEP-2010:
Select rgl.trxn_date
rgl.subinventory
rgl.line_count gross_line_count
rgl.ext_prc gross_value
rlc.line_count lines_filled
rlc.ext_prc lines_filled_value
of SCO_REQGROSSLINES_V vö outer join left sco_reqlinescomplete_v rlc
ON rgl.datesubinv_key = rlc.datesubinv_key
where vo. TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
order of rgl.trxn_date, rgl.subinventory
Select rgl.trxn_date, rgl.subinventory
rgl.line_count gross_line_count
rgl.ext_prc gross_value
rlc.line_count lines_filled
rlc.ext_prc lines_filled_value
of SCO_REQGROSSLINES_V vo
sco_reqlinescomplete_v rlc
where vo. TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
AND rgl.datesubinv_key = rlc.datesubinv_key (+)
order of rgl.trxn_date, rgl.subinventory
Question: Why the left outer joins is would work as a simple join on DATESUBINV_KEY? Do the keys function differently from the keys defined in the data dictionary views? If they do how these keys work as data dictionary keys?Hello
The WHERE clause is applied after the outer join is complete. In your example, Vo will be in the game even if they have no match in rlc. In this case, all columns of rlc will be NULL.
Okay, so you have these lines containing data from vo but NULL values, where the rlc data was supposed to go. Now it's time to start the WHERE clause. You then apply that conditions in the WHERE clause:AND rlc.trxn_date BETWEEN ...
NULL is between what whether, if the line the prodeuced the outer join is rejected.
All the columns in involivn conditions of rlc probably needs to be part of the join condition, not the WHERE clause.
For example, in you first ask the FROM and WHERE clauses can be:FROM sco_reqgrosslines_v rgl LEFT OUTER JOIN sco_reqlinescomplete_v rlc ON rgl.datesubinv_key = rlc.datesubinv_key AND rlc.trxn_date BETWEEN TO_DATE ( '29-AUG-2010' , 'DD-MON-YYYY' ) AND TO_DATE ( '04-SEP-2010' , 'DD-MON-YYYY' ) WHERE rgl.trxn_date BETWEEN TO_DATE ( '29-AUG-2010' , 'DD-MON-YYYY' ) AND TO_DATE ( '04-SEP-2010' , 'DD-MON-YYYY' )
Always use (at least) two arguments when calling TO_DATE.
Conditions that involve only VO can be in the WHERE clause, but if all the rlc conditions in the WHERE clause, then the effect will be the same as a join internally.
It is no difference between tables and views (or subqueries) in this regard: the same thing would happen, whether it is vo and rlc really tables or not.
-
Definition of a join in a join within the view object
I have an instance where I try to do joins in joins. The SQL is down, although it does not run. My questions are, what suggestions you have for this clean? Also, more important, I want to have the inner joins within the inner joins, within the view object. I can set the join type in the source of the VO, but what would be the type of instruction with the inner join internal?
Of MOT_QM_TERRITORY_QUOTAS TerritoryQuotaEO
INNER JOIN MOT_TERRITORIES AS TerritoryEO ON TerritoryQuotaEO.TERRITORY_VERSION_ID = TerritoryEO.TERRITORY_VERSION_ID
(INNER JOIN MOT_TERR_RESOURCES AS TerritoryResourceEO ON TerritoryEO.TERRITORY_VERSION_ID = TerritoryResourceEO.TERRITORY_VERSION_ID)
(INNER JOIN HZ_PARTIES AS PartyPEO ON TerritoryResourceEO.RESOURCE_ID = PartyPEO.PARTY_ID,)
INNER JOIN HZ_PARTIES AS PartyPEO1 ON TerritoryResourceEO.RESOURCE_ID = PartyPEO1.PARTY_ID))
INNER JOIN MOT_QM_TERR_QUOTA_CONFIG AS TerritoryQuotaConfigEO ON TerritoryQuotaEO.territory_id = territoryquotaconfigeo.territory_id
INNER JOIN MOT_QM_QUOTA_PLANS_VL AS QuotaPlanEO ON territoryquotaeo.quota_plan_id = quotaplaneo.quota_plan_id
LEFT OUTER JOIN MOT_QM_RESOURCE_QUOTAS WE ResourceQuotaEO TerritoryQuotaEO.TERRITORY_QUOTA_ID = ResourceQuotaEO.TERRITORY_QUOTA_ID
Any help would be appreciated. Thank you, KimKim,
VO expert mode allows you to specify a sql statement to create the original Version of. You put a complete SQL statement in the framework to execute it.
Again, you can change the location where clause and the order by clause. Just be careful when you use bind variables in your statement. Expert mode VO tend to be enveloped by another sql statement:select * from (your original sql statement here) QRSLT
If you add a where clause or clause by clause oder after the QRSLT (which is the case if you add where clause by addWhereClause() method, it must be remembered that the attributes are now named qrslt.attribute_name instead of org_table_name.attribute_name.)
On the other side, you can disable this envelope of the sql statement calling a method (can't remember which right now, so please look in the docs).Timo
Maybe you are looking for
-
new feature in the new software update
I think my tip can be really useful. Is "function for emergency assistance. It consists inform his voice of the user of the iPhone to Siri, saying 'HELP SIRI' so that it doesn't become a way for pranks. Therefore, in case of emergency (flight, Gapur,
-
My printer color laserjet (color laserjet pro m252dw) no longer works due to not recognize a black cartridge to third because of a recent update of the firmware. Error given is 'Supply memory error'. I already looked to the top of the page of Softwar
-
My password does not work on Microsoft Money 2004.
Password does not work on Microsoft Money 2004. Our accounts are here! Can we get in? All the answers (well over!) would be welcome. original title: Microsoft Money 2004
-
A1 - set the sensitivity of the touch screen
Is there a way to set the sensitivity of my touch screen A1. It works but it seems to require more pressure than expected.
-
BitmapField consumes all clicks on the screen
Hello I hope someone can help me with this problem: I have a screen that has only BitmapField is on. When you click on this 'something' BitmapField should be here which works very well. The problem is that even if I click elsewhere on the screen the