parents and children of the same table records

I want to create a query that is a union such that 2nd resultset is based on the game of results 1. I have a table that has parent and child records in the same table.

Table: EVENTS
EVENT_ID
PARENT_EVENT_ID
CREATED_DATE
(other columns)

If PARENT_EVENT_ID is null, then this is a parent record, otherwise it is a book of the child. I want to select all parent records then union them with all the related child records... something like this:

Select * from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null - all parents
Union
Select * event where PARENT_EVENT_ID in (select EVENT_ID of EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null)-include all children selected from the top parent

It works but it of kind of ugly, I want to avoid using the subselect in the 2nd because it is a repeat of the 1st statement, is there a way to alias the first statement and only refer to him in the 2nd query?

Hello

CONNECTION is very similar to a UNION on the same table. How is this:

SELECT     *
FROM     events
WHERE     created_date     < SYSDATE - 90
START WITH     parent_event_id     IS NULL
CONNECT BY     parent_event_id     = PRIOR event_id
     AND     LEVEL          <= 2    -- Maybe
;

?

To answer your question: Yes, you can still keep the result set of a query and the Treaty as if it were a table or vew, like this:

WITH     roots     AS
(
     SELECT     *
     FROM     events
     WHERE     created_date     < SYSDATE - 90
     AND     parent_event_id     IS NULL
)
SELECT     *
FROM     roots
     --
UNION ALL
        --
SELECT     *
FROM     events
WHERE     created_date     < SYSDATE - 90
AND     parent_event_id     IN (
                      SELECT  event_id
                      FROM    roots
                  )
;

It's always a bit ugly, however. I would use CONNECT BY or from Oracle 11.2, a recursive WITH clause (which is explicitly a UNION), or, in any version, a self-join, like this:

SELECT     c.*
FROM          events  c
LEFT OUTER JOIN     events     p  ON   p.event_id  = c.parent_event_id
WHERE   p.parent_event_id  IS NULL
;

I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Report where the queriy above (the one you decide to use) is producingthe bad results and explain, using specific examples, how you get the right results from these data in these places.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Tags: Database

Similar Questions

  • Insert objects parents and children in the same request

    Hello.

    I use Web 2.0 CRM on demand Services create opportunities with Notes, but I'll have a few mistakes if I add a Note to the ListOfNotes of the opportunity.

    I use a windows forms application that is coded in c#.
    I wan't creat the opportunity and his notes in the same request (method OpportunityInsert).

    I fill the object [] OpportunityData with the data of opportunity and theOpportunityData. ListOfNote.Note [0] with the Note data. When I run my application, I get this message:

    "Operation on the 'Opportunity' integration component update failed because no record corresponding to the component 'led' with search specification" [name] = "XXXXX" ' could be found. "." (SBL-EAI-04403) »


    Why does say 'operation update' if I call the OpportunityInsert method?
    It seems he's trying to find an opportunity before creating it, I do not understand...

    Ins't it is possible to define in the parent (opportunity) all child objects (Notes, activities) and call the Insert and create all? How can I do this?

    Thank you.

    Edited by: 859863 may 18, 2011 18:24

    Hello

    I got your point. As I said most early to insert a new Note, you will need to use the method Execute of opportunity because InsertChild method is not supported in WS 2.0. Here is an example of XML code demonstrates how to use the Execute method to display several insert in a single SOAP request operation.


              
                   
                        
                             New
                             ABC
                             XYZ
                             XYZ
                             
                                  
                                  

                             

                        

                   

                   LIC
              

         

    If possible to share code you are using, and then I can fix your code. But first try to use the Execute method, then enter in this method
    operation = "insert".

    Thank you & best regards
    Sablok

  • Key Reg primary and foreign at the same table

    Hello

    It is - ok if create primary and foreign keys on the same table itself?

    For example:

    In a table X, I have two columns such as Codeunite and ParentUnitcode.
    Is it ok if create Mt10 as principal and ParentUnitcode as foreign keys in the table itself?

    The foreign key base table: OrganizationalUnit
    Foreign key columns: ParentUnitCode
    Primary/Unique key base: OrganizationalUnit
    Primary/unique key col: Mt10

    Can anyone answer me on that?

    Concerning
    Rajesh

    OWB,

    If the two tables are favouring a one-to-one relationship so there no need to have two separate tables and so you can have free referential foreign keys in the same table where the primary key.

  • check point and polygon in the same table

    Hello

    Can I store two different types of geometry as the Point and polygon in a table with one column of the SDO-Gemetry? I read somewhere that we can only store one type either points, polygon or line in one table with only on column geom, is that correct? If so, what would be the solution if the data is of type points and polygons? Should I create different table?

    Appreciate any response or any type of recommendation.

    FYI - I use oracle 10g with oracle spatial extension.

    Best regards

    Marwa

    M

    The fact that you combine several types of geometry in the same column has obvisouly some impact in the way that you investigate this type of column.

    you could include a clause, for example, to filter on the type of geometry: where a.loc.gtype = 2001 (point gtype).

    you could also, as you ask specifically points, through the access of the x and the coordinate of the point y (type) with a.loc.sdo_point.x =... and even for y.

    but I think in your case, once you have built your spatial index, it may be better (in terms of performance) to fetch the spatial operator that uses the spatial index.

    so the where clause would be: where sdo_relate (a.loc, (2001,8307,SDO_POINT_TYPE (107.53,32.53,null), null, null), sdo_geometry "mask = EQUALITY '") = 'TRUE '.

    Luke

  • Group by and count on the same table

    Hello

    DB version: 11.2.0.3

    Tried to SQL:

    create table log1 (identification number, status varchar2 (15) date of insert1);

    insert into log1 values (1, 'SUCCESS', sysdate-1);

    insert into log1 values (2, 'SUCCESS', sysdate-2);

    insert into log1 values (3, 'FAIL', sysdate-1);

    insert into log1 values (4, 'FAIL', sysdate-2);

    insert into log1 values (5, 'FAIL', sysdate-1);

    insert into log1 values (6, 'ERROR', sysdate-1);

    insert into log1 values (7, 'ERROR', sysdate-1);

    insert into log1 values (8, 'ERROR', sysdate-1);

    insert into log1 values (9, 'ERROR', sysdate-1);

    WITH AS TBL1

    (SELECT THE STATE OF 'SUCCESS' OF THE DUAL UNION ALL

    SELECT "FAIL" STATUS OF THE DUAL UNION ALL

    SELECT 'PENDING' STATUS OF DOUBLE)

    SELECT NVL (TBL1. STATUS OF STATE, 'TOTAL'), COUNT (LOG1.ID)

    FROM TBL1 JOIN LOG1 FULL EXTERNAL

    ON LOG1. STATUS = TBL1. STATUS

    GROUP BY ROLLUP (TBL1. STATUS)

    STATUSCOUNT (LOG1.ID)
    IN CASE OF FAILURE3
    SUCCESS2
    PENDING0
    TOTAL (*)4
    TOTAL9

    t need only State of SUCCESS, FAILURE, WAITING. and NUMBER of global ID omit the rest of type status as ERROR, etc. EXECUTION in the result set.

    I don't need the TOTAL (*) of the above result set. Which is total (Error).

    Please tell us how the query above can be changed to produce the result to wait.

    Thank you

    Hello

    So, you want to see all the tbl1 lines, if they have a match in log1, and for the grand total of lines, you must count the log1 lines if they have a match with tbl1.  This looks like a job for a FULL OUTER JOIN:

    SELECT t.status

    EARL of (l.status) AS cnt

    OF log1 l

    FULL OUTER JOIN tbl1 t WE t.status = l.status

    GROUP OF ROLLUP (t.status)

    HAVING t.status IS NOT NULL

    OR of a GROUP (t.status) = 1

    ;

  • Update, and select from the same table

    Hello

    I have this selection - I've tested and work

    [code]

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT
    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end

    as KTBT_ISO,

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN
    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end

    as KTZN_ISO,

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB
    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB

    end as KTAB_ISO,

    DTF_REEW_201301.brnrn,
    DTF_REEW_201301.ktat

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    [/ code]

    With the result of KTBT_ISO, KTZN_ISO and KTAB_ISO I want to update the table 'reewdq. DTF_REEW_201301' - and this picture is in the select statement.

    I think I've tried every update statement - but no update does not work.

    I need something like this:

    [code]

    Update reewdq. DTF_REEW_201301 set t1 t1. KTBT_ISO =

    (

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT
    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end
    as KTBT_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    ),

    T1. KTZN_ISO =

    (

    Select

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN
    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end
    as KTZN_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    ),

    T1. KTAB_ISO =

    (

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB
    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB
    end as KTAB_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    )

    [/ code]

    But this isn´t of the labour code. Someone an idea please? Can someone help me please.

    Best regards

    Heidi

    Use MERGE:

    Fusion

    in reewdq. DTF_REEW_201301 t1

    a_l'_aide_de)

    Select the case sensitive option

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT

    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT

    end as KTBT_ISO,

    case

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN

    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN

    end as KTZN_ISO,

    case

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB

    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB

    end as KTAB_ISO,

    reewdq. ROWID that RID

    of reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,

    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN

    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT

    and CTF_REEW_KUM_201301.KTMO = DTF_REEW_201301.KTMO - 1

    ) t2

    on)

    T1. ROWID = t2.rid

    )

    When Fachhochschule

    then

    Update

    the t1 value. KTBT_ISO = t2. KTBT_ISO,

    T1. KTZN_ISO = t2. KTZN_ISO,

    T1. KTAB_ISO = t2. KTAB_ISO

    /

    SY.

  • Help with career within the same table and find the relevant rank.

    HI all the gurus

    Pls help me out here... I need to implement some which is dependent on SUPERIOR record following found regarding one earlier. Some examples of data.

    create table SOR_OFF (OFF_ID, OFFS_ID number, REPORT number, CON_DATE number date, STATE varchar2 (20));

    REM INSERTING into  SOR_OFF
    SET DEFINE OFF;
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (987,349,30658,to_date('12-SEP-04','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (988,349,30658,to_date('29-DEC-98','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (990,349,30658,to_date('29-JUL-96','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (991,350,30658,to_date('27-NOV-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (992,352,30658,to_date('04-OCT-91','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (993,353,30658,to_date('12-JUN-95','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (994,353,30658,to_date('21-NOV-83','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (995,355,30658,to_date('21-APR-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (996,356,27250,to_date('23-SEP-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (997,357,30658,to_date('15-MAY-95','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (998,358,30658,to_date('13-JAN-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (999,358,30658,to_date('13-MAR-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1000,359,30658,to_date('17-DEC-96','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1003,360,30658,to_date('22-JUN-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1004,361,30658,to_date('15-FEB-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1006,362,30658,to_date('26-JUL-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1007,364,30658,to_date('01-JUL-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1009,365,30658,to_date('20-MAY-99','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1010,365,30658,to_date('01-JUL-99','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1011,366,30658,to_date('18-JUN-84','DD-MON-RR'),'Deleted');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1012,366,30658,to_date('15-JUL-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1013,366,30658,to_date('15-JUL-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1014,367,30658,to_date('07-NOV-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1015,368,30658,to_date('29-MAY-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1016,369,30658,to_date('10-SEP-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1020,370,30658,to_date('07-JUL-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1026,372,30658,to_date('23-JUL-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1027,373,30658,to_date('30-OCT-96','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1030,375,30658,to_date('03-OCT-91','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1034,376,30658,to_date('20-APR-95','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1037,378,30658,to_date('07-APR-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1039,379,30658,to_date('26-JAN-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1040,380,30658,to_date('12-MAY-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1041,381,30658,to_date('08-JAN-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1042,382,13428,to_date('27-JAN-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1043,383,30658,to_date('19-APR-91','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1044,384,30658,to_date('17-DEC-54','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1045,385,27884,to_date('03-APR-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1046,386,28480,to_date('01-DEC-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1048,388,30658,to_date('18-AUG-92','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1050,389,3894,to_date('26-AUG-88','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1051,389,30658,to_date('09-APR-96','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1053,391,30658,to_date('30-NOV-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1054,392,30658,to_date('27-MAY-93','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1055,393,3894,to_date('05-JUN-91','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1056,394,30658,to_date('29-MAY-96','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1057,395,3894,to_date('15-JUL-94','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1058,396,30658,to_date('22-FEB-91','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1061,398,30658,to_date('14-MAR-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,CON_DATE,STATUS) values (1062,398,30658,to_date('14-MAR-90','DD-MON-RR'),'Active');
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52810,37334,27250,'ACTIVE',to_date('25-JUL-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52811,37334,27250,'ACTIVE',to_date('23-NOV-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (21648,17315,27250,'Deleted',to_date('02-JAN-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (24740,17315,27250,'ACTIVE',to_date('05-JAN-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (8622,6410,27250,'Active',to_date('26-JUN-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44079,6410,27250,'ACTIVE',to_date('27-OCT-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54828,38266,13428,'ACTIVE',to_date('31-JUL-96','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55278,38266,13428,'ACTIVE',to_date('10-SEP-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55279,38266,13428,'ACTIVE',to_date('13-NOV-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48172,34748,17442,'ACTIVE',to_date('03-SEP-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48173,34748,17442,'ACTIVE',to_date('01-APR-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (45319,33194,9950,'ACTIVE',to_date('03-APR-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (45320,33194,9950,'ACTIVE',to_date('21-FEB-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (46803,34029,30862,'ACTIVE',to_date('05-MAY-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (46804,34029,30862,'ACTIVE',to_date('26-OCT-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (53886,34029,30658,'ACTIVE',to_date('18-NOV-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (13479,11608,14966,'Active',to_date('16-NOV-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (13480,11608,14966,'Active',to_date('01-JAN-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (60251,40687,27250,'ACTIVE',to_date('23-JAN-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (60252,40687,27250,'ACTIVE',to_date('14-JUL-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (17454,14278,604,'Active',to_date('10-AUG-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (17455,14278,1232,'Active',to_date('27-OCT-03','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52438,37084,27250,'ACTIVE',to_date('23-JUL-03','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52648,37084,27250,'ACTIVE',to_date('17-FEB-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (20653,16456,27250,'Deleted',to_date('02-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (31000,16456,0,'Deleted',null);
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (38241,16456,27250,'ACTIVE',to_date('28-APR-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54130,37980,1232,'ACTIVE',to_date('08-MAR-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (56129,37980,1232,'ACTIVE',to_date('07-AUG-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55025,38388,30622,'ACTIVE',to_date('06-DEC-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55032,38388,30622,'ACTIVE',to_date('01-DEC-10','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55517,38657,27884,'ACTIVE',to_date('04-FEB-10','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55518,38657,27884,'ACTIVE',to_date('17-AUG-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55519,38657,27884,'ACTIVE',to_date('21-JUL-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44764,32871,12408,'ACTIVE',to_date('18-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44765,32871,12408,'ACTIVE',to_date('16-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44766,32871,12408,'ACTIVE',to_date('16-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (19076,15174,27250,'ACTIVE',to_date('02-NOV-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (50173,15174,1232,'ACTIVE',to_date('16-SEP-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (45046,33005,27250,'ACTIVE',to_date('03-SEP-92','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (45160,33005,27250,'ACTIVE',to_date('08-FEB-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (45161,33005,27250,'ACTIVE',to_date('06-NOV-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44118,32387,27250,'ACTIVE',to_date('22-MAR-96','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44119,32387,9950,'ACTIVE',to_date('30-DEC-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44120,32387,9950,'ACTIVE',to_date('28-SEP-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48418,34888,19586,'ACTIVE',to_date('02-MAR-90','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48419,34888,28480,'ACTIVE',to_date('18-DEC-07','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48420,34888,28480,'ACTIVE',to_date('24-AUG-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (43307,31893,29598,'ACTIVE',to_date('26-APR-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (43437,31893,9950,'ACTIVE',to_date('20-SEP-07','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (53612,37738,13428,'ACTIVE',to_date('28-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (53613,37738,15208,'ACTIVE',to_date('15-DEC-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (21555,17241,13428,'ACTIVE',to_date('11-JUN-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (21556,17241,13428,'ACTIVE',to_date('02-JAN-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (41336,30685,14966,'ACTIVE',to_date('07-OCT-03','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (42363,30685,9950,'ACTIVE',to_date('20-NOV-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (50926,36355,30862,'ACTIVE',to_date('13-DEC-07','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (50928,36355,30862,'ACTIVE',to_date('13-SEP-07','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (25520,20471,27250,'ACTIVE',to_date('06-JUN-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (25521,20471,0,'ACTIVE',to_date('31-AUG-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (2035,1069,30658,'Active',to_date('29-JAN-92','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (36762,1069,9950,'ACTIVE',to_date('16-MAY-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (36763,1069,9950,'ACTIVE',to_date('17-AUG-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (29807,23548,18458,'ACTIVE',to_date('18-AUG-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (29826,23548,17868,'ACTIVE',to_date('13-AUG-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (12818,10852,1232,'Active',to_date('01-JUN-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (12988,10852,1232,'Active',to_date('01-JUL-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44287,32502,27884,'ACTIVE',to_date('10-JAN-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (44917,32502,9950,'ACTIVE',to_date('09-JUL-08','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (14430,12464,15070,'Active',to_date('03-APR-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (14431,12464,30658,'Active',to_date('08-NOV-89','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (42691,12464,30622,'ACTIVE',to_date('18-JAN-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (21608,17278,14966,'ACTIVE',to_date('03-AUG-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (25145,17278,14966,'ACTIVE',to_date('01-NOV-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54918,38323,17868,'ACTIVE',to_date('21-MAR-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55607,38323,17868,'ACTIVE',to_date('22-APR-10','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (28304,22497,1232,'ACTIVE',to_date('29-NOV-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (40755,22497,1232,'ACTIVE',to_date('13-DEC-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (13239,11318,19002,'Deleted',to_date('01-APR-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (13240,11318,19002,'Active',to_date('01-JAN-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54317,38064,14966,'ACTIVE',to_date('01-DEC-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54318,38064,30862,'ACTIVE',to_date('14-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (60404,38064,30658,'ACTIVE',to_date('31-AUG-11','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (60405,38064,30658,'ACTIVE',to_date('31-AUG-11','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52800,37327,27250,'ACTIVE',to_date('27-JUN-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52801,37327,27250,'ACTIVE',to_date('27-JUN-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (52802,37327,27250,'ACTIVE',to_date('19-DEC-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (41154,30599,27250,'ACTIVE',to_date('02-APR-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (46115,30599,27250,'ACTIVE',to_date('15-SEP-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48532,34983,1232,'ACTIVE',to_date('16-SEP-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (48533,34983,1232,'ACTIVE',to_date('16-SEP-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (26868,21438,1232,'ACTIVE',to_date('13-JAN-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (26909,21438,1232,'ACTIVE',to_date('13-DEC-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54646,38177,28480,'ACTIVE',to_date('02-DEC-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54647,38177,28480,'Deleted',null);
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (54648,38177,28480,'ACTIVE',to_date('01-NOV-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (26924,21471,10672,'ACTIVE',to_date('16-JAN-97','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27385,21471,10672,'ACTIVE',to_date('12-NOV-97','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27404,21471,3894,'ACTIVE',to_date('02-MAR-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (40329,30063,28480,'ACTIVE',to_date('07-OCT-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (40407,30063,28480,'ACTIVE',to_date('27-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27949,22235,27250,'ACTIVE',to_date('07-JUL-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27950,22235,27250,'ACTIVE',to_date('07-JUL-03','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (32387,25414,19032,'ACTIVE',to_date('18-APR-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (46214,25414,19032,'ACTIVE',to_date('18-APR-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (32226,25340,30658,'ACTIVE',to_date('25-MAY-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (33363,25340,27884,'ACTIVE',to_date('11-SEP-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (33364,25340,27884,'ACTIVE',to_date('08-FEB-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55789,38840,1830,'ACTIVE',to_date('22-MAR-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55790,38840,1830,'ACTIVE',to_date('22-MAR-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (55792,38840,1830,'ACTIVE',to_date('20-MAR-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (1976,1026,30658,'Active',to_date('21-JUN-94','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (47881,1026,1232,'ACTIVE',to_date('25-SEP-09','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (47882,1026,1232,'ACTIVE',to_date('21-JUN-04','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (13820,11900,27250,'Active',to_date('15-MAY-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (35519,11900,27250,'ACTIVE',to_date('18-JAN-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (35520,11900,27250,'ACTIVE',to_date('14-AUG-00','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (35521,11900,30658,'ACTIVE',to_date('03-DEC-02','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (35524,11900,30658,'ACTIVE',to_date('21-MAR-06','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (35525,11900,27250,'ACTIVE',to_date('29-AUG-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (26168,20977,27250,'ACTIVE',to_date('24-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27644,20977,27250,'Deleted',to_date('29-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (27764,20977,27250,'Deleted',to_date('28-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (50681,20977,27250,'ACTIVE',to_date('28-OCT-05','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (49856,35737,27250,'ACTIVE',to_date('03-DEC-97','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (49858,35737,27250,'ACTIVE',to_date('19-JUL-07','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (41260,30649,27250,'ACTIVE',to_date('01-JUL-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (41261,30649,27250,'ACTIVE',to_date('01-JUN-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (8290,6012,14966,'Active',to_date('16-OCT-98','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (8291,6012,14966,'Active',to_date('24-FEB-99','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (49978,35835,9950,'ACTIVE',to_date('10-SEP-01','DD-MON-RR'));
    Insert into  SOR_OFF (OFF_ID,OFFS_ID,STATE,STATUS,CON_DATE) values (49979,35835,9950,'ACTIVE',to_date('31-MAY-06','DD-MON-RR'));
    

    What I want is less than

    -Search for a line more low which is CON_DATE > = to_date ('01-NOV-1998', ' MON-DD-YYYY "") AND STATE = 30658 and get the second row whose state = 30658 but having separate con_date

                               or CON_DATE = > = to_date (November 1, 1997 ',' MON-DD-YYYY "") AND STATE <>30658 & get the second row including State = 30658 but having separate con_date

    and lower (status) = 'active '.


    and get another line that extends beyond the found line, but having separate con_date (no operation of the same day.)

    I tried to do it with and then attach it again with the same table, but I don't get different results...

    Please advise.

    Hello

    n_shah18 wrote:

    NO Frank

    Thanks for trying.

    First find a line that corresponds

    ((CON_DATE > = to_date (1er novembre 1998 ', ' MON-DD-YYYY ") AND STATE = 30658))

    or (CON_DATE > = to_date (November 1, 1997 ',' MON-DD-YYYY "") AND STATE <> 30658))


    8 second get/check the following line immediately for offs_id even that has different con_date, that is superior to prev con_date but State should be 3065


    If offs_id found then return else throw line...


       


    Thus, in addition to the conditions that I listed previously, there must be a line with the same offs_id, which has a con_date later and the State concerned; is this fair?

    You can use a self-join to see if there is such an extra line:

    WITH params AS

    (

    SELECT TO_DATE (November 1, 1998 ', 'DD-Mon-YYYY') AS later_threshold_date

    AS target_state 30658

    11900 AS target_offs_id

    OF the double

    )

    SELECT s.offs_id

    OF s sor_off

    JOIN params p ON s.offs_id = p.target_offs_id

    AND ((s.con_date > = p.later_threshold_date))

    AND s.state = p.target_state

    )

    OR (s.con_date > = ADD_MONTHS (p.later_threshold_date, 12))

    AND s.state <> p.target_state

    )

    )

    JOIN sor_off ON s2.offs_id = s.offs_id s2

    AND s2.con_date > s.con_date

    AND s2.state = p.target_state

    GROUP BY s.offs_id

    ;

    The only difference between this and the previous solution is the last join, in other words, the 3 lines of code just before the GROUP BY clause.

  • Detailed form Master in Apex - creating main records and details at the same time

    I m trying to create a master form / retail.
    The master is a simple standard form and below on the same page there is a tabular presentation containing the details.

    I am facing a problem when you try to save a new record from the master at the same time with new details.
    If I create a new record of the master and at the same time create detail records for this master (on the same page), when I submit that the foreign key of the details field is not filled in. So only one master record gets inserted into the table and record line is not inserted.

    When I have everything first create a master without a detail and edit this master and then add details so everything's allright (since the primary key field is filled out at the time).

    I just need to confirm that whether in the APEX form master detail, can save master and line record at the same time or is it as master must be registered the 1 and then line must be enterd and saved?

    Please let me know, if this functionality can be achieved in the APEX.

    Hello

    There was an error in the process of pl/sql, you referenced f01 (F01. COUNT) in the loop condition and which should have been f03, also you have assigned the wrong field to what should have been P3_DEPARTMENT_ID

    I fixed that. Also, I'm not 100% sure but I think in order to use the table in the column must be of type text or something (and not hidden), but I can't check now because of lack of time.

    A few mistakes during the presentation, but they are still due to constraints on the other fields.

    FOR I IN 1.APEX_APPLICATION. G_F03. COUNTY

    LOOP

    APEX_APPLICATION. G_F03 (I): =: P3_DEPARTMENT_ID;

    END LOOP;

    Concerning

    Bottom

  • I got two sources of camera the same audio recording - how to use multicam to audio synchronization and display TWO cameras simultaneously

    I had two sources of camera recording the same audio - I want to be able to do is use mulitcam SYNCHRONIZE the audio and video at the same time and be able to use the two clips simultaneously in a video - multicam - how can we use the TWO videos? In Multicam, I can only go to one video at a time - is to detach anyway, so I can trim two camera responsition camera and 1 on a 16:9 screen? What would be the best way to do this? Any help would be welcome - Ty

    Two PPut copies the multicam in editing element, one on the other.

  • Name of the file and the measure in the same table?

    Hello

    I wrote the following VI which opens each image file in a folder and measure a certain size on the image. He then puts the result in a table.

    The table has a column and N lines since I N images in my folder. How can I change this VI so that it puts the name of the file in the same table as well as the measurement?

    I want the table to look like:

    File1 measurement1

    File2 GCA2

    ...

    and so on.

    Currently, it just shows

    measurement1

    GCA2

    ....

    and so on.

    The VI are:

    You cannot use the Table Express. Like the properties page says: this is for digital data. You will need to use a bit of real LabVIEW to create the table. A table is simply a string 2D array. Convert the digital chain, build an array of 1 d of the filename and numberic strings and use a shift register to build a 2D array. Something like the code below.

  • How to record the numbers and words in the same file

    Hello:

    I did a vi where I record the spectrum and its integration in different positions of a two-dimensional net. I save the information in two spreadsheet with the comand "write to file measure."

    Now, I am recording the parameters initial positions, end X X and space between measurement points. I want a file with two columns that looks like:

    Initial position X 1000

    final position X 2000

    space 100

    But idon't know how to save the words and numbers in the same file.

    As I have to perform several steps I want to automatically choose the name of the file (something like parameters_1, parameters_2...)

    Thank you for your attention

    Hi bitxor.

    You can use all the functions of the WriteTotext file to write strings to a file.

    Then you could set up WriteToMeasurementFile' to add new data to existing files (instead of overwrite or renaming)...

    BTW. It is not a good idea to mix lvm files containing arbitrary spreadsheet data!

  • If I have the two LOV in the same table then how to connect when I select first and second LOV value also change?

    Mr President

    If I have the two LOV in the same table then how to connect when I select first and second LOV value also change?

    My two fields are FLOW AND DR_NAME

    FLOW = ACCT_ID

    DR_NAME = ACCT_NAME

    I created with success of LOV for these fields.

    First LOV gives acct_id in the debit field and second LOV gives the value of acct_name to dr_name.

    How can I report these lov, it's that when I change my acct_id then acct_name also change

    I have these two tables

    CREATE TABLE "NOM"  (
      "ACCT_ID" VARCHAR2(7) NOT NULL ENABLE, 
      "ACCT_NAME" VARCHAR2(50) NOT NULL ENABLE, 
      "O_BAL" NUMBER(13,2),
      CONSTRAINT NOM_PK PRIMARY KEY ("ACCT_ID")ENABLE
       
       );
    CREATE TABLE "VOUCHERDET" (
      "V_ID" VARCHAR2(9) NOT NULL ENABLE,
      "LINEITEM" NUMBER ,
      "DEBIT" VARCHAR2(7) , 
      "DR_NAME" VARCHAR2(50), 
      "CREDIT" VARCHAR2(7) , 
      "CR_NAME" VARCHAR2(50), 
      "PARTICULARS" VARCHAR2(100), 
      "AMOUNT" NUMBER(21,2),
    CONSTRAINT VOUCHERDET_PK PRIMARY KEY ("V_ID","LINEITEM")ENABLE, 
    CONSTRAINT PUR_SAL_LINE_POD_FK FOREIGN KEY(PROD_ID)
      REFERENCES PRODUCTS (PROD_ID)ENABLE,  
    CONSTRAINT VOUCHERDET_DEBIT_FK FOREIGN KEY ("DEBIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE, 
    CONSTRAINT VOUCHERDET_CREDIT_FK FOREIGN KEY ("CREDIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE,  
    CONSTRAINT VOUCHERDET_V_FK FOREIGN KEY ("V_ID")
       REFERENCES "VOUCHER" ("V_ID") ON DELETE CASCADE ENABLE
      );
    
    

    Concerning

    so, instead of this second ActId, choose ACCT_NAME:

  • Trying to record demo and training at the same time

    Ok... I remember when I got 8 Captivate you can record more than a software simulation both (multimode). I'm doing it, but I can't figure out how. I chose to add a software simulation and selected automatic as registration type. It seems I don't have the possibility to choose a type of simulation in the Mode menu: Demo, training, assessment, and Custom. What do I have to use Custom? When I select this option, I don't always anywhere to select more than one record mode. I want to record a demo and training at the same time. Thank you!

    This will not work because you are already in a single file, you can not expect suddenly to be converted into 3 files. It was exactly the same behavior for previous versions.

    To be able to capture in addition to a mode, you must start a new project with the file new software Simulation (or the old shortcut CTRL-R).

  • Updated with the values in the same table, for other records corresponding to conditions

    Hi Experts,

    Sorry do not provide the structure of the table (it is a simple structure)

    I have a requirement where I need to update the columns of a table based on the same table with some match empid and date values. If the date and empid match so I have these values to any other folder and update of one who is not having details of Office . I need the Update query

    Before the update my array of values is as below

    Sort_num Emp_id Bureau start_date

    1 101 AUS 01/01/2013
    2 101 01/01/2013
    3 101 15/01/2013
    4 103 USA 01/05/2013
    5 103 01/01/2013
    6 103 05/01/2013
    7 104 FRA 01/10/2013
    8 104 10/01/2013
    9 104 01/01/2013

    After update my table should be as below

    Sort_num Emp_id Bureau start_date

    1 101 AUS 01/01/2013
    2 101 AUS 01/01/2013
    3 101 15/01/2013
    4 103 USA 01/05/2013
    5 103 01/01/2013
    6 103 USA 01/05/2013
    7 104 FRA 01/10/2013
    8 104 FRA 01/10/2013
    9 104 01/01/2013

    Thanks in advance

    I don't have the time to create the table with the data, but basically, you should be able to code the following text

    update one table

    Office set = (select desktop in table b where b.emp_id = a.emp_id)

    and b.start_date = a.start_date

    and b.office is not null

    )

    where is ([as well as overall query])

    and a.office is null

    In my opinion, who will do the trick.

    HTH - Mark D Powell.

  • How can I align two different text lines in the same table in two different directions (centered on one and one on the left)?

    Hello

    I want to focus the two different text lines that are in the same table, but one on the Center and the other on the left. I put a < span > tag in the hope that he was overwhelmed the family of police .bottomsel table class properties and the. Police-family Cig84 and color but the text-align only: they are both on the left.

    Here is my source and CSS codes:

    Source:

    < table width = "600" border = "0" >

    < b >

    < class td = "bottomref" > < p > < span class = "bottomsel" > | < a href = "index.html" target = "_self" > Main < /a > | " < a href = "about.html" target = "_self" > on < /a > | " < a href = "clients.html" target = "_self" > customers < /a > | " < a href = "contact.html" target = "_self" > Contact < /a > | " </span > < br / >

    < span class = 'credits' > credits: < span class = "Cig84" > Cig84 </span > < / span > < /p > < table >

    < /tr >

    < /table >

    CSS:

    {.bottomsel}

    text-align: center;

    do-family: Georgia, "Times New Roman", Times, serif;

    }

    {.credits}

    text-align: left;

    }

    . {Cig84}

    Color: #F00;

    do-family: "Comic Sans MS", cursive;

    }

    Use tags to paragraph with CSS classes.

    CSS:

    . Center {text-align: center}

    .the {text-align: left}

    HTML:

    This text is centered

    This text is left-aligned

    Nancy O.

Maybe you are looking for