Help with SOQL query for the filter of AutoSynch
The goal is to seize any product that contains "Maint" in there. Here's what we have but we get no result of the call.
Where:
(LastModifiedDate > = last download successful AND Product__c = ' Maint % ')
Any suggestions or corrections?
I would like to use
.... Product__c like ' % Maint.
and test my query SOQL using Force.com Explorer or your friendly local SFDC administrator to debug any further.
Tags: Marketers
Similar Questions
-
Dynamic problem with lookup-query for the purpose of resource request
Hi all
I need to set up several IOM user exchange mailboxes, I can set up AD account and account of the mailbox without any problem, but only for the first ad and Exchange account. For the second and third, etc. I get the error: "Invalid login name" during Exchange of account provisioning. I discovered that this problem exists with Exchange Connector - it is not able to collect correct GUID. So in my xml Dataset I use dynamic query Lookup to select manually correct Alias, the login name and GUID. The query for the GUID is the sequel (I cloned RO for AD and Exchnage):
AttributeReference available-in-bulk = "true" length = "32" widget = 'search query' type = 'String' attr-ref = "Object GUID" name = "Object GUID" >
* < lookupQuery search-query = "select distinct UD_KFUSER_OBJECTGUID GUID, ud_KFUSER_uid like UD_KFUSER UD_KFUSER, orc orc Login, sta sta where UD_KFUSER.orc_key = orc.orc_key and orc.usr_key = ' $Form data." Take ' and UD_KFUSER. "UD_KFUSER_AD = 27 and orc.orc_status = STA.sta_status AND STA.sta_bucket! = 'Cancelled'" display-field = "GUID" save-field = "Object GUID" / > *.
* < / AttributeReference > *.
My questions are:
1. I have to type * to run the query in the user interface, without * I got error:
+ < 17 February 2012 11:12:22 THIS > < error > < oracle.adfinternal.view.faces.config.ric +.
h.RegistrationConfigurator > < BEA-000000 > < ADF_FACES - 60096:Server Exception durin
PPR, #10 g
oracle.iam.platform.canonic.base.NoteException: an error occurred during executin
g the search query.
to oracle.iam.platform.canonic.agentry.GenericEntityLookupActor.perform)
GenericEntityLookupActor.java:337)
Is this right?
2. when I got correct values (from the search query) - they are missing on the details of the application and form of RO - what Miss me?
I use OIM 11.1.1.5, in my xml dataset I use correct attr-Ref (labels), when I type the values manually, they are propagated to form RO and Exchange mailbox is created.
Best
MPI not had no problem when writing search query.
This works very well for me.
The request will be filled for the field, so why choose *?
I used as
-
Need help on rewriting query for the DOMAIN CONTEXT index
Hello
I'd be really grateful if someone could give me a tip how to rewrite the query so that the DOMAIN INDEX is executed as the last and not the first... According to the plan to explain it...
What I want: I want to index FIELD CONTAINS search for text ONLY for ITEMS that are extracted from the inner query (table MS_webarticlecache)...
Because it seems now DOMAIN INDEx is executed first on all the MS_ARTICLE table and then filtered by inner query ID's...
This query execution time is now around 86seconds... Inner query has all the indexes for SID_SUBCLIPPING and DATE_ARTICLE... (seen in line 3 of explain plan) If this one is fast and returns the unique id by grouping it and concating keywords...
Without text... search results are retrieved in 3 seconds...
DOMAIN index is created with Oracle 11 g FILTER BY ID, ART_DATE... and is on the MS_ARTICLE table and the ORATEXT seen on the sql column...
Table MS_ARTICLE has 1.8mil lines...
MS_WEBCACHEARTICLE table has cca. 2 lines of millet
SQL:
SELECT A.*, B.KEYWORDS OF
MS_ARTICLE HAS
JOIN THE
(SELECT be, wm_concat (keywords) "KEY words" FROM MS_webarticlecache WHERE SID_SUBCLIPPING IN ('LEK', "KRKA") AND DATE_ARTICLE > = TRUNC(SYSDATE-400) AND DATE_ARTICLE < = TRUNC (SYSDATE) GROUP BY be) B
WE
A.ID = B.ID_ARTICLE AND CONTAINS (A.ORATEXT, 'IMMUNAL', 1) > 0
Here is explain plan:
Plan
SELECT STATEMENT ALL_ROWSCost: 1 K bytes: cardinality K 16: 237
1 FIELD INDEX INDEX (DOMAIN) PRESCLIP. ART_IDX cost: 120
TABLE 2 ACCESS BY INDEX ROWID TABLE PRESCLIP.MS_ARTICLE cost: cardinality K bytes: 5 775: 237
3 INDEX RANGE SCAN INDEX PRESCLIP. WEBCACHE_SUBCLIPDATE cost: cardinality 10: 964
TABLE ACCESS BY INDEX ROWID TABLE PRESCLIP.MS_WEBARTICLECACHE cost 4: 250 octets: 45 K cardinality: 931
5 INLIST ITERATOR
Cost of 6 HASH JOIN: 1 K bytes: cardinality K 16: 237
7 FILTER
GROUP 8 SORT BY cost: 1 K bytes: cardinality K 16: 237
Thank you very much for the help.
KrisNo, dbms_stats.gather_index_stats should be enough I think. From RECONSTRUCTION vs FULL - on rebuilding mode Oracle rebuilt just the table $I from scratch (it creates a temporary table, fills and then current exchanges and the new tables). It should be much faster that the FULL optimization, where the picture remains the same and only its content changes. The resulting table will be more compact, too.
-
Help with SQL query for SQL experts!
Hi all
For the very expert on SQL.
------------------
create table t1 (STEP number);
Insert into t1 select rownum from dba_tables where rownum < 11;
commit;
create table t2 (the STEP number, name varchar2 (4), varchar2 (1)) of the State;
insert into t2 values (1, 'TOTO', ' A');
insert into t2 values (3, 'TOTO', 'C');
insert into t2 values (4, 'TOTO', ');
insert into t2 values (1, 'FIFI', ' A');
insert into t2 values (6, 'FIFI', 'B');
commit;
----------------
My goal is to list the STATE in the NAME of all the STEPS, even if measures do not exist for a NAME.
In other words, my query should return a result like this: (query on t1 and t2, of course)
STEP 1 2 3 4 5 6
TOTO A C D NO NO NO
FIFI HAS NO NO NO NO D
Thank you in advance.
with the data as)
Select
T1. Step step
name
State
Of
T1, t2
where
T1. Step = T2. Step (+)
)Select
*
from the data
Pivot (max (state))
for step (1,2,3,4,5,6,7,8,9,10)
)
where the name is not nullNAME 1 2 3 4 5 6 7 8 9 10 TOTO A - C D - - - - - - FIFI A - - - - B - - - - If the column name must be the stage instead of the name
with the data as)
Select
Step 1 T1. Step
name as step
State
Of
T1, t2
where
T1. Step = T2. Step (+)
)Select
*
from the data
Pivot (max (state))
for step 1 in (1,2,3,4,5,6,7,8,9,10)
)
where the step is not null -
Help with a table for the many buttons of MC
Hello. I am a very new flash user and working on a flash project that has 50 movie clip buttons.
Each button will be different so I plan to 50 buttons in the library. Each button will have 4 States - upward, downstairs, Upover, & Downover. There are 4 keyframes button, 1 for each State, with a stop() on each keyframe.
Action script I have to press '1' is attached at the end.
Ok. Here's where I'm stuck. What I want to do is to use an array to store the value true or false for each of my buttons so I hope I did not copy and paste this code 50 times and change the name of the button. It seems that I should be able to use the 1 section of the code to change the State of some I press the button. I just don't understand the tables and how a MC to refer to a table.
Everyone mind help me a little?Let's back up a step or two. This actionscript as I wrote it is expected
to be placed in a space of script of frame on the same scenario as the buttons
themselves. Each button instance must have an instance name, "btn1",.
ETX. I guess you did. These button instances must be in
the same framework that the ActionScript. In other words, if the buttons exist
in frame 1, then the ACE should also be Framework 1.1. the button instance names table must have a relative to path
each of the buttons. The names cannot have quotes around them. The
reference is the name and path of the instance. So, if the buttons are
an another movieClip then you should include the name of the element with the
each button name: example (buttonClip.btn1, buttonClip.btn2, etc.). This
It is essential for the second part to work properly.The loop will use the references button in the table and assign the
enabled property and its value for each button, then it will assign each
the functions of each button. This is what you were after,
a function that will work for each event for each of the
buttons.Given the reference to instances of button is false, all the rest
will fail.Take a look at this example,
http://www.DDG-designs.com/downloads/arraySample.zip, this should help
to explain the process. In this example, the buttons are in a movieClip. -
Need help with instr/Regexp for the query
Hi people of Oracle
I use Oracle
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
I have a few responses from students and the valid values are + / / (alphabet) o/p and spaces at the end of the scam only not in the middle.
According to my condition, the registration number 2 3.4 must be in the request but I'm alone (chart 3).
Can we use REG_EXP
Help, please.
Thanks in advance.
Rajesh
with x as)
(
SELECT '+-+-POPPPPPP' STUDENT_RESPONSE, 1 numero_enregistrement FROM DUAL Union all the
SELECT ' + --AOPPPPPP++' STUDENT_RESPONSE, 2 numero_enregistrement FROM DUAL Union all the
SELECT "+-+-OPPPPPP -' STUDENT_RESPONSE, 3 numero_enregistrement FROM DUAL union all
SELECT '+-+-9OPPPPPP' STUDENT_RESPONSE, 4 numero_enregistrement FROM DUAL)
)
(SELECT NUMERO_ENREGISTREMENT,
TRIM (STUDENT_RESPONSE) X
WHERE
((INSTR (UPPER (TRIM (STUDENT_RESPONSE)),'-') = 0))
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), '+') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), 'O') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), 'P') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)),' ')! = 0)
)
)Hi, Renon,
Rb2000rb65 wrote:
Hi people of OracleI use Oracle
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing optionsThanks for posting this (and the WITH clause for sample data). It is very useful.
I have a few responses from students and the valid values are + / / (alphabet) o/p and spaces at the end of the scam only not in the middle.
You combine several qeustions responses in a single VARCHAR2 column? It would be better to have a separate line for each question.
According to my condition, the registration number 2 3.4 must be in the request but I'm alone (chart 3).
What exactly are your needs? You try to find the rows where the student_response contains one of the forbidden characters, or if it contains a space anywhere, but at the end of the string?
Can we use REG_EXP
Yes, but it's pretty easy and probably more effective, do not use regular expressions in this case:
Here's one way:SELECT record_number , student_response FROM x WHERE TRANSLATE ( UPPER ( RTRIM (student_response, ' ')) , 'X+-OP' , 'X' ) IS NOT NULL ;
In other words, once you remove the spaces and all occurrences of '+', '-', 'o' or 'P', then the forbidden characters are left, and you want to select the line, if there is one of these.
If you really, really want to use a regular expression:
SELECT record_number , student_response FROM x WHERE REGEXP_LIKE ( RTRIM (student_response) , '[^-+OP]' -- or '[^+OP-]', but not '[^+-OP]'. Discuss amongst yourselves , 'i' ) ;
but, again, it will be probably slower than the first solution, using TRANSLATE.
Published by: Frank Kulash, October 17, 2011 13:05
Published by: Frank Kulash, October 17, 2011 13:41
What follows is a bit simpler that TRANSLATE:SELECT record_number , student_response FROM x WHERE RTRIM ( UPPER ( RTRIM (student_response, ' ')) , '+-OP' ) IS NOT NULL ;
-
Help with a query of the pivot hierarchy
I looked in the FAQ, but I'm just not see it.
I have the following:
A request for return:
I want the following:o_id oname typ prnt 118 Pension Admin PRC 91 91 Retirement LOB 218 218 Benefits SEG 81 119 Plan Mgmt PRC 91 91 Retirement LOB 218 218 Benefits SEG 81 142 RCS Software PRC 93 93 Risk Software LOB 221 221 Risk Services SEG 81
Version:ID PRC LOB SEG 118 Pension Admin Retirement Benefits 119 Plan Mgmt Retirement Benefits 142 RCS Software Risk Software Risk Services
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
AMT for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
Sample data:
I can't go beyond:create table t1( o_id number(3) , oname varchar2(20) , typ varchar2(3) , prnt number(3) ); insert into t1 values(118, 'Pension Admin', 'PRC', 91); insert into t1 values(91, 'Retirement', 'LOB', 218); insert into t1 values(218, 'Benefits', 'SEG', 81); insert into t1 values(119, 'Plan Mgmt', 'PRC', 91); insert into t1 values(142, 'RCS Software', 'PRC', 93); insert into t1 values(93, 'Risk Software', 'LOB', 221); insert into t1 values(221, 'Risk Services', 'SEG', 81);
I tried this, but of course she returns only a single line:select level lvl, org.* from t1 org start with typ = 'PRC' connect by o_id = prior prnt;
What escapes me, any help would be appreciated.select * from ( select lvl, oname from ( select level lvl, t1.* from t1 start with typ = 'PRC' connect by o_id = prior prnt ) ) pivot ( min(oname) for lvl in (1 prc, 2 lob, 3 seg) )
with org as ( select connect_by_root o_id o_id, oname, typ from t1 start with typ = 'PRC' connect by o_id = prior prnt ) select * from org pivot( max(oname) for typ in('PRC' PRC,'LOB' LOG,'SEG' SEG) ) / O_ID PRC LOG SEG ---------- -------------------- -------------------- -------------------- 119 Plan Mgmt Retirement Benefits 142 RCS Software Risk Software Risk Services 118 Pension Admin Retirement Benefits SQL>
SY.
-
Help with a query on the HRMS tables
I need assistance with a request that I'm running. Here are two tables that I'm trying to join:
PER_ALL_POSITIONS
PER_ALL_PEOPLE_F
What I'm trying to accomplish is to get the first name, last name by PREPtable ALL_PEOPLE_F and then join the PER_ALL_POSITIONS table to get a unique list of positions. However what I need help for is to determine how to join the two tables. I know that the primary key on PER_ALL_PEOPLE_F is Person_ID but this value does not appear in the table PER_ALL_POSITIONS. Could someone give me any advice would be greatly appreciated. :)you need go to per_all_assignments_f, then to per_all_positions per_all_people_f.
-
HELP with wall mount for the iMac-end 2012 model 27 in.
Can someone help me please... I brought the iMac 27 in. in 2013. And I need to mount it on the wall.
To my astonishment, I discovered that I can't get on the wall that my iMac is late 2012 model. And this model does not come with wall VESA opition.
When I brought my computer, I was not put to the aware of the notice of wall-mounted or free-standing support.
I spoke with tech support but no joy. I was told to replace my iMAC or buy 3rd party mounting Kit. Unfortunately the 3rd party SDK does not solve my problem
I wrote an email to Tim Cook, CEO, Jonathan I, Chief Designer but not heard of one of them.
I would be very grateful if someone out there can help me with my dilemm. Thank you hear from someone soon.
Mrs. Regis Kishan
-
Help with Volume control for the video player
Hey!
My video plays and stops correctly on my video player, but I can't understand this volume control. My cursor moves to the way I want it, but the volume does not adjust. Please tell me what is wrong with my code:
slider_1.onPress = function() {}
this.startDrag (true, _root.volume_bar1._x, _root.volume_bar1._y, _root.volume_bar1._x + 133, _root.volume_bar1._y);
}
slider_1.onRelease = function() {}
this.stopDrag ();
}
slider_1.OnMouseMove = function() {}
newPoint = new Object();
newPoint = this ._x
newPoint = this ._y
_root.volume_bar1.globalToLocal (newPoint);
_root.demo_reel.setVolume(-1*newPoint.x);
}
I watched a tutorial and died this code, but of course my own instance names.
Thanks in advance!
use:
paramsF (slider_1, _root.volume_bar1._x, 0, _root.volume_bar1._x + 133 100);
slider_1.onPress = function() {}
this.startDrag (true, _root.volume_bar1._x, _root.volume_bar1._y, _root.volume_bar1._x + 133, _root.volume_bar1._y);
}
slider_1.onRelease = function() {}
this.stopDrag ();
}
slider_1.OnMouseMove = function() {}
_root.demo_reel.volume = this.m * this._x + this.b;
}
function paramsF(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):Void {}
MC.m =(Y1-Y2) /(x1-x1);
MC.b = Y1 - mc.m * x 1;
}
-
Help with a script for the date field
Is this possible when the display of a date field is not also: date {EEEE, MMMM D, YYYY}
then
Message: "Please select a date from the calendar to the date.
and focus on the date field
Thank you
I thought the event output, if you change the this.rawValue to xfa.event.change, you can try to use the calculate... event, which would mean that they get the message earlier.
Anyway they will always be able to cut-and - paste a date if it is in the correct format.
Bruce
-
Dialog box that says ' Creative Cloud Installer wants to make changes. Type your password for this purpose"- I type my password for Adobe ID (creative cloud), but it will not accept it. who should I go for help with this query?
It does not ask the cloud your computer admin password password!
-
An error occurred when querying for the pending operations
Original title: sysprep problem
I have an acer aspire 5738Z, I use windows 7 (64 bit) I try to open sysprep.exe and it does not open, a text box appears saying "an error occurred when querying for the pending operations. What can I do to fix this?Hello
Thanks for posting the request in the Microsoft community forums.
I understand that you receive the error "an error has occurred when querying for outstanding operations" when trying to open sysprep.exe on the computer.You can try the solutions provide and check if it helps solve the issue.
Method 1:
You can scan System File Checker to fix corrupted files.
How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
http://support.Microsoft.com/kb/929833Method 2:
If the steps above fail then you can try the steps and check.a. run regedit by typing regedit in start search by pressing ENTER.
b navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Key: RegistrySizeLimit
Type: REG_DWORD
Value: 0xffffff (4294967295)
c. reset.If you need help with Windows, keep us informed. We will be happy to help you.
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
A design of query for the conversion of time difference in days, hours, Minutes
Hi all
A design of query for the conversion of time difference of time in number of days remaining remaining hours minutes and rest in seconds. Made this one till now. Please suggest for all modifications, until now, it seems to work very well, kindly highlight for any anomaly.
WITH DATA (startDAte, EndDate, Datediff) AS (SELECT to_date ('2015-10-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual)
UNION ALL SELECT to_date ('2015-10-01 10:00:39 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:40 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 10:30:45 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 11:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 10:30','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 11:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 09:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 09:00','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 10:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 08:30:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 09:30:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 08:30','yyyy-dd-mm hh24:mi:ss')-to_date('2015-11-01 09:30','yyyy-dd-mm hh24:mi:ss') FROM dual
)
Select
trunc ((EndDate-StartDate)) days.
trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24) hours)
trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60) Minutes,))
(to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60 - trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60)) * 60 seconds))))
data;
Thanks for the answers in advance.
AHA!
TO_TIMESTAMP expects a string as input, so it first makes an implicit conversion from DATE to a string, in the format of NSL_DATE_FORMAT.
To convert the TIMESTAMP DATE independently NLS_DATE_FORMAT, use
CAST (
AS TIMESTAMP)
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
How can I restrict websites to download to my browser
https://www.Mozilla.org/en-us/contribute/...This keeps appearing on my browser. How to stop this type of activity?
-
Is a USB or card reader available for iPhone accessory 6, with
I have an iPhone 6 more. I want to attach a USB * Card reader to improve the memory of the iPhone. Is such a device available for I phones?
-
Dear Sir/Madam, I wanted to share some suggestions Issues & motorcycle G2 after the update of the Android Problems after the update of the Android: Closed frequent automatic app. Apps are being forced closed. Phone is suspended, laging. Gujarati Lang
-
Is this the right place for a novice computer person?
-
Check configuration on S170 L4 traffic monitor?
You can check that I made this connection correctly on our new S170? I'm greatly grateful in advance! On the switch, I created 1 session of the monitor with the following command: monitor session 1 source Fa6/0/38, 48/0/Fa2 interface control interfa