Update lines with the info from the other rows in the same Table.

I'm trying to update the lines with the information of the same table. The table is loaded with information from a report that runs and there must be a new entry every month, but I would like to bring some of the info from the last month. This statement below works but updates all rows in the new load table and in my test case, I only did a few game only like 5 files need to get updates. It is an example of what I'm trying to do. If I add this (C2. COL_INVC_ID = C1. COL_INVC_ID) until the last "* where *" statement get an invalid identifier for 'C2 '. COL_INVC_ID ". So what I'm doing wrong here? How can I update only the lines where also in recent months run?

Thanks in advance for any help!

------------
Update OpenIssues OI1
Together (OI1. NUM, OI1. Status, OI1. Code, OI1. LastModifiedDate) =
(Select ios2. NUM, ios2. Status, ios2. Code, ios2. LastModifiedDate
Of OpenIssues ios2
Where OI2.num = OI1.num and ios2. TableLoadDate = TO_DATE (January 31, 2012 00:00:00 ',' ' the HH24: MI: SS DD/MM/YYYY)
)
Where and OI1. TableLoadDate = TO_DATE (February 29, 2012 00:00:00 ',' ' the HH24: MI: SS DD/MM/YYYY)
------------


SQLMe

As Frank suggested merger is much effective here, go...

  create table  temp
as(
select 1 eno, 1 amt , sysdate load_date from dual union all
select 1 eno, 2 amt , add_months(sysdate,1) load_date from dual union all
select 2 eno, 1 amt , sysdate load_date from dual union all
select 2 eno, 2 amt , add_months(sysdate,1) load_date from dual
);

merge into temp t
using (select eno, amt, load_date
         from temp
        where trunc(Load_Date) = TO_DATE('05/30/2012', 'MM/DD/YYYY')) s
on ((s.eno = t.eno) and trunc(t.Load_Date) = TO_DATE('06/30/2012', 'MM/DD/YYYY'))
when matched then
  update set t.amt = s.amt;
commit;

select * from temp;

Tags: Database

Similar Questions

  • How to update columns with the value of other lines in the same table

    Hello

    I use Oracle 11.2, I'd use SQL statements to update a column based on values in other rows in the same table. Here are the details:

    create table TB_test (number 4 myId, crtTs date, date of MDPU);

    insert into tb_test (1, to_date ('20110101', 'YYYYMMDD'), null);
    insert into tb_test (1, to_date ('20110201', 'YYYYMMDD'), null);
    insert into tb_test (1, to_date ('20110301', 'YYYYMMDD'), null);
    insert into tb_test (2, to_date ('20110901', 'YYYYMMDD'), null);
    insert into tb_test (2, to_date ('20110902', 'YYYYMMDD'), null);

    After you run the SQL code, I would like to have the following result:

    1, 20110101, 20110201
    1, 20110201, 20110301
    1, 20110301, null
    2, 20110901, 20110902
    2, 20110902, null

    Thanks for your suggestion.

    I guess you need this, otherwise please explain logic correctly:

    SQL> merge into tb_test t
      2  using (
      3    select rowid as rid
      4         , lead(crtts) over(partition by myid order by crtts) as updts
      5    from tb_test
      6  ) v
      7  on (t.rowid = v.rid)
      8  when matched then update
      9   set t.updts = v.updts
     10  ;
    
    5 rows merged.
    
    SQL> select * from tb_test order by 1,2;
    
          MYID CRTTS     UPDTS
    ---------- --------- ---------
             1 01-JAN-11 01-FEB-11
             1 01-FEB-11 01-MAR-11
             1 01-MAR-11
             2 01-SEP-11 02-SEP-11
             2 02-SEP-11
    
  • Copy a few lines in the same table, but with different IDS

    Hi all
    I had this problem... I have a table with its pk (which is a sequence). With a statement select, I extract a few lines, and then I would record in the same table, but with IDS different (obviously eheheh).

    I don't know how to do...

    Thks for all help ;)


    p.s. I want to change some fields in lines before saving as well... don't know how do it more...

    example:

    ID NAME TYPE
    1 ferrari car
    2 cars lamborghini


    I'm trying to copy the second and changing its type in "BMW".

    I could result:

    1 ferrari car
    2 cars lamborghini
    3 bmw cars



    Thank you

    Assuming that your table is named cars_tb and the cars_seq of the sequence.

     insert into cars_tb
      select cars_seq.nextval, name, type
      from cars_tb
    

    This would overlap with any existing lines, but with a new id.

    If you want to duplicate a specific line and change a value, you could do something like:

     insert into cars_tb
      select cars_seq.nextval, name, 'BMW'
      from cars_tb
      where type = 'lamborghini'
    

    or better, use the PK

     insert into cars_tb
      select cars_seq.nextval, name, 'BMW'
      from cars_tb
      where id = 2
    
  • 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.

  • FRM - 40202:Field must be entered on two blocks with the same table

    I have two blocks, blockA and blockB, both from the same table that is tableX.

    When I ask of blockA and it worked, then I go to blockB and modify data, and save, there is no problem. But when I do not run the query of blockA or if the query did not return any results, I go to blockB and change some data then save, I got this error. The cursor then go to first blockA point. So now, I have to delete this empty line before the Save.


    Any suggestion?

    you set a few initial values programmatically for a block?
    in this case, the status changes to INSERT and you will get this message.
    You can check the staus with GET_RECORD_PROPERTY (1, "A BLOCK", STATUS), e.g. with the trigger KEY-COMMIT.

  • Several Windows updates fail with the same error code 80070081 0 x

    Anyone has any idea why? I just run SFC/scannow and restarted the computer, but no joy.

    Thank you for your help. When I wrote the first time, I had already tried your mentioned basic steps. : D I was troubleshooting computers for friends and family for a long time, and I'm a fan of CCleaner (one of the first things I install on any computer!). Unfortunately, they had not solved the problem.

    I have not run Windows repair tool. It is a work computer, and because my colleague use it almost all the time, I didn't have enough time to play with him. Anyway, he had a program called "Advanced Systemcare v.6" that someone had already loaded. A scan with the program detected and repaired something that solves the problem of failure of Windows Update.

    But I will keep your advice in mind. During the next update Tuesday, if updates not yet once again, I'll try the Windows repair tool.

    Thanks again!

  • Update events with the same old and new values.

    Hello.
    I use simple replicated cache and subscription to update events to it with the ObservableMap #addMapListener (MapListener) method.
    The problem is that, in the case of update received old and new values are identical by operator is.
    The values are updated by the following scenario:
    E MyEntity = cache.get (myKey) (MyEntity);
    e.setName ("new name");
    cache.put (myKey, e);

    I have this problem only if there is a single node of the cluster, adding new nodes solves problem.

    How can I solve this problem for the server node?

    Currently I use the copy constructor to put the new object with modified fields to get two items in my interlocutor. Like this:
    E MyEntity = new MyEntity ((MyEntity) cache.get (myKey));
    e.setName ("new name");
    cache.put (myKey, e);
    -----
    Cache configuration:
    <>cache-config
    < cache-system-mapping >
    <>cache-mapping
    < name of cache - > * < / cache-name >
    < scheme name > MyReplScheme < / system-name >
    < / cache-mapping >
    < / cache-system-mapping >

    <>- cached patterns
    < replicated system >
    < scheme name > MyReplScheme < / system-name >
    < service name > MyReplService < / service-name >
    < support-map-plan >
    < local-scheme / >
    < / support-map-plan >
    < / replicated system >
    < / cache-plans >
    < / cache-config >
    -----
    Version 3.6.0.2 consistency.
    The JDK version: 1.6.0_21 x 86, x86_64 1.6.0_26

    Edited by: simlink April 30, 2013 04:55
    Added temporal solution.

    Hello

    Yes, I suppose you could say that it is a 'feature' of a single node cluster. But given that nobody uses consistency as a single node cluster, I would say that this is not a problem; even your tests should not be done on a single node cluster. The whole point of consistency is it is on ladders to store data across many virtual machines Java, if you can organize all your data in a single JAVA virtual machine, and then use a hash table and save the cost and complexity of the use of consistency.

    JK

  • Copy a line in the same table with most original values

    Hello experts SQL, I hope you can help me. Forgive me if this topic has already been answered and posted but I couldn't find.

    I need to copy thousands of rows in a table to itself (table). The goal is to insert/add a new line of effdt for non-respondents according to a recent study. I get the old ' ORA-00001: unique constraint "error when I try to run sql. If I specify a value for one of the key fields, emplid, it's not a problem, but I can't specify the values 4 000 + in my sql.
    Could you please give me advice on how to achieve this? Your help is greatly appreciated. Here is my SQL test that does not work:

    INSERT INTO pers_data_usa has
    (effdt, emplid, MILITARY_STATUS, US_WORK_ELIGIBILTY,
    CITIZEN_PROOF1, CITIZEN_PROOF2, MEDICARE_ENTLD_DT)
    SELECT EFFDT, B.emplid, TO_DATE(SYSDATE,'DD/MON/YYYY')
    '1', 'Y', B.CITIZEN_PROOF1, B.CITIZEN_PROOF2, B.MEDICARE_ENTLD_DT
    OF pers_data_usa B, pers_data_usa A
    WHERE A.EMPLID = B.emplid
    AND A.EFFDT <>SYSDATE

    ORA-00001: unique constraint (SCHEMA. PERS_DATA_USA)

    When I put the values in emplid, the line is created. There is a unique constraint on the emplid for non-null and it is a key field.

    Thanks in advance for your answers and review... Jason

    What is the unique constraint that is violated, said the? (Is the name of the constraint really the same as the name of the table?) One or more of the lines that you want to copy probably already has a corresponding row in the table that violates the uniqueness constraint.

    If it is an array of PeopleSoft delivered, shouldn't use you PeopleSoft APIs to change the data? Unless you are absolutely certain you know all tables in PeopleSoft that potentially makes reference to this table, directly modify the data tends to cause a lot of headaches down the line.

    Justin

  • Two lines with the same value (in a single pass) but a different value (in another pass)...

    Hello
    I have the following table:
    create the table pp_status (ppid number (10), ppdescr varchar2 (20),)
    (1) number, varchar2 (4)) bordered;
    The ppid is the primary key.

    where: the ppid Gets the values of a sequence, status may have values (0, 1, 2) and bordered of... years.
    Thus, some values of line may be as follows:
    insert into pp_status values(1,'XX',0,'2009');
    insert into pp_status values(2,'XXY',0,'2010');
    insert into pp_status values(3,'XXT',1,'2009');
    .....

    Now, I want to impose a business rule in which declaratively:
    If and only if both lines have values of shell (as in row 1, 3 in the example above lines) but different data values in the neck of status (and specifically the values 0 and 1 (not 2), as in the lines of the sample 1 and 3) then the second row (that is, the third row in the whole of the sample) is permitted , otherwise not. For example, the following lines:
    insert into pp_status values(3,'XXT',2,'2009'); {because of the whole first line was inserted}
    insert into pp_status values(3,'XXT',0,'2009'); {because of the whole first line was inserted}

    should not be allowed...

    Is it possible to achieve without writing code... I mean the declaratively.

    Note: I use DB10g v.2

    Thank you
    SIM

    SIM,

    It's an interesting challenge, which requires two unique indexes to solve declaratively:

    SQL> create table pp_status(ppid number(10),ppdescr varchar2(20),
      2  status number(1) check (status in (0,1,2)),firstyear varchar2(4));
    
    Tabel is aangemaakt.
    
    SQL> create unique index ui1 on pp_status (firstyear,decode(status,2,0,status))
      2  /
    
    Index is aangemaakt.
    
    SQL> create unique index ui2 on pp_status (firstyear,decode(status,2,1,status))
      2  /
    
    Index is aangemaakt.
    
    SQL> insert into pp_status values(1,'XX',0,'2009');
    
    1 rij is aangemaakt.
    
    SQL> insert into pp_status values(2,'XXY',0,'2010');
    
    1 rij is aangemaakt.
    
    SQL> commit
      2  /
    
    Commit is voltooid.
    
    SQL> insert into pp_status values(3,'XXT',2,'2009');
    insert into pp_status values(3,'XXT',2,'2009')
    *
    FOUT in regel 1:
    .ORA-00001: Schending van UNIQUE-beperking (RWIJK.UI1).
    
    SQL> insert into pp_status values(3,'XXT',0,'2009');
    insert into pp_status values(3,'XXT',0,'2009')
    *
    FOUT in regel 1:
    .ORA-00001: Schending van UNIQUE-beperking (RWIJK.UI1).
    
    SQL> insert into pp_status values(3,'XXT',1,'2009');
    
    1 rij is aangemaakt.
    

    Kind regards
    Rob.

    PS: why the hell proclaim the year varchar2 (4) instead of number 4?

  • Add the value of column based on a different line with the same id

    Hello world

    I have a query that displays the first three columns of the table below. I would like to add a column to this output, most indicating (for each row) if there is an electronic product in the same order. For example, the command 1 in the table below contains 1 unit of furniture and 1 unit of electronics. In my outings, I would add a flag 'Y' for the two rows 1 and 3. Also, I would add a "N" indicator to any order which does contain all the electronics.

    Any ideas on how to achieve this? Any idea or suggestion is appreciated!

    order_id product_cat quantity with_electronics
    1furniture1THERE
    2grocery1N
    1Electronics1THERE

    Thank you

    Zsolt

    Hi, Zsolt,

    You can also use analytical functions.  For example:

    SELECT order_id, product_cat, quantity

    MAX (CASE

    WHEN product_cat = 'electronics '.

    THEN 'Y '.

    ANOTHER "N".

    END

    ) OVER (PARTITION BY order_id) AS with_electronics

    Orders

    ;

    Of course, I can't test it without a table.

  • Can't understand why this query returns multiple lines with the same data

    Hi all
    I am a relative novice and self-taught when it comes to SQL. I wrote a query to our reporting tool that returns multiple rows, and I can't understand why. I know that I can use the SELECT DISTINCT option, but it really slows the execution when I do. I'd really rather understand if I can change the code to avoid the multiples. This is the query. I've included a few statements in italics to help explain the break. Any ideas?

    SELECT MATSITE, MATPONUM, FIRSTRECPTDATE
    Of
    Subquery that concludes the first date on which purchase orders have been implemented with ACK State
    (SELECT ACKSTAT. PONUM AS 'ACKPONUM', (MIN (ACKSTAT. CHANGEDATE)) AS 'FIRSTACKDATE '.
    OF PZMAX. POSTATUS ACKSTAT
    WHERE (ACKSTAT. STATE = 'ACK') AND (ACKSTAT.ORGID ='CGSALTUS)
    GROUP OF ACKSTAT. PONUM),
    Subquery that concludes the first reception against a purchase order transaction for purposes of comparison
    (SELECT TRANS. PONUM AS "MATPONUM", TRANS. SITEID AS 'MATSITE', (MIN (TRANS. TRANSDATE)) AS 'FIRSTRECPTDATE '.
    OF PZMAX. MATRECTRANS TRANS
    WHERE (TRANS.ORGID ='CGSALTUS) AND (TRANS. HOUR > =: startDate and TRANS. TRANSDATE < =: endDate)
    TRANS GROUP. SITEID, TRANS. PONUM)
    WHERE
    (ACKPONUM = MATPONUM AND FIRSTRECPTDATE < FIRSTACKDATE) OR (NOT EXISTS (SELECT 1 FROM PZMAX. POSTATUS ACKSTAT2 WHERE (ACKSTAT2. PONUM = MATPONUM) AND (ACKSTAT2. STATE = 'ACK') AND (ACKSTAT2.ORGID ='CGSALTUS)))

    The where the instruction is intended to find when one of two conditions exists. ((1) received happened before the command either in ACK or 2) a reception that's happened, but the purchase order is never in ACK State. It seems that this second condition that creates multiple lines.

    Any thoughts will be appreciated geratly.

    Dave Teece
  • Copy line in the same table?

    Hi all!

    Can copy a form of line a table and insert a new row?
    Is this possible with features like CF cfupdate? or should I try and find an answer in sql?

    TNX for all help!

    INSERT INTO Table1 (FieldA, FieldB, FieldC)
    SELECT FieldA, FieldB, FieldC
    FROM Table2
    WHERE FieldD = SomeValue

  • Need a script to select the update the row to another row in the same table

    I have a table with the columns and values
    KeyID       EffectiveDate     InactiveDate
    1              01/01/2013
    1              01/02/2013
    1              01/03/2013
    2              12/31/2012
    2              01/02/2013
    2              01/03/2013
    I need to update the InactiveDate of a line with the EffectiveDate of a line with the EffectiveDate newer than the update line and the even KeyID.
    KeyID       EffectiveDate     InactiveDate
    1              01/01/2013      01/02/2013
    1              01/02/2013      01/03/2013
    1              01/03/2013
    2              12/31/2012      01/02/2013
    2              01/02/2013      01/03/2013
    2              01/03/2013
    I want to have a select script that shows
    KeyID       EffectiveDate        InactiveDate    New_InactiveDate
    1              01/01/2013                              01/02/2013
    1              01/02/2013                              01/03/2013
    1              01/03/2013
    2              12/31/2012                              01/02/2013
    2              01/02/2013                              01/03/2013
    2              01/03/2013
    Thanks for any help.

    Published by: 881656 on January 3, 2013 17:57

    Published by: 881656 on January 3, 2013 18:15

    Published by: 881656 on January 3, 2013 18:20

    Hello

    881656 wrote:
    I have a table with the columns and values

    KeyID       EffectiveDate     InactiveDate
    1              01/01/2013
    1              01/02/2013
    1              01/03/2013
    2              12/31/2012
    2              01/02/2013
    2              01/03/2013
    
    I need to update the InactiveDate of a row with the EffectiveDate of a row with the newer EffectiveDate than the row to be updated and with the same KeyID.
    
    KeyID       EffectiveDate     InactiveDate
    1              01/01/2013      01/02/2013
    1              01/02/2013      01/03/2013
    1              01/03/2013
    2              12/31/2012      01/02/2013
    2              01/02/2013      01/03/2013
    2              01/03/2013
    

    This sounds like a job for the analytical function of LEAD:

    MERGE INTO table_x     dst
    USING (
         SELECT  keyid
         ,     effectivedate
         ,     LEAD (effectivedate) OVER ( PARTITION BY  keyid
                                           ORDER BY         activedate
                                         )            AS inactivedate
          )               src
    WHEN MATCHED THEN UPDATE
    ON    (    src.id          = dst.id
          AND  src.effectivedate     = dst.effectivedate
          )
    SET     dst.inactivedate     = src.inactivedate
    ;
    
    I want to have a select script which shows
    
    KeyID       EffectiveDate        InactiveDate    New_InactiveDate
    1              01/01/2013                              01/02/2013
    1              01/02/2013                              01/03/2013
    1              01/03/2013
    2              12/31/2012                              01/02/2013
    2              01/02/2013                              01/03/2013
    2              01/03/2013
    

    Once that you have done the above MERGER, it is simply:

    SELECT    *
    FROM      table_x
    ORDER BY  keyid
    ,         effectivedate
    ;
    

    If you do not have sthe FUSION, then see the query in the USING clause of the MERGER.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

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

  • How to draw a line (with the line segment tool) then draw another line, from those previous anchor point. When I try immediately draw another line on the other anchor lines it try to turn instead.

    I'm following a course of basic fundamental illustrator on Lynda. The video of "draw straight lines" is troubling me. They draw a line with the line segment and then draw another line coming out the anchor point at an angle.

    Here's where it is troubling me - when I try to drag a line to the anchor point trying to transform the first line, I drew. (the line cursor turns into a selection tool) I can't draw another line connecting the first.

    Advice would be great because it's driving crazy me.

    See you soon,.
    Kyle

    Yes, it is irritating. You must clear the previous line first. If you want to make sure that both ends are perfectly aligned, start by turning on the guides. If you want two lines to be part of the same way, you should use the tool pen instead.

Maybe you are looking for

  • Satellite Pro 400 onboard Bluetooth problems

    Hello I have a u400 with installation XP Prof When you activated the on-board bluetooth sound is broken. the sound plays a broken sound. Install the new driver and his fix at the moment. Activate the bluetooth, but the sound is broken. The client usi

  • 2600n: 2600n don't print laptop

    I have laptop Dell with window 8.1 64bits.  I installed an old 2006 printer---> it was nine 2600n Color Laser jet printer.   Print a test page and it is very beautiful.  When I try to print from my laptop it will close the application (word, excel, o

  • Problemas para instalar programas

    Saludos, compre UN annual package of 50 dollars, pero hoy has the hora of tratar instalar los programas creative cloud through me instala una prueba "gratuita" 7 dias, there invited me a COMPRAR los programas, in spite of that there is pay el plan co

  • Importing in lightroom Canon cr2 files 5

    I recently updated from a Canon 550 to a 760 D. Since when I could not import new raw files in CR2 format. I had no problem with the import of these files before changing my camera. I checked and han perfectly up-to-date with updates to Lightroom?!

  • Is there a release date of Adobe Comp CC for Android?

    Is there a release date of Adobe Comp CC for Android?I need to know because it depends very much on which Tablet I buy.Thank you very much