Row comparision

hi,
I have a table naming CODE_ROW with 3 columns ECHO,ABC,RESULT_OUT
ECHO ABC RESULT_OUT
eco1234     abc123     4567
eco1234     abc123     63738
eco1234     abc123     73738
eco1234     abc124     4567
eco1234     abc124     8787
eco1234     abc124     63738
eco1234     abc125     4567
eco1234     abc125     63738
The output which I need is like :
o/p
eco1234 abc123,abc124,abc125 4567,63738
eco1234 abc124 8787
eco1234 abc123 73738
In the column ABC the value abc123,abc124 and abc125 are having common values in the 3rd column RESULT_OUT i.e 4567,63738
So in the output the 1st row shud have all the common values that are in ABC concatinated with 'coma'.
And the next rows shuc contain the distinct values of column ABC.
So basically it is row comparision.
Can anyone please help me out in solving dis by using only select query without using Procedures,Cursors etc.
Edited by: user11345528 on Dec 2, 2009 10:50 PM

First of all let's extract all rows from t with two new columns:
RNUM is the rownum resetted at (result_out, echo) level
TOT is the total number of rows for that (result_out, echo) couple.
SVIL>with t as (
  2  select 'eco1234' ECHO, 'abc123' ABC,  4567 RESULT_OUT from dual union
  3  select 'eco1234','abc123', 63738 from dual union
  4  select 'eco1234','abc123', 73738 from dual union
  5  select 'eco1234', 'abc124', 4567 from dual union
  6  select 'eco1234', 'abc124', 8787 from dual union
  7  select 'eco1234', 'abc124', 63738 from dual union
  8  select 'eco1234', 'abc125', 4567 from dual union
  9  select 'eco1234', 'abc125', 63738 from dual
10  )
11  select echo, result_out, abc, rank() over(partition by echo, result_out order by rownum) rnum,
12         count(0) over (partition by echo, result_out) tot from t;
ECHO    RESULT_OUT ABC                                  RNUM        TOT
eco1234       4567 abc123                                  1          3
eco1234       4567 abc124                                  2          3
eco1234       4567 abc125                                  3          3
eco1234       8787 abc124                                  1          1
eco1234      63738 abc123                                  1          3
eco1234      63738 abc124                                  2          3
eco1234      63738 abc125                                  3          3
eco1234      73738 abc123                                  1          1Then let's extract these records in a hierarchical structure applying sys_connect_by_path to concatenate the values of the abc field. Go to the following page to get further information about this tecnique
Link:http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
SVIL>with t as (
  2  select 'eco1234' ECHO, 'abc123' ABC,  4567 RESULT_OUT from dual union
  3  select 'eco1234','abc123', 63738 from dual union
  4  select 'eco1234','abc123', 73738 from dual union
  5  select 'eco1234', 'abc124', 4567 from dual union
  6  select 'eco1234', 'abc124', 8787 from dual union
  7  select 'eco1234', 'abc124', 63738 from dual union
  8  select 'eco1234', 'abc125', 4567 from dual union
  9  select 'eco1234', 'abc125', 63738 from dual
10  )
11    select echo, ltrim(sys_connect_by_path(abc,','),',') abc, result_out
12      from (select echo, result_out, abc, rank() over(partition by echo, result_out order by rownum) rnum,
13                   count(0) over (partition by echo, result_out) tot from t
14           )
15  where rnum=tot
16  connect by prior rnum+1=rnum and prior echo=echo and prior result_out=result_out
17  start with rnum=1;
ECHO    ABC                            RESULT_OUT
eco1234 abc123,abc124,abc125                 4567
eco1234 abc124                               8787
eco1234 abc123,abc124,abc125                63738
eco1234 abc123                              73738Finally let's repeat the previous step starting from the above query to aggregate the result_out column too:
SVIL>with t as (
  2  select 'eco1234' ECHO, 'abc123' ABC,  4567 RESULT_OUT from dual union
  3  select 'eco1234','abc123', 63738 from dual union
  4  select 'eco1234','abc123', 73738 from dual union
  5  select 'eco1234', 'abc124', 4567 from dual union
  6  select 'eco1234', 'abc124', 8787 from dual union
  7  select 'eco1234', 'abc124', 63738 from dual union
  8  select 'eco1234', 'abc125', 4567 from dual union
  9  select 'eco1234', 'abc125', 63738 from dual
10  )
11  select echo, abc, ltrim(sys_connect_by_path(result_out,','),',') result_out
12  from (select echo, abc, result_out, rank() over(partition by echo, abc order by rownum) rnum,
13               count(0) over (partition by echo, abc) tot
14          from (
15            select echo, ltrim(sys_connect_by_path(abc,','),',') abc, result_out
16              from (select echo, result_out, abc, rank() over(partition by echo, result_out order by rownum) rnum,
17                           count(0) over (partition by echo, result_out) tot from t
18                   )
19          where rnum=tot
20          connect by prior rnum+1=rnum and prior echo=echo and prior result_out=result_out
21          start with rnum=1)
22       )
23  where rnum=tot
24  connect by prior rnum+1=rnum and prior echo=echo and prior abc=abc
25  start with rnum=1;
ECHO    ABC                            RESULT_OUT
eco1234 abc123                         73738
eco1234 abc123,abc124,abc125           4567,63738
eco1234 abc124                         8787Max

Similar Messages

  • Row comparision in PL/SQL

    Hi
    I want do row comparision in pl/sql using if condition.
    I have data in pl-sql table.
    Lead/Lag function can be used in sql only??
    If i want to compare row without writing query, is there any
    option available??
    Thanks in advance.

    To tag onto Blu's coments... just what are your data doing in a "PL/SQL table" and not in a proper and real Oracle table?
    Oracle most basic core feature that makes Oracle in "the" RDBMS on this planet is its ability to crunch data. With a rich feature set of diverse indexes, partitioning, clustering, IOTs, etc.
    Now why would you want not to use that, and instead stuff data into an array in a programming language? What benefits are there dealing with a very rigid and very primitive data structure such as an array.. when you have Oracle tables to use?
    This does not imply that arrays are "bad things".. not at all. These are (primitive) data management tools within the context of dealing with local programming data.
    But as soon as you want to run SQLs on it.. or view with envy the SQL functions that are available for crunching data.. that tells me that your data is very much in the wrong place. It should be inside Oracle (as a table or temp table).. not inside an array in PL/SQL (or in an array in any other language for that matter).

  • Comparision of a row with multiple criteria

    Hi All,
    I have below source table which gives me CUTSOMER_ID, FIRST_NAME, LAST_NAME, DOB, ZIPCODE and D_ID. Now i need to compare it with target, which gives me same columns. below are my comparision criteria.
    1. Compare CUSTOMER_ID, if it matches with any of the target CUSTOMER_ID mark the row with F_FLG = M
    2. If CUSTOMER_ID does not match, then compare the row with target based on compbination of (FIRST_NAME, LAST_NAME, DOB and ZIPCODE). If this combination of columns matches with any of the row from target, then marked row with F_FLG = M
    3. If CUSTOMER_ID and combination of (FIRST_NAME, LAST_NAME, DOB and ZIPCODE) column does not match with any of the target row, the use another set of column. compare the row with target based on compabination of (FIST_NAME, LAST_NAME, D_ID). If this combinatio of column matches with ay of the row from target, then marked row with F_FLG = M
    4. If any of the above criteria does not match, then mark the row with F_FLG = N
    CUSTOMER_ID     FIRST_NAME     LAST_NAME     DOB          ZIPCODE          D_ID
    101          GEORGE          MAC          15-APRIL-2009     12345          23456
    102          MICLE          DON          10-MARCH-1980     45678          29087
    103          VIJAG          UJIK          01-JAN-1950     67890          27689
    104          BONY          PANDA          03-MAY-1961     12345          27878These combinations should be performed once at a time. If it satisfies the first criteria, we do not need to check for remaining 3. If it does not match with 1 then perform 2 if matches flag the row and if not, go for 3rd criteria. if matches them mark with M else N
    Below is the Target rows.
    CUSTOMER_ID     FIRST_NAME     LAST_NAME     DOB          ZIPCODE          D_ID
    101          ADA          MICO          15-APRIL-2009     12345          23456
    999          MICLE          DON          10-MARCH-1980     45678          23567
    888          VIJAG          UJIK          01-APR-1999     89897          27689
    777          AAA          BBB          03-MAY-1961     87687          12345Here,
    for 1st row, CUSTOMER_ID matches with source and target, flag the row with valye = M
    for 2nd row, CUSTOMER_ID (102) does not match with Target. but combination of (FIRST_NAME, LAST_NAME, DOB and ZIPCODE) matches, flag the row with value = M
    for 3rd row, CUSTOMER_ID (103) and combination of (FIRST_NAME, LAST_NAME, DOB and ZIPCODE) does not match, but combination of (FIRST_NAME, LAST_NAME and D_ID) matches, flag the row with value = M
    for 4th row, none of the combination matches with Target, flag the row with value = N
    Output should be
    CUSTOMER_ID     FIRST_NAME     LAST_NAME     DOB          ZIPCODE          D_ID     F_FLG
    101          GEORGE          MAC          15-APRIL-2009     12345          23456     M
    102          MICLE          DON          10-MARCH-1980     45678          29087     M
    103          VIJAG          UJIK          01-JAN-1950     67890          27689     M
    104          BONY          PANDA          03-MAY-1961     12345          27878     N

    Try this one
    WITH data1 AS
         (SELECT 101 customer_id, 'GEORGE' first_name, 'MAC' last_name, TO_DATE ('15-APRIL-2009', 'dd-mon-yyyy') dob,
                 12345 zipcode, 23456 d_id
            FROM DUAL
          UNION ALL
          SELECT 102 customer_id, 'MICLE' first_name, 'DON' last_name, TO_DATE ('10-MARCH-1980', 'dd-mon-yyyy') dob,
                 45678 zipcode, 29087 d_id
            FROM DUAL
          UNION ALL
          SELECT 103 customer_id, 'VIJAG' first_name, 'UJIK' last_name, TO_DATE ('01-JAN-1950', 'dd-mon-yyyy') dob,
                 67890 zipcode, 27689 d_id
            FROM DUAL
          UNION ALL
          SELECT 104 customer_id, 'BONY' first_name, 'PANDA' last_name, TO_DATE ('03-MAY-1961', 'dd-mon-yyyy') dob,
                 12345 zipcode, 27878 d_id
            FROM DUAL),
         data2 AS
         (SELECT 101 customer_id, 'ADA' first_name, 'MICO' last_name, TO_DATE ('15-APRIL-2009', 'dd-mon-yyyy') dob,
                 12345 zipcode, 23456 d_id
            FROM DUAL
          UNION ALL
          SELECT 999 customer_id, 'MICLE' first_name, 'DON' last_name, TO_DATE ('10-MARCH-1980', 'dd-mon-yyyy') dob,
                 45678 zipcode, 23567 d_id
            FROM DUAL
          UNION ALL
          SELECT 888 customer_id, 'VIJAG' first_name, 'UJIK' last_name, TO_DATE ('01-APR-1999      ', 'dd-mon-yyyy') dob,
                 89897 zipcode, 27689 d_id
            FROM DUAL
          UNION ALL
          SELECT 777 customer_id, 'AAA' first_name, 'BBB' last_name, TO_DATE ('03-MAY-1961      ', 'dd-mon-yyyy') dob,
                 87687 zipcode, 12345 d_id
            FROM DUAL)
    SELECT customer_id, first_name, last_name, dob, zipcode, d_id, f_flg
      FROM (SELECT customer_id, first_name, last_name, dob, zipcode, d_id, f_flg,
                   ROW_NUMBER () OVER (PARTITION BY customer_id ORDER BY f_flg) rn
              FROM (SELECT DISTINCT d.customer_id, d.first_name, d.last_name, d.dob, d.zipcode, d.d_id,
                                    CASE
                                       WHEN d.customer_id = d2.customer_id
                                          THEN 'M'
                                       WHEN d.first_name = d2.first_name
                                       AND d.last_name = d2.last_name
                                       AND d.dob = d2.dob
                                       AND d.zipcode = d2.zipcode
                                          THEN 'M'
                                       WHEN d.first_name = d2.first_name AND d.last_name = d2.last_name AND d.d_id = d2.d_id
                                          THEN 'M'
                                       ELSE 'N'
                                    END f_flg
                               FROM data1 d, data2 d2
                           ORDER BY 1, DECODE (f_flg, 'M', 1)))
    WHERE rn = 1Regards,
    Mahesh Kaila

  • Can we create a analyses with measures  as rows for comparision trend

    I am working in OBIEE 11g.
    Need to create a analyses with measures as rows and study their yearly progress in a single table
    normally dimesions are used as rows and measures as columns but this one is slightly different ..tried using table and pivot but unable to show diff measures in single table
    Something like this:
    ------------------------------------Yearly ------Prev year------change%               
    Shipped Qty ---------------------150----------100--------------50%
    Delivered Qty---------------------150----------100--------------50%
    Undelivered Qty-----------------150----------100--------------50%
    Billed Qty---------------------------150----------100--------------50%
    where shipped Qty , Delivered Qty , Billed Qty are the various measures
    Please share your expertise in achieveing this
    Would appreciate your help as its urgent
    Regards
    Pranati

    Hi Pranati,
    Create a Union report. You have one calculated column with just the text, eg.; 'Shipped Qty' and 3 columns with the 'Shipped Qty'-measures; Yearly ------Prev year------change%
    Do the same for the other 3 Qty's
    Good Luck,
    Daan Bakboord
    http://obibb.wordpress.com

  • Comparision on row level

    Hi,
    There is a table containing 3 columns where roll_No is unique
    Roll_no |col1 | col2 | col3
    1 12 20 16
    2 10 9 25
    3 15 18 10
    I want to do is to take out 2 max values from a row & divide the sum of that by 2. just like below
    Roll_no | col1 | col2 | col3 -------- Avg
    1 12 20 16 16+20/2 -----only 2 max values
    2 10 9 25 10+25/2 -----only 2 max values
    3 15 18 10 15+18/2 -----only 2 max values
    How could it be possible?

    In case you have more than 3 column from where max needs to be taken, you can also use UNPIVOT with Analytic functions ROW_NUMBER as well
    with t_data
    as
         select 1 roll_no, 12 col1, 20 col2, 16 col3,18 col4, 20 col5 from dual union all
         select 2, 10,  9, 25, 15, 20 from dual union all
         select 3, 15, 18, 10, 10, 10 from dual
    SELECT
        t1.roll_no,
        col1,
        col2,
        col3,
        col4,
        col5,
        inn_qry.avg_max_2
    FROM
        t_data t1,
            SELECT
                roll_no,
                AVG(diff_col) AS avg_max_2
            FROM
                    SELECT
                        t1.*,
                        row_number() over (partition BY t1.roll_no order by diff_col DESC) rn
                    FROM
                            SELECT
                            FROM
                                t_Data UNPIVOT (diff_col FOR col IN (col1,col2,col3,col4,col5))
                        t1
            WHERE
                rn IN (1,2)
            GROUP BY
                roll_no
        inn_qry
    WHERE
        inn_qry.roll_no = t1.roll_no;
    ROLL_NO                COL1                   COL2                   COL3                   COL4                   COL5                   AVG_MAX_2             
    1                      12                     20                     16                     18                     20                     20                    
    2                      10                     9                      25                     15                     20                     22.5                  
    3                      15                     18                     10                     10                     10                     16.5                  

  • Input ready query and display only rows

    I am trying to replicate scenario which is equivalent to creating manual layout in SEM-BPS with settings for layout category - Key Figures in Data columns, and rows defined individually.  In this version it is possible to restrict certain rows as comparision only.
    How can I acheive this using Input ready query? In my query I have created a strucure for Planning Items, but I am not able to show certain planning item selections as display only.
    Any thoughts?

    Hello Gregor,
    Thanks for you answer.
    I already have two structures as mentioned by you.
    Can you please let me know what exactly you meant by set the input flag on the cell level? What settings I have to change to set the flag, do I have to use any formula?  In my example I have three rows for Planning item row structure and I want only one row to be selected as display only row. 
    Regards,
    Sachin

  • XML Comparision Using XDX - Issue with Carriage Return key

    Hi
    I am using oracle XDX for doing a comparision between 2 xml files .I have issue is any node contains a enterkey chr(13)||chr(10) the xml shows that node as different.Even though they are same .

    Hi All,
    Ive updated the problem..with some output... essentially Ive get it to a situation wher I load ALL my records into the table but I still get a bad file with a "|" record issue and the log file still syas that Im trying to load 7 record when I only have the 6 records.
    ...............SQL statment...
    set trimpspool on
    set feedback off
    set heading off
    set linesize 500
    set pagesize 0
    spool loaddata_FP.lst
    SELECT '"'||spart.x_lsm_region||'"'||','||
    '"'||spart.x_sub_type||'"'||','||
    '"'||spart.x_origin_type||'"' ||'|'
    FROM siebel.cx_ls_part_ship spart;
    spool off
    -- sample of control file
    load data infile 'loaddata_FP.lst' "str '|'"
    into table siebel_data_fp fields terminated by "," optionally enclosed by '"'
    (x_lsm_region,
    x_sub_type,
    x_cust_face_staff,
    x_nature_partner,
    x_origin_type)
    --sample log file with error why is it telling me I have 7 records when I am processing 6?
    value used for ROWS parameter changed from 64 to 22
    Record 7: Rejected - Error on table SIEBEL_DATA_FP, column X_SUB_TYPE.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Table SIEBEL_DATA_FP:
    6 Rows successfully loaded.
    1 Row not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    --- sample bad file showing the pipe ... whay is sqlloader trying to process this pipe when its part of the record...
    /u01/oracle/admin/adhoc/xxxl(TESTxx)$
    /u01/oracle/admin/adhoc/xxx(TESTxx)$ vi FCT_PARTNERSHIP_ldrcontrol.bad
    "FCT_PARTNERSHIP_ldrcontrol.bad" [Incomplete last line] 2 lines, 213 characters
    |
    ~
    ~
    ~
    any help appreciated!
    Edited by: spliffer on 04-May-2010 05:06

  • Compare 2 tables and insert rows missing in each table.

    I have a tough situation. I have two exact tables- one online and one offline database. I know that there are missing rows of data from each table, so I need to make a comparison of one table and insert rows that do not exist. I was thinking to try this, but it took over 3 hours to run and did not return anything:
    insert into t
    select * from t a
    where not exists (select * from [email protected] b
    where a.col1 != b.col1
    and a.col2 != b.col2
    and a.col3 != b.col3);
    and it goes on for another 7columns.
    The trouble I have is to include a date clause so that the query can be broken down into running only a few months of data comparisions at a time- the records go back 4 years to compare. Also is there a way to write this so that it will query both tables at the same time in order to speed things up- or is one table at a time the best advice? Each table has over 100 million records to compare, that's why I was hoping to use a date criteria since one column is date.
    Let me know what you advise to make this work, I hope I was on the right track.

    Not sure if the MINUS operator will perform better with your data set but;
    SQL> create table t1 (some_id number, some_date date)
    Table created.
    SQL> create table t2 (some_id number, some_date date)
    Table created.
    SQL> insert into t1 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t1 values (2, trunc(sysdate-5))
    1 row created.
    SQL> insert into t1 values (4, trunc(sysdate-90))
    1 row created.
    SQL> insert into t2 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t2 values (3, trunc(sysdate-10))
    1 row created.
    SQL> insert into t2 values (5, trunc(sysdate-100))
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
    3 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
    3 rows selected.
    SQL> insert into t1 (
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> insert into t2 (
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
             3 07-07-20
    4 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
             2 07-07-25
    4 rows selected.

  • How to track modified rows in ALV list

    I need to keep track of all the rows in the ALV list that the users have modified.  When the user selects SAVE, I need to read the modified rows and save the changes to the database.  I thought I could use mp_mod_rows but I cannot get the syntax and the variable declarations correct. 
    Thanks.
    Sandy

    Hi,
    R u using FM or.............
    If u r using FM look at my example.....
    data: LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------
    gt_layout-zebra = 'X'.
    gt_layout-detail_popup = 'X'.
    gt_layout-colwidth_optimize = 'X'.
    ITAB1[] = ITAB[].<<<<<-----make a copy of ITAB for further comparision.
    call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = i_repid
    i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = header
    is_layout = gt_layout
    i_callback_top_of_page = 'TOP-OF-PAGE1'
    i_grid_title = text-h17
    it_sort = gt_sort[]
    i_default = 'X'
    i_save = 'U'
    is_variant = gt_variant
    it_events = gt_events
    I_GRID_SETTINGS = LC_GLAY<<<<<<------
    TABLES
    t_outtab = itab.
    clear itab.
    Form USER_COMMAND1
    FORM USER_COMMAND1 USING u_ucomm LIKE sy-ucomm
    us_selfield TYPE slis_selfield."#EC CALLED
    case u_ucomm.
    when '&DATA_SAVE'.<<<<<<<<----
    This will come after the data was EDITTED and when SAVE was clicked by user in output scren.
    Here now in the final internal table(ITAB) you can find the data changed in EDIT mode.
    After this you can do manipulation what ever you want.
    Thanks.
    If this helps you reward with points.

  • Refreshing JTable contents (rows and columns) handling.

    Hi,
    I have a general question related to refreshing the contents of JTable and handling some application specific requirements.In our application we are planning to refresh the contents of JTable automatically after certain period of time by fetching data from database and update the JTable contents or user has clicked refresh button.
    But following scenarios we are planning to handle when refresh is called automatically or user has clicked refresh button.
    1) User is working with data of JTable. Like rows of JTable has checkBoxes and user selects them and doing operation like viewing the details of selected rows in new details dialog. So if refreshing is done then the selection will be lost if I update the whole data in JTable.
    a)Will it be possible to append the data at the end of JTable rows without disturbing the existing JTable contents.
    b) Is it feasible to compare the data of existing rows and newly fetched rows and update only the rows whose values are changed in database or update specifically updated columns. But this comparision for finding changed values will result in performance problems.So are there any other alternatives of doing this, ideas are most welcome.
    c) Simple way is to alert the user that data will be updated and everything will be refreshed will be the choice in worst case.
    I guess many may have encountered such problems and may have solved it depending on the product requirements.
    Ideas and suggestions are most welcome.
    Regards.

    Hi,
    Here are my views and my assumptions.
    Assumptions :
    1) Your JTable is populated with list of Objects.
    2) Your tables in database is having columns like created date, created time, updated date updated time
    3) Order by clause for all the time will remain same.
    If these assumptions are correct then I think you can achieve your goal.
    Here how it is.
    Your application session will maintain last db hit time and will maintain for every hit that applicate made to fetch data from db.
    When object is created on the server side once it fetch data from table it will compare the created date/time or update date/time with the session varibale that holds last visit date/time. Based on this flag need to be set to indicate if this item is added/updated/deleted since last visit.
    And when all these object is returned to your client, the table model will iterate through the list and based on object index in the list and and if object is changed will update only that perticular row.
    Hope this is what you want to achieve.
    Regards

  • Retrieve rows between timestamps

    Hi,
    I have a transaction table that have updates through out the day Now I need to retrieve rows that are updated between two timestamps.
    I'm tryin to retrieve using s_timestamp between TS1 and TS2 but it says not valid month. Then I tried to_char(s_timestamp,'HH:MM:SS') between to_char(ts1,'HH:MM:SS') and to_char(ts2,'HH:MM:SS') it retuns no rows.
    Now I tried
    to_char(s_timestamp,'HH:MM:SS') between '10:10:20' and '12:12:30' Even then it retuned no rows. I'm sure there is data in there. Can anybody please suggest a solution.
    Thanks

    to_char(s_timestamp,'HH:MM:SS') between '10:10:20' and '12:12:30'The value '10:10:20' is a constant STRING and is no longer a time value (it may look like a time value, but to the DB it is just a string comparision at this point).
    It just compares the to_char conversion of s_timestamp to be between the strings '10:10:20' and '12:12:30' (not between two time values).
    SQL> create table test (s_timestamp date);
    Table created.
    SQL> INSERT INTO test VALUES (SYSDATE);
    1 row created.
    SQL> SELECT *
      2  FROM   test
      3  WHERE  s_timestamp BETWEEN
      4         to_date('10-oct-2004 04:00:00',
      5                 'dd-mon-yyyy hh24:mi:ss') AND
      6         to_date('10-oct-2004 05:00:00',
      7                 'dd-mon-yyyy hh24:mi:ss')
      8  /
    S_TIMESTAMP
    10-OCT-2004
    1 row selected.
    SQL>

  • Difference/Comparision between two tests

    Hi every one,
    I am trying to write a script for comparing any two tests.
    I got an example script in help, speed_comparision.vbs, Which is very help ful for my script. 
    But I have all files in .dat form. i am converting it to .tdm each time by follwing steps manually,
    1. Load test 1
    2. Load test 2
    3. Keep only time channel and acc in test 1 and acc in test 2. (Delete rest all channels.)
    4. Now save this as speed.tdm or acceleration.tdm.
    Instead of doing this each time for all the .dat files, how can i make it automatic in script. Is it possible. 
    or
    Is there a way to find the difference / comparision between two tests with out converting them to tdm.
    I understand that load 2 tests and come to analysis and integrate the two two tests, I wil get the difference. But I am trying to plot my output in speed_comparision.tdr, which is in help. Plz help me in this regard.
    I need a script for doing this. 
    Thanks ,
    Rash
    Attachments:
    Dat files.zip ‏226 KB

    Hi Shilpa,
    The simplest way is to check the latest requests that has been released and imported in all the concerned servers. to do this u need to go to the table E071, give the Object type as FORM and Object Name as the <name of the Smartform> and execute.
    If u see the top most row of your results contain the same Request No. then u can conclude that there are no differences in the smartform in both the servers.
    Otherwise u can also check the requests displayed after executing the table entries in Tcode SE10 and check whether they have been released or not.
    Hope this helps,
    Arnab.

  • Need some input on comparision btw sorted and std table.

    Hi,
    Just a small comparision on using standard table, sorted table, and sorted table using index in a loop with where conditions.
    I just ran this report to find out the time taken and it is quite surprising. Case 3 of the program is quite faster than case2 and of course very fast than case1. any inputs on how this is possible???
    output value :
    try 1: 674, 192, 147 for 100 entries.
    try 2: 603, 53 , 6 for 20 entries.
    *C-- Small report to compare sorted and standard table.
    REPORT  zloopcompare.
    TYPES : BEGIN OF tp_marc,
              werks TYPE marc-werks,
              matnr TYPE marc-matnr,
            END OF tp_marc.
    DATA : t_marc TYPE STANDARD TABLE OF tp_marc.
    DATA : t_marc1 TYPE SORTED TABLE OF tp_marc
    WITH NON-UNIQUE KEY werks matnr.
    DATA : wa_marc TYPE tp_marc.
    DATA : p1 TYPE i,
           p2 TYPE i.
    DATA : l_tabix TYPE sy-tabix.
    DATA : count TYPE i.
    PARAMETERS : p_werks TYPE marc-werks OBLIGATORY.
    SELECT werks matnr FROM marc
    INTO TABLE t_marc1
    UP TO 1000 ROWS.
    t_marc[] = t_marc1[].
    *Case1 - standard table with where condition.
    GET RUN TIME FIELD p1.
    LOOP AT t_marc INTO wa_marc
    WHERE werks EQ p_werks.
    ENDLOOP.
    GET RUN TIME FIELD p2.
    p2 = p2 - p1.
    WRITE : / p2.
    *Case2- sorted table sorted as per the where condition.
    GET RUN TIME FIELD p1.
    LOOP AT t_marc1 INTO wa_marc
    WHERE werks EQ p_werks.
    ENDLOOP.
    GET RUN TIME FIELD p2.
    p2 = p2 - p1.
    WRITE : / p2.
    *Case3- using index to get faster access.
    GET RUN TIME FIELD p1.
    READ TABLE t_marc1 INTO wa_marc WITH KEY werks = p_werks.
    IF sy-subrc EQ 0.
      l_tabix = sy-tabix + 1.
      LOOP AT t_marc1 INTO wa_marc FROM l_tabix.
        IF wa_marc-werks NE p_werks.
          EXIT.
        ENDIF.
      ENDLOOP.
    ENDIF.
    GET RUN TIME FIELD p2.
    p2 = p2 - p1.
    WRITE : / p2.

    HI sharath,
    I just checked and executed the code :
    1. case 1 and 2 are fine.
    2. but 3 is not what u desire.
      <b>(in fact its not looping at all)</b>
    3.  the code in case 3 is :
    IF wa_marc-werks NE p_werks.
    EXIT.
    ENDIF.
    So the loop goes inside ONLY ONCE,
    and so, hence, its LIGHTNING FAST.
    Please note that READ TABLE reads only
    1 record.
    4. ***************
    Instead of NE
    write this, and u will see that its not so fast.
    <b>IF wa_marc-werks = p_werks.</b>
    EXIT.
    ENDIF.
    regards,
    amit m.

  • Product Comparision using Endeca

    Does Endeca support product comparision?
    If yes can someone porivde me supproting document to implement it.

    There is no out-of-the-box cartridge for product comparison as far as I'm aware, but it is pretty simple to implement - Endeca stores properties/dimensions against each record, so you just need to provide a mechanism for the customer to select the records to be compared, then either a way for the business to specify the attributes that should be displayed in the comparison rows, or alternatively dynamically display them (loop through each selected record and build a hashmap of all the dimensions/properties, then loop through this hashmap and write out the rows accordingly, including blanks if applicable or alternatively only rendering a row if all products/records have data for the corresponding property/dimension).
    Michael

  • View data in one row

    Hi, guys I have a table filled in this way and I can't modify the data inside:
    F1 F2 F3 F4
    1 A null null
    1 null B null
    1 null null C
    2 D null null
    2 null E null
    2 null null F
    3 G null null
    3 null H null
    3 null null I
    Is there a way to see the data in this other way (without any NULL)?:
    F1F2F3F4
    1 A B C     
    2 D E F
    3 G H I
    Thank you
    Alex
    Message was edited by:
    user566533
    Message was edited by:
    user566533

    > About the Model clause, I am sure Rob can do better and I am waiting for his solution ;-)
    This looks way too complex for the type of question for me. And as said you are generating more rows than necessary that have to be filtered by a subquery in the final step.
    Although I'm convinced that the original poster does not have rows with data in more than one of the columns, I could not resist the challenge and came up with this:
    SQL> create table mytable
      2  as
      3  select 1 f1, 'A' f2, null f3, null f4 from dual union all
      4  select 1, 'B', null, null from dual union all
      5  select 1, null, 'C', null from dual union all
      6  select 1, null, 'D', null from dual union all
      7  select 1, null, 'E', null from dual union all
      8  select 1, null, null, 'F' from dual union all
      9  select 2, 'G', null, null from dual union all
    10  select 2, 'I', null, null from dual union all
    11  select 2, 'H', null, null from dual union all
    12  select 2, null, 'T', null from dual union all
    13  select 2, null, 'K', null from dual union all
    14  select 2, 'U', null, 'J' from dual
    15  /
    Tabel is aangemaakt.
    SQL> select f1
      2       , max(decode(l,2,f)) f2
      3       , max(decode(l,3,f)) f3
      4       , max(decode(l,4,f)) f4
      5    from ( select t.*
      6                , row_number() over (partition by f1, l order by f) rn
      7             from ( select f1
      8                         , l
      9                         , decode(l,2,f2,3,f3,4,f4) f
    10                      from mytable
    11                         , (select 2 l from dual union all select 3 from dual union all select 4 from dual)
    12                  ) t
    13            where f is not null
    14         )
    15   group by f1
    16       , rn
    17   order by f1
    18       , rn
    19  /
       F1 F2    F3    F4
        1 A     C     F
        1 B     D
        1       E
        2 G     K     J
        2 H     T
        2 I
        2 U
    7 rijen zijn geselecteerd.which I think looks easier.
    > Is there a way to delete rows in model other than using subquery?
    Not really. You can leverage the "RETURN UPDATED ROWS" clause to not return the original rows, in other words: delete the original rows from the result set. But generating extra cells that are to be deleted later on, generally does not make much sense and (therefore?) there is no way to delete rows in the model clause. So the subquery is the way to do it if you really want to.
    Note that I use the subquery technique too for string aggregation using the model clause, because I tested the subquery filter is more performant than the RETURN UPDATED ROWS clause.
    Regards,
    Rob.

Maybe you are looking for

  • I want classic back!

    My 160GB classic ipod will no longer connect to iTunes.  I'm so depressed.  And learning that it is discontinued just shoots another arrow in my heart.  So, I made the plunge and bought a 64GB itouch.  It *****!  I live in the "sticks" with minimal i

  • Exporting specific user provisioning in 9.3.1

    Hi All, I am trying to find a way to export provisioning information to specific users. For exampled I d like to export all roles for 5 specific users. Is this possible? What would be the export.user.filter parameter? Thanks for your help. Seb

  • How to switch how to switch Work process from request type DIA to BTC.

    We have problem in our sap sytem,When we try to log in to the sytem it throughd the abap dump START_CALL_SICK, "no application server offers an BTC service".in sm50 it shows only dialoge workprocess and no backgroung workprocss are present.When i che

  • Package Organizational Structure

    Hello, I have a question about how to use packages correctly. From what I've read, it seems like packages exist purely to introduce domain to a given class and its naming. I'm probably trying to over complicate this, but I was wondering if any furthe

  • Can't Find the Pedals...

    Hello, I am a complete noob in GarageBand so apologies if this is a stupid question... I am conecting my guitar to my macbook and everything is working fine, however, I just cant find how to add efect pedals to my tracks... I mean I can add them to t