Compare dates in a different columns

Hi All,
How to get the largest date out from different columns.
here is my query....
select * from
(select date1 from table1) a,
(select date2 from table2) b,
(select date3 from table3) c
I want to get the largest date among date1, date2 and date3
thank you in advance

Hi,
I think the following query helps to you.....
SELECT GREATEST(a,b,c) FROM(
SELECT
(SELECT MAX(SYSDATE+1) FROM EMP WHERE EMPNO=D.EMPNO) as a,
(SELECT MAX(SYSDATE+2) FROM EMP WHERE EMPNO=D.EMPNO) as b ,
(SELECT MAX(SYSDATE+3) FROM EMP WHERE EMPNO=D.EMPNO )AS C FROM EMP D WHERE EMPNO=7698)Regards
Reddy.

Similar Messages

  • ALV -Excel download -header & data comming in Different columns

    Hi,
    I have an ALV report with FM.When I download it to excel through LIST/EXPORT/LOCALFILE some columns are getting messed up (ex: header is in one column and data is comming in different column).
    When i do with LIST/EXPORT/SPREADSHEET option it is working fine.
    but users want to use the first option only.
    I am use FM's in this report.
    Regards
    Praveen

    Hi
    What is the statement you used to dowload data .Check the field catalog that u are passing to downloaad function module.
    or check in the debuging mode..
    change these options in excel sheet and checkout if it can help u
    1. Go to Tools -> Macro -> Security in Excel
    2. Select the ‘Trusted Sources’ tab and ensure that the checkbox titled ‘Trust access to Visual Basic Project’ is ticked.
    3. With the feature switched on, the data is passed to Excel.
    check this sample one
    TABLES : MAST , "Material to BOM Link
    STKO , "BOM Header
    MARA . "General Material Data
    * Types Begin with TY_ *
    TYPES : BEGIN OF TY_MASTER ,
    MATNR TYPE MAST-MATNR , "Material Number
    WERKS TYPE MAST-WERKS , "Plant
    STLAN TYPE MAST-STLAN , "BOM Usage
    STLNR TYPE MAST-STLNR , "Bill of material
    STLAL TYPE MAST-STLAL , "Alternative BOM
    ANDAT TYPE MAST-ANDAT , "Date record created on
    AEDAT TYPE MAST-AEDAT , "Date of Last Change
    AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
    STLST TYPE STKO-STLST , "BOM status
    ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
    DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
    END OF TY_MASTER .
    TYPES : MY_TYPE(20) TYPE C.
    * Constants Begin with C_ *
    * Internal tables Begin with IT_ *
    DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
    WA_MASTER TYPE TY_MASTER .
    DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
    * Data Begin with W_ *
    DATA : W_PTH TYPE RLGRAP-FILENAME.
    DATA : W_FILE TYPE RLGRAP-FILENAME.
    * Field Symbols Begin with FS_ *
    * Select Options Begin with SO_ *
    * Parameter Begin with PR_ *
    * I N I T I A L I Z A T I O N *
    *--- Add Header Fields to Header Table ---
    APPEND 'Material Number' TO IT_HEADER .
    APPEND 'Plant' TO IT_HEADER .
    APPEND 'BOM Usage' TO IT_HEADER .
    APPEND 'Bill Code' TO IT_HEADER .
    APPEND 'Alternative BOM' TO IT_HEADER .
    APPEND 'Created On' TO IT_HEADER .
    APPEND 'Changed On' TO IT_HEADER .
    APPEND 'Changed By' TO IT_HEADER .
    APPEND 'BOM Status' TO IT_HEADER .
    APPEND 'Planned Price' TO IT_HEADER .
    APPEND 'Delivery Plant' TO IT_HEADER .
    IF SY-MANDT = '700'.
    W_PTH = '\lkdb01ISDISSoftware DevelopmentsDevelopmentsData FilesSAP DumpsBOM_Available'.
    ELSE.
    W_PTH = 'C:'.
    ENDIF.
    * A T S E L E C T I O N S C R E E N *
    * s t a r t o f s e l e c t i o n
    START-OF-SELECTION.
    *--- Load Data to Internal Table ---
    * SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST
    * INTO TABLE IT_MASTER
    * FROM MAST
    * INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    * AND STKO~STLAL EQ MAST~STLAL
    * INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    * WHERE MARA~MTART LIKE 'ZFG%'
    * AND STKO~LKENZ NE 'X'
    * AND STKO~LOEKZ NE 'X'
    * AND STKO~STLST EQ '1'.
    SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    AND STKO~STLAL EQ MAST~STLAL
    INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
    AND MBEW~BWKEY EQ MAST~WERKS
    INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    IF SY-SUBRC <> 0.
    MESSAGE I014(ZLOAD).
    ENDIF.
    *--- Set Path to Function Module ---
    CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = W_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_MASTER
    FIELDNAMES = IT_HEADER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_EIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    MESSAGE I023(ZLOAD) WITH text-001.
    ELSE.
    MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
    ENDIF.
    END-OF-SELECTION.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    Reward all helpfull answers
    Regards
    Pavan
    Message was edited by:
            Pavan praveen

  • How to compare data from 2 different time periods

    Hi folks,
    I have a question on approach to a problem. I want to be able to compare data from a common db, but for 2 different time periods. For example I want to see the number of occurences of an instance in my data for today and compare it against occurences a week ago today. What's the best approach for this kind of problem? Is this done with 2 separate queries from 2 sub reports and then compared some how? Any comments on this approach or an other are appreciated.
    TIA bvd

    Follow these steps:
    1) Bring your first time period in your main report.  This will be your first query.
    2) Bring your second time period in a subreport.  This will be your second query.
    3) Bring the values from your subreport into your main report using shared variables.
    4) Lastly, compare the results using formulas in your main report.
    I hope this information proves useful.
    Regards,
    Zack H.

  • Compare dates between 2 different rows and columns

    I'm having problems figuring this out.  Here is an example table:
    What I need to be able to find is any records where the Discontinue_Date is greater than the Effective_Date on the next row for a given Customer ID and Part_ID.  This is a customer pricing table so the Discontinue_Date of row 53 for example should never
    be greater than the Effective_Date of row 54130, these are the records I'm looking to find.  So I'm looking for a SELECT query that would look for any records where this is true.  Obviously the last Discontinue_Date row for a Customer_ID will not
    have a next row so I wouldn't want to return that. 
    Let me know if anyone has any ideas or if more clarification is needed, I've been struggling with how to get started on this!!
    Thanks very much in advance!
    JIM

    >> I'm having problems figuring this out. Here is an example table: <<
    NO! Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data
    should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. You pasted a colored picture that we have to transcribe into DDL to do your job for you. But you also do not know basic terminology! 
    Rows are not records, since tables are sets, there is no “next row” concept, rows do not have physical row numbers, etc.  Your mindset is still in a spreadsheet and not RDBMS. 
    >> What I need to be able to find is any records [sic] where the discontinuation_date is greater than the effective_date on the next row for a given customer_id and part_id. <<
    Why not prevent bad data instead of trying to kludge and report it after the fact? 
     Consider this self-reference trick to prevent gaps in a timeline of events:
    CREATE TABLE Events
    (event_id CHAR(10) NOT NULL,
    previous_event_end_date DATE NOT NULL
    CONSTRAINT Chained_Dates
    REFERENCES Events (event_end_date),
    event_start_date DATE NOT NULL,
    event_end_date DATE UNIQUE, -- null means event in progress
    PRIMARY KEY (event_id, event_start_date),
    CONSTRAINT Event_Order_Valid
    CHECK (event_start_date <= event_end_date),
    CONSTRAINT Chained_Dates 
    CHECK (DATEADD(DAY, 1, previous_event_end_date) = event_start_date).
    << other stuff for this event >>
    -- disable the Chained_Dates constraint
    ALTER TABLE Events NOCHECK CONSTRAINT Chained_Dates
    -- insert a starter row
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Foo Fest', '2010-01-01', '2010-01-02', '2010-01-05');
    -- enable the constraint in the table
    ALTER TABLE Events CHECK CONSTRAINT Chained_Dates
    -- this works
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Glob Week', '2010-01-05', '2010-01-06', '2010-01-10');
    -- this fails
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Snoob', '2010-01-09', '2010-01-11', '2010-01-15'); 
    Since you did not write DDL for us, you can use this idiom to get a working schema. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to compare data cross 2 different tables in logical layer?

    Hello
    I have run into a situation where I need to bring in a new column from the status table say 'flag'. This physical column then needs to compare itself with the sales fact's code column. So if the code is '100' and above, then flag column should be '0', else flag.
    In the data models, the sales fact joins to status dimension physically and logically.
    So in the expression builder of the flag column in my BMM layer, I have something like *(case when Sales Mart. Sales Fact. status > '100' then '0' else Sales Mart. Sales Fact. flag end)*..
    However, although the syntax is correct in the expression builder, however the logical column doesn't accept that expression via 'invalid expression'.
    I think I know the problem, because flag column and status column are from different physical and logical column therefore it can't be used in the case statement at logical level. Because I tested this theory with '*(case when Sales Mart. Sales Fact. status > '100' then '0' end)'* and it accepted it.
    Nonetheless, I can't modify the database table nor the ETL to put both columns in one table, nor am I allowed to defined such expression at answers.
    Is there a way I can base the result of flag column on the data of status column from a different logical table?
    Please advice!
    Thanks

    Follow these steps:
    1) Bring your first time period in your main report.  This will be your first query.
    2) Bring your second time period in a subreport.  This will be your second query.
    3) Bring the values from your subreport into your main report using shared variables.
    4) Lastly, compare the results using formulas in your main report.
    I hope this information proves useful.
    Regards,
    Zack H.

  • How compare data from 2 different ODS and then load data to Cube

    Hello, everybody,
    I  have 2 ODS ZINFO_1 and  ZINFO_2. These ODS contain data:
    ZINFO_1
    document number; item number; amount
    10004;1;200
    10004;3;330
    10004;4;650
    10005;1;110
    ZINFO_2
    document number; item number; amount
    10004;1;700
    10004;4;430
    After comparison ODS ZINFO_1 with ZINFO_2, into InfoCube ZICINFO_3 I have get data from ODS ZINFO_1 that document number and item number is not equal to ZINFO_2 ODS’s document number and item number.
    Data in InfoCube ZICINFO_3 should be:
    ZICINFO_3
    document number; item number; amount
    10004;3;330
    10005;1;110
    Could you give me suggestions how do this?
    Thanks in advance.
    Best Regards,
    Arunas Stonys

    Most of the time you write a routine in the update rule and you want to read a table or ODS to look up for that particular field you are intersted in, if you are doing reading the table or DSO in the update rule, it will execute for each and every record, but you do reading the table in the start routine which will get executed for each data package and in your update rule, you read the internal table to put your logic.     
    The Start rouline can be as follows
    Please do modify this routline for ur requirement
    Another situation where I am loading DATA from DSO 1 to DSO 2 and looking for Records from DSO3 and DSO4.
    DSO1---->DSO2(looking up data from DSO3 and DSO4 to update to DSO2).
    NOw in the start routine I define 2 internal tables for DSO3 and DSO4 having sturctures like DSO3 and DSO4(with only useful fields and key fields,becoz u may not need all the fields from dSO3 and DSO4 afterall)
    Now I am loading data in those interanal tables by using SELECT Query in START routine.
    Now In various transformatino rule for populating different target fields I am reading those internal tables(itab_dso3 and itab_dso4) putting the read and where condition like
    Code for field Z(of DSO2)
    Read fieldX fieldY fields Z from itab_dso3 into wa_dso3 with key fieldsX=source_fields-fieldsx fieldY=source_fields-fieldsy.
    if sy-subrc eq 0.
    result = wa_dso3-fieldz
    endif.
    (here i am reading the itab loaded in start routine and reading it with the help of two source fields(dso1 fields fieldX and fieldY ) and comparing them with DSO3 .If there is a match then I am udpating fieldz of DSO2 with fieldZ from DSO3.)
    Please do assign points if it is needful.
    Thanks in advance.
    Best WIshes,
    VVenkat.

  • Compare date datatype against timestamp column

    Hi,
    I have a table "test" with a TIMESTAMP column as "insert_timestamp".
    I have an application with a query like
    select * from test where insert_timestamp between i_start_date and i_end_date;i_start_date and i_end_date are DATE data type variables.
    When I ran this query, it returned results:
       select * from test where insert_timestamp between sysdate - 1 and sysdate;My question is if it is ok to compare against a TIMESTAMP column in table using DATE data type variables?.
    I am just making sure the app doesn't break during execution due to this.
    Thanks in advance

    yes you can use...
    But with timestamp you get precision till fraction of seconds but not in case of data type...
    So if you have data which differ in fraction of seconds like
    1.0001 sec,1.0003 sec,1.0004 sec,1.0005 sec,1.0006 sec...
    then if i have to get data between 1.0003 and 1.0005 seconds you cannot use a date variable here...
    Ravi Kumar

  • Splitting a column data into 4 different columns

    HI ALl,
    I have a column that bring the data friom the database like this :
    1.1.01 10.1 M10-08: This is the best deal ever
    I want to split that up into 4 columns ( prefrebely in RPD) . 1 column will be 1.1.01, 2nd column as just M or Q ( Depending upon the data) . 3rd Column as M10-08. 4th Column as the vervbage ( eg : this is the best deal ever).
    How would i do this. ANy help will be appreciated.
    thanks

    Hi user599926,
    The Business Model and Mapping Layer (logical layer) in the RPD is the right place for this kind of change. Here's what you do
    1) Import your physical table into the RPD
    2) Drag and drop that table into a BMM folder
    4) Right click on the logical table and select "New Object" -> "Logical Column..."
    5) Give the column a name
    6) Click on the Data Type tab
    7) Double click on the Logical Table Source (LTS) *Make sure "Show all logical sources" is checked
    8) Uncheck "Show mapped columns"
    9) Check "Show unmapped columns"
    10) you should now only see your new column.
    11) Click on the three dots "..." next to the name of the column.
    12) Use the SUBSTRING() function on your original field. E.g. SUBSTRING(FIELD1 FROM 1 FOR 6)
    13) Hit OK
    14) Hit OK
    15) Repeat steps 4-14 for 2nd ,3rd and 4th column. They will just have a different FROM and FOR number.
    Good luck!
    -Joe

  • How to download data into  two different columns 2003 excel format in ole

    Hi ALL
    when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
    both fields come in only one column .Can any one suggest  
      CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI   IN CHARACTER MODE.

    If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
    FORM fill_cell USING p_row p_col p_value.
      CALL METHOD OF obj_excel 'CELLS' = obj_cell
        EXPORTING
        #1 = p_row
        #2 = p_col.
      SET PROPERTY OF obj_cell 'VALUE' = p_value.
    ENDFORM.                    "fill_cell

  • Different filters to data in 2 different columns

    Oracle BI 11g
    Hi,
    I have 1 fact table Sales (ID, Date, VersionID, Count) and 2 dimension table - Calendar (Date, Year, Month, Week, Day, ...), Versions (ID, Name).
    I've created Time Hierarchy on table Calendar, so I can use AGO function. I made new logical column "Count (1 month ago)". It works correctly.
    Now I need create Analysis with columns: Month, Count, Count (1 month ago). BUT! In column "Count" I need to see only Budget version values, and in column "Count (1 month ago)" I need to see only Actual version values.
    I try to use filter for column "Count" - "Version is equal to Budget", but it works for all Analysis, but not for column "Count".
    How can I solve this problem?

    Hi,
    in column formula in the criteria tab we have filter option.This is useful for filtering that column only.
    syntax:
    Filter(measure using dimensioncolumn)

  • Data saggrigation into different columns

    Hi,
    I need help on following:
    i have data in the table as
    col1 col2
    3 343
    3 567
    3 333
    3 987
    3 987
    there are other column too. I have to populate this like:
    col1 c1
    3 (1) ---- 35399
    3 (2) ---- 46388
    3 (3) ---- 37377
    Let me explain this:
    col1 defines how many columns col2 will have. There will be definite 10 rows (per record set).
    the out put will have 3(1) are records of row1 in col2... like wise.
    Col2 can have maximum of 26 columns. This means result set will have max 26 rows.
    Please let me know if there is confusion in requirement.
    Thanks
    Edited by: user2544469 on Feb 9, 2011 4:38 AM

    user2544469 wrote:
    Hi,
    I need help on following:
    i have data in the table as
    col1 col2
    3 343
    3 567
    3 333
    3 987
    3 987
    there are other column too. I have to populate this like:
    col1 c1
    3 (1) ---- 35399
    3 (2) ---- 46388
    3 (3) ---- 37377
    Let me explain this:
    col1 defines how many columns col2 will have. columns do not contain columns. Columns do not contain "fields". I think you need to go back and revisit the basic rules of data normalization, and get this data model to third normal form.
    There will be definite 10 rows (per record set).
    the out put will have 3(1) are records of row1 in col2... like wise.
    Col2 can have maximum of 26 columns. This means result set will have max 26 rows.
    Please let me know if there is confusion in requirement.
    Thanks
    Edited by: user2544469 on Feb 9, 2011 4:38 AM

  • Comparing data in different resultsets

    Hi everybody!
    I am working on an web application involving some EAI, as a requirement i need to compare data from two different sources (databases to be precise) and fill a XML based on certain rules. I wish to know if there is a way to compare two ResultSet objects (with almost similar data) directly, or the only way to do is compare each value seperately.
    Also please suggest from efficiency point of view if its viable to store data from resultSet to a certain struc kind of object and then comparing, as it would involve lots of overhead compared to directly comparing the two resultsets.
    TIA
    Abhishek

    i have to compare various columns of each row and assign flags in output xml as to note if data is inconsistant, though i am taking measures so as to get the rows in the same order in both result sets, but the primary purpose of this comparison is indeed to check data integrity between both the sources.

  • Parse string into different column and optimization

    We are in process of building an audit process for any changes that occur automatically or manually by the user on some of the table data. To do this we have two options:
    1. Have master table to store the audit event summary and a detail table to store each column change with old and new values. Something like:
    CREATE TABLE TEST_ADT_DTL
      EVNT_ID      NUMBER,
      COL_NAME     VARCHAR2(1000),
      OLD_COL_VAL     VARCHAR2(1000),
      NEW_COL_VAL     VARCHAR2(1000)
    );but this approach has some processing overhead since for the changes to each record there will be multiple records based on number of columns updated. If we are loading 40K transaction twice a month, and the changes are almost 30-40% so the detail table will grow considerably.
    2. To have the detail table with one column that will have a concatenated string of changes with field name, old and new values.
    CREATE TABLE TEST_ADT_EVNT
      EVNT_ID        NUMBER,
      TBL_NAME       VARCHAR2(100),
      OPER_CD        VARCHAR2(1),
      USR_ID         VARCHAR2(10),
      ACT_DT         DATE,
      PK_STRNG_VAL   VARCHAR2(100),
      CMNT_TXT       VARCHAR2(1000) 
    CREATE TABLE TEST_ADT_DTL
      EVNT_ID      NUMBER,
      ADT_LOG     VARCHAR2(1000)
    INSERT INTO TEST_ADT_EVNT VALUES (1, 'CUSTOMER', 'A', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (2, 'CUSTOMER', 'U', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (3, 'ORDER', 'A', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (4, 'ORDER', 'U', 'EFG', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (5, 'ORDER', 'U', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_DTL VALUES (2, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;');
    INSERT INTO TEST_ADT_DTL VALUES (4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;');
    INSERT INTO TEST_ADT_DTL VALUES (5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;');
    COMMIT;I want to know if we want to generate a report for audit log, how can I display the data from detail table in columns. I mean how to parse the ADT_LOG column to show the data in three different columns like:
    FIELD     OLD         NEW
    CITY     AVENEL    EDISON
    ZIP       07001      07056
    .along with the columns from EVNT table.
    And, want to know which approach would be better.

    hey I think I finally got it using the model clause.
    not sure if this will be faster or not.
    you can increase the number of iterations if you are not hitting them all,
    ( the lower your iteration number the faster this will run)
    select adt_log, field, old, new from
    with TEST_ADT_DTL as
    (select 2 evnt_id, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;' ADT_LOG FROM DUAL UNION
    select 4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;' from dual union
    select 5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;' from dual
    select evnt_id, adt_log, field, old, new  from test_adt_dtl
    model return updated rows
    partition by (evnt_id)
    dimension by ( 0 d)
    measures (adt_log, adt_log field, adt_log old, adt_log new, 0 it_num )
    rules iterate (50) -- until ?
    adt_log[any] = adt_log[0],
    field[0] = substr(adt_log[0], instr(adt_log[0],'FIELD',1,1)+6, instr(adt_log[0],',',1,1) - instr(adt_log[0],'FIELD',1,1)-6),
    old[0] =   substr(adt_log[0], instr(adt_log[0],'OLD',1,1)+4, instr(adt_log[0],',',1,2) - instr(adt_log[0],'OLD',1,1)-4),
    new[0] =   substr(adt_log[0], instr(adt_log[0],'NEW',1,1)+4, instr(adt_log[0],';',1,1) - instr(adt_log[0],'NEW',1,1)-4),
    field[iteration_number ] =    substr(adt_log[0],
                                         instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6,
                                         (instr(adt_log[0],',',( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6 ),1)
                                         (  instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6))
    old[iteration_number ] =    substr(adt_log[0],
                                         instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4,
                                         (instr(adt_log[0],',',( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4 ),1)
                                         (  instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4))
    new[iteration_number]  =    substr(adt_log[0],
                                         instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4,
                                           (instr(adt_log[0],';',1,iteration_number + 1)
                                           (instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4)
    order by evnt_id, it_num
    where new is not nullEdited by: pollywog on Apr 13, 2010 10:28 AM

  • Compare data and return the different columns

    Good Afternoon,
    I am trying to compare the data in two tables and return only the columns and data where there is a difference.
    I have a compare script which checks every column in the two tables against each other, but as there are 200 columns in the tables it is tricky to see which column has a difference.
    So in my result set if coulum N is the differenct I would only want to return column N from both tables in the result set.
    I hope that this all makes sense?.

    Easiest way is to use tablediff utility for checking difference between tables
    see
    http://www.mssqltips.com/sqlservertip/1073/sql-server-tablediff-command-line-utility/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Best way to compare data of 2 tables present on 2 different servers

    Hi,
    We are doing data migration and I wil like to compare data between 2 tables which are present on 2 different server. I know to find the difference i can go for minus or full outer join and by creating the database link.
    But my problem is the volume of the data. The tables under consideration has approximately 40-60 columns and number of rows in each tables are around 60-70 million. Also both the tables are on 2 diffferent servers.
    I would like to know
    1] What will be the best way to compare the data and print the difference from performance perepective? I know that if I am going for DB links then its will definitely impact the performance as the tables are across 2 different servers.
    2] Is it advisable to go for using SQL - PL/SQL for this kind of senario or dump the data in flat files and use C or C++ code to find the difference.
    Regards,
    Amol

    Check this at asktom.oracle.com. Search for "Marco Stefanetti" and follow the few posts between Marco and Tom. As far as your tables being on separate servers, you could consider dumping the data to file and using external table or using CTAS ( create table as select ) to get both tables locally.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2151582681236

Maybe you are looking for

  • TS3694 msvcr80.dll error 7 windows error 126

    itunes wont open, it tells me msvcr80.dll is missing from my computer, reinstall the program, followed by itunes was not installed correctly, please reinstall. error 7 (windows error 126). i reinstall itunes and it does the same thing over and over a

  • (Chrome Like) Auto-Hide Tab bar in Safari Full Screen mode

    Is there a plugin or some other way to auto hide the tab bar in Safari fullscreen mode like the way Chrome does? This is the only thing stopping me from using Safari, it's way smoother than Chrome and feels much more native to Lion, but the fact the

  • Adobe DPS - Selectable text

    Hello everyone, I was curious, is there a way for someone reading text on your App to be able to select that text?  For example: If I was reading a page of text and saw a word that I wanted to select and copy, can this be done?  Im curious because I

  • Unrecoverable timeout!

    Hi, We are on SP10 and our scenario send HTTP request to marketplace. When i send a test message to marketplace from RWB there is a timeout and the response message in sxmb_moni is : "HTTP server code 403 reason java.io.InterruptedIOException: Unreco

  • Mysql++ on Mac

    My code, which works fine in Linux (Ubuntu 10.10) looks like this: Connection conn(false); conn.connect(db, server, user, pass) Transaction trans(conn); Query query = conn.query("Update blah blah"); query.execute(); // inside try,catch,catch block qu