Help on query for missing documents

Thanks in advance
Can you tell me what is wrong with the query below
**************************************************************************************************************************
WITH missing_time_n AS
(
SELECT m.*
, ROW_NUMBER () OVER (PARTITION OF TRUNC (m.date_time, 'MI') ORDER BY m.date_time, m.description1, m.descript2) AS r_num
OF missing_time m
)
AS extrema
(
SELECT MIN (a.date_time) AS earliest_date_time, MAX (a.date_time) AS latest_date_time FROM a missing_time_n
)
all_minutes AS
(
Earliest_date_time SELECT + ((NIVEAU-1) / (24 * 60)) AS Date_Time FROM extrema
CONNECTION OF LEVEL < = 1 + ((latest_date_time-earliest_date_time) *(24 * 60))
)
two_rows AS
(
SELECT LEVEL AS n, "missing time" | Description (LEVEL) AS to_char dual CONNECT BY LEVEL OF < = 2
)
SELECT NVL (mn.date_time, am.date_time), (mn.description1, tr.description), NVL NVL (mn.descript2, tr.description)
To all_minutes:
CROSS JOIN two_rows tr
FULL OUTER JOIN missing_time_n mn ON am.date_time = TRUNC (mn.date_time, 'MI')
AND tr.n = mn.r_num
ORDER BY mn.date_time, am.date_time, mn.r_num, tr.n
**************************************************************************************************************************

I want to display my output and insert records of missing time

Original request

In this query 09:01 and 09:03 are missing for the same date

SQL > SELECT * FROM MISSING_TIME;

DATE_TIME DESCRIPTION1 DESCRIPT2

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
------------------------------
25/09/2003 09:00 test1 test2
25/09/2003 09:00 test2 test3
25/09/2003 09:02 test1 test2
25/09/2003 09:02 test2 test3
25/09/2003 09:04 test1 test2
25/09/2003 09:04 test2 test3

6 selected lines

My output

I want to display my output and thus place time records missing (09:01 and 09:03)

DATE_TIME DESCRIPTION1 DESCRIPT2



--------------------------------------------------------------------------------
25/09/2003 09:00 test1 test2
25/09/2003 09:00 test2 test3
2008-09-25 09:01 lack of time lack of time 1 1
2008-09-25 09:01 missing Time2 missing time2
25/09/2003 09:02 test1 test2
25/09/2003 09:02 test2 test3
2008-09-25 09:03 lack time lack of time 1 1
2008-09-25 09:03 missing Time2 missing time2
25/09/2003 09:04 test1 test2
25/09/2003 09:04 test2 test3
**************************************************************************************************************************
create table missing_time (date_time date, description1 varchar2 (30), descript2 varchar2 (30));

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:00 ',' yyyy/mm/dd hh24:mi:ss'), "test1", "test2");

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:00 ',' yyyy/mm/dd hh24:mi:ss'), "test2", "test3");

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:02 ',' yyyy/mm/dd hh24:mi:ss'), "test1", "test2");

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:02 ',' yyyy/mm/dd hh24:mi:ss'), "test2", "test3");

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:04 ',' yyyy/mm/dd hh24:mi:ss'), "test1", "test2");

insert into missing_time (description1, date_time, descript2)
values (to_date (' 25/09/2003 09:00 ',' yyyy/mm/dd hh24:mi:ss'), "test2", "test3");
**************************************************************************************************************************

Your problem is the following:

two_rows AS
(SELECT LEVEL n, "Missing time" |) To_char (LEVEL) FROM DUAL description
CONNECT BY LEVEL<=>

You try to FORCE two lines when the time is missing, hwt if there were three as in the data you provided?

Remove this bogus query you will get the best results:

SQL > SELECT am.date_time, am.n,.
2 NVL (mn.description1, ' lack of time ' | ') description1 am.n),
NVL 3 (mn.descript2, ' lack of time ' | ') description2 am.n)
4. A - all_minutes I
() 5
6. SELECT earliest_date_time
7 + ((LEVEL-1) / (24 * 60)) Date_Time, LEVEL n
8 FROM)
9. SELECT MIN (a.date_time) AS earliest_date_time,
10 MAX (a.date_time) AS latest_date_time
11 FROM missing_time one)
12 CONNECT BY LEVEL<= 1="" +="" ((latest_date_time="" -="" earliest_date_time)="" *="" (24="" *="" 60)))="">
13-, - two_rows I
14--(SÉLECTIONNEZ NIVEAU AS n, «Temps manquant» ||) Description of AS (LEVEL) to_char FROM DUAL
15 - CONNECT BY LEVEL<= 2)="">
16,-FULL OUTER JOIN
(17)
18 SELECT m.*, ROW_NUMBER () OVER (PARTITION OF TRUNC (m.date_time, 'MI') ORDER BY m.date_time)
19, m.description1, m.descript2) AS r_num
Minutes FROM missing_time m 20)
21 WHERE am.date_time = TRUNC ((+), 'MI' mn.date_time)
22 - AND tr.n (+) = mn.r_num
23 ORDER BY am.date_time, am.n
24.

DATE_TIME DESCRIPTION1 DESCRIPTION2 N
---------------- ---------- -------------------- --------------------
25/09/2003 09:00 1 test1 test2
25/09/2003 09:00 1 test2 test3
25/09/2003 09:00 1 test2 test3
25/09/2003 09:01 missing 2 time 2 lack of time 2
25/09/2003 09:02 3 test1 test2
25/09/2003 09:02 3 test2 test3
25/09/2003 09:03 miss 4 time 4 lack time 4
25/09/2003 09:04 5 test1 test2

8 selected lines.

Tags: Database

Similar Questions

  • Need help with query for points and polygons, 2 tables of

    Hi all

    I'm slowly stumbling along trying to figure things out space.

    I have two tables, GEO_POINTS:
    (
    DEP_ID NUMBER (12) NOT NULL,
    LINE NUMBER 4 NOT NULL,.
    MDSYS. POINT_LOC SDO_GEOMETRY
    )

    and POLYGON_AREAS:
    (
    POLY_NAME VARCHAR2 (120 CHAR),
    POLY_DESC VARCHAR2 (120 CHAR),
    MDSYS POLY_POINTS. SDO_GEOMETRY
    )

    Neither table is engraved in stone, if any, I can change some structure.

    I'm trying to understand how to write a query to retrieve all the points in a polygon, perhaps even with an optional buffer provided by the user.

    Conversely, I would probably also need to know what polygons a point would have drawn in, and it's the only request I could make any progress on.

    What I have so far, which is not working properly, is the following:

    Select * from deposits_search where dep_id in)
    SELECT dep_id
    OF geo_points, polygon_areas
    where (sdo_relate)
    poly_points,
    (SELECT point_loc
    OF geo_points
    WHERE dep_id = 10282444),
    ("mask = ANYINTERACT") = "TRUE");

    In the light of the foregoing, I want to select all the lines of a third table (DEPOSITS_SEARCH), for all polygons which is a point. The DEP_ID column is my primary key for most of the data tables in the database, and the number rose in my application query. However, the above returns all rows. It should only return one, because I only have a polygon of test defined so far.

    Any help is greatly appreciated. Thank you

    Bill Ferguson

    in which case you must include a line of buffer for the interaction between the points and polygons (with a stamp),

    better, you use the SDO_WITHIN_DISTANCE operator.

    http://download.Oracle.com/docs/HTML/B14255_01/sdo_operat.htm#i77653

    Not so sure what you mean with "I always have problems while providing a point location and extract the polygons that point would be plotted in" as so-called before unless you want that as a 'transitional instance of a geometry. (Specified using a variable binding or a builder SDO_GEOMETRY.) »

    http://download.Oracle.com/docs/HTML/B14255_01/sdo_operat.htm#i78531

    Read what geometry2 means in there. Read the examples and you will see that you have the geometry second in space operator as a builder. If this is what you need.

    Luke

  • [AS] [CS5] How to check if a book file has missing documents?

    Hello

    Does anyone know how to check a file to Active Directory for missing documents using Applescript?

    Thanx

    John

    Hello

    I have not been able to access all of the properties of the content of a book like the book State, but I can get the "full name" of each one, the content of the book. As is the full path of the file to where InDesign thinks is the file, you can try to make an alias, if the file is not there it will fail. If you use a try you can take the file paths failed.

    Tell application "Adobe InDesign CS3"

    Set missingBookFiles to {}

    Repeat with x 1 as the content of the book of book 1

    value bookPath full name of book content x of volume 1

    Try

    bookPath bookPath as an alias value

    in case of error

    Copy bookPath at the end of missingBookFiles

    try to end

    end repeat

    tell the end

    return missingBookFiles

    I hope it's useful.

    Gareth

  • 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/929833

    Method 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.

  • Time Machine is unable to locate my missing document

    TIme Machine opens ok, I select Pages, TM back in time, I don't want to restore at this point, I click on Pages and a window says it's 'size calculation' forever. I am not able to focus on my missing document. What I am doing wrong?

    Is there a reason that miss me that you posted this on Photos for Mac forum?

    You can not open file from a TM backup - you must use the TM = tipn applicai to restore then you open once they have been restored

    Use Time Machine to back up or restore your Mac - Apple Support

    http://pondini.org/TM/FAQ.html

    LN

  • When I look at a photo, PC keeps "searching for missing file.

    PC was overloaded with thousands of photos. I cut and pasted on a separate hard drive.

    Now, I tried to copy and paste on the drive C on the PC.
    I see the images of out-of-focus, with a dialog box saying "searching for missing file.
    Help?
    Conway M

    Hi M Conway,

    Thanks for posting your question in the Microsoft Community!

    To be able to understand the question in a better way than to provide you with the exact resolution, I would like to know exactly the problem you are experiencing.

    (1) what photo viewer are you using?

    Please send us the screenshot:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/how-do-i-post-a-screen-shot-on-this-forum/c86de820-C620-401c-A804-9f6337cd3053

    Please post is back with more information to help you solve the problem as soon as possible.

  • Why is my music library still looking for missing unknown album everyday now never stops

    Why is my music library still looking for missing unknown album everyday now never stops

    Hello

    ·         You did changes to the computer before the show?

    ·         What Media Player do you use to play music files?

    ·         What is the file type of the music files you want to play?

    If you are using Windows media player, I suggest you to re - index the WMP library by following the steps below and check it, if it helps:

    (a) output Windows Media Player.

    (b) click Start, run, type %LOCALAPPDATA%\Microsoft\Media Player, and then click OK.

    (c), select all the files in the folder and then click on Delete on the file menu.
    Note: You don't have to remove the folders that are in this folder.

    (d) restart Windows Media Player.
     
    Note: Windows Media Player automatically rebuilds the database

  • My help and Support is missing from my Vista

    My help and Support is missing from my Vista, and I'm in trouble. I write articles in this Forum.

    This question is not the healing of my problem; It's curiosity, because every time I'm looking for help and Support, I see a list of users, but my article is never seen; where they is gon? Admitted that I am a new enterent but my items are not!

    Hi Tali432hus,

    1. are you referiing to this post, that you created in the Web site of the answer?

    If so, you can check your profile page and see if it is listed.

    You can also see the response to your message.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-performance/the-help-and-support-features-have-gone-missing/8325401b-7821-4662-A62D-93f725450af3

    Hope this information is useful.

  • Windows Vista - my worksheets had icons for word documents or installation of programs icons

    When starting my computer, why Office five of the six albums icons for spread sheet documents appear as icons for word documents and the icon for the sixth broadcast sheet paper appears as one of an executable program?  My computer is infected?

    Hi VidaFenton,

    (1) remember to make changes?

    (2) is this problem limited to spreadsheets?

    Method 1: Run the fixit available in the links below and check if that makes a difference-Worth to try
    Difficulty of broken desktop shortcuts and common system maintenance tasks

    Note: FixIt would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of DATA loss from that particular area.

    Method 2: If you suspect a virus infection, run Microsoft Security scanner (MSS) to any threat and try to correct

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    If the question is limited to spreadsheets, you can post your query on Office Forum

    Office Forum
    http://answers.Microsoft.com/en-us/Office/Forum/office_2010-office_other?page=1

  • No show of "Previews" in Windows Explorer for Office documents

    With the "preview pane" selected no previews are shown for all documents 'Office'  Previews are shown for photos and programs such as Adobe Reader.  How to 'Office' overviews documents?

    If you haven't tried it already, see if repair Office help (could reset Manager/preview correctly)

    1. Quit all Microsoft Office programs are running.
    2. Open Control Panel and open Add / Remove Programs (if you are running Windows XP) or programs and features (if you are running Windows Vista or Windows 7).
    3. In the list of installed programs, click Microsoft Office 2010, and then click repair.
  • Need help with license for Windows store

    Hello! I have problem with Windows store, he says he has a problem with the license.

    It happened because I tried to upgrade my Windows 8.1 to Windows 10 and I've failed at about 20 times. Servers of M$ have been save this issue but they have not registered my fails so now servers $ M think I use illegal license for my laptop. My laptop is Asus F55A and I can not use the store because M$ servers does not allow me too.

    Please Microsoft something about it.i have legal Windows but probably your servers register this as illegal because I repeatedly upgrading to windows 10 who never worked and your servers did not know my fails.

    Please answer.

    Error with Windows store code "this application failed to start because of a problem with its license. Please try again later.

    Any help will be for me!

    Hello

    Thanks for posting your query on the Microsoft Community.

    According to the description, I understand that you are facing problems with Windows.

    I suggest you to refer to the suggestions of B Abid replied on 29 October 2012 and check if that helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-windows_store/unable-to-open-Windows-8-store/8a90d67e-9FEE-4B1F-A549-e702d0b207f4

    Hope that the information provided is useful. Let us know if you have questions related to Windows, 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.

    1. 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).

    2. 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'.
  • 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

  • Script that can check for missing fonts

    In this script for use in InDesign CS3:


    var doc = app.documents[0];
    var mExitFlag = false;
    
    var mTextFrames = doc.textFrames;
    for(var i = 0; i < mTextFrames.length; i++){
        if (mTextFrames[i].parentStory.overflows && checkIfOnPage(mTextFrames[i]) && mTextFrames[i].itemLayer.visible == true){
            alert('To much text' )
            mExitFlag = true;
        }
    }
    
    var mLinks = doc.links;
    for(var i = 0; i < mLinks.length; i++){
        if ((mLinks[i].status == LinkStatus.LINK_MISSING || mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE) && checkIfOnPage(mLinks[i].parent.parent) && mLinks[i].parent.parent.itemLayer.visible == true ){
            alert('Missing or not updated link' );
            mExitFlag = true;
        }
    }
    
    
    if(mExitFlag){    
        exit();    
    }
    
    function checkIfOnPage(mItem){     
        var _OldZeroPoint = app.activeDocument.zeroPoint;    
        app.activeDocument.zeroPoint = [0,0];    
        
        var _Width =app.activeDocument.documentPreferences.pageWidth;    
        var _Height=app.activeDocument.documentPreferences.pageHeight;    
        
        
        var _Bounds = mItem.geometricBounds;    
        
        if ((_Bounds[3] < 0)  || (_Bounds[1] > _Width) || (_Bounds[0] > _Height) || (_Bounds[2] < 0)){    
            return false    
        }else{    
            return true    
        }    
        app.activeDocument.zeroPoint =_OldZeroPoint;    
    }
    var doc = app.activeDocument;
    var _PDFExportPreset = app.pdfExportPresets.item('NewspaperAds_1v4_IND4');
    if (_PDFExportPreset == null){
       alert('Preset missing');
       exit();
    }
    var _DocName = doc.name.replace(/\.indd/, "");
    var _EndNumber = parseInt(_DocName.match(/\d{3}$/),10); /* extract end number */
    /* test if is a number */
    if (isNaN(_EndNumber)){
        alert('End document name is not a number');
        exit();
    }
    
    

    I also want to check for missing fonts - is it possible?

    I found this online earlier and use it regularly. missingItem is the variable too assign the missing font, do with it as you wish.

    var missingItem = "\n".

    var usedFonts = document.fonts;

    for (var i = 0; i)< usedfonts.length;="">

    If (usedFonts [i] .status! = FontStatus.INSTALLED) {}

    missingItem += "\n" + usedFonts [i] .fontFamily;

    }

    }

  • Windows group policy missing Document icon

    I'm dealing with the issue of icon missing document with my group policy deployment. I tried rebuilding cache icon as suggested in another thread, but who did not. I use for my deployment of user configuration group policy (Yes, I know the conventional wisdom is to use the configuration of the computer, but I'm pretty well connected to this option). In the Customization Wizard, I'm trying to set the value for the UNHCR-> AcroExch.Document.11-> DefaultIcon to point to the icon of the document in the user roaming application data. The value that I use is "[APPDATA]\Microsoft\Installer\[ProductCode]\PDFFile_8.ico,0" (without quotes). Can someone let me know if my environment variables are correct and also give some other ideas as to what I can do? Thank you very much!

    Here is the solution for those who encounter the same problem. Under editor Direct in the Customization Wizard, find all the DefaultIcon key and replace "[WindowsFolder]."

    "[% USERPROFILE] \AppData\Roaming\Microsoft\".  It of a royal pain, but with hopefully Adobe will fix this with player 12.

  • Default insertion for missing items using DBMS_XMLSave.insertXML

    Hello

    I'm trying to insert default values for some columns, without going through these as column names in the xml document. Is it possible to do? This is the code I use for now, but it inserts null for missing values in the xml document.

    insCtx: = DBMS_XMLSave.newContext ("TABLENAME"); -get the context
    lines: = DBMS_XMLSave.insertXML (insCtx, p_xmlDoc); -Insert the doc
    DBMS_XMLSave.closeContext (insCtx); -close the handle

    This approach has any impact on performance, if the xml document is like 10000 inserts line?

    Yes, this could have an impact on performance on large documents because of the transformation in memory.

    The solution of this situation is at the first store the document in an XMLType table (or column) and run the table INSERT.

    Here's a recent thread about this: {message identifier: = 10327556}

    What is your version of the database btw?

Maybe you are looking for

  • I don't want my name and first name in game Center

    I don't want to see my full name in game Center How can I remove it

  • The upgrade of my Mini

    My Mini is 4 years. Since El Capitan, it seems slow. Launching the app, reboot, lMacsales say the MacMini can handle 16GB, specifications say 8, someone has done this? Taking into account also 750 for one SSD 512 GB swap Any advice would be appreciat

  • My laptop keep crashing...

    The cursor sticks and nothing moves. I restart and some time it will fix it, but most of the time it crashes again. There are several I.Explorer opening in the tool bar, this might be a reason why my laptop crashes? How do I stop these tool bar openi

  • Repeated low disk message.

    I get the message low disk all the time. I run Disk Cleanup daily and he returned. I don't want to receive notifications, I want the problem to stop. I run Disk Cleanup daily and it does not help. Is it possible to solve the problem? I can't run syst

  • Screesaver

    I use the photo option for my screensaver, with the help of a folder with a number of subfolders. My question is when the photos are displayed is it possible to display the file name and location with the photo?