How to find  latest updating row in a table

Hi
How to find latest updating row in a table

ADF 7 wrote:
SELECT *  FROM Table WHERE lastupdTimestamp = (SELECT MAX(lastupdTimestamp) FROM Table)lastupdtimestamp - holds and date an time of an records when it last updation takes place in table.
lastupdtimestamp is a column in my table.And how will this make sense in the scenario I've described, where UserA does an update before UserB, but commits the update after UserB's commited update? And add UserC and UserD and a 1000 more users to this scenario where concurrent updates happen.
What actual time does this lastupdtimestamp contain and represent? And why? How is that lastupdtimestamp used in business logic and processing? Or is it just a silly-bugger-let's-add-somekind-of-time column to that table that essentially meaningless?
Not saying that one should never add such a timestamp based column. Simply that one needs to understand WHAT it contains and it needs to be SENSIBLY used within the data model.
However, in my experience such columns are often slapped on afterwards, never featured in the actual data model designed, and is then used without a second though that the database and its data is a multi-user and multi-process system. And things happen at the same time. And things overlap (serialisation is the exception - not the rule).

Similar Messages

  • How to find latest updated row in a table

    Hi
    Here I have command that display updated time.But I Need which row was lastly updated (show particular row) in that table.
    select scn_to_timestamp(max(ora_rowscn))
    from employee;

    First of all, SCN to timestamp mapping exists for a short period of time, so if change is relatively old you'll get ORA-08181:
    SQL> select max(ora_rowscn) from emp;
    MAX(ORA_ROWSCN)
           22622685
    SQL> select scn_to_timestamp(max(ora_rowscn)) from emp;
    select scn_to_timestamp(max(ora_rowscn)) from emp
    ERROR at line 1:
    ORA-08181: specified number is not a valid system change number
    ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1
    SQL> Anyway, based on SCN we can find out which BATCH of table row modifications was committed last. But you can't find out which modification withing that BATCH was made last.
    SY.

  • How to find newly updated rows in a table

    Hi..
    How to know newly updated rows in a table.
    Thanks in advance
    pal

    Or other good thing would be to add LAST_UPDATED column to your table, that can reflect the time the row gets updated.
    G

  • How to find latest updated tables in current schema.

    Hi,
    I am in 3rd line support work, jobs(unix shell scripts) are running on daily at scheduled time.
    Regarding to my work, i need to found latest updated tables.
    How to find latest updated tables in current schema.
    please guide me.
    Thanks and Regards,
    Venkat.

    duplicate thread
    Answers on other thread: How to find latest updated tables in current schema.

  • How to find the LOCKED ROWS in a table?

    Not locked objects, but for a table the locked rows.

    Check below links :
    http://www.jlcomp.demon.co.uk/faq/locked_rows.html
    How to find the locked row.
    who are waiting for same record?
    HTH
    Girish Sharma

  • How to find latest Revison of material in table?

    We managed our material change with CO & revision.
    Now I have requirement to prepare one report for material, in that report I ned latest rev & CO assigned to material.
    Where can I find latest rev of materials in table. I know we can use table AEOI, but this table display all rev. I need only & only latest rev.
    I have 38,000 materials handy, now I need to find latest rev of these 38,000 materials.
    Please help.
    Tom.

    I guess the question would be is this a one time report or something ongoing?
    If you can use MS Access you can create this report by downloading the AEOI table to access.
    Then create a copy of the table structure only and set the key field as Material.
    Set up a query to append the unique material numbers with the highest version number into the new table.
    Modify the query and repeat with highest version number minus 1.  Repeat until the version number is 1.
    Once  a material has been copied into the table, no further entries will be allowed because the material number is the key filed.  You should wind up with a table containing the information you want.
    You might be able to do this with a single query by using the MAX fuction on version number field.
    Once you create this, it should be easy to throw in some macros, add a button to a form, and be able to repeat the process at any time with the click of a button.
    If you need to do this in SAP, you'd have to create a Z table, have an ABAP'er write the correct query to copy over the records from the AEOI table and than base reports on this Z table.
    FF

  • How to find number of rows in a table

    i have one table ,it contains millions of record,how can i know number of rows in that table without using count(*),
    i tried in user_table ,for the column NUM_ROWS,but it is not showing number of rows,pls send me a solution for this.
    regards,
    singh

    Ok, that only was to show simply that max option
    might not an option to reduce execution time.Yes, but I/O variances have a tendency to really skew the observed elapsed execution time - making execution time alone a poor choice to determine what SQL will perform better than another.
    Both MAX(ROWNUM) and COUNT(*) results in the same amount of I/O - as both uses the exact same execution plan, I/O wise. In this example, a FTS.
    SQL> create table testtab nologging as select * from all_objects where rownum < 10001;
    Table created.
    -- warmed up the buffer cache with a couple of SELECTs against TESTAB in order
    -- to discard PIOs from the results
    SQL> set autotrace on
    SQL> select count(*) from testtab;
    COUNT(*)
    10000
    Execution Plan
    Plan hash value: 2656308840
    | Id | Operation | Name | Rows | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 35 (9)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | | |
    | 2 | TABLE ACCESS FULL| TESTTAB | 9262 | 35 (9)| 00:00:01 |
    Note
    - dynamic sampling used for this statement
    Statistics
    0 recursive calls
    0 db block gets
    131 consistent gets
    0 physical reads
    0 redo size
    223 bytes sent via SQL*Net to client
    238 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    SQL> select max(rownum) from testtab;
    MAX(ROWNUM)
    10000
    Execution Plan
    Plan hash value: 2387991791
    | Id | Operation | Name | Rows | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 35 (9)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | | |
    | 2 | COUNT | | | | |
    | 3 | TABLE ACCESS FULL| TESTTAB | 9262 | 35 (9)| 00:00:01 |
    Note
    - dynamic sampling used for this statement
    Statistics
    0 recursive calls
    0 db block gets
    131 consistent gets
    0 physical reads
    0 redo size
    225 bytes sent via SQL*Net to client
    238 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    So seeing that we have the exact same baseline for both queries, and that PIO does not influence the results, we time a 1000 executions of both.
    SQL> declare
    2 cnt number;
    3 begin
    4 for i in 1..1000
    5 loop
    6 select count(*) into cnt from testtab;
    7 end loop;
    8 end;
    9 /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.19
    SQL>
    SQL> declare
    2 cnt number;
    3 begin
    4 for i in 1..1000
    5 loop
    6 select max(rownum) into cnt from testtab;
    7 end loop;
    8 end;
    9 /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:15.87
    SQL>
    This shows that what makes the MAX() more expensive is just that - determining the MAX(). For each row, Oracle has to call its internal MAX() function with two values - the current max result and the new value. This function then returns the new max value. This overhead per row adds up to a significant overhead in execution time - making the MAX() approach 5x slower than the COUNT() approach.

  • How to find index of row in dynamic table?

    Our form has a table to which the user can add rows.  We want to be able to edit the custom help text of each field in the row to add the row number for accessibility.  But need the index number of the row to reference the row of the fields. And we can't figure out how to get it.
    We have tried both the field initialize and field layout events, but our property for index is not being recognized. For the initialize event of one of the fields in the row, we wrote this code:
    xfa.host.messageBox("We are in the initialize event for this field.");
    var thisRow = this.parent.index;
    xfa.host.messageBox(thisRow);
    We have the table set up with 8 intial rows. The first message pops up 8 times, but the second doesn't appear at all.  How can we get the number of the row we are addressing?
    Thanks.

    Not sure what's going on there but messageBox() is throwing an error for some reason (use CTRL-J in Acrobat to open the Console):
    GeneralError: Operation failed.
    XFAObject.messageBox:3:XFA:form1[0]:subMain[0]:Table1[0]:Row1[1]:TextField1[0]:ready
    Argument mismatch in property or function argument
    It works if you add some text:
    xfa.host.messageBox("Row Number: " + thisRow);
    app.alert() works: app.alert(thisRow);
    And console.println() works (less annoying for testing than popups - open the Console window to see the results):
    console.println(thisRow);
    Ah, just figured it out - messageBox() doesn't seem to like a number first, it's expecting a string. The following works with your original script:
    var thisRow = this.parent.index.toString();

  • How to find sum of ROWS in advanced table...............

    hi all,
    i have a requirement where we have to calculate sum of the row values in advanced table
    when i click on ADDROW button a new row is displayed after entering the values
    i need to get the sum of values that i enter into the new row
    i know about RECALCULATE button which gives sum of columns but i need to get the sum of the rows
    plz help me.........
    thanx in advance
    DEV

    Hi Dev ,
    You need to make use of iteration , loop through every record in the VO get the column value and keep adding it
    to obtain the sum .
    Here is the code to loop through and get the column value
    OAApplicationModule am = oapagecontext.getApplicationModule(oawebbean);
    int sum = 0;
    OAViewObject oaviewobject =(OAViewObject)am.findViewObject("ApplicationsListVO"); // your vo name attached to table region
    if(oaviewobject!=null)
    oapagecontext.writeDiagnostics(this,"View Object is exists",OAFwkConstants.STATEMENT);
    int rowcountValue = oaviewobject.getRowCount(); // retruns no of rows
    Row rowAdv= oaviewobject.first();
    RowSetIterator iterator = oaviewobject.createRowSetIterator("iterator");
    iterator.setRangeStart(0);
    iterator.setRangeSize(oaviewobject.getRowCount());
    for(int i=0; i<iterator.getRowCount(); i++)
    oapagecontext.writeDiagnostics(this,"Inside For loop ",OAFwkConstants.STATEMENT);
    rowAdv =iterator.getRowAtRangeIndex(i); // start from 0 to fetch count ( no of rows )
    if(rowAdv != null)
    if(rowAdv.getAttribute("VacancyName")!=null) // get your column name
    vacancyValue = rowAdv.getAttribute("VacancyName").toString();
    Sum = sum +vacancyValue ; // Obtain the sum here
    Let me know if you need further inputs .
    Keerthi

  • How to find out the rows inserted between a time period.

    Hi,
    Please help me to solve this.
    Table - emp.
    Colmns - empno(Primary Key),ename, mgr
    How to find out the rows inserted between a time period.
    For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
    regards,
    Mathew.

    Hi,
    Maybe work:
    For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
    e.g.:
    SGMS@ORACLE10> create table test(cod number);
    Table created.
    SGMS@ORACLE10> insert into test values (1);
    1 row created.
    SGMS@ORACLE10> insert into test values (2);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> insert into test values (3);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
    SCN_TO_TIMESTAMP(ORA_ROWSCN)       ORA_ROWSCN        COD
    06/11/06 08:56:56,000000000         727707205          1
    06/11/06 08:56:56,000000000         727707205          2
    06/11/06 08:57:05,000000000         727707210          3Cheers

  • How can i update rows  in a table based on a match from a select query

    Hello
    How can i update rows in a table based on a match from a select query fron two other tables with a update using sqlplus ?
    Thanks Glenn
    table1
    attribute1 varchar2 (10)
    attribute2 varchar2 (10)
    processed varchar2 (10)
    table2
    attribute1 varchar2 (10)
    table3
    attribute2 varchar2 (10)
    An example:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)

    Hi,
    Etbin wrote:
    Hi, Frank
    taking nulls into account, what if some attributes are null ;) then the query should look like
    NOT TESTED !
    update table1 t1
    set processed = 'Y'
    where exists(select null
    from table2
    where lnnvl(attribute1 != t1.attribute1)
    and exists(select null
    from table3
    where lnnvl(attribute2 != t1.attribute2)
    and processed != 'Y'Regards
    EtbinYes, you could do that. OP specifically requested something else:
    wgdoig wrote:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)This WHERE clause won't be TRUE if any of the 4 attribute columns are NULL. It's debatable about what should be done when those columns are NULL.
    But there is no argument about what needs to be done when processed is NULL.
    OP didn't specifically say that the UPDATEshould or shouldn't be done on rows where processed was already 'Y'. You (quite rightly) introduced a condition that would prevent redo from being generated and triggers from firing unnecessarily; I'm just saying that we have to be careful that the same condition doesn't keep the row from being UPDATEd when it is necessary.

  • How to find latest entry in the table according to time

    how to find latest entry in the table according to the time
    is there any function module to do so
    \[removed by moderator\]
    Regards
    Shashi
    Edited by: Jan Stallkamp on Aug 25, 2008 4:39 PM

    Hi,
    If you want to read the entry from an internal table,
    sort the internal table in the descending order by the time and
    delete adjacent duplicates by comparing the fields other than time and the internal table will have the latest record.
    Suggestion: instead of only time try to have one more field called date with the time combination
    Regards,
    Ramesh

  • How to find the level of each child table in a relational model?

    Earthlings,
    I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
    So: How to find the level of each child table in a relational model?
    I have a relacional database (9.2), all right?!
         O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
        /↑\ Fks
       O"O O" <-- level 2 for first table (circle)
      /↑\ Fks
    "o"o"o" <-- level 1 for middle table (circle)
       ↑ Fk
      "º"Tips:
    - each circle represents a table;
    - red tables no have foreign key
    - the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
    I started thinking about the following:
    First I have to know how to take the children:
    select distinct child.table_name child
      from all_cons_columns father
      join all_cons_columns child
    using (owner, position)
      join (select child.owner,
                   child.constraint_name fk,
                   child.table_name child,
                   child.r_constraint_name pk,
                   father.table_name father
              from all_constraints father, all_constraints child
             where child.r_owner = father.owner
               and child.r_constraint_name = father.constraint_name
               and father.constraint_type in ('P', 'U')
               and child.constraint_type = 'R'
               and child.owner = 'OWNER') aux
    using (owner)
    where child.constraint_name = aux.fk
       and child.table_name = aux.child
       and father.constraint_name = aux.pk
       and father.table_name = aux.father;Thinking...
    Let's Share!
    My thanks in advance,
    Philips
    Edited by: BluShadow on 01-Apr-2011 15:08
    formatted the code and the hierarchy for readbility

    Justin,
    Understood.
    Nocycle not work in 9.2 and, even that would work, would not be appropriate.
    With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
    -- 1
    declare
      type udt_roles is table of varchar2(30) index by pls_integer;
      cRoles udt_roles;
    begin
      execute immediate 'create user philips
        identified by philips';
      select granted_role bulk collect
        into cRoles
        from user_role_privs
       where username = user;
      for i in cRoles.first .. cRoles.count loop
        execute immediate 'grant ' || cRoles(i) || ' to philips';
      end loop;
    end;
    -- 2
    create table philips.root1(root1_id number,
                               constraint root1_id_pk primary key(root1_id)
                               enable);
    grant all on philips.root1 to philips;
    create or replace trigger philips.tgr_root1
       before delete or insert or update on philips.root1
       begin
         null;
       end;
    create table philips.root2(root2_id number,
                               constraint root2_id_pk primary key(root2_id)
                               enable);
    grant all on philips.root2 to philips;
    create or replace trigger philips.tgr_root2
       before delete or insert or update on philips.root2
       begin
         null;
       end;
    create table philips.node1(node1_id number,
                               root1_id number,
                               node2_id number,
                               node4_id number,
                               constraint node1_id_pk primary key(node1_id)
                               enable,
                               constraint n1_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n1_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable,
                               constraint n1_n4_id_fk foreign key(node4_id)
                               references philips.node4(node4_id) enable);
    grant all on philips.node1 to philips;
    create or replace trigger philips.tgr_node1
       before delete or insert or update on philips.node1
       begin
         null;
       end;
    create table philips.node2(node2_id number,
                               root1_id number,
                               node3_id number,
                               constraint node2_id_pk primary key(node2_id)
                               enable,
                               constraint n2_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n2_n3_id_fk foreign key(node3_id)
                               references philips.node3(node3_id) enable);
    grant all on philips.node2 to philips;
    create or replace trigger philips.tgr_node2
       before delete or insert or update on philips.node2
       begin
         null;
       end;                          
    create table philips.node3(node3_id number,
                               root2_id number,
                               constraint node3_id_pk primary key(node3_id)
                               enable,
                               constraint n3_r2_id_fk foreign key(root2_id)
                               references philips.root2(root2_id) enable);
    grant all on philips.node3 to philips;
    create or replace trigger philips.tgr_node3
       before delete or insert or update on philips.node3
       begin
         null;
       end;                          
    create table philips.node4(node4_id number,
                               node2_id number,
                               constraint node4_id_pk primary key(node4_id)
                               enable,
                               constraint n4_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable);
    grant all on philips.node4 to philips;
    create or replace trigger philips.tgr_node4
       before delete or insert or update on philips.node4
       begin
         null;
       end;                          
    -- out of the relational model
    create table philips.node5(node5_id number,
                               constraint node5_id_pk primary key(node5_id)
                               enable);
    grant all on philips.node5 to philips;
    create or replace trigger philips.tgr_node5
       before delete or insert or update on philips.node5
       begin
         null;
       end;
    -- 3
    create table philips.dictionary(table_name varchar2(30));
    insert into philips.dictionary values ('ROOT1');
    insert into philips.dictionary values ('ROOT2');
    insert into philips.dictionary values ('NODE1');
    insert into philips.dictionary values ('NODE2');
    insert into philips.dictionary values ('NODE3');
    insert into philips.dictionary values ('NODE4');
    insert into philips.dictionary values ('NODE5');
    --4
    create or replace package body philips.pck_restore_philips as
      procedure sp_select_tables is
        aExportTablesPhilips     utl_file.file_type := null; -- file to write DDL of tables   
        aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
        aExportIndexesPhilips    utl_file.file_type := null; -- file to write DDL of indexes
        aExportGrantsPhilips     utl_file.file_type := null; -- file to write DDL of grants
        aExportTriggersPhilips   utl_file.file_type := null; -- file to write DDL of triggers
        sDirectory               varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02 
        cTables                  udt_tables; -- collection to store table names for the relational depth
      begin
        -- omits all referential constraints:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
        -- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
        -- append a SQL terminator (; or /) to each DDL statement:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
        -- create/open files for export DDL:
        aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
        aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
        aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
        aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
        aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
        select d.table_name bulk collect
          into cTables -- collection with the names of tables in the schema philips
          from all_tables t, philips.dictionary d
         where owner = 'PHILIPS'
           and t.table_name = d.table_name;
        -- execution
        sp_seeks_ddl(aExportTablesPhilips,
                     aExportReferencesPhilips,
                     aExportIndexesPhilips,
                     aExportGrantsPhilips,
                     aExportTriggersPhilips,
                     cTables);
        -- closes all files
        utl_file.fclose_all;
      end sp_select_tables;
      procedure sp_seeks_ddl(aExportTablesPhilips     in utl_file.file_type,
                             aExportReferencesPhilips in utl_file.file_type,
                             aExportIndexesPhilips    in utl_file.file_type,
                             aExportGrantsPhilips     in utl_file.file_type,
                             aExportTriggersPhilips   in utl_file.file_type,
                             cTables                  in out nocopy udt_tables) is
        cDDL       clob := null; -- colletion to save DDL
        plIndex    pls_integer := null;
        sTableName varchar(30) := null;
      begin
        for i in cTables.first .. cTables.count loop
          plIndex    := i;
          sTableName := cTables(plIndex);
           * Retrieves the DDL and the dependent DDL into cDDL clob       *      
          * for the selected table in the collection, and writes to file.*
          begin
            cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTablesPHILIPS, cDDL);
          exception
            when dbms_metadata.object_not_found then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportReferencesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportIndexesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportGrantsPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTriggersPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
        end loop;
      end sp_seeks_ddl;
      procedure sp_writes_ddl(aExport in utl_file.file_type,
                              cDDL    in out nocopy clob) is
        pLengthDDL  pls_integer := length(cDDL);
        plQuotient  pls_integer := null;
        plRemainder pls_integer := null;
      begin
          * Register variables to control the amount of lines needed   *
         * for each DDL and the remaining characters to the last row. *
        select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
          into plQuotient, plRemainder
          from dual;
          * Join DDL in the export file.                            *
         * ps. 32766 characters + 1 character for each line break. *
        -- if the size of the DDL is greater than or equal to limit the line ...
        if plQuotient >= 1 then
          -- loops for substring (lines of 32766 characters + 1 break character):
          for i in 1 .. plQuotient loop
            utl_file.put_line(aExport, substr(cDDL, 1, 32766));
            -- removes the last line, of clob, recorded in the buffer:
            cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
          end loop;
        end if;
          * If any remains or the number of characters is less than the threshold (quotient = 0), *
         * no need to substring.                                                                 *
        if plRemainder > 0 then
          utl_file.put_line(aExport, cDDL);
        end if;
        -- record DDL buffered in the export file:
        utl_file.fflush(aExport);
      end sp_writes_ddl;
    begin
      -- executes main procedure:
      sp_select_tables;
    end pck_restore_philips;<font color="red">The problem is that I still have ...
    When creating the primary key index is created and this is repeated in the file indexes.
    How to avoid?</font>

  • Update Row into Run Table Task is not executing in correct sequence in DAC

    Update Row into Run Table Task is not executing in correct sequence in DAC.
    The task phase for this task is "Post Lost" . The depth in the execution plan is 19 but this task is running some times in Depth 12, some times in 14 and some time in Depth 16. Would like to know is this sequence of execution is correct order or not? In the out of the Box this task is executed at the end of the entire load. No Errors were reported in DAC log.
    Please let me know if any documents that would highlight this issue
    rm

    Update into Run table is a task thats required to update a table called W_ETL_RUN_S. The whole intention of this table is to keep the poor mans run history on the warehouse itself. The actual run history is stored in the DAC runtime tables, however the DAC repository could be on some other database/schema other than warehouse. Its mostly a legacy table, thats being carried around. If one were to pay close attention to this task, it has phase dependencies defined that dictate when this task should run.
    Apologies in advance for a lengthy post.... But sure might help understanding how DAC behaves! And is going to be essential for you to find issues at hand.
    The dependency generation in DAC follows the following rules of thumb!
    - Considers the Source table target table definitions of the tasks. With this information the tasks that write to a table take precedence over the tasks that reads from a table.
    - Considers the phase information. With this information, it will be able to resolve some of the conflicts. Should multiple tasks write to the same table, the phase is used to appropriately stagger them.
    - Considers the truncate table option. Should there be multiple tasks that write to the same table with the same phase information, the task that truncates the table takes precedence.
    - When more than one task that needs to write to the table that have similar properties, DAC would stagger them. However if one feels that either they can all go in parallel, or a common truncate is desired prior to any of the tasks execution, one could use a task group.
    - Task group is also handy when you suspect the application logic dictates cyclical reads and writes. For example, Task 1 reads from A and writes to B. Task 2 reads from B and writes back to A. If these two tasks were to have different phases, DAC would be able to figure that out and order them accordingly. If not, for example those tasks need to be of the same phase for some reason, one could create a task group as well.
    Now that I described the behavior of how the dependency generation works, there may be some tasks that have no relevance to other tasks either as source tables or target tables. The update into run history is a classic example. The purpose of this task is to update the run information in the W_ETL_RUN_S with status 'Completed' with an end time stamp. Because this needs to run at the end, it has phase dependency defined on it. With this information DAC will be able to stagger the position of execution either before (Block) or after (Wait) all the tasks belonging to a particular phase is completed.
    Now a description about depth. While Depth gives an indication to the order of execution, its only an indication of how the tasks may be executed. Its a reflection of how the dependencies have been discovered. Let me explain with an example. The tasks that have no dependency will have a depth of 0. The tasks that depend on one or more or all of depth 0 get a depth of 1. The tasks that depend on one or more or all of depth 1 get a depth of 2. It also means implicitly a task of depth 2 will indirectly depend on a task of depth 0 through other tasks in depth 1. In essence the dependencies translate to an execution graph, and is different from the batch structures one usually thinks of when it comes to ETL execution.
    Because DAC does runtime optimization in the order in which tasks are executed, it may pick a task thats of order 1 over something else with an order of 0. The factors considered for picking the next best task to run depend on
    - The number of dependent tasks. For example, a task which has 10 dependents gets more priorty than the one whose dependents is 1.
    - If all else equal, it considers the number of source tables. For example a task having 10 source tables gets more priority than the one that has only two source tables.
    - If all else equal, it considers the average time taken by each of the tasks. The longer running ones will get more preference than the quick running ones
    - and many other factors!
    And of course the dependencies are honored through the execution. Unless all the predecessors of a task are in completed state a task does not get picked for execution.
    Another way to think of this depth concept : If one were to execute one task at a time, probably this is the order in which the tasks will be executed.
    The depth can change depending on the number of tasks identified for the execution plan.
    The immediate predecessors and successor can be a very valuable information to look at and should be used to validate the design. All predecessors and successors provide information to corroborate it even further. This can be accessed through clicking on any task and choosing the detail button. You will see all these information over there. As an alternate method, you could also use the 'All/immediate Predecessors' and 'All/immediate Successor' tabs that provide a flat view of the dependencies. Note that these tabs may have to retrieve a large amount of data, and hence will open in a query mode.
    SUMMARY: Irrespective of the depth, validate
    - if this task has 'Phase dependencies' that span all the ETL phases and has a 'Wait' option.
    - click on the particular task and verify if the task does not have any successors. And the predecessors include all the tasks from all the phases its supposed to wait for!
    Once you have inspected the above two you should be good to go, no matter what the depth says!
    Hope this helps!

  • How to find total recs in a local table for a particular condition

    Hi,
    How to find total recs in a local table for a particular condition?
    Thanks,
    CD

    Well, you may want to try this as well, and compare to the LOOP way.  Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it.  Again I think there may be some overhead in doing the copy.  Next, delete out all records which are the reverse of your condition.  Then whatever is left is the rows that you want to count.  Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1 <> 'A'.
    lv_count = lines( itab_tmp ).
    Regards,
    Rich Heilman

Maybe you are looking for

  • Fatal Error Acrobat failed to send a DDE command

    Hello all.  I have a fillable form I developed using word 2010.  I am trying to convert it to a PDF form.  I open acrobat and select star from wizard from the Forms menu.  I browse to find the word document and open it.  I save the PDF document and e

  • Macbook starts up but no desk top shows, no hard drive shows

    help mac book starts up programs and files are functional but no desktop display or hard drive. thanks in advance for your help

  • Runtime Error with Multiple Applications running in one Ear.

    I have the Coherence and Tangosol jar files loaded in my ear and the coherence-cache-config.xml in the classpath, if i add two web apps to this ear that use the same jars i get this error: SRVE0026E: [Servlet Error]-[action]: java.lang.NoClassDefFoun

  • Dock has disappeared after reboot

    rebooted imac because it was slow, now the dock has disappeared. Re-rebooted, but still no dock. Can't reposition it or anything in dock pref. help

  • Pls help me in loading image in a frame...plsss

    hi,pls help me in displaying the image in the region specified as JTextarea...i m on a project on image processing but as a beginner i dont know how 2 display image in the centre of my frame which consists of menubar at top and buttons at bottom..i h