Oracle 9 - triggering a delete on a table update

How,

I'm under 9.2.0.5.0 on Solaris and I would like your help on the following scenario.

Have a table that stores information about a certain status of an object. Assume that the table could be made by two fields only

CardID
Card_status

Our application updates the Card_status based on the lifecycle of this object. For a specific status ("used"), we would like to 'move' the record in this table on another table and remove them from the original table.

I did a trigger to first create the record even on the secondary table and that works fine, but I would also delete the original record in the primary table. I created another INSERT trigger on the secondary table to delete the record from the primary table, but once the update status of the "used" on the primary card I get "is changing, function of triggering/can not see" because the transaction is managed as a single a (create the folder on the secondary table and delete on the primary).

Is it possible to handle this? Can schedule a task for this in the background, but if there was a chance to do it automatically with a trigger would be better for me.

Thank you!

Mike

albertone wrote:
tried but got an impasse, probably because of two operations (the update that triggers a and the release removes one) access the record and so is not the transaction.

Nevermind any autonomous transaction did not - it would have been easy. ATs must also be carefully monitored to ensure that the data is not otherwise be stripped.

Can take you a step back? Instead of delete directly, you can save the primary key of the row to be deleted in a table (global temporary table perhaps), issuing a block delete by using the list of tables in a second time?

Tags: Database

Similar Questions

  • You will need to select the rows that have been deleted from the table.

    Please help me with this query

    I'm trying to find the records has been deleted from a table.

    I know recovery flash but I want to check with the request.

    Please help me with this...

    You can see the folders by using the flashback feature, if it is available in the undo data

    SQL> delete from tbl_x;
    
    3 rows deleted.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from tbl_x;
    
    no rows selected
    
    SQL> select * from tbl_x as of timestamp to_timestamp(sysdate-5/24/60);
    
            ID TOTAL_DAYS   NO_DAYS1   NO_DAYS2   NO_DAYS3 START_PER END_PERIO
    ---------- ---------- ---------- ---------- ---------- --------- ---------
             1         20         10          5          5 01-JAN-01 01-JAN-02
             1         10          5          5          0 11-MAY-01 11-MAY-03
             2          4          4          0          0 15-FEB-02 15-FEB-03
    
  • Given Oracle Spatial are stored in the database tables?

    Given Oracle Spatial are stored in the database tables?

    Oracle spatial is DBMS oracle server functionality. It allows you in NATIVE mode, store and manage all standard types of spatial data and their attributes and metadata in the oracle database enterprise, in the way that you are quite familiar with. on top of standard oracle database features, adds types of geographic data, spatial index, geometric operators and queries, functions, spatial and analytical, to name a few.

    MapViewer is a feature of Oracle Fusion Middleware, which makes cards using spatial data managed by Oracle Spatial. That's what you called "generator of maps. but of course, it's not just a map generator, he has much more to offer, such as MapBuilder, WMS, Oracle cards.

    For more information, please see the technical details:

    http://www.Oracle.com/technology//products/spatial/index.html
    http://www.Oracle.com/technology/products/MapViewer/index.html

  • ORA-30506: triggers system cannot rely on tables or views

    Hai all,


    Why the b/m trigger fails with the error;

    create or replace trigger audit_ddl_trg after the ddl on the TABS
    *
    ERROR on line 1:
    ORA-30506: triggers system cannot rely on tables or views


    create or replace trigger audit_ddl_trg after ddl on TABS
    declare
      sql_text ora_name_list_t;
      stmt VARCHAR2(4000) := '';
      n number;
    begin
      if (ora_sysevent='TRUNCATE')
      then
        null;
      else
        n:=ora_sql_txt(sql_text);
        for i in 1..n
        loop
          stmt:=substr(stmt||sql_text(i),1,4000);
        end loop;
        insert into audit_ddl(d, osuser,current_user,host,terminal,owner,type,name,sysevent,sql_txt)
        values(
          sysdate,
          sys_context('USERENV','OS_USER') ,
          sys_context('USERENV','CURRENT_USER') ,
          sys_context('USERENV','HOST') ,
          sys_context('USERENV','TERMINAL') ,
          ora_dict_obj_owner,
          ora_dict_obj_type,
          ora_dict_obj_name,
          ora_sysevent,
          stmt
        );
      end if;
    end;
    Thank you
    Kai

    Kai,

    check this Doc ID metalink note: 107481.1 for the possible resolution, if not, see after outbreak of the sample

    CREATE OR REPLACE Trigger test
     AFTER LOGON
     ON SCOTT.SCHEMA  <==== The corrected line.
     BEGIN
      NULL;
     END;
    

    Concerning

  • How imp one table, delete the old data? or the deletion of the table (before)

    Suppose that: in my tcomven of the actual table, I have 15 records, guess also, I have the file: h12292008.dmp there are 27 records

    If I type:

    IMP TABLES = (tcomven) UFIERROS/linuxx fromuser = UFIERROS touser = UFIERROS file = h12292008.dmp ignore = Y

    show imported 27 files, I checked the table and I have 15 + 27 files = 42 Records

    My question:

    before you import the table is possible delte all the contents of the Tcomven table (note I do first with sqlpleu and or sqldeveloper) my question is exista flag custom imp?


    or:

    If I type (same command ignore without flag):

    IMP TABLES = (tcomven) UFIERROS/linuxx fromuser = UFIERROS touser = UFIERROS file = h12292008.dmp

    tells me an error: the object exists, same question: the imp command flag for gout have first of all the tcomven of the table (or in any case, at the head of exp e)?


    Thank you

    Your needs:

    When you use imp (old style) of command line... you must delete/truncate the table before

    If you are using expdp/impdp, there option TABLE_EXISTS_ACTION help 'TRUNCATE' table before.

    TABLE_EXISTS_ACTION Action to perform if any object already exists.

    Valid keywords: (SKIP), APPEND, REPLACE and TRUNCATE.

  • How to understand if the table update or obsolete?

    Hello Experts

    I use the following to understand that the picture is up-to-date or out-of-date. However, it is said that the picture is not expired, but when I check the number of lines of user_tables is does not not to the actual number of lines. The difference is 272132. Is this normal? Normally, about 50000 rows are inserted in the table of responses a day.

    My other question is, are there other ways to ensure that statistics on the table are updated or not? What do you think?

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    SQL > select stale_stats from the user_tab_statistics where table_name = "ANSWERS";

    STA

    ---

    NO.

    SQL > select num_rows from user_tables where table_name = 'RESPONSES;

    NUM_ROWS

    ----------

    18525435

    SQL > select count (*) responses;

    COUNT (*)

    ----------

    18797567

    Note: by the way what do I do in order to write the code in code view? I used {code}, but it doesn't work.

    Thanks in advance.

    Hello

    The NUM_ROWS in USER_TAB_STATISTICS will be updated when you GATHER STATISTICS on the table. Check the column LAST_ANALYZED in USER_TAB_STATISTICS, which indicates if the STATISTICS were gathered again on the RESPONSES of the Table. If collect you statistics on the RESPONSE table now then NUM_ROWS will reflect the most accurate value.

    Normally after 'significant' DML (INSERT / UPDATE/DELETE) on a table, it is recommended to collect statistics.

    DBMS_STATS documentation describes this http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_stats.htm#CIHBIEII

    In addition,

    Use the Advanced Editor and > to select image formatting.

    Demonstration of Table statistics collection adding...

    IMPLEMENT...

    > drop table tst

    table deleted TST.

    > format table_name col A10

    > alter session set NLS_DATE_FORMAT = "dd-mm-yyyy HH24:mi:ss.

    session the changed VALUE.

    > create table tst (c number)

    table created TST.

    > insert in TCT select level c. from dual connect by level<>

    99 inserted rows.

    > validation

    committed.

    We will collect statistics on the TST table...

    > exec ('HR', 'TST') SYS.dbms_stats.gather_table_stats

    anonymous block filled

    > select table_name, num_rows, last_analyzed from user_tables where table_name = 'TST '.

    TABLE_NAME, NUM_ROWS LAST_ANALYZED

    ---------- ---------- ---------------------

    TCT 99 04/12/2013-17:58:51

    NUM_ROWS account (about) the correct number of rows.

    We will insert several lines and check the statistics.

    > insert in TCT select level c. from dual connect by level<>

    999 inserted rows.

    > validation

    committed.

    > select table_name, num_rows, last_analyzed from user_tables where table_name = 'TST '.

    TABLE_NAME, NUM_ROWS LAST_ANALYZED

    ---------- ---------- ---------------------

    TCT 99 04/12/2013-17:58:51

    NOTE: The NUM_ROWS and LAST_ANALYZED have not changed... YET.

    > exec ('HR', 'TST') SYS.dbms_stats.gather_table_stats

    anonymous block filled

    > select table_name, num_rows, last_analyzed from user_tables where table_name = 'TST '.

    TABLE_NAME, NUM_ROWS LAST_ANALYZED

    ---------- ---------- ---------------------

    TST 1098 17:58:52 04/12/2013

    Now we have complete and up-to-date statistics.

    Hope it will be useful.

    VR,

    Sudhakar

  • Oracle Hyperion Public sector planning and budgeting release update

    What is the latest version of Oracle Hyperion Planning and budgeting Public sector? Is Oracle Hyperion Planning and budgeting Release 13 released by oracle Public sector... Please any update is most appreciated...

    Thanks in advance for the answer

    Hello

    11.1.2.4 is the last version available for the Public sector, planning and budgeting.

    And here is the generic 2 Patch available for scheduling:

    Patch 20817841: PATCH BUG - HYPERION PLANNING - PATCH UPDATE 11.1.2.4.001 VALUE

    Patch 20937926: HYPERION PLANNING - PATCH UPDATE SET 11.1.2.4.002

    Kind regards

    Bala

  • Oracle 10g - problem with "DELETE from TABLE WHERE ID in (1,2,3)" (use cfqueryparam)

    Hello, everyone.

    I have problems with executing a DELETE statement on an Oracle 10 g server.

    DELETE 
    FROM tableA
    WHERE ID in (1,2,3)
    

    If there is only a single ID for the IN clause, it works.  But if more than one ID is provided, I get an error message "SQL command" not correctly completed.  Here's the query as CF:

    DELETE 
    FROM TRAINING
    WHERE userID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(form.userID)#">
         AND TRAINING_ID in <cfqueryparam value="#form.trainingIDs#" cfsqltype="CF_SQL_INTEGER" list="yes">
    

    Someone at - it works with Oracle that can help me with this?  I'm a developer experienced in MS - SQL; Oracle is new to me.

    Thank you

    ^_^

    So much worse... a colleague just told me I should always use parentheses around the values in the IN clause.

  • what the step to follow oracle when run select, delete, update...

    Hi expeerts,

    I want to know analysis thorough database oracle for performance - tuning. when we execute these queries as shown below in oracle. what oracle stage to execution. Please tell me step by step. my new in oracle, I try to understand what happens when we run these command. I have read a lot of blog and book but the thing very confuse me. Please help me solve these...  


    Select (with where, order by, and group by clause) = >?

    Delete (with where clause) = >?

    Update (with where clause) = >?

    Truncate and drop = >?

    Reg,

    Hard

    The SELECT, DELETE, and UPDATE all the

    (a) read buffers of memory if it is already present in the memory

    or

    (b) retrieves the disk blocks in the buffers

    The DELETE and UPDATE statement must then update the buffer in memory.  The buffer can be written on the disc of "lazy" way by the DBWR process - that is to say the actual writing on the disk is postponed to later in time.  The changes caused by DELETING and UPDATING are captured in food stamps by progress and what is written on the disc as soon as or before a COMMIT is issued.

    The TRUNCATE causes a control point of the segment (ensure that all Sales belong to the table buffers are written to disk) before the scopes are released and updated by the high tide.

    Hemant K Collette

  • How to create a stored procedure to delete and create table

    Version: Oracle 10g

    I am trying to create a stored procedure that is delete it and create a table based on a select statement. I can create the table, but I can't let it go.

    CREATE or REPLACE procedure EC_LOAD is
    Start
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    Of
    sales_revenue;
    end ecload;

    I need to drop the Sales_table before inserting the values. How can I do this?

    user610131 wrote:

    I need to drop the Sales_table before inserting the values. How can I do this?

    If you drop off where you insert it :)? Do you mean DELETE or TRUNCATE?

    If table can be truncated (and don't forget TRUNCATE is DDL then he will commit):

    CREATE OR REPLACE procedure EC_LOAD is
    begin
    EXECUTE IMMEDIATE 'TRUNCATE TABLE Sales_table';
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    from
    sales_revenue;
    end ecload;
    

    Otherwise, use DELETE:

    CREATE OR REPLACE procedure EC_LOAD is
    begin
    DELETE Sales_table;
    INSERT INTO Sales_table
    (FSCL_WK,
    DIV,
    ACCT_TYPE)
    Select
    FSCL_WK,
    DIV,
    ACCT_TYPE
    from
    sales_revenue;
    end ecload;
    

    SY.

  • Delete duplicate of table records

    CREATE a GLOBAL TEMPORARY TABLE (MyTable1
    Name1 varchar2 (100)

    );

    insert into MyTable1 values ('11');
    insert into MyTable1 values ('11');
    insert into MyTable1 values ('11');
    insert into MyTable1 values ('11');
    insert into MyTable1 values ("12");
    insert into MyTable1 values ("12");

    Select * from MyTable1

    I want to remove duplicates from MyTable1 names... And after deletion, I should have 11 and 22 only.

    I can do this using query below, but it seems not to be effective. Is there another way to do this?

    delete from MyTable1
    where rowid not in
    (select max (rowid)
    from MyTable1
    Group name1
    )

    Published by: 871447 on August 3, 2011 12:47

    There is a Tom asking on this subject which might help:

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:15258974323143

    mseberg

  • delete rows from table

    Hello

    I'm trying to remove the lines that contain a multiple of the x-data in the original table and have the output array display the original array less table of harmonics of delete.

    Original array:

    3 100

    18 200

    13 300

    8 400

    500 0

    600 0

    700 0

    Deletes rows that contain multiples of 300.  Output array will be

    3 100

    18 200

    8 400

    500 0

    700 0

    Any help will be really appreciated.

    Thank you

    hiNi.

    This?

  • Deletion of the tables of the ODM

    Assuming that I am done with my project parts (for example, classification), it is OK to delete tables such as those starting with DM$ P * CLAS, etc.?

    When is it OK to remove the tables starting with ODMR$?

    Hi Cindy,.

    If you use Data Miner then cleaning can be done automatically.

    If you remove a workflow Data Miner - all objects created by the workflow are deleted (as templates or tables generated by the node Create Table).

    No input source is deleted because they were not created by the workflow.

    If the workflow would both eliminate the tables/views ODMR$ (which are generated internally by ODMr in the model test results etc.) and the tables of DM$ P (which are physical tables within the model of the ODM itself).

    If you delete a node in a workflow, then objects created by this node disappears when the workflow is saved.

    If you drop the Data Miner repository, the fall process deletes all the objects thus generated workflow.

    You can also keep the workflow and physically remove all the underlying tables in the range $ ODMR but recognize that you will need to restart the workflow as always, they will be marked as complete, but the results have been removed.

    You don't really have to remove the DM tables $ P directly (see below).

    If you build models outside ODMr, the you must use the pl/sql api to abandon the model:

    DBMS_DATA_MINING. DROP_MODEL (model_name IN VARCHAR2,

    Force IN BOOLEAN DEFAULT FALSE);

    If you have a number of models to remove, you can write sql script to query the view of models of mines dictionary and use it as a driver to drop patterns.

    Hope this helps, Mark

  • Request to delete rows for table fa_mass_additions

    Helloo

    I need help to remove rows from the table fa_mass_additions Oracle EBS of assets fixed r12

    Each line is characterized by a unique recnum. However, there are duplicate for the Serial_number entries. I need to remove all but 1.

    For example

    Recnum 60341 Serial_number 1110007600100

    Recnum 60342 Serial_number 1110007600100

    Recnum 60343 Serial_number 1110007600100

    Recnum 60344 Serial_number 1110007600200

    Recnum 60345 Serial_number 1110007600200

    Recnum 60346 Serial_number 1110007600300

    Recnum 60347 Serial_number 1110007600300

    Note-see duplicates for serial numbers

    After the removal of table should be

    Recnum 60341 Serial_number 1110007600100

    Recnum 60344 Serial_number 1110007600200

    Recnum 60346 Serial_number 1110007600300

    Any query sql or pl/sql will be greatly appreciated

    Thank you

    A backup point might be something to consider, but that would be your business decision.

    An alternative workaround that might be used would be to go ahead and after some lines in the meantime, but it is accepted that this should not be an obligation, and the system should operate in a consistent way.

    Can I deduce that the number is not filled, that this value cannot reproduce? If these lines have a tag number, I think that you can check in the version of FATagNumberValidator.class (run a check of the Apps for assets and check for this version of the file). If the instance is not already have version 120.0.12010000.2, your site can be helped in this scenario, the application of Patch 18800958 - ADI WEB: NO DUPLICATE tag ERROR IN SPREADSHEET NUMBERS. There is more explanation of this issue of tag number in the Doc ID 1944256.1.

    In raising this question if, you made me realize that we cannot have similar validation for the serial number, or at least we do not have a named validator in a similar way. I have to do further research on this aspect, but if this is the case, I think that the best I could do would be to log an improvement to that request it.

  • Oracle 10g | Approach of deleting archivelogs

    Hi guys

    Below are my RMAN for the local database installed in my work laptop & I'm trying to understand and learn more about RMAN + Archivelogs (after having faced a major disaster recently)

    RMAN > SHOW ALL.

    using the control file of the target instead of recovery catalog database

    RMAN configuration parameters are:

    CONFIGURE RETENTION POLICY TO 3 DAY RECOVERY WINDOW;

    CONFIGURE BACKUP OPTIMIZATION # by default

    SET UP DEFAULT DISK DEVICE TYPE; # by default

    CONFIGURE CONTROLFILE AUTOBACKUP ON;

    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO "%F" # by default

    SET UP THE DEVICE TYPE DISK PARALLELISM 1 BACKUP BACKUPSET TYPE; # by default

    CONFIGURE BACKUP OF DATA TO DISK FILE TYPE DEVICE TO 1; # by default

    CONFIGURE BACKUP ARCHIVELOG FOR DEVICE TYPE DISK TO 1; # by default

    CONFIGURE MAXSETSIZE TO UNLIMITED; # by default

    CONFIGURE ENCRYPTION OF DATABASE # by default

    CONFIGURE THE ENCRYPTION ALGORITHM "AES128"; # by default

    CONFIGURE THE NONE ARCHIVELOG DELETION POLICY; # by default

    CONFIGURE SNAPSHOT CONTROLFILE NAME TO ' D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFSCT. ORA'; # by default

    I have used enterprise manager to configure Oracle offers scheduled backup of all day @ 10:00 which is perfect work. Further I created manually backups RMAN publishing below command that is also good enough.

    RMAN > BACKUP AS BACKUPSET DATABASE MORE ARCHIVELOG;

    Well, I find myself with almost a month long archivelog files in the file system. It is safe for me delete archivelogs of my file system manually once after a full backup with RMAN is successfully? What happens if I want to backup RMAN automatically the data base and archivelog and then delete the archivlogs? Should I use a script for batch processing with the operating system or can I create RMAN scripts to do the job, such as job scheduler database?

    Kind regards

    Hello

    What happens if I want to backup RMAN automatically the data base and archivelog and then delete the archivlogs? Should I use a script for batch processing with the operating system or can I create RMAN scripts to do the job, such as job scheduler database?

    You can specify the DELETE INPUT or DELETE ALL INPUT clauses for the BACKUP ARCHIVELOG command to delete the log files archived once they are saved, eliminating the separate step of manually delete the archived redo logs. With DELETE INPUT , RMAN only deletes the specific copy of the newspaper of archived recovery chosen for the backup set. With DELETE ALL INPUT , RMAN deletes each file backed up log redo archived log destinations archiving.

    Read more here: http://docs.oracle.com/cd/B19306_01/backup.102/b14192/bkup003.htm#i1006454

Maybe you are looking for