A complex join . Please help

I have a complex join to perform.
I need some help please.
I have a table call Table A
TableA
id_entity    inst_type     inst_code  dt_trade
AGL          SE              5660249    01 Feb '06
AGL          SE              5660249    01 Feb '06
AGL          SE              5660249    05 Feb '06
TableB
id_inst                 id_inst_xref
0029010          SE     5660249
0070789          SE     5660249
0071190          SE     5660249
0072385          SE     5660249
0073215          SE     5660249
0084797          SE     5660249
0091375          SE     5660249
Table C
id_inst     id_isin
0029010     FR0000120172
0070789         FR0000120172
0071190     FR0000120172
*** All the id_inst in TableC have the same id_isinAll the 3 Tables now have to be linked to together such that
Output
id_entity    Inst_code   id_isin         dt_trade    count
AGL          5660249     FR0000120172    01 Feb '06  2
AGL          5660249     FR0000120172    02 Feb '06  1What I am doing is
Select ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin,count(*)
from  TableA ta,TableB tb,TableC tc
where ta.id_entity = 'AGL'    and
      ta.inst_code       = (How do I get the id_inst from TableB)
                            and then use the id_inst from TableB
                            to get the id_isin from TableC)
group by ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin
Can I say :
Select ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin,count(*)
from  TableA ta,TableB tb,TableC tc
where ta.id_entity = 'AGL'    and
      ta.inst_code = (Select distinct tb.id_inst
                      from tableB tb
                      where tb.id_inst_xref = ta.id_inst_code
                      ) and then link the id_inst from here to TableC ang get the id_isin??Can someone please help.??

I had a bit of a go at writing the query but I don't quite understand the data. Here is what I tried.
jeff@ORA10GR2> create table tablea
2 (id_entity varchar2(3)
3 ,inst_type varchar2(3)
4 ,inst_code number
5 ,dt_trade date);
Table created.
jeff@ORA10GR2>
jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060201','YYYYMMDD'));
1 row created.
jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060201','YYYYMMDD'));
1 row created.
jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060205','YYYYMMDD'));
1 row created.
jeff@ORA10GR2>
jeff@ORA10GR2> create table tableb
2 (id_inst number
3 ,inst_type varchar2(3)
4 ,id_inst_xref number);
Table created.
jeff@ORA10GR2>
jeff@ORA10GR2> insert into tableb values (0029010, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0070789, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0071190, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0072385, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0073215, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0084797, 'SE', 5660249);
1 row created.
jeff@ORA10GR2> insert into tableb values (0091375, 'SE', 5660249);
1 row created.
jeff@ORA10GR2>
jeff@ORA10GR2> create table tablec
2 (id_inst number
3 ,id_isin varchar2(20)
4 );
Table created.
jeff@ORA10GR2>
jeff@ORA10GR2> insert into tablec values (0029010, 'FR0000120172');
1 row created.
jeff@ORA10GR2> insert into tablec values (0070789, 'FR0000120172');
1 row created.
jeff@ORA10GR2> insert into tablec values (0071190, 'FR0000120172');
1 row created.
jeff@ORA10GR2>
jeff@ORA10GR2>      select tb.id_inst_xref, tc.id_isin
2      from tableb tb, tablec tc
3      where tb.id_inst = tc.id_inst;
ID_INST_XREF ID_ISIN
5660249 FR0000120172
5660249 FR0000120172
5660249 FR0000120172
jeff@ORA10GR2>
jeff@ORA10GR2> select ta.id_entity,ta.inst_code,ta.dt_trade,dt.id_isin,count(*)
2 from tablea ta,
3      (select tb.id_inst_xref, tc.id_isin
4      from tableb tb, tablec tc
5      where tb.id_inst = tc.id_inst) dt
6 where ta.inst_code = dt.id_inst_xref
7 group by ta.id_entity,ta.inst_code,ta.dt_trade,dt.id_isin;
ID_ INST_CODE DT_TRADE ID_ISIN COUNT(*)
AGL 5660249 05/FEB/06 FR0000120172 3
AGL 5660249 01/FEB/06 FR0000120172 6
jeff@ORA10GR2>
jeff@ORA10GR2> drop table tablea;
Table dropped.
jeff@ORA10GR2> drop table tableb;
Table dropped.
jeff@ORA10GR2> drop table tablec;
Table dropped.
jeff@ORA10GR2>
jeff@ORA10GR2> spool off

Similar Messages

  • Query Using Joins.Please Help

    Hi,
    A Query please
    I have a Customer table and an Order Table
    The customer can place multiple orders
    Create Table Customers
    (Cust_id      number(2),
    cust_name    varchar2(15),
    constraint   pk_custid PRIMARY KEY(Cust_id)
    Create Table Orders
    (Order_no    number(2),
    Cust_id     number(2),
    order_status varchar2(1),
    constraint  pk_orderno PRIMARY KEY(order_no),
    constraint  fk_custid  FOREIGN KEY(cust_id)
    REFERENCES  Customers(cust_id)
    )Now,the Customer table has a single record
    whereas the Order Table has multiple records
    for the same customer.
    SQL> Select * from Orders
    ORDER_NO   CUST_ID ORDER_STATUS
            1         1 P
            2         1 PI'd like to view the different orders for that same customer
    Using a simple Join DOES NOT give the right output:
    SQL> Select C.cust_id,C.cust_name,
      2  O.order_no,O.order_status
      3  From Customers C,Orders O
      4  where C.cust_id = O.order_no;
      CUST_ID CUST_NAME        ORDER_NO O
            1 ABCD              1       PThere are 2 records in the Orders Table?
    How to view both the records from Orders Table?
    Do I need to use the EXISTS clause?
    Can someone please help?

    Well, I would have thought that you would join C.cust_id with the O.cust_id (and not O.order_no)???
    SQL> Select C.cust_id,C.cust_name,
      2  O.order_no,O.order_status
      3  From Customers C,Orders O
      4  where C.cust_id = O.order_no;

  • Executing web service operation with complex input - Please help

    Hi All,
    I am working on invoking a web service through ADF. The request format for the webservice consists of multiple occurance of same element. Below is sample request. here <index> is repeating n number of times.
    <soapenv:envelope>
    <soapenv:Body>
              <ns6:StoreDocumentRequest>
                   <ns6:docFileType>ABC</ns6:docFileType>
                   <ns6:Metadata>
                        <ns6:index>
                             <ns6:indexType>Format_Type</ns6:indexType>
                             <ns6:indexValue>ACROBAT</ns6:indexValue>
                        </ns6:index>
                        <ns6:index>
                             <ns6:indexType>Buyer_No</ns6:indexType>
                             <ns6:indexValue>1234567</ns6:indexValue>
                        </ns6:index>
                        <ns6:index>
                             <ns6:indexType>Document_Type</ns6:indexType>
                             <ns6:indexValue>101A</ns6:indexValue>
                        </ns6:index>
                        <ns6:index>
                             <ns6:indexType>Capture_Location</ns6:indexType>
                             <ns6:indexValue>XYZ</ns6:indexValue>
                        </ns6:index>
                   </ns6:Metadata>
                   <ns6:Content>XXXXXXXXXXXX</ns6:Content>
              </ns6:StoreDocumentRequest>
         </soapenv:Body>
    </soapenv:envelope>
    now I need to populate these values thrugh Operation binding in my managed bean class. I have also dragged these parameters and operation on my jsf page to get hold of those in my managed bean context. I am having following code in my managed bean to set these parameters.
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    OperationBinding storeDocumentBinding = bindings.getOperationBinding("StoreDocument");
    storeDocumentBinding.getParamsMap().put("docFileType", filetype);
    storeDocumentBinding.getParamsMap().put("Content", filecontents);
    storeDocumentBinding.getParamsMap().put("indexType", filecontents);
    storeDocumentBinding.getParamsMap().put("indexValue", filecontents);
    storeDocumentBinding.getParamsMap().put("indexType", filecontents);
    storeDocumentBinding.getParamsMap().put("indexValue", filecontents);
    storeDocumentBinding.execute();
    Here I am facing some issues:
    1. The operation is not picking values put from ParamMap(). It is taking values as empty (as in my .jspx page form, I have made it hidden though). It takes value from my jspx page form, which is blank.
    2. when I am manually entering values in the .jspx page form, for <indexValue> and <indexType> tags, it is taking only one value (last one) for creating the request.
    3. the storeDocument() function is a SOAP based service. How can I check for SOAP response after operationBinding.execute(). I checked for response after execution, it sends an object as result. How to get a SOAP response from it.
    I need to fetch few values from the SOAP response and display it on screen.
    Please help me out. I am noob in ADF.
    regards,
    Rajan

    Hi Puthanampatti,
    I followed the link and did exactly as mentioned. Here is my code
    public String downloadDocument(FacesContext context, OutputStream out) throws IOException {
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    OperationBinding retrieveDocumentBinding = bindings.getOperationBinding("RetrieveDocument");
    DCIteratorBinding attachmentsIterator = (DCIteratorBinding)bindings.get("AttachmentsIterator");
    String documentId = attachmentsIterator.getCurrentRow().getAttribute("Seq").toString();
    System.out.println(customSoapProvider.getRequest()); // getting null here
    AttributeBinding docFileTypeVal = (AttributeBinding)bindings.getControlBinding("docId");
    docFileTypeVal.setInputValue(522117);
    Object result = retrieveDocumentBinding.execute();
    System.out.println(customSoapProvider.getResponse()); //getting null here
    but I am getting a null response in the last line.
    what am I missing here.
    regards,
    Rajan
    Edited by: Rajan M on Jan 5, 2013 11:27 AM

  • Self join please help

    I would be very grateful if someone would show me show to use the self join, I understand what is does but just don't know how to use it. I have a question from a exercise but no answer so I can't check it the question is - using temporary labels to abbreviate table names, find all the staff that earn more than 'SONG'.
    here is the table
    STAFFID SNAME JOB MGR STARTDATE SAL COMM BRANCHID
    5963 SMITH ADMIN 5209 15-NOV-00 1600 20
    5994 BATES ASSISTANT 5896 20-FEB-01 1800 100 30
    5125 CHAN ASSISTANT 5896 22-FEB-02 1550 150 30
    5665 JONES MANAGER 5938 02-MAR-01 3100 20
    5465 WILSON ASSISTANT 5896 28-OCT-00 1250 140 30
    5896 HAYAT MANAGER 5938 01-MAY-01 3100 30
    5287 CLARK MANAGER 5938 09-JUL-02 3100 10
    5887 COSTA BUYER 5665 18-APR-04 3150 20
    5938 SHAW DIRECTOR 17-NOV-01 7000 10
    5484 TURNER ASSISTANT 5896 08-OCT-01 1550 0 30
    5678 KALIM ADMIN 5887 23-APR-04 1600 20
    5009 JAMES ADMIN 5896 03-DEC-01 1600 30
    5209 SONG BUYER 5665 03-JAN-02 3000 20
    5439 SIMPSON ADMIN 5287 23-FEB-02 1600 10
    Thanks in advanced :)
    Edited by: user11093259 on 01-Dec-2010 10:19

    Hi,
    Welcome to the forum!
    Always post your best attempt at solving the problem. You'll get more specific replies that will help you learn more, and it often clarifies what you're trying to do.
    Here's a typical self-join, using the scott.dept table (which you probably have avaialble).
    SELECT     l.dname          AS lower_dname
    ,     h.dname          AS higher_dname
    FROM     scott.dept     l
    JOIN     scott.dept     h  ON     l.dname     < h.dname
    ;Output:
    LOWER_DNAME    HIGHER_DNAME
    ACCOUNTING     OPERATIONS
    ACCOUNTING     RESEARCH
    ACCOUNTING     SALES
    OPERATIONS     RESEARCH
    OPERATIONS     SALES
    RESEARCH       SALESAs you can see, this pairs every higher_dname with every dname that is less than it.
    This is very similar to your problem. The main difference is, where the query above shows every possible higher_dname (and the lower_dnames related to it), you're interested in a single, specific higher value (and the rolws with lower values related to it). You can restrict the query to show only that one, specific higher values by adding a WHERE clause. Try it. If you get stuck, ask a more specific question, and, remember, post your code.

  • CAC complex scenarios - please help!!!

    I have read the CAC section of the SRND and I think I'm still confused on certain sections of the document. Would greatly appreciated anyone help on this :-)
    Just assume RSVP is not a feasible option for now...
    Re: Diagram 1
    i) In this scenario, how many CCM clusters would you have & why? Would you put a cluster to each hub and remote site (i.e. to all sites)?
    Ii) If each site has it's own cluster, how many GK would you use and why?
    Re: Diagram 2
    Iii) Assume it is a "Centralized model" where the HO hosts the only CCM cluster, do you see any problems in terms of CAC?
    Iv) What would you configure for the location for the Non-GK controlled trunk between hub office (site D) & HO (site G)?
    V) Do you ever configure any locations for the HO site? Or just leave the HO phones and HO Intercluster trunk as "none"?
    Vi) Say if site A makes 7 calls to site B, and if site C also makes 8 calls to site B simultenously, can site B still call HO? I think the answer is no. Location CAC is not really designed to support multi-tier environment? anything we can do to fix this problem if the scenario has to be in Centralized model?
    (N.B:- I have changed the location to be 'number of calls' rather than 'bandwidth' for simplicity)
    Re: Diagram 3
    Vi) In the centralized model,.If we have to reserve a certain bandwidth along all links end-to-end by RSVP, how is that differenet from using CAC? Don't we still need to over-pump the links? Say if a certain path along the RSVP path reserves 60 calls, wouldn't we need to RSVP for 60 calls through the whole path just like CAC?
    Re: Diagram 4
    Vii) For Tail End Hop off, assume all the voip dial peer has been setup on all the VGs, and the Route Pattern at Centralized CCM has been setup to point to the local VG (at site G) as Route List. But If the bandwidth between the hub (site D) & HO (site G) are all used up, but I want the user at site H to still be able to call the PSTN, can I use AAR in this scenario?
    Thanks!

    Hi thisisshanky,
    Re: Case 1 (Diagram 5)
    i) At Hub (site D), shall the 'locations' for the 3 x Non-GK intercluster trunk be left as 'none'?
    ii) For the 'locations' for GK Inter-cluster trunks, shall they be set to 'none' as the traffic passing thru the GK are already being managed by GK already?
    iii) If Hub (site D) wants to make 30 calls to site E, F, G & H at any time, would the total interzone bandwidth for ZoneA be 70 calls?
    iv) Now, assume Zone B (site E, F, G & H) only needs to make 20 calls in total back to Zone A at any time, but since Zone A needs to make 70 calls as per iii, what should we do at GK?
    bandwidth interzone ZoneA '70 calls'
    bandwidth interzone ZoneB '20 calls' (would this restrict ZoneA to only be able to make 20 calls to Zone B?)
    Re Case 2:
    Can you please explain more on what problems will be faced since you mentioned it is not a true hub & spoke?
    Re Case 3:
    Can anyone else please shed some light on RSVP?
    Re Case 4:
    I'm a bit confused between the difference between the following 3 ways of setting up PSTN fallback if WAN bandwidth is insufficient in GK scenario
    Say I want to call extn 3xxx on the remote office. The intercluster prefixs are *801, and the PSTN digits for the site is 9231-3xxx.
    Method 1:
    Configure a route list that contains two route groups. The first route group contains the intercluster trunk that routes outgoing calls over the IP WAN. Second route group contains the Voice Gateway.
    Method 2:
    Just on the Voice Gateway:
    dial-peer voice 1 voip
    destination-pattern 8013xxx
    session target ras
    preference 0
    dial-peer voice 2 pots
    destination-pattern 092313xxx
    port 1/0:23
    preference 1
    Method 3:
    Use AAR
    Another extra Q regarding bandwidth for GK.
    According to Cisco SRND, GK uses double the bandwidth as the codec call rate, so...
    G.711 - GK uses 128kbps
    G.729 - GK uses 16kbps
    However, this is excluding all Layer 2, IP & RTP overhead... so when i am planning for number of calls, what values should i use as 'bandwidth per call'?
    Cheers,
    Hunt

  • Urgent query on joins --Please Help!!

    Hi Experts,
    We have two table T1 and T2 with A three columns in T1 as A(uniquie constraint and not null )and in table T2 as X.
    We need to find rows in T1 for which no value of A exists in X of T2.Please provide your suggestion on the query we can frame for this requirement.
    Thanks and Regards
    Debashis
    Edited by: user13267825 on Aug 27, 2010 3:08 AM

    Maybe something like this then:
    SELECT a FROM t1 WHERE b = :something
    MINUS
    SELECT x FROM t2
    / This is a case where it is always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Complex requirement for Date/Time Period related - Please help!!

    Hi,
    This is a complex requirement by my client.
    There is a Patients table with the patient's eligbility for the insurance, on monthly wise. I have to find the Inactive patients and also when they are Inactive in the past as well as as of now. 
    Few points about the table and logic:
    1.Data is from Jan 2012 and it is on monthly basis. For Eg: if he enrolls on Jan 2012 and he is active till last month(Jan 31,2015), then From Jan 2012 to Jan 2015, one record per each month is available.  ie total of 37 records for him. If he is Inactive
    for a period then that period record will  be missing.
    2.I need to consider from the day they enrolled to till Jan 31st,2015, to find out whether they are Inactive for any months between their enrolled date to till Jan 31st,2015.
    3. In the below image, PatientID 1000 - No issue with him. he enroled on Aug 2014 and has records till Jan 2015 - No issues. He will not be counted for Inacive members.
    4.patientID 1001 - He is active till now as he hsa records till Jan 2015. But he was Inactive from 2014-06-06 to till  2014-06-30. So,he has to be counted as 'less than 1 month Inactive member for 2014'
    5.PatientID 1002 - He is active till now as he haa records till Jan 2015. But he was Inactive from 2014-09-01 to till  2014-09-30. So,he has to be counted as ' 1 month Inactive member for 2014'
    6.PatientID 1003 - He was Inactive for 09th &10th months for 2014. and also he has record only till Dec 2014. So,he has to be counted as '2 month Inactive member for 2014' and '1 month Inactive for 2015'
    7.PatientID 1004 - He is active from jan 2012 to Apr 2012 only. So,he has to be counted as '8 month Inactive member for 2012','12 month Inactive member for 2013','12 month Inactive member for 2014'  and '1 month Inactive for 2015'
    Please help me to find this as this is very complex for me - Finally they want a table like the second image below
    In the table X=0 means Count of all Members who are NOT inactive ).
    Thanks much in advance for your valuable inputs!

    Create something like a calendar table with a column with dates from enough years that will cover your patient history. For example dates from Jan 1, 2012 to some future date like Dec 31, 2020. Then it will be an OUTER join with this calendar table and get
    DISTINCT months when the patient was inactive.
    The calendar table can have just Month and Year too instead of dates. But usually dates can be useful in many other scenarios too.
    An example -
    create table patient (id int, effective_date date, end_date date)
    create table calendar (id int identity, calendar_date date)
    insert into patient (id, effective_date, end_date) values
    (1000, '1/1/2014', '1/31/2014'), -- patient 1
    (1000, '2/1/2014', '2/28/2014'),
    (1000, '3/1/2014', '3/31/2014'),
    (1001, '1/1/2014', '1/31/2014') -- patient 2
    declare @date date = '1/1/2014'
    while @date <= '12/31/2014' -- 1 year
    begin
    insert into calendar (calendar_date)
    values(@date)
    set @date = DATEADD(dd, 1, @date)
    end
    select distinct p.id as patient, MONTH(c.calendar_date) AllMonths, YEAR(calendar_date) Allyears
    from patient as p right outer join calendar as c
    on c.calendar_date between p.effective_date and p.end_date
    ;with
    AllMonthYears as (select MONTH(calendar_date) Months, YEAR(calendar_date) Years from calendar)
    , AllPatients as (select distinct id as PatientId from patient)
    , AllPatientsWithMonthsYears as (select distinct * from AllMonthYears cross join AllPatients)
    select *
    from AllPatientsWithMonthsYears as apmy
    left outer join patient as p
    on apmy.Months = month(p.effective_date)
    and apmy.Years = year(p.effective_date)
    and apmy.PatientId = p.id
    order by apmy.PatientId, apmy.Years, apmy.Months

  • Please help! I defragged my hard drive and now Illustrator CS6 is trying to open all of my complex Illustrator files with a "Text Import Options" box as if they are text files, and they are not opening!

    Please help! Illustrator CS6 started trying to open all of my complex.ai files with a "Text Import Options" box as if they were text files, and they are not opening!  Help!

    Hi Monika,
    I have spent the last two or three days trying to do what you suggested.  I uninstalled Adobe 6 from Windows.  Some files that CS6 placed on my system during installation remained, including fonts and .dll files.
    I had to abandon the Cleaner Tool you suggested because in one screen it allowed me to specify removing CS6 only, but on the following screen it only gave on option to remove ALL Adobe programs.  I could not do that because I didn't have the serial number handy for CS3 in case I want to reinstall it at some point.
    I tried to get technical help with the Cleaner Tool problem but no definitive help was available, so I reinstalled CS6 again without having the benefit of the Cleaner Tool.  I tried to get the serial number for CS3 so I could use the Cleaner Tool but spent 2 wasted hours in chat.  Even though I had a customer number, order number, order date, place of purchase, the email address used AND 16 digits of the serial number, in two hours the agent couldn't give me the serial number.  After two hours I had nothing but instructions to wait another 20 minutes for a case number.
    Illustrator CS6 is still trying to open some backups as Text and otherNone of the problems have been fixed.  I have tried to open/use the .ai files in CS6 installed on another system and am getting the same result, so I don't think the software was damaged by the cleaner.  The hard drive cleaner is well-known and I've run it many times without any problem to previous versions of Illustrator or any other programs.
    When I ordered, the sale rep promised good technical support and gave me an 800 number, but after I paid the $2000, I learned that the 800 number she gave me doesn't support CS6 and hangs up on me.  Adobe doesn't call it a current product even though they just sold it to me about 3 weeks ago.
    Would appreciate any help you experts can offer.  If I can't solve this, the last backup I can use was from June and I will have lost HUNDREDS of hours of work and assets that I cannot replace.
    Exhausted and still desperately in need of help...

  • Left outer join issue, please help

    Hi All,
    My oracle DB : 10G
    I have 3 tables:
    1) w_orders_fs
    2) w_product_d
    3) w_order_f
    (Below are the scripts for creating these 3 tables along with data)
    I have a sql which :
    select o_fs.invoice_number
           , o_fs.product_id o_fs_product_id
           , p_d.product_id p_d_product_id
           , p_d.row_wid_skey p_d_row_wid_skey
           , o_f.product_wid_skey
    from w_orders_fs o_fs
         , w_product_d  p_d
         , w_orders_f o_f
    where o_fs.invoice_number = 10
          and o_fs.product_id = p_d.product_id(+)
          and p_d.current_flg = 'Y'
          and p_d.row_wid_skey = o_f.product_wid_skey(+)
          and o_f.invoice_number = 10
    which is giving me an output :
    INVOICE_NUMBER|O_FS_PRODUCT_ID|P_D_PRODUCT_ID|P_D_ROW_WID_SKEY|PRODUCT_WID_SKEY
    10|2|2|4|4
    Desired output:
    INVOICE_NUMBER|O_FS_PRODUCT_ID|P_D_PRODUCT_ID|P_D_ROW_WID_SKEY|PRODUCT_WID_SKEY
    10|2|2|4|4
    10|1|1|3|NULL
    Now the overall objective is to pull the 2nd record of my desired output, my above query is not giving me this 2nd record since in my w_orders_f table product_wid_skey is not populated(one of the 2 records where invoice number = 10), I am just confused how to achieve this left outer join.
    Please help.
    Regards
    Rahul
    CREATE/INSERT  SCRIPTS:
    CREATE TABLE W_ORDERS_FS
      INVOICE_NUMBER        NUMBER(3),
      INVOICE_DT            DATE,
      CREATED_BY            NUMBER(6),
      CREATED_ON_DT         DATE,
      CHANGED_BY            NUMBER(6),
      CHANGED_ON_DT         DATE,
      LAST_UPDATE_DT        DATE,
      CUSTOMER_ID           NUMBER(6),
      PRODUCT_ID            NUMBER(2),
      PRICE_PER_UNIT        NUMBER(5),
      STORE_ID              NUMBER(4),
      OTY_ORDERED           NUMBER(5),
      TOT_PRICE_BY_PRODUCT  NUMBER,
      ETL_PROC_WID          VARCHAR2(100 BYTE),
      DATASOURCE_NUM_ID     INTEGER
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (10, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 160, 1, 8, 1000, 10, 80, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (10, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 160, 2, 25, 1000, 10, 250, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (11, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 161, 6, 9, 1100, 10, 90, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (12, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 5, 10, 1500, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (13, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 163, 5, 10, 2000, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (14, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 1, 8, 1400, 20, 160, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 2, 25, 2200, 5, 125, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 6, 9, 2200, 5, 45, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 5, 10, 2200, 5, 50, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 1, 8, 2200, 5, 40, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 165, 3, 10, 2200, 15, 150, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 165, 1, 8, 2200, 25, 200, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 165, 4, 1, 2200, 55, 55, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 5, 10, 2200, 55, 550, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (17, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 160, 1, 8, 1000, 10, 80, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (17, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 160, 7, 10, 1000, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (18, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 161, 1, 8, 1400, 10, 80, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (18, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 161, 7, 10, 1400, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 3, 10, 1100, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 4, 1, 1100, 10, 10, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 165, 5, 10, 3200, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 165, 6, 9, 3200, 10, 90, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 8, 5, 3200, 10, 50, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 2, 25, 3200, 10, 250, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 9, 1, 3200, 10, 10, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 10, 5, 3200, 5, 25, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (24, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 1, 8, 3200, 10, 80, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (24, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 10, 5, 3200, 5, 25, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (23, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 3, 10, 1100, 10, 100, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (23, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 162, 4, 1, 1100, 10, 10, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (22, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 1, 8, 3200, 10, 80, '22858060', 1);
    Insert into W_ORDERS_FS
       (INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, CUSTOMER_ID, PRODUCT_ID, PRICE_PER_UNIT, STORE_ID, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (22, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 164, 2, 25, 3200, 10, 250, '22858060', 1);
    COMMIT;
    CREATE TABLE W_PRODUCT_D
      ROW_WID            NUMBER(10),
      ROW_WID_SKEY       NUMBER(10,5),
      PRODUCT_ID         NUMBER(2)                  NOT NULL,
      PRODUCT_NAME       VARCHAR2(50 BYTE),
      OTY_IN_STOCK       NUMBER(5),
      CREATED_BY         NUMBER(2),
      CREATED_ON_DT      DATE,
      CHANGED_BY         NUMBER(2),
      CHANGED_ON_DT      DATE,
      LAST_UPDATE_DT     DATE,
      W_INSERT_DT        DATE,
      W_UPDATE_DT        DATE,
      CURRENT_FLG        VARCHAR2(1 BYTE),
      ORIGINAL_QUANTITY  NUMBER(10),
      ETL_PROC_WID       VARCHAR2(100 BYTE),
      DATASOURCE_NUM_ID  NUMBER
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (1, 1, 7, '7up', 180, 20, TO_DATE('06/04/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 200, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (2, 2, 8, 'Nestle munch', 990, 23, TO_DATE('06/05/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1000, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, CHANGED_BY, CHANGED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (3, 3, 1, 'Coca cola mini', 0, 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 100, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, CHANGED_BY, CHANGED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (4, 4, 2, 'coca cola peg bottle', 465, 20, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/16/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 500, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, CHANGED_BY, CHANGED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (5, 5, 3, 'ruffle lays', 965, 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1000, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, CHANGED_BY, CHANGED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (6, 6, 4, 'center fresh', 9925, 23, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 10000, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (7, 7, 5, 'Mirinda', 10, 20, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 100, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (8, 8, 6, 'pepsi', 25, 20, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 50, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (9, 9, 9, 'Mentos mint', 990, 20, TO_DATE('06/13/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1000, '22858060', 1);
    Insert into W_PRODUCT_D
       (ROW_WID, ROW_WID_SKEY, PRODUCT_ID, PRODUCT_NAME, OTY_IN_STOCK, CREATED_BY, CREATED_ON_DT, CHANGED_BY, CHANGED_ON_DT, LAST_UPDATE_DT, W_INSERT_DT, CURRENT_FLG, ORIGINAL_QUANTITY, ETL_PROC_WID, DATASOURCE_NUM_ID)
    Values
       (10, 10, 10, 'Marie gold biscuit', 0, 20, TO_DATE('06/13/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('06/18/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 13:29:24', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/19/2013 11:09:35', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 10, '22858060', 1);
    COMMIT;
    CREATE TABLE W_ORDERS_F
      ROW_WID               NUMBER,
      INVOICE_NUMBER        NUMBER(3),
      INVOICE_DT            DATE,
      CREATED_BY            NUMBER(6),
      CREATED_ON_DT         DATE,
      CHANGED_BY            NUMBER(6),
      CHANGED_ON_DT         DATE,
      LAST_UPDATE_DT        DATE,
      PRODUCT_WID_SKEY      NUMBER(15),
      PRICE_PER_UNIT        NUMBER(5),
      OTY_ORDERED           NUMBER(5),
      TOT_PRICE_BY_PRODUCT  NUMBER,
      W_INSERT_DT           DATE,
      TIME_WID              VARCHAR2(29 BYTE),
      DAY_NUM_OF_WEEK       NUMBER,
      MONTH_END_DT          DATE,
      QUARTER_NUM_OF_YEAR   NUMBER,
      YEAR_END_DT           DATE,
      ETL_PROC_WID          VARCHAR2(100 BYTE),
      DATASOURCE_NUM_ID     INTEGER,
      INTEGRATION_ID        VARCHAR2(100 BYTE)
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (1, 10, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 10, 80, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '10~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (2, 10, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 4, 25, 10, 250, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '10~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (3, 11, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 8, 9, 10, 90, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '11~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (4, 12, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 7, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '12~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (5, 13, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 7, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '13~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (6, 14, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 20, 160, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '14~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (7, 15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 4, 25, 5, 125, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '15~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (8, 15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 8, 9, 5, 45, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '15~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (9, 15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 7, 10, 5, 50, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '15~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (10, 15, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 5, 40, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '15~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (11, 16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 5, 10, 15, 150, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '16~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (12, 16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 25, 200, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '16~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (13, 16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 6, 1, 55, 55, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '16~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (14, 16, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('05/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 7, 10, 55, 550, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '05282013', 3, TO_DATE('05/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '16~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (15, 17, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 10, 80, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '17~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (16, 17, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 1, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '17~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (17, 18, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 10, 80, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '18~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (18, 18, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 1, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '18~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (19, 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 5, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '19~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (20, 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 19, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 6, 1, 10, 10, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '19~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (21, 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 7, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '20~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (22, 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 20, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 8, 9, 10, 90, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '20~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (23, 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, 5, 10, 50, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '21~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (24, 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 4, 25, 10, 250, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '21~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (25, 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 9, 1, 10, 10, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '21~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (26, 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21, TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/14/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 10, 5, 5, 25, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06142013', 6, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '21~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (27, 24, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 10, 80, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06182013', 3, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '24~1');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (28, 24, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 10, 5, 5, 25, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06182013', 3, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '24~1');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (29, 23, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 5, 10, 10, 100, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06172013', 2, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '23~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (30, 23, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 22, TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/17/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 6, 1, 10, 10, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06172013', 2, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '23~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (31, 22, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -8, 8, 10, 80, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06162013', 1, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '22~');
    Insert into W_ORDERS_F
       (ROW_WID, INVOICE_NUMBER, INVOICE_DT, CREATED_BY, CREATED_ON_DT, LAST_UPDATE_DT, PRODUCT_WID_SKEY, PRICE_PER_UNIT, OTY_ORDERED, TOT_PRICE_BY_PRODUCT, W_INSERT_DT, TIME_WID, DAY_NUM_OF_WEEK, MONTH_END_DT, QUARTER_NUM_OF_YEAR, YEAR_END_DT, ETL_PROC_WID, DATASOURCE_NUM_ID, INTEGRATION_ID)
    Values
       (32, 22, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23, TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/16/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 4, 25, 10, 250, TO_DATE('06/19/2013 12:17:41', 'MM/DD/YYYY HH24:MI:SS'), '06162013', 1, TO_DATE('06/30/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2, TO_DATE('12/31/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '22858060', 1, '22~');
    COMMIT;

    This works:
    select o_fs.invoice_number
           , o_fs.product_id o_fs_product_id
           , p_d.product_id p_d_product_id
           , p_d.row_wid_skey p_d_row_wid_skey
           , o_f.product_wid_skey
    from w_orders_fs o_fs
         , w_product_d  p_d
         , w_orders_f o_f
    where o_fs.invoice_number = 10
          and o_fs.product_id = p_d.product_id(+)
          and p_d.current_flg(+) = 'Y'
          and p_d.row_wid_skey = o_f.product_wid_skey(+)
          and o_f.invoice_number(+) = 10
    If you want to outer join to a table, you have to include a ( + ) on each of its columns in the where clause (or cope with them possibly being null). Personally, I find ANSI syntax easier to work with when dealing with outer joins:
    select o_fs.invoice_number
           , o_fs.product_id o_fs_product_id
           , p_d.product_id p_d_product_id
           , p_d.row_wid_skey p_d_row_wid_skey
           , o_f.product_wid_skey
    from w_orders_fs o_fs
    left outer join w_product_d  p_d
    on o_fs.product_id = p_d.product_id
    and p_d.current_flg = 'Y'
    left outer join w_orders_f o_f
    on p_d.row_wid_skey = o_f.product_wid_skey
    and o_f.invoice_number = 10
    where o_fs.invoice_number = 10

  • Join with count() issue, please help!

    Hello All,
    I have this (probably really simple) issue that I cannot seem to resolve...I have 2 tables here (tbl_system_engineer and tbl_task_request)...(only relevant columns are listed below)
    tbl_system_engineer
    - id NUMBER
    - full_name VARCHAR2
    tbl_task_request
    - tr_number NUMBER
    - submitted_on_date DATE (date task was submitted)
    - ass_comp_date DATE (date task is due)
    - closed_date DATE (date task was officially closed)
    - requestor NUMBER (the system engineer id, the person who created this task)
    The query is supposed to summarize how many of the system engineers tasks are as followed:
    - "past completion date" - how many tasks have tbl_task_request.closed_date > tbl_task_request.ass_comp_date OR SYSDATE > tbl_task_request.ass_comp_date for the engineer
    - "Approaching Completion Date" - how many tasks have a tbl_task_request.ass_comp_date in this month but not "past completion date" for the engineer
    - "On Schedule" - how many tasks have a tbl_task_request.ass_comp_date > the end of SYSDATE month and year
    The result set rows are supposed to look like...
    "System Engineer full name", past completion date count, approaching completion date count, on schedule count
    Please help!

    Hi,
    Welcome to the forum!
    That's an example of a Pivot , where you want to GROUP BY a combination of columns, and have some of the columns appear as different columns, not different rows.
    The way to do that is to GROUP BY the expression(s) for which you want rows, and use CASE expressions for the others.
    For example:
    SELECT       e.full_name
    ,       COUNT ( CASE
                   WHEN  r.closed_date     > r.xyz_comp_date
                   OR    SYSDATE          > r.xyz_comp_date
                   THEN  1
                  END
                )     AS overdue
    ,       COUNT ( CASE
                   WHEN  xyz.comp_date     <  ADD_MONTHS ( TRUNC(SYSDATE, 'MONTH')
                                                      , 1
                   AND   r.closed_date     <= r.xyz_comp_date
                   AND   SYSDATE          <= r.xyz_comp_date
                   THEN  1
                  END
                )     AS approaching
    ,       COUNT ( CASE
                   WHEN  xyz.comp_date     >= ADD_MONTHS ( TRUNC(SYSDATE, 'MONTH')
                                                      , 1
                   THEN  1
                  END
                )     AS on_schedule
    FROM       tbl_system_engineer     e
    JOIN       tble_task_request     r     ON     r.requestor     = e.id
    GROUP BY  e.full_name
    ;I don't have versions of your tables, so I can't actually test this. I suspect that some consideration for NULLs needs to be added to the CASE conditions.
    if you post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) then people can test their ideas.
    Sometimes, especially when the columns are mutually exclusive, it's simpler to calculate a value in a sub-query, telling with which column of output each row is associated. That computed value is then used in very simple CASE expressions in the main query,
    Among the annoying features of this site is ithat ir replaces what it thinks are naughty words with s.  I suspect that happend in your post.  I assume all the columns with ** are the same, for which I substituted above.

  • Can you please help me by saying me how can i join two different picture to make it as one picture.??

    Hi Sir/ Madam,
       My name is Rishav and I am facing some problem with my Photoshop CC. Actually I have a question. If you guys could help me out i will be very obliged. The quest in "Can you please help me by saying me how can i join two different picture to make it as one picture.??"

    Maybe you should post over at
    Photoshop for Beginners
    or start with the "Get Started" section of the Help:
    Photoshop Help | Photoshop Help
    And your question
    Can you please help me by saying me how can i join two different picture to make it as one picture.??
    does not seem particularly specific – do you want to simply combine two images as they are, do you want to clip elements from the one and insert them into the other, …?
    Could you post (lores of) the images and explain what you intend to achieve?

  • Please HELP join these 2 iTunes folders in Windows 7 preserving album artwork & tags (discussion reply requested)

    (Discussion Reply Requested ) Please HELP join these 2 iTunes folders in
    Windows 7 preserving album artwork & "tags"
    I have searched and not found an up to date understandable answer as how
    to join 2 working portable same (apple ID) user iTunes folders into one itunes folder
    while above all else preserving hand edited Abum Artwork and hand edited tags.
    ( It was many hours of hand edited added Album Artwork and editing of tags )
    Situation is Windows 7 ( 64 bit ) with current iTunes installed ( 2014-03-17 )
    The hard drive crashed and the old \iTunes folder and all old contents have been copied and backed up.
    The windows 7 64 bit and latest iTunes 64 bit has been re-installed cleanly ( no old music added )
    Music from the iTunes cloud was then added/downloaded into iTunes
    Now \itunes has 40 gig of music available to play.
    Now I want to join the currently installed working \itunes folder ( 40 gig of music )
    with  the old saved \itunes folder  ( 100 gig of music ) into just one \iTunes folder
    with preserving the current Album Artwork and editing of "tags" of both folders.
    I have seen previous answers that use words like " consolidate " , " export / import ",
    " merge " , " apple home sharing " , " use explorer to copy  ..." , ect
    none of which mentioned if the current Album Artwork
    or tags survive unchanged from their current "specially edited" status.
    I know their may be the ineviatable "duplicates", but there seems
    to be several ways to handle them.  ( If you know the best way to
    prevent or remove duplicates in this situation with joining two
    iTunes folders in Windows please include that information also ).
    Please provide an explanation of how to join these 2 iTunes folders
    in Windows 7 into one \iTunes folder while preserving Album Artwork and tags.

    Mike, thanks for the response. I will try this. I'll have to dig around here too, bc I want to know more about how I can import a windows xml file (while replacing the drive paths) and it creating a seperate itunes library with the pointers on the mac. Essentially, I have 2 libraries and there may not be a way around this with a windows machine and a mac - ive read plenty on Choose library on open, and mac to mac, windows to windows.
    I also need to know more about what is getting stored in the album art folders. I believe it seems that when you select all, and copy the image in the artwork get info page its actually embedding these images in the files themselves, but if you paste into the left bottom artwork display pane its just adding where?? If I deleted the contents of this folder what would happen, should I not be copying this content?
    If I update the images on the mac and swap out the drive paths and move the external drive back to the windows box, will i lose any updates I did while on the mac?
    Good suggestion though, I'll try this out.

  • Please help - Joining three tables and get row values into Column. Please help!

    Hi,
    There is a SourceTable1 (Employee) with Columns like EmployeeID,Name,DOB.
    There is a sourcetable2 (EmployeeCode) with columns like EmployeeID,Code,Order.
    There is a source table 3  #EmployeeRegioncode  and its columns are (EmployeeID , RegionCode , [Order] 
    The target table 'EmployeeDetails' has the following details. EmployeeID,Name,DOB,Code1,Code2,Code3,Code4,regioncode1
    regioncode2 ,regioncode3 ,regioncode4 
    The requirement is , the value of the target table columns the Code1,code2,code3 ,code4,code5 values should
    be column 'Code' from Sourcetable2 where its 'Order' column is accordingly. ie) Code1 value should be the 'Code' value where [Order] column =1, and Code2 value should be the 'Code' value where [Order] =2, and so on.
    Same is the case for Source table 3- 'Region code' column also for the columns  regioncode1
    regioncode2 ,regioncode3 ,regioncode4 
    Here is the DDL and Sample date for your ref.
    IF OBJECT_ID('TEMPDB..#Employee') IS NOT NULL DROP TABLE #Employee;
    IF OBJECT_ID('TEMPDB..#EmployeeCode') IS NOT NULL DROP TABLE #EmployeeCode;
    IF OBJECT_ID('TEMPDB..#EmployeeDetails') IS NOT NULL DROP TABLE #EmployeeDetails;
    ---Source1
    CREATE table #Employee 
    (EmployeeID int, Empname varchar(20), DOB date )
    insert into #Employee VALUES (1000,'Sachin','1975-12-12') 
    insert into #Employee VALUES (1001,'Sara','1996-12-10') 
    insert into #Employee  VALUES (1002,'Arjun','2000-12-12')
    ---Source2
    CREATE table #EmployeeCode 
    (EmployeeID int, Code varchar(10), [Order] int)
    insert into #EmployeeCode VALUES (1000,'AA',1) 
    insert into #EmployeeCode VALUES (1000,'BB',2)   
    insert into #EmployeeCode  VALUES (1000,'CC',3)  
    insert into #EmployeeCode VALUES  (1001,'AAA',1)  
    insert into #EmployeeCode  VALUES  (1001,'BBB',2)  
    insert into #EmployeeCode  VALUES  (1001,'CCC',3)  
    insert into #EmployeeCode  VALUES  (1001,'DDD',4)  
    insert into #EmployeeCode  VALUES  (1002,'AAAA',1)  
    insert into #EmployeeCode  VALUES  (1002,'BBBB',2)  
    insert into #EmployeeCode  VALUES  (1002,'CCCC',3)  
    insert into #EmployeeCode  VALUES  (1002,'DDDD',4)  
    insert into #EmployeeCode  VALUES  (1002,'EEEE',5)  
    ---Source tbl 3
    CREATE table #EmployeeRegioncode 
    (EmployeeID int, RegionCode varchar(10), [Order] int)
    insert into #EmployeeRegioncode VALUES (1000,'xx',1) 
    insert into #EmployeeRegioncode VALUES (1000,'yy',2)   
    insert into #EmployeeRegioncode  VALUES (1000,'zz',3)  
    insert into #EmployeeRegioncode VALUES  (1001,'xx',1)  
    insert into #EmployeeRegioncode  VALUES  (1001,'yy',2)  
    insert into #EmployeeRegioncode  VALUES  (1001,'zz',3)  
    insert into #EmployeeRegioncode  VALUES  (1001,'xy',4)  
    insert into #EmployeeRegioncode  VALUES  (1002,'qq',1)  
    insert into #EmployeeRegioncode  VALUES  (1002,'rr',2)  
    insert into #EmployeeRegioncode  VALUES  (1002,'ss',3)  
    ---Target
    Create table #EmployeeDetails
    (EmployeeID int, Code1 varchar(10), Code2 varchar(10),Code3 varchar(10),Code4 varchar(10),Code5 varchar(10) , regioncode1 varchar(10),
    regioncode2 varchar(10),regioncode3 varchar(10),regioncode4 varchar(10))
    insert into #EmployeeDetails  VALUES (1000,'AA','BB','CC','','','xx','yy','zz','')  
    insert into #EmployeeDetails  VALUES (1001,'AAA','BBB','CCC','DDD','','xx','yy','zz','xy')  
    insert into #EmployeeDetails VALUES (1002,'AAAA','BBBB','CCCC','DDDD','EEEE','qq','rr','ss','')  
    SELECT * FROM  #Employee
    SELECT * FROM  #EmployeeCode
    SELECT * FROM  #EmployeeRegioncode
    SELECT * FROM  #EmployeeDetails
    Can you please help me to get the desired /targetoutput?  I have sql server 2008.
    Your help is greatly appreciated.

    select a.EmployeeID,b.code1,b.code2,b.code3,b.code4,b.code5,c.Reg1,c.Reg2,c.Reg3,c.Reg4 from
    #Employee a
    left outer join
    (select EmployeeID,max(case when [Order] =1 then Code else '' end) code1,
    max(case when [Order] =2 then Code else '' end)code2,
    max(case when [Order] =3 then Code else '' end)code3,
    max(case when [Order] =4 then Code else '' end)code4,
    max(case when [Order] =5 then Code else '' end)code5 from #EmployeeCode group by EmployeeID) b
    on a.EmployeeID=b.EmployeeID
    left outer join
    (select EmployeeID,max(case when [Order] =1 then RegionCode else '' end) Reg1,
    max(case when [Order] =2 then RegionCode else '' end)Reg2,
    max(case when [Order] =3 then RegionCode else '' end)Reg3,
    max(case when [Order] =4 then RegionCode else '' end)Reg4 from #EmployeeRegioncode group by EmployeeID) c
    on a.EmployeeID=c.EmployeeID
    Thanks
    Saravana Kumar C

  • Physical joins problem- Please Help

    Hi experts,
    I have two Fact Tables i.e. PRODUCT_FACT and CLAIM_FACT. They don't have direct joins but they are joined through dimensions. such as CALENDAR, GEOGRAPHY and ORGANIZATION.
    Here's how it looks
    PRODUCT_FACT----CALENDAR----CLAIM_FACT.
    PRODUCT_FACT----GEOGRAPHY---CLAIM_FACT.
    PRODUCT_FACT----ORGANIZATION----CLAIM_FACT.
    When I take any column from PRODUCT_FACT and CALENDAR, the result comes accurately. but when I add a column from CLAIM_FACT to the same query, it shows no results even if the related data is present in the tables..
    Is there something I am missing.....If Any body has faced same kind of issue with conformed dimensions, Please help me....
    Edited by: LavaRider on Apr 23, 2010 11:59 PM

    OK Im guessing you havent set your Fact table content levels either, please do.
    What the error means is that there are no compatible fact table logical table sources at the same level as specified in the dimension, ususally because we havent specified the level at all in the LTS as opposed to a modelling problem.
    Its good practice to set all levels for fact tables by the conformed dimensions, and certainly all levels in Dimensions. For at least two reasons - Give BI Server every possible chance of creating most efficient SQL, Allow another developer to very quickly ascertain what they are dealing with rather than having to "explore" the data / Foreign keys etc.

  • 'unable to join the network...' wifi network error ! please help, 'unable to join the network...' wifi network error ! please help

    im on pay as you go.. still trying to set up wifi to my home network.. im putting in the password (sky broadband) and i keep getting the message
    Unable to join the network...
    driving me crazy now - please help !

    Other possibilities:
    Your router firmware is out of date. Check the manufacturer's website for an update
    You have MAC (Media Access Control) filtering enabled on the router, that restricts access to "known" devices and the new iPhone is not on the table of known devices
    Your router has a setting limiting the number of simultaneous allowed devices
    Your routers SSID ("name") is still the default (e.g., LINKSYS, DLINK, NETGEAR, etc). Your phone has encountered other routers with the same name as you have traveled, and the phone is confused as to which router is the real one. If your router's name is still the default you should change it.

Maybe you are looking for

  • Using a TV to display photos

    I have a MacBook, and also a Sony Bravia (HD ready) TV with a 15-pin input marked 'PC' on the back. I am interested in linking the two so that I can see photographs from (iPhoto) on the TV screen. Two questions here... First, is a mini-DVA-to-VGA lea

  • No iSight camera in Vista?

    i installed windows vista using boot camp 2.0 and i installed the drivers for the leopard install disc it all works fine but i can't find the camera i looked in the device manager and its there its working but when i got to My computer there is no ca

  • Is ECC's enhpx(x=1,2,3,4) the same as PI's enhpx?

    I get confused on this. Would you please help? Thanks!

  • Why iOS 7 App crashes when i Open it?

    Why when I try to open iOS 7 app for tips it crashes? I already made update but no helps

  • Al abrir documentos con reader, todo es gris sólido

    Al abrir documentos con reader, todo es gris sólido. El documento entero aparece como un A3 gris, sin poder ver imágenes ni texto en él.