Dbms_xplan, e-rows, a-rows

oracle 10.2.0.5
Where does dbms_xplan get the a-rows and e-rows? When I look in v$sql_plan I only see 1 cardinality field. How does it get two different values?
we have statistics_level=typical, so v$sql_plan_statistics is not populated. So it can't be from that.

>
Where does dbms_xplan get the a-rows and e-rows?
>
e-rows are optimizer estimates and a-rows are actual statistics gathered during execution
See this blog by Maria Colgan - a member of the Oracle Optimizer development team.
https://blogs.oracle.com/optimizer/entry/how_do_i_know_if
You might want to bookmark her blog.

Similar Messages

  • Calculating values from row to row with pure sql?

    Hello,
    I'm searching for a way to calculate values from row to row with pure sql. I need to create an amortisation table. How should it work:
    Known values at start: (they can be derived with an ordinary sql-statement)
    - redemption amount RA
    - number of payment terms NT
    - annuity P (is constant in every month)
    - interest rate IR
    What has to be calculated:
    First row:
    RA1 = RA - P
    Z1 = (RA1 * (IR/100/12))
    T1 = P - Z1
    2nd row
    RA2 = RA1 - T1
    Z2 = (RA2 * (IR/100/12))
    T2 = P - Z2
    and so on until NT has reached.
    It should look like
    NT
    P
    Tn
    Zn
    RAn
    1
    372,17
    262,9
    109,27
    22224,83
    2
    372,17
    264,19
    107,98
    21961,93
    3
    372,17
    265,49
    106,68
    21697,74
    4
    372,17
    266,8
    105,38
    21432,25
    5
    372,17
    268,11
    104,06
    21165,45
    6
    372,17
    269,43
    102,75
    20897,34
    7
    372,17
    270,75
    101,42
    20627,91
    8
    372,17
    272,09
    100,09
    20357,16
    9
    372,17
    273,42
    98,75
    20085,07
    10
    372,17
    274,77
    97,41
    19811,65
    11
    372,17
    276,12
    96,06
    19536,88
    12
    372,17
    277,48
    94,7
    19260,76
    13
    372,17
    278,84
    93,33
    18983,28
    14
    372,17
    280,21
    91,96
    18704,44
    15
    372,17
    281,59
    90,59
    18424,23
    16
    372,17
    282,97
    89,2
    18142,64
    17
    372,17
    284,36
    87,81
    17859,67
    18
    372,17
    285,76
    86,41
    17575,31
    19
    372,17
    287,17
    85,01
    17289,55
    20
    372,17
    288,58
    83,59
    17002,38
    21
    372,17
    290
    82,18
    16713,8
    22
    372,17
    291,42
    80,75
    16423,8
    23
    372,17
    292,86
    79,32
    16132,38
    24
    372,17
    294,3
    77,88
    15839,52
    25
    372,17
    295,74
    76,43
    15545,22
    26
    372,17
    297,2
    74,98
    15249,48
    27
    372,17
    298,66
    73,52
    14952,28
    28
    372,17
    300,13
    72,05
    14653,62
    29
    372,17
    301,6
    70,57
    14353,49
    30
    372,17
    303,09
    69,09
    14051,89
    31
    372,17
    304,58
    67,6
    13748,8
    32
    372,17
    306,07
    66,1
    13444,22
    33
    372,17
    307,58
    64,6
    13138,15
    34
    372,17
    309,09
    63,08
    12830,57
    35
    372,17
    310,61
    61,56
    12521,48
    36
    372,17
    312,14
    60,04
    12210,87
    37
    372,17
    313,67
    58,5
    11898,73
    38
    372,17
    315,21
    56,96
    11585,06
    39
    372,17
    316,76
    55,41
    11269,85
    40
    372,17
    318,32
    53,85
    10953,09
    41
    372,17
    319,89
    52,29
    10634,77
    42
    372,17
    321,46
    50,71
    10314,88
    43
    372,17
    323,04
    49,13
    9993,42
    44
    372,17
    324,63
    47,55
    9670,38
    45
    372,17
    326,22
    45,95
    9345,75
    46
    372,17
    327,83
    44,35
    9019,53
    47
    372,17
    329,44
    42,73
    8691,7
    48
    372,17
    331,06
    41,11
    8362,26
    I would appreciate every help and idea to solve the problem solely with sql.
    Thanks and regards
    Carsten

    It's using Model Clause and / or Recursive With (sometimes maybe both)
    Regards
    Etbin
    with
    rec_proc(nt,i,ra,p,ir,z,t) as
    (select nt,i,ra - p,p,ir,round((ra - p) * 0.01 * ir / 12,2),p - round((ra - p) * 0.01 * ir / 12,2)
       from (select 48 nt,22597 ra,372.17 p,5.9 ir,0 z,0 t,1 i
               from dual
    union all
    select nt,i + 1,ra - t,p,ir,round((ra - t) * 0.01 * ir / 12,2),p - round((ra - t) * 0.01 * ir / 12,2)
       from rec_proc
      where i < nt
    select * from rec_proc
    try to adjust initial values and rounding please
    NT
    I
    RA
    P
    IR
    Z
    T
    48
    1
    22224.83
    372.17
    5.9
    109.27
    262.9
    48
    2
    21961.93
    372.17
    5.9
    107.98
    264.19
    48
    3
    21697.74
    372.17
    5.9
    106.68
    265.49
    48
    4
    21432.25
    372.17
    5.9
    105.38
    266.79
    48
    5
    21165.46
    372.17
    5.9
    104.06
    268.11
    48
    6
    20897.35
    372.17
    5.9
    102.75
    269.42
    48
    7
    20627.93
    372.17
    5.9
    101.42
    270.75
    48
    8
    20357.18
    372.17
    5.9
    100.09
    272.08
    48
    9
    20085.1
    372.17
    5.9
    98.75
    273.42
    48
    10
    19811.68
    372.17
    5.9
    97.41
    274.76
    48
    11
    19536.92
    372.17
    5.9
    96.06
    276.11
    48
    12
    19260.81
    372.17
    5.9
    94.7
    277.47
    48
    13
    18983.34
    372.17
    5.9
    93.33
    278.84
    48
    14
    18704.5
    372.17
    5.9
    91.96
    280.21
    48
    15
    18424.29
    372.17
    5.9
    90.59
    281.58
    48
    16
    18142.71
    372.17
    5.9
    89.2
    282.97
    48
    17
    17859.74
    372.17
    5.9
    87.81
    284.36
    48
    18
    17575.38
    372.17
    5.9
    86.41
    285.76
    48
    19
    17289.62
    372.17
    5.9
    85.01
    287.16
    48
    20
    17002.46
    372.17
    5.9
    83.6
    288.57
    48
    21
    16713.89
    372.17
    5.9
    82.18
    289.99
    48
    22
    16423.9
    372.17
    5.9
    80.75
    291.42
    48
    23
    16132.48
    372.17
    5.9
    79.32
    292.85
    48
    24
    15839.63
    372.17
    5.9
    77.88
    294.29
    48
    25
    15545.34
    372.17
    5.9
    76.43
    295.74
    48
    26
    15249.6
    372.17
    5.9
    74.98
    297.19
    48
    27
    14952.41
    372.17
    5.9
    73.52
    298.65
    48
    28
    14653.76
    372.17
    5.9
    72.05
    300.12
    48
    29
    14353.64
    372.17
    5.9
    70.57
    301.6
    48
    30

  • How to set number of rows in "Rows Per Page Selector" in Interactive Report

    Hi Guys,
    Is there any way to set the number of rows in "Rows Per Page Selector" in Interactive Report. By default it is set to 15.
    I know one way is to change the number of rows when you are running the report and then set that as 'Default Report Setting'.
    If anybody is aware of any other way, please let me know.
    Cheers,
    Ashish Agarwal
    http://www.dbcon.com.sg

    Hi Pavel,
    can you please specify your question more clearly. If you are on NW 7.0 you can determine a number of colums for your filter item with following command:
    COLUMNS
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/85/08e241aa8e9d39e10000000a155106/content.htm
    If you meant the amount of rows within the analysis item you can use following command within your analysis item:
    BLOCK_ROWS_SIZE   (numbers of rows displayed at once)
    BLOCK_ROWS_STEP_SIZE  (numbers of rows to be scrolled for one step)
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/76/489d39d342de00e10000000a11402f/content.htm
    Brgds,
    Marcel
    Edited by: Marcel Landsfried on Feb 10, 2009 7:45 PM
    Edited due to wrong url

  • Merging multiple rows in to a single row (when rows meet merging criteria)

    Hi 
    I have a scenario to merge multiple rows in to a single rows when the data in those rows fall in merge criteria .Below is how my data is 
    Now the merging logic for the above rows is , we need to combine multiple rows in to a single row when the data in those rows permits us to do in that way. Simply saying , its like sandwich where we combine multiple things to a single piece.The output for
    the above rows should be
    Here  we combined Row 1 ,2, 3 in to a single row as the data in those rows permits to merge in to single row. But the row 4 cannot be combined to any of those rows because the data in those rows doesn't permits us do a merge ( As the value of the column
    JobSource for the row 4 is different from the other rows ) .
    My original data has 56 columns , but for readability i kept only 9 columns. 
    can you please throw some idea on how to achieve this scenario. I know we need to use CTE for achieving this, but i am not able succeed in doing an iteration on multiple rows.
    Appreciate your response .

    Thanks for your reply .
    Rule for merging is simple . First of all there is no unique row identifier for each row , the fact table is not having an identity column in the database . I called row 1 , row 2  etc in my post above only to make better explanation of my scenario.
    The rule for merge is below. 
    1) we can combine only when the data in a column for one row is null & the data in same column for the other row is not null . It should also satisfy the condition where the data in other columns should conflict each other.
    2) Data for all columns for the merging rows should not be conflicting (i.e. we should not merge the rows when the data in a column is not equal to the same column in the other row
    ,considering not null value)
    Steps in merging the above source data :
    1) Consider the case of row 1 and row 2 in the source, we can combine these rows as the data is satisfying the rule 1 for columns (Jobsource,Flight, Package,Update,Iscancelled
    ,Result, Severity) and columns (JobID and RuleName ) fall under rule 2.  we merge these two rows in to a single row and keep in that in the table.
    2) Then the resulting row is again merged with the second row which is present above by applying the rule 1 and rule 2 . Below would be output of merge operation.
    Now there would be only two rows in the output . But these rows cannot be merged as the data doesn't satisfy the merge rules 2 . As Jobsource for the row 1 in the above output is "PresubmissionSource" which is not equal
    to "PostSubmission" jobSource which is in row 2. So these two rows are left unmerged .So the above two rows would be the output of merge operation on my source data.
    This process has to be repeated for all the rows in the table. As of now my table as 92 Million rows with 56 columns which need to be considered for merging rows. I replicated my scenario in 9 columns and 4 rows to understand better.

  • Transferring data from one table to another table using a Keycolumn using SSIS row by row dynamically

    Hi All,
    I have a Store Procedure(SP) which has a output variable name "AcivityID" which is the key column. In this SP, transformation  of data is done from one table to insert data into other table. I have to execute the SP and insert row by row data
    using the output variable "ActivityID"  whose value will keep on changing. How can I do it?
    Thanks,
    Kallu

    Value changing on a row by row basis? Not quite sure what you mean, but it seems that you want to use the results of an insert into one table as input for another. If so then SSIS is not needed, inside the stored proc use the SQL that will do that and for
    all records as
    INSERT A INTO dbo.table1
    OUTPUT INSERTED.A INTO MyTable;
    Arthur My Blog

  • How to update row by row  in   Jdbc Adapter sender  ?

    Hi friends ,
                      No i am reading data from a table using select query and resulting data i am keeping in the FTP folder as XML File.
                      I want to
                     1. to  know how many rows i read ? 
                     2. Update the  read completed time in each row of the sender side table . 
               (   I am  using <b>select * from a table where tag='n'  </b> . I am giving this in <b>Query SQL Statement</b> of JDBC Sender adapter processing parameter .
    I am writing update query as update table set tag='y' where tag='n' .
                         Will it perform row by row ?
                     3. Insert in to another R3 System  table  the rows which i read  as a log  .
                          Can  you please give  procedure to do that .
                        Expecting your reply asap .
                        Thank you
    Best Regards.,
    V.Rangarajan

    Hi raj ,
                 Thanks for ur reply .   I am new to xi . Just i am doing a scenario . I can able to read  the ms-sql server table data using jdbc Sender  adapter .
                   Can i use RFC Adapter to insert the values to R3 table ?   
                    If  i have mapped  to rfc fields will it store into the table once we read  the data from ms_sql server table using select query of JDBC Sender  Adapter ?
    Best Regards
    V.Rangarajan

  • Can we display comments row for row in Input Ready Query...

    Dear All,
    Currently I have created Web template with Signle Document. When executed it in the Portal it will come up with a "Save" and "Cancel" button of its own and can allowing me to capture comment here & Finally Click on SAVE button which was stored in Documents area in RSA1.
    Now I am was trying to figure out to display comments Row for Row in Input Ready Query...
    Can you give ideas on this...

    Check link http://help.sap.com/saphelp_nw04/helpdata/en/1e/99ea3bd7896f58e10000000a11402f/frameset.htm
    In query properties in BEx query designer you have to do settings to - Display document links
    For metadata, master data, and InfoProvider data for a query, you can display links to Documents that you have created for these objects. If documents exist for these objects, the symbol  appears next to these objects. If you click on this symbol, you jump to where the document is displayed on the Web.
    Highlight the appropriate setting so that the document links for the desired document class are displayed. The document classes are oriented to the various categories of BW objects. InfoProvider data, metadata and master data.

  • WorkOrderList TileView Row & Selected Row Background Color Change

    Hi,
         can we change the background color of WorkorderList TileView Row & Selected Row Background color ?. Actually i am trying to change the color of both in WorkOrderList but it not reflecting any color on my Agentry client. I used a style on Tile List View Data/Style.
    but these applied style on Rows & Selected Rows are not working in Agentry client.
    if any other alternate solution exist in Agentry, please guide me.
    i am using following...
      sap mobile platform-2.3.3
    Thanks & Regard
    Manish Kumar
    Tags edited by: Michael Appleby

    Hi Jason
          Yes using Image we can achieve that goal but i want to use a background color instead of Image background. Finally I used a background color on label and set the that label field on Screen. And It's showing the background color on WorkOrderList Row & Selected Row that what i wanted. But on both Row & Selected TileView Screen showing white outline that i don't want and also i could not remove the default Selected Blue Background Color.
         Please guide me how to remove white outline and default Blue Selected Background color.
    Thanks & Regard
    Manish Kumar

  • How to get row by row

    hai all,
    1Q. let us assume that i am accessing a table.
    let us assume its emp table with fields eno, ename, sal then by using result set i have to get the resultset as
    1 bvrkii 4000
    2 xxxxxx 5000
    ---- and so on
    if i am accessing a dept table with fields deptno, deptnm then my resultset should be as
    1 aaaaa
    2 bbbbb
    what i want to say is, let any number of rows or columns in the table. but i have to get them row by row till the end of the resultset. is it possible.
    2Q. is there any command in java just as in vb
    rs.recordcount()
    where rs is a result set.
    3Q. is there any way to find the field names of a table in java.
    that is if i am using emp table means it has
    to give the result as the fields are
    eno
    ename
    sal
    Thanks in advance.
    by
    bvrk.

    1) Yes, you can keep looping through a ResultSet to retrieve all the rows. You can just place your rs.next() call inside a loop, since it returns false when there are no more rows.
    while(rs.next())
       String no = rs.getString("eno");
       String name = rs.getString("ename");
       //etc...
    }As far as how many columns are in the table, since you know what table you're pulling data from, you should know how many columns there are.
    2) There is no method to give you the count of a ResultSet, mainly because of the nature of the ResultSet, which doesn't actually contain data itself, but is really just a cursor that moves along the data in the database. So it doesn't really know where the end is until it gets there. However, give me the reason you want the count of the rows, and i'll give you a reason why it's not necessary.
    3) Retrieving table and column names is database independent, so you'll need to construct a SQL query with the correct syntax for whichever database you're using, retrieve the column names from that, and then use them to retrieve data from your other tables. Most databases provide a few system tables for this reason.

  • How to delete row by row comparing to first collumn?

    Hello!
    I have a problem - I need to delete row by row , but the problem is, that I know that first COLUMN of any table is a PK.
    To retrieve COLUMN NAME I use:
    SELECT column_name, table_name FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = c1.tmp_table_name;
    But this somehow doesn't work.
    Below you can see my script (not worked for now):
    declare
    xxx varchar2(100);
    begin
    for c1 in (select table_name, tmp_table_name from tmp_tables) loop
    EXECUTE IMMEDIATE
    ' SELECT column_name into '|| xxx ||' FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = ' ||''''||c1.tmp_table_name||'''';
    execute immediate
    'begin
    for c2 in (select * from '|| c1.tmp_table_name || ') loop begin
    insert into '|| c1.table_name || ' values c2; delete from '|| c1.tmp_table_name || ' where ' || xxx ||' = c2.'||xxx ||'; exception when others then null; end; end loop; end;';
    end loop;
    end;
    P.S. Inserts work perfect. I have a problem with delete rows that are in c1.table_name, from c1.tmp_table_name (this two tables have the same structure, PK, always), because I have different column names in another tables tables that are PK. (for example: K, ID, NS and so on) please help me to write correct script.
    For example for first fetched row it will be like:
    begin
    for c1 in (select table_name, tmp_table_name from tmp_tables) loop
    execute immediate
    'begin for c2 in (select * from '|| c1.tmp_table_name || ') loop begin
    insert into '|| c1.table_name || ' values c2; delete from '|| c1.tmp_table_name ||' where K = c2.K; exception when others then null; end; end loop; end;';
    end loop;
    end;
    That script works perfect. But I have many others tables with different PK - not K.

    Solution with error-logging table
    -- create the error-logging table
    CREATE TABLE tbl_MergeErrors (
        Stamp       TIMESTAMP(3),
        TableName   VARCHAR2(30),
        KeyColumn   VARCHAR2(30),
        KeyValue    VARCHAR2(4000),
        ErrorCode   NUMBER(5),
        ErrorMsg    VARCHAR2(4000),
      CONSTRAINT pk_MergeErrors
          PRIMARY KEY (TableName, Stamp)
          USING INDEX
    -- procedure to insert errors
    CREATE OR REPLACE
    PROCEDURE LogMergeError (pTableName  IN VARCHAR2,
                             pKeyColumn  IN VARCHAR2,
                             pKeyValue   IN VARCHAR2)
    IS PRAGMA AUTONOMOUS_TRANSACTION;
        -- you couldn't insert SQLCODE or SQLERRM directly into a table (ORA-00984)
        nSQLCODE   NUMBER(5)      := SQLCODE;
        vcSQLERRM  VARCHAR2(4000) := SQLERRM;
    BEGIN
      INSERT INTO tbl_MergeErrors
             (Stamp, TableName, KeyColumn, KeyValue, ErrorCode, ErrorMsg)
          VALUES (SYSTIMESTAMP, RTrim( SubStr( pTableName, 1, 30)),
                  RTrim( SubStr( pKeyColumn, 1, 30)), SubStr( pKeyValue, 1, 4000),
                  nSQLCODE, vcSQLERRM);
      COMMIT WORK;
    -- if an error occured here, then just roll back the autonomous transaction
    EXCEPTION
      WHEN OTHERS THEN   ROLLBACK WORK;
    END LogMergeError;
    -- create the tables and insert test-data
    CREATE TABLE TMP_TABLES (
        TABLE_NAME       VARCHAR2(200),
        TMP_TABLE_NAME   VARCHAR2(200),
      CONSTRAINT TMP_TABLES_X PRIMARY KEY (TABLE_NAME)
    CREATE TABLE TMP_KL002 (
        K   VARCHAR2(40),
        N   VARCHAR2(200)
    CREATE TABLE TMP_TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200)
    CREATE TABLE KL002 (
        K VARCHAR2(40),
        N VARCHAR2(200),
      CONSTRAINT PK_KL002 PRIMARY KEY (K)
    CREATE TABLE TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200),
      CONSTRAINT PK_TABLE1 PRIMARY KEY (NS)
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('kl002','tmp_kl002');
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('table1','tmp_table1');
    INSERT INTO tmp_KL002 (K, N) VALUES ('00', 'none');
    INSERT INTO tmp_KL002 (K, N) VALUES ('07', 'exists');
    INSERT INTO tmp_KL002 (K, N) VALUES ('08', 'not assigned');
    INSERT INTO tmp_table1 (NS, N) VALUES ('2000', 'basic');
    INSERT INTO tmp_table1 (NS, N) VALUES ('3000', 'advanced');
    INSERT INTO tmp_table1 (NS, N) VALUES ('4000', 'custom');
    COMMIT WORK;
    -- to test, if it works correct when primary key values exists before
    INSERT INTO KL002 VALUES ('07', 'exists before');
    COMMIT WORK;
    -- check the data before execution
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    -- empty the error-logging table
    TRUNCATE TABLE tbl_MergeErrors DROP STORAGE;
    -- a solution
    DECLARE
        PLSQL_BLOCK  CONSTANT VARCHAR2(256) := '
    BEGIN
      FOR rec IN (SELECT * FROM <0>) LOOP
        BEGIN
          INSERT INTO <1> VALUES rec;
          DELETE FROM <0> t WHERE (t.<2> = rec.<2>);
        EXCEPTION
          WHEN OTHERS THEN
              LogMergeError( ''<1>'', ''<2>'', rec.<2>);
        END;
      END LOOP;
    END;';
    BEGIN
      FOR tabcol IN (SELECT t.Tmp_Table_Name, t.Table_Name, c.Column_Name
                     FROM Tmp_Tables t,
                          User_Tab_Columns c
                     WHERE     (c.Table_Name = Upper( t.Tmp_Table_Name))
                           AND (c.Column_ID = 1)
                ) LOOP
        EXECUTE IMMEDIATE Replace( Replace( Replace( PLSQL_BLOCK,
                                   '<0>', tabcol.Tmp_Table_Name),
                                   '<1>', tabcol.Table_Name),
                                   '<2>', tabcol.Column_Name);
      END LOOP;
    END;
    -- check the data after execution ...
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    -- ... and also the error-logging table
    SELECT * FROM tbl_MergeErrors ORDER BY Stamp, TableName;
    -- of couse you must issue an COMMIT (the ROLLBACK is only for testing
    ROLLBACK WORK;
    -- drop the test-tables
    DROP TABLE TABLE1 PURGE;
    DROP TABLE KL002 PURGE;
    DROP TABLE TMP_TABLE1 PURGE;
    DROP TABLE TMP_KL002 PURGE;
    DROP TABLE TMP_TABLES PURGE;
    -- you shouldn't drop the error-logging table, but I use it to free up my db
    DROP TABLE tbl_MergeErrors PURGE;Greetings, Niels

  • How to Comapare Row by Row in ODI Interface

    Hi all
    i want to Compare Record by Record from my Source Table.
    Can any one Explain Logic How can i do through ODI Interface?

    If you want row by row processing (rather than set based) then look at using Knowledge Modules that implicitly use a cursor via the agent to load the staging table (e.g LKM SQL to SQL) or a KM that explicitly uses a cursor to load the target table (e.g IKM Incremental updata row by row).
    It wont be as fast as set based though!
    What do you want to do with each row? Can you load them all into the staging area and then process row by row?

  • What is the best approach to process data on row by row basis ?

    Hi Gurus,
    I need to code stored proc to process sales_orders into Invoices. I
    think that I must do row by row operation, but if possible I don't want
    to use cursor. The algorithm is below :
    for all sales_orders with status = "open"
    check for credit limit
    if over credit limit -> insert row log_table; process next order
    check for overdue
    if there is overdue invoice -> insert row to log_table; process
    next order
    check all order_items for stock availability
    if there is item that has not enough stock -> insert row to
    log_table; process next order
    if all check above are passed:
    create Invoice (header + details)
    end_for
    What is the best approach to process data on row by row basis like
    above ?
    Thank you for your help,
    xtanto

    Processing data row by row is not the fastest method out there. You'll be sending much more SQL statements towards the database than needed. The advice is to use SQL, and if not possible or too complex, use PL/SQL with bulk processing.
    In this case a SQL only solution is possible.
    The example below is oversimplified, but it shows the idea:
    SQL> create table sales_orders
      2  as
      3  select 1 no, 'O' status, 'Y' ind_over_credit_limit, 'N' ind_overdue, 'N' ind_stock_not_available from dual union all
      4  select 2, 'O', 'N', 'N', 'N' from dual union all
      5  select 3, 'O', 'N', 'Y', 'Y' from dual union all
      6  select 4, 'O', 'N', 'Y', 'N' from dual union all
      7  select 5, 'O', 'N', 'N', 'Y' from dual
      8  /
    Tabel is aangemaakt.
    SQL> create table log_table
      2  ( sales_order_no number
      3  , message        varchar2(100)
      4  )
      5  /
    Tabel is aangemaakt.
    SQL> create table invoices
      2  ( sales_order_no number
      3  )
      4  /
    Tabel is aangemaakt.
    SQL> select * from sales_orders
      2  /
            NO STATUS IND_OVER_CREDIT_LIMIT IND_OVERDUE IND_STOCK_NOT_AVAILABLE
             1 O      Y                     N           N
             2 O      N                     N           N
             3 O      N                     Y           Y
             4 O      N                     Y           N
             5 O      N                     N           Y
    5 rijen zijn geselecteerd.
    SQL> insert
      2    when ind_over_credit_limit = 'Y' then
      3         into log_table (sales_order_no,message) values (no,'Over credit limit')
      4    when ind_overdue = 'Y' and ind_over_credit_limit = 'N' then
      5         into log_table (sales_order_no,message) values (no,'Overdue')
      6    when ind_stock_not_available = 'Y' and ind_overdue = 'N' and ind_over_credit_limit = 'N' then
      7         into log_table (sales_order_no,message) values (no,'Stock not available')
      8    else
      9         into invoices (sales_order_no) values (no)
    10  select * from sales_orders where status = 'O'
    11  /
    5 rijen zijn aangemaakt.
    SQL> select * from invoices
      2  /
    SALES_ORDER_NO
                 2
    1 rij is geselecteerd.
    SQL> select * from log_table
      2  /
    SALES_ORDER_NO MESSAGE
                 1 Over credit limit
                 3 Overdue
                 4 Overdue
                 5 Stock not available
    4 rijen zijn geselecteerd.Hope this helps.
    Regards,
    Rob.

  • Row By Row Operation

    Hi experts,
    I stuck in a issue for webi report, i want to know if we can perform row by row operation in webi.
    Problem:
    My Formula for calculation delay is
    delay =
    =Sum([DurationATEDL_new]-[ExpectedDurationEDL_new])
    Where ([DurationATEDL_new]>[ExpectedDurationEDL_new])
    I am displaying values in the table like
    Company Code       Division     DurationATEDL_new]   ExpectedDurationEDL_new    Delay
    ABC                         DEF           42                                 23                                           19
    I am getting correct values for i.e 42 and 23 but 19 is not the correct value for me. What i want to do is to apply row by row or for every ID operation on delay column to check if durationAtEDL > ExpectedDuration EDl then sum the delay and display values. but currently what it is doing is simply subtracting 42 - 23 = 19......
    ExpectedDurationEDL_new  =([Expected Duration in(1)]/[RequestRows]) Where ([ClosedRequests]=[SP Request ID (ZTM_IS_K6___F2)] And [Current Node/Stage C (ZTM_IS_K6___F88)]="EDL")                                      
    DurationATEDL_new=(([Durartion]*[RequestRows])/[RequestRows]) Where (([ClosedRequests]=[SP Request ID (ZTM_IS_K6___F2)]) And [Current Node/Stage C (ZTM_IS_K6___F88)]="EDL")
    what should i change in my delay formula to achieve subtraction sum on the basis of each id and condition if exp duration < duration???
    Thanks
    Rizwan

    Thanks Koen:
    Your idea worked for me ...This is how i get rid of the situation..
    (([DurationATEDL_new])
    ForEach ([ClosedRequests])-[ExpectedDurationEDL_new])
    Where (([exp<duration_flag]=1) ForEach ([ClosedRequests]))
    Thanks

  • ODI 10G Using ODI sequences row by row

    Hi everyone,
    I have source as FILE system(All_files.txt) it has just one column :example1.txt,example2.txt etc..
    My source table like this:
    FLAT_FILE(FILE):
    FILE_NAME String(100)
    TARGET(Oracle)----->HR.TMP_ALL_FILES
    FILE_NAME(:FILE_NAME(VARCHAR2 100))
    LOAD_ID(NUMBER)-->ODI_SEQ_NEXTVAL
    CRE_DT(SYSDATE)
    Now I am using odi seq is called ODI_SEQ that I mapped into LOAD_ID.But I want to get row by row sequences like:1,2,3,4.....
    My target must be like this:
    example1.txt 1 sysdate
    example2.txt 2 sysdate
    example3.txt 3 sydate.
    How Can ı get row by row using ODI sequence?
    Edited by: aetl on Dec 17, 2012 12:30 AM

    Hi aetl,
    I might be wrong but I think that if you use a set-based IKM (like IKM SQL Control Append), the value will only change for the next set.
    You can use an Oracle Sequence instead, this will change row-by-row.
    Regards,
    JeromeFr

  • Print,Check,Apppend Row,Delete Row,Insert Row buttons actions code

    HI,
    I have a ALV table in that buttons Print,Check,Apppend Row,Delete Row,Insert Row buttons are there.But client requirement is they don't want those buttons in ALV they want in above the ALV table.
    Can you please let me know how to hide those buttons in ALV.and give me code Print,Check,Apppend Row,Delete Row,Insert Row action code..HI,

    I hope you have instantiated your ALV. Check the below code
    * Instantiate the used component " You can use code wizard to get this code.
      DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_usg_alv( ). "usg_alv should be your usage name
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
    * Get Model
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_usg_alv( ).
      DATA lo_value TYPE REF TO cl_salv_wd_config_table.
      lo_value = lo_interfacecontroller->get_model(
    * Hide Standard buttons on ALV toolbar
      DATA: l_std_func TYPE REF TO if_salv_wd_std_functions.
      l_std_func ?= lo_value                                 .
      l_std_func->set_edit_append_row_allowed( abap_false )  .
      l_std_func->set_sort_headerclick_allowed( abap_true ) .
      l_std_func->set_edit_append_row_allowed( abap_false )  .
      l_std_func->set_edit_insert_row_allowed( abap_false )  .
      l_std_func->set_edit_delete_row_allowed( abap_false )  .
      l_std_func->set_view_list_allowed( abap_false )        .
      l_std_func->set_sort_headerclick_allowed( abap_false ) .
      l_std_func->set_edit_check_available( abap_false )     .
      l_std_func->set_pdf_allowed( abap_false )              .
      l_std_func->set_export_allowed( abap_true )            .
    Radhika.

Maybe you are looking for

  • Should I downgrade from OSX 10.8.5 to OSX 10.4, then upgrade to 10.5 or 10.6 from there?

    Ever since I upgraded to 10.8 earlier this year, my MBP seems to struggle with every application and process.  Nothing operates smoothly, and Chrome, which I absolutely loved using prior, is significantly outperformed by safari.  I can no longer view

  • Reader X failing on Save and Save As, after the form has been opened for  longer than an hour.

    I'm wondering if anyone else has had this happen or maybe can offer a solution. I have several Dynamic XML forms designed in LiveCycle ES2 v9 that since our ministry switched to Reader X have been failing. At first, the save button greys out (even th

  • Can't install Intel Rapid Storage Technology driver on Yoga 2 11

    The Lenovo driver list for the Yoga 2 11 includes Intel Rapid Storage Technology (IRST) Driver for 64-bit Windows. However, attempting to install this results in the message, "No Appropriate Driver to be Installed". Likewise, attempting to install th

  • Field VSBED empty in IDOC DELVRY03

    Hi, I'm generating an outbound idoc DELVRY03 for a delivery. The field LIKP-VSBED is filled. Normally the value in LIKP-VSBED is supposed to be copied in field E1EDL20-VSBED of DELVRY03 idoc. But when the idoc is generate the field E1EDL20-VSBED is e

  • Oldest OS for a Quicksilver?

    Right now I have Panther on my Quicksilver. I have some classic apps that I would like to run, and would like to install a classic OS, either to run in Classic mode or to boot directly into. I have an iMac install CD (OS 8.6) and a Powerbook 3400 ins