Creating a trigger for update

I have a table that consists of the following: product_id number, location number, qty number. product_id and location are primary keys.
I want to create a trigger before an update and if the record doesn't exist that is trying to be updated, then I have to create the record.
For example, if I want to do an update of the following:
update inventory set qty = 80 where product_id=13 and location=45;
Let's say that the record doesn't exist, how do I do this with a trigger.

Hi,
First of all i would like to clear one thing:
IF you are trying to update any record and that record does not exist in table then trigger will not be called.
"afiedt.buf" 10 lines, 236 characters
  1  CREATE OR REPLACE TRIGGER t_trig
  2  BEFORE UPDATE ON t
  3    FOR EACH ROW
  4    BEGIN
  5             DBMS_OUTPUT.PUT_LINE('Trigger has been  called!!!');
  6    EXCEPTION
  7       WHEN OTHERS THEN
  8               DBMS_OUTPUT.PUT_LINE('IN EXCEPTION:'||SQLERRM);
  9*  END;
SQL>/
Trigger created.
SQL>DESC t;
Name                                      Null?    Type
NAME                                               VARCHAR2(20)
SQL>SELECT * FROM t;
NAME
BBB
1 row selected.
SQL>SET SERVEROUTPUT ON
SQL>
SQL>UPDATE t SET NAME='XXX' WHERE name='AAA';
0 rows updated.
SQL>UPDATE t SET NAME='XXX' WHERE name='BBB';
Trigger has been  called!!!  <-- Trigger called here
1 row updated.So to achieve your result you have to do it outside the trigger.
If you are updating trougha a procedure, after update statement you can use SQL%ROWCOUNT to get how many rows have been updated. If it zero you can insert the record.
Regards

Similar Messages

  • Create an app for update the time zone info

    Hello,
    I would like to create an app for update the zone info region of the iphone, because all the zone are not updated with the last version of DST (Daylight Saving time), for example in my country (Chile) the zone info file is different beetween the official website (IANA.org) and the current firmware of the iphone.
    My question :
    What is the posibility for an app to modify the content of the zones ? (here : /private/var/stash/usr/share/zoneinfo/)
    it's legal to submit an app with this customization ?
    thank you very much for your help.
    Gilles

    ok !! so it's a technical problem ...
    sorry for the question, i have only an iphone with jailbreak and i can manipulate all the file, I thought there was the same posibility for an official app without rooting.
    thank Michael.

  • Help me in creating a Trigger for Insert and Update Options

    Hi
    Please help me in creating a Trigger .
    My requirement is that after insert or update on a Table , i want to fire an event .
    I have started this way ,but doesn't know how to fully implement this .
    say i have a dept table
    CREATE TRIGGER DepartmentTrigger
    AFTER INSERT ON Dept
    BEGIN
    INSERT INTO mytable VALUES("123","Kiran");
    END DepartmentTrigger;
    Please tell me how can i put the Update option also .
    Thanks in advance .

    Please tell me how can i put the Update option also .Add "Or Update". ;-)
    Here are a few suggestions, but you definitely need to refer to the manual page that the previous poster suggested.
    CREATE OR REPLACE TRIGGER DepartmentTrigger
    AFTER INSERT Or Update ON Dept
    BEGIN
    INSERT INTO mytable VALUES(:new.Dept,'DEPT ADDED OR CHANGED');
    END DepartmentTrigger;
    The "Or Replace" means you can replace the trigger while you're developing without having to type in a drop statement every time. Just change and rerun your script, over and over until you get it right.
    Adding "Or Update" or "Or Delete" makes the trigger fire for those events too. Note, you may want seperate triggers in different scripts and with different names for each event. You have to decide if your design really does the same thing whether it's an insert or an update.
    :new.Dept is how you would refer to the changed vale of the Dept column (:old.Dept is the prior value). I changed the double quotes on the string in the VALUES clause to single quotes.
    Andy

  • Help on Procedure and trigger for updating(urgent please)

    SQL> / Table A
    CTUT_ID CTUT_COMPANY_NAME CURRT_USER_ID FMIS_ID CREATE_DA UPDATE_BY UPDATE_DATE
    1234 A 15-APR-03
    2222 B 15-APR-03
    3333 C 15-APR-03
    4444 D 15-APR-03
    5555 E 15-APR-03
    6666 F 15-APR-03
    150282 G oRACLE 23-APR-03
    1 H 15-APR-03
    2 I 15-APR-03
    3 J 15-APR-03
    150343 K TIGER 24-APR-03
    150305 L EXAMPLE 23-APR-03
    150342 M SCOTT 24-APR-03
    sQL >/ Table B
    Empno     Empname UPDATE_BY UPDATE_DATE
    1 AA
    2 BB
    3 CC
    4 DD
    What i need to do is i need to create an update trigger on both tables
    like create a procedure
    1)In procedure i need to check like
    IF TABLEA.CURRT_USER_ID = (SELECT USER FROM DUAL)
    THEN
    UPDATE_BY = (CURRENT_USER_ID of CTUT_ID)
    FOR EXAMPLE CURRENT USER_ID IS SCOTT THEN
    UPDATE_BY = 150342
    UPDATE_DATE = SYSDATE
    ELSIF
    UPDATE_BY <=> (CURRENT_USER_ID of CTUT_ID)
    THEN
    MESSAGE('USER IS NOT IN TABLE);
    END IF;
    and call that procedure in the update triggers
    FOR BOTH TABLES TABLEA,TABLEB
    i CREATED A PROCEDURE BUT IT IS NOT WORKING
    ANY HELP PLEASE
    CREATE OR REPLACE PROCEDURE UPDATE(
    UPDATE_DATE out DATE,
    UPDATE_BY out VARCHAR2)
    IS
    Uuser varchar2(20);
    Udate date;
    Ufound number(1);
    BEGIN
    SELECT USER,SYSDATE
    INTO Uuser,Udate from dual;
    SELECT count(*),CTUT_ID into Ufound,Uctut_id
    FROM TABLEA
    WHERE CURRT_USER_ID = Uuser
    Group by Ctut_id;
    IF (UFOUND = 1) THEN
    UPDATE_DATE := UDATE;
    UPDATE_BY := UCTUT_ID;
    END IF;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20001,'User Does not Exist');
    END UPD_CONSTITUENT;
    CREATE A TRIGGER :
    CREATE OR REPLACE TRIGGER TU
    BEFORE INSERT ON TABLEA
    FOR EACH ROW
    BEGIN      
    UPDATE(:NEW.update_date,
         :NEW.update_BY);
    END IF;      
    END;
    SQL> update TABLEA
    2 set CTUT_COMPANY_NAME = 'SCOTT TEST'
    3 WHERE FMIS_USER_ID = 'N';
    update TABLEA
    ERROR at line 1:
    ORA-04091: table TABLEA is mutating, trigger/function may not see it
    ORA-06512: at "UPDATE", line 12
    ORA-06512: at "TU", line 1
    ORA-04088: error during execution of trigger 'TU'

    Hi Mara,
    You are right thats what i want
    I have a table A
    EmpNo Empname Currtuser_id Update_date Updateby
    1 Denis Oracle
    2 Scott Scott
    3 Mara MMara
    1)what i need to do is when any user tries to update the table Table A
    Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
    If his user id exits in table A
    Then allow him to update the TABLE A
    and insert his EMPNO in UPDATE_BY
    and SYSDATE in UPDATE_BY
    He will do all this process using forms
    But i need to have trigger or procedure in database level for table
    2) I have another table like 10 tables
    Suppose TABLE B
    When user tries to update TABLE B
    Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
    If his user id exits in table A
    Then allow him to update the TABLE B
    and insert his EMPNO in UPDATE_BY
    and SYSDATE in UPDATE_BY
    3) I need to have a common Procedure and call that procedure in all tables in UPDATE TRIGGER
    Thanks for your help
    Thanks

  • Mutating Error problem using audit trigger for UPDATE

    I need to add 4 columns to all of my tables named:
    INSERT_BY
    INSERT_DATA
    UPDATE_BY
    UPDATE_DATE
    I intend these to act as "inserted" and "last updated" audit trails within the table, as opposed to creating a new table and storing the audit information there. The insert columns appear to be easy, as I can just use a DEFAULT clause within the definition of the table. However when I attempted to write a (my first) trigger then I run into problems with mutating tables. Presumebly because I am attempting to change the table while the trigger is referencing it.
    create or replace trigger test_audit
    after update on dictionary
    begin
    update dictionary
    set update_by = user, update_date = sysdate
    where entity_id = :old.entity_id;
    end;
    I thought I could maybe get around this by calling a procedure from inside the trigger. Something like:
    create or replace procedure test_audit(vColumn in varchar2, vData in varchar2, vTable in varchar2) is
    -- vTable is table name
    -- vColumn is PK of table
    -- vData is value of PK in current row
    begin
    update vTable
    set update_by = user, update_date = sysdate
    where vColumn = vData;
    commit;
    end test_audit;
    However I cannot use variable for table names. Will this mean I have to create a procedure for each table/trigger? Is there a way to reference the table name as a variable and keep this a generic procedure? Or is there an easier way to record the auditing UPDATE information for each changed row within the original table?
    Many thanks in advance......

    Will
    this mean I have to create a procedure for each
    table/trigger? I think you've answered that question already.
    Is there a way to reference the table
    name as a variable and keep this a generic procedure?Not that I'm aware of.
    Or is there an easier way to record the auditing
    UPDATE information for each changed row within the
    original table?Well, there's the AUDIT feature.
    C.

  • How to create a trigger for particular value insertion?

    If I have a Table T, which has columns as A,B,C,D. I want to create a trigger to give an error message if someone inserts or updates T with values in A as '001' AND value in B as '99'
    Please reply soon....
    Thanks

    user8560155 wrote:
    I need a trigger only not a constraint...
    Why? Is there any valid reason for that?
    I tried the above trigger but it was not successful :(
    Can I use 'If statements' as well???The below will work..
    create table t
      a varchar2(10),
      b varchar2(10),
      c varchar2(10),
      d varchar2(10)
    create or replace trigger trig1
    after insert or update on t
    for each row
    --"trigger will be fired only when below condition is satisfied"
    when ( new.a = '001' or new.b = '99' )
    begin
    raise_application_error(-20000, 'Invalid value in A or B');
    end;
    insert into t(a) values('001');
    SQL Error: ORA-20000: Invalid value in A or B
    ORA-06512: at "SCOTT.TRIG1", line 2
    ORA-04088: error during execution of trigger 'SCOTT.TRIG1'
    insert into t(a) values('002');
    1 rows inserted.

  • Create a trigger for to prevent  duplicate

    Hi
    How can I to build a trigger for insert , to prevent duplicate register when I use SQLLOADER ?

    The user guide is your friend.
    As for an unique index:
    CREATE UNIQUE INDEX <name> ON <table>(<column1>, <column2>);Again, refer to the user guide.
    C.

  • Creating a Trigger for Deleting the records from a parent Table

    I am new to creating Trigger
    We will need several small tables that will be used to store any records that are deleted by the owner of the table. These will likely need a trigger where we would Delete from the parent table and on that Delete populate the child table with the previous record's data.
    Please give me a pseudo code for this
    Thanks
    John
    Edited by: user10750995 on Dec 30, 2008 9:06 AM

    Something like this:
    CREATE OR REPLACE TRIGGER trg_my_table_hist
    AFTER DELETE
    ON my_table
    FOR EACH ROW
    BEGIN
    INSERT INTO Hist_MyTable
    ( column1, column2, ..., DELETION_DATE)
    VALUES
    (:OLD.column1, :OLD.column2, ...., SYSDATE);
    END;
    /My_Table is your main table. When a row is deleted, the trigger will be fired and copy the deleted row to another table called Hist_My_Table. I'm supposing that the history table has all columns as they are defined in main tables plus a column named DELETION_DATE.
    My experience indicates that, probably, it's a good idea maintain update history and the user. But it depends on your requests.
    Regards,
    Miguel

  • HOW TO CREATE A TRIGGER TO UPDATE A DATE FIELD WHEN RECORD IS MODIFIED

    Hi,
    I have a field (column)
    SalesLeadLastModifiedDate
    in the table
    SalesPipeline
    A record's field (SalesLEadLastModifiedDate) should be updated with current date and time every time any column in a record is modified. I'm new to SQL and can't figure out how to write this trigger. Could someone help me and also
    refer literature that would give me independence? Online MSDN language without matching examples is not helping.
    Tnx.,
    IJ

    Break it down into pieces.  Write a small script that updates some small (but more than 1) number of rows.  After updating the rows, write another update statement that will set your modified date column to the current date and time.  Once
    you have that working, you can easily convert that into a trigger.  Pseudo-code would be:
    begin tran;
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <some column> = <something> where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <your date colum> = ?? where SalesPipelineID in (45, 76);
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    rollback tran;
    Notice the transaction control statements.  This will allow you to run the script, evaluate the result, and then revert all changes (leaving your database unchanged).  In turn, this will allow you to run the same script over and over and over again
    and achieve (for the most part) the same results with each execution.  You can search the forums for examples of trigger code - just beware that many "solutions" are not necessarily well-written.

  • Can't create the diskette for updating the BIOS on Satellite 1800-712

    I was given a Satellite 1800-712 with bugged BIOS (the power went down while reflashing) So now when the notebook is switched on a sign shows
    BIOS (Block2) is damaged! (Call your serviceman)
    and so on...
    I've downloaded the latest bios for the notebook, but when I try to follow the instructions given (unzip, insert a formated 1.44mb disk, start the *.exe file and a 1.44mb should be created) nothing happens. When I run the exe (chgbiosa.exe) if I'm running windows xp nothing happens, and if I'm running DOS says "Initial Error".
    In the Archive of the bios is a readme. It says that I should copy the files (BIOFC72T.COM and CHGBIOSA.EXE) to a 1.44mb floppy disk. Well it doesn't help either.
    Any ideas what should I do? Thanks in advance.

    Hi
    I found this thread in the forum:
    http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=19801&messageID=72625
    The case described in the thread above is very similar to your issue.
    According to this message every newer BIOS has a protection mechanism which means that even in case of an incomplete flashing procedure, the responsible area in the BIOS-flash for the upgrade is never deleted.
    So usually you should contact the service point in you country to solve this problem but maybe the description in the other thread will help you.
    But you know, everything what you do is at you own risk

  • Urgent -Create  RFC for update the database and delete from the database

    Hi Guy's,
    Please help me how  to create the RFC for update to databse and delete from database(step-by-step) procedure.
    Thanks and Regards,
    Sai.

    Hi,
    Please go through the following link,
    reward if helps.
    [RFC Step By Step|https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728]
    regards,
    mahantesh

  • Create transaction for update a custom table

    Hi,
    I have a custom table Z****. What are all the steps to create a transaction for updating my custom table? I don't want to use SM30 anymore.
    Thank you.

    Create a Table maintainence through the maintainence generator.
    Open table in SE11, goto utilities => table maintainence generator.
    Once the generator is created,
    In the same screen of generator - Goto Environment => Transaction Code
    Select Transaction Code with Parameter.
    In the default values - Enter the Transaction as SM30 . Select skip first screen.
    In default values at the bottom
    Add
    screen field = VIEWNAME and value = Ztable name.
    screen field =UPDATE  and value = 'X'.
    Edited by: Pranu Pranu on May 19, 2010 2:36 PM

  • Issue in Database trigger for HZ_CUSTOMER_PROFILES PL/SQL: ORA-00936: miss

    Hi
    We are trying to create database trigger on update of table HZ_CUSTOMER_PROFILES when CREDIT_HOLD='Y'
    If this update is done from certain operating unit we are inserting into another custom table when compiling trigger we are getting error as given below
    LINE/COL ERROR
    5/2 PL/SQL: SQL Statement ignored
    17/2 PL/SQL: ORA-00936: missing expression
    SQL> l 5
    5*
    SQL> l 17
    17* COUNTRY,
    Copying code used for creating trigger
    CREATE OR REPLACE TRIGGER "APPS"."SDS_CREDIT_HOLD_ROW"
    BEFORE UPDATE ON HZ_CUSTOMER_PROFILES
    FOR EACH ROW
    WHEN ( new.CREDIT_HOLD='Y')
    BEGIN
    IF FND_PROFILE.VALUE('ORG_ID')=3217 THEN
    INSERT INTO SDS.SDS_CREDIT_HOLD
    (CUSTOMER_NAME,
    CUSTOMER_NUMBER,
    ADDRESS,
    CITY,
    COUNTRY,
    HOLD_BY,
    MAIL_LIST1,
    RESP_VALUE,
    ORG_ID,
    MAIL_LIST2)
    VALUES
    (select rc.customer_name,
    rc.customer_number,
    ra.address1,
    ra.city,
    ra.country,
    fu.user_name,
    fu.email_address,
    TO_NUMBER(FND_GLOBAL.RESP_ID),
    TO_NUMBER(fnd_profile.value('ORG_ID')),
    SDS_EMAIL_ADD_FNC('KAMALAKAR.GUDAPAREDDI,BRIAN.MILLER')
    from HZ_CUSTOMER_PROFILES hcp, ra_site_uses rsa,
    ra_addresses ra, ra_customers rc, fnd_user fu,
    (select distinct site_use_id from HZ_CUST_SITE_USES where site_use_code='BILL_TO'
    and status='A') site_acct
    where hcp.status='A'
    and cust_account_id in (select distinct cust_account_id from HZ_CUSTOMER_PROFILES
    where credit_hold='Y'
    and status='A')
    and hcp.site_use_id=rsa.site_use_id (+)
    and rsa.address_id=ra.address_id (+)
    and rsa.site_use_id= site_acct.site_use_id (+)
    and hcp.cust_Account_id=rc.customer_id
    and hcp.credit_hold='Y'
    and hcp.last_updated_by=fu.user_id
    and hcp.CUST_ACCOUNT_PROFILE_ID=:new.CUST_ACCOUNT_PROFILE_ID
    and hcp.ROWID=:new.ROWID);
    END IF;
    -- commit;
    END SDS_CREDIT_HOLD_ROW;
    tried to search for fix in forums checked all columns in select clause and insert they appear to be fine attaching table structure also for reference
    CREATE TABLE SDS_CREDIT_HOLD
    (CUSTOMER_NAME VARCHAR(50),
    CUSTOMER_NUMBER VARCHAR2(30),
    ADDRESS VARCHAR2(240),
    CITY VARCHAR2(60),
    COUNTRY VARCHAR2(60),
    HOLD_BY VARCHAR2(100),
    MAIL_LIST1 VARCHAR2(240),
    RESP_VALUE NUMBER,
    ORG_ID NUMBER,
    MAIL_LIST2 VARCHAR2(240))
    if any hint for fixing this issue it will be highly appreciated
    Thanks
    Kamalakar.G

    Problem is here:
    WHEN ( new.CREDIT_HOLD='Y')
    Should be using a colon in front of any new or old columns in your PL/SQL and SQL, thus try this:
    WHEN ( :new.CREDIT_HOLD='Y')
    FYI: when using triggers (unless you specify otherwise in the trigger definition itself):
    old values are referenced via :old.column and new values via :new.column

  • Writing trigger for DML tracking on three table

    Hello,
    I need help on how can i write a trigger for updating backup table on DML changes on source table.
    I have source table named APP_SOURCE and backup table name APP_BACKUP with same data and structure.
    On any DML on source table APP_SOURCE it corresponding backup table APP_BACKUP should also be updated with same number of record changes on any DML
    (insert/update/delete) to maintain data consistency on both tables
    For cross refernce all changed DML records on source table APP_SOURCE should be tracked and stored within third table APP_SOURCEDMLTRACK storing old value and new value data before and after dml changes on source table APP_SOURCE
    source table create script:
    CREATE TABLE APP_SOURCE
    RCN_ID VARCHAR2(23 BYTE),
    CRD_NUM VARCHAR2(23 BYTE),
    TRN_TYP VARCHAR2(10 BYTE),
    TRN_DTE DATE,
    REF_NUM VARCHAR2(23 BYTE),
    TRN_CRR VARCHAR2(3 BYTE),
    TRN_AMT NUMBER(24,6),
    BLL_CRR VARCHAR2(3 BYTE),
    BLL_AMT NUMBER(16,2),
    BSN_DTE DATE,
    BRN_S VARCHAR2(10 BYTE),
    ACC_NUM_S VARCHAR2(24 BYTE),
    BRN_D VARCHAR2(10 BYTE),
    ACC_NUM_D VARCHAR2(24 BYTE),
    SRL_NUM VARCHAR2(12 BYTE),
    DVI_TYP VARCHAR2(8 BYTE),
    ORG_MSG_TYP VARCHAR2(6 BYTE),
    ACQ_CDE VARCHAR2(15 BYTE),
    ACQ_BIN VARCHAR2(11 BYTE),
    REV VARCHAR2(1 BYTE),
    DBCR_FLG VARCHAR2(1 BYTE),
    ATM_FEE NUMBER(16,2),
    ATM_ID VARCHAR2(16 BYTE),
    INT_FEE NUMBER(16,2),
    TRM_ID VARCHAR2(10 BYTE),
    MCN_CDE VARCHAR2(40 BYTE),
    MCN_INF VARCHAR2(40 BYTE),
    PNT_RCN_ID NUMBER(12),
    FGN_KEY VARCHAR2(23 BYTE),
    ERR_CDE VARCHAR2(200 BYTE),
    JNK VARCHAR2(50 BYTE),
    CRD_USED VARCHAR2(10 BYTE),
    RES_CDE VARCHAR2(3 BYTE),
    REA_CDE VARCHAR2(4 BYTE),
    PRC_CDE VARCHAR2(10 BYTE),
    MCC VARCHAR2(4 BYTE),
    APP_CDE VARCHAR2(8 BYTE),
    ISS_INS_ID VARCHAR2(11 BYTE),
    ACQ_INS_ID VARCHAR2(11 BYTE),
    ACQ_NET_CDE VARCHAR2(20 BYTE),
    ISS_NET_CDE VARCHAR2(20 BYTE),
    INST_ID VARCHAR2(60 BYTE),
    FIID1 VARCHAR2(20 BYTE),
    FIID2 VARCHAR2(20 BYTE),
    SWT_FLE VARCHAR2(50 BYTE),
    VIS_FLE VARCHAR2(50 BYTE),
    VIS_FLE_MCHDTE DATE,
    VIS_FLE_EODDTE DATE,
    VIS_FLE_RCNTYP NUMBER(2),
    VIS_FLE_ACNTID VARCHAR2(35 BYTE),
    MAS_FLE VARCHAR2(50 BYTE),
    MAS_FLE_MCHDTE DATE,
    MAS_FLE_EODDTE DATE,
    MAS_FLE_RCNTYP NUMBER(2),
    MAS_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE1_FLE VARCHAR2(50 BYTE),
    TIE1_FLE_SRC VARCHAR2(50 BYTE),
    TIE1_FLE_MCHDTE DATE,
    TIE1_FLE_EODDTE DATE,
    TIE1_FLE_RCNTYP NUMBER(2),
    TIE1_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE2_FLE VARCHAR2(50 BYTE),
    TIE2_FLE_SRC VARCHAR2(50 BYTE),
    TIE2_FLE_MCHDTE DATE,
    TIE2_FLE_EODDTE DATE,
    TIE2_FLE_RCNTYP NUMBER(2),
    TIE2_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE3_FLE VARCHAR2(50 BYTE),
    TIE3_FLE_SRC VARCHAR2(50 BYTE),
    TIE3_FLE_MCHDTE DATE,
    TIE3_FLE_EODDTE DATE,
    TIE3_FLE_RCNTYP NUMBER(2),
    TIE3_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE4_FLE VARCHAR2(50 BYTE),
    TIE4_FLE_SRC VARCHAR2(50 BYTE),
    TIE4_FLE_MCHDTE DATE,
    TIE4_FLE_EODDTE DATE,
    TIE4_FLE_RCNTYP NUMBER(2),
    TIE4_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE5_FLE VARCHAR2(50 BYTE),
    TIE5_FLE_SRC VARCHAR2(50 BYTE),
    TIE5_FLE_MCHDTE DATE,
    TIE5_FLE_EODDTE DATE,
    TIE5_FLE_RCNTYP NUMBER(2),
    TIE5_FLE_ACNTID VARCHAR2(35 BYTE),
    TIE6_FLE VARCHAR2(50 BYTE),
    TIE6_FLE_SRC VARCHAR2(50 BYTE),
    TIE6_FLE_MCHDTE DATE,
    TIE6_FLE_EODDTE DATE,
    TIE6_FLE_RCNTYP NUMBER(2),
    TIE6_FLE_ACNTID VARCHAR2(35 BYTE),
    EJ_FLE VARCHAR2(50 BYTE),
    EJ_FLE_MCHDTE DATE,
    EJ_FLE_EODDTE DATE,
    EJ_FLE_RCNTYP NUMBER(2),
    EJ_FLE_ACNTID VARCHAR2(35 BYTE),
    BTH_FLE VARCHAR2(50 BYTE),
    BTH_FLE_MCHDTE DATE,
    BTH_FLE_EODDTE DATE,
    BTH_FLE_RCNTYP NUMBER(2),
    BTH_FLE_ACNTID VARCHAR2(35 BYTE),
    BRN_ISS_FLE VARCHAR2(50 BYTE),
    BRN_ISS_FLE_MCHDTE DATE,
    BRN_ISS_FLE_EODDTE DATE,
    BRN_ISS_FLE_RCNTYP NUMBER(2),
    BRN_ISS_FLE_ACNTID VARCHAR2(35 BYTE),
    BRN_ACQ_FLE VARCHAR2(50 BYTE),
    BRN_ACQ_FLE_MCHDTE DATE,
    BRN_ACQ_FLE_EODDTE DATE,
    BRN_ACQ_FLE_RCNTYP NUMBER(2),
    BRN_ACQ_FLE_ACNTID VARCHAR2(35 BYTE),
    TRNACC_ID VARCHAR2(21 BYTE),
    PRT_TRNACC_ID VARCHAR2(35 BYTE),
    PROCESS_ID VARCHAR2(20 BYTE),
    SWT_VCH1_NUM VARCHAR2(100 BYTE),
    SWT_VCH2_NUM VARCHAR2(100 BYTE),
    SWT_VCH3_NUM VARCHAR2(100 BYTE),
    SWT_VCH4_NUM VARCHAR2(100 BYTE),
    SWT_VCH5_NUM VARCHAR2(100 BYTE),
    SWT_VCH1A_NUM VARCHAR2(100 BYTE),
    SWT_VCH2A_NUM VARCHAR2(100 BYTE),
    SWT_VCH3A_NUM VARCHAR2(100 BYTE),
    SWT_VCH4A_NUM VARCHAR2(100 BYTE),
    SWT_VCH5A_NUM VARCHAR2(100 BYTE),
    SWT_VCH1B_NUM VARCHAR2(100 BYTE),
    SWT_VCH2B_NUM VARCHAR2(100 BYTE),
    SWT_VCH3B_NUM VARCHAR2(100 BYTE),
    SWT_VCH4B_NUM VARCHAR2(100 BYTE),
    SWT_VCH5B_NUM VARCHAR2(100 BYTE),
    SWT_VCH1C_NUM VARCHAR2(100 BYTE),
    SWT_VCH2C_NUM VARCHAR2(100 BYTE),
    SWT_VCH3C_NUM VARCHAR2(100 BYTE),
    SWT_VCH4C_NUM VARCHAR2(100 BYTE),
    SWT_VCH5C_NUM VARCHAR2(100 BYTE),
    SWT_VCH1D_NUM VARCHAR2(100 BYTE),
    SWT_VCH2D_NUM VARCHAR2(100 BYTE),
    SWT_VCH3D_NUM VARCHAR2(100 BYTE),
    SWT_VCH4D_NUM VARCHAR2(100 BYTE),
    SWT_VCH5D_NUM VARCHAR2(100 BYTE),
    SWT_VCH1E_NUM VARCHAR2(100 BYTE),
    SWT_VCH2E_NUM VARCHAR2(100 BYTE),
    SWT_VCH3E_NUM VARCHAR2(100 BYTE),
    SWT_VCH4E_NUM VARCHAR2(100 BYTE),
    SWT_VCH5E_NUM VARCHAR2(100 BYTE),
    SWT_VCH1F_NUM VARCHAR2(100 BYTE),
    SWT_VCH2F_NUM VARCHAR2(100 BYTE),
    SWT_VCH3F_NUM VARCHAR2(100 BYTE),
    SWT_VCH4F_NUM VARCHAR2(100 BYTE),
    SWT_VCH5F_NUM VARCHAR2(100 BYTE),
    SWT_VCH1G_NUM VARCHAR2(100 BYTE),
    SWT_VCH2G_NUM VARCHAR2(100 BYTE),
    SWT_VCH3G_NUM VARCHAR2(100 BYTE),
    SWT_VCH4G_NUM VARCHAR2(100 BYTE),
    SWT_VCH5G_NUM VARCHAR2(100 BYTE),
    SWT_VCH1H_NUM VARCHAR2(100 BYTE),
    SWT_VCH2H_NUM VARCHAR2(100 BYTE),
    SWT_VCH3H_NUM VARCHAR2(100 BYTE),
    SWT_VCH4H_NUM VARCHAR2(100 BYTE),
    SWT_VCH5H_NUM VARCHAR2(100 BYTE),
    SWT_VCH1I_NUM VARCHAR2(100 BYTE),
    SWT_VCH2I_NUM VARCHAR2(100 BYTE),
    SWT_VCH3I_NUM VARCHAR2(100 BYTE),
    SWT_VCH4I_NUM VARCHAR2(100 BYTE),
    SWT_VCH5I_NUM VARCHAR2(100 BYTE),
    VIS_VCH_NUM VARCHAR2(100 BYTE),
    MAS_VCH_NUM VARCHAR2(100 BYTE),
    TIE1_VCH_NUM VARCHAR2(100 BYTE),
    TIE2_VCH_NUM VARCHAR2(100 BYTE),
    TIE3_VCH_NUM VARCHAR2(100 BYTE),
    TIE4_VCH_NUM VARCHAR2(100 BYTE),
    TIE5_VCH_NUM VARCHAR2(100 BYTE),
    TIE6_VCH_NUM VARCHAR2(100 BYTE),
    EJ_VCH_NUM VARCHAR2(100 BYTE),
    BTH_VCH_NUM VARCHAR2(100 BYTE),
    BRN_ISS_VCH_NUM VARCHAR2(100 BYTE),
    BRN_ACQ_VCH_NUM VARCHAR2(100 BYTE),
    PAR_DTE DATE,
    EOD_DTE1 DATE,
    EOD_DTE2 DATE,
    FILLER1 VARCHAR2(4000 BYTE),
    FILLER2 VARCHAR2(4000 BYTE),
    FILLER3 VARCHAR2(4000 BYTE),
    BRM_LINKID1 VARCHAR2(20 BYTE),
    BRM_LINKID2 VARCHAR2(20 BYTE),
    BRN_ACQ_FLE_ORG VARCHAR2(50 BYTE),
    CRM_TRACK_FLAG VARCHAR2(20 BYTE),
    DIFF_AMT NUMBER(16,2),
    IS_RCN NUMBER(1),
    MCH_DTE DATE,
    MIGRATION_FLAG VARCHAR2(50 BYTE),
    NET_CDE VARCHAR2(20 BYTE),
    TRACK_FLAG VARCHAR2(100 BYTE),
    TRN_MM VARCHAR2(2 BYTE),
    TRN_YY VARCHAR2(4 BYTE),
    MOVE_FLAG VARCHAR2(15 BYTE),
    PURGE_FLAG NUMBER(2),
    REV_FLAG NUMBER(1),
    TEMPVCH_LOCK_DTE DATE
    Please provide me any refernce on web or document which i can implement or code on how to code the required trgger.
    Regards,
    Ganesh

    Perhaps you should consider using Materialized View Replication.
    http://docs.oracle.com/cd/E11882_01/server.112/e10706/repoverview.htm#autoId9
    Instead of writing triggers, you put a materialized view log on your source table. Then you can turn your backup table into a materialized view that is based on the source table. When you perform a fast refresh of the backup table MV, it will read the MV log on the source table. Refreshes should take almost no time at all to process.
    If the data must be absolutely up-to-date at all times, you can use refresh on commit so that the MV is always in synch with the table. Normally I recommend against using refresh on commit, and instead recommend a short refresh interval.
    You can use triggers as you suggest, but it seems simpler to use something like MVs to create a shadow table.

  • GeoRasterException: -13463 .. even after creating DML trigger

    Hi all
    i am getting the following exception :
    oracle.spatial.georaster.GeoRasterException: -13463;GeoRaster object with rasterId = 281, rdt = null not found in system data view.
    Please create DML trigger for its table and column. Do:
    sdo_geor_utl.createDMLTrigger('tableName','columnName')
    at oracle.spatial.georaster.JGeoRaster.getRasterSubset_NoComp(JGeoRaster.java:1001)
    at oracle.spatial.georaster.JGeoRaster.getRasterSubset(JGeoRaster.java:798)
    at oracle.spatial.georaster.JGeoRaster.getRasterImage(JGeoRaster.java:2510)
    at oracle.spatial.georaster.JGeoRaster.getRasterImage(JGeoRaster.java:2038)
    at spdb.SpatialQuery.getRaster(SpatialQuery.java:68)
    at spdb.SpatialQuery.main(SpatialQuery.java:91)
    I have created the DML trigger using
    sdo_geor_utl.createDMLTrigger('IMGTABLE','RASTER');
    but still i keep getting the same error
    what am i doing wrong
    THanks

    AB,
    about your application, please consider these:
    If your original images are seamlessly mosaickable, it's better to mosaick them into one large image and then query. Note, the requirement from the oracle 10g sdo_geor.mosaic is very strict.
    But I guess, in most apps, this is not practical. So, you have to query multiple images and do some work in your app. The approach could be:
    1. Since your images are all georeferenced, call sdo_geor.generateSpatialExtent and populate the spatial extent for all images. Then build a spatial index (RTree) on the georaster table based on the spatial extents. Note, If the georaster objects have different model spaces, you need call sdo_cs.transform to convert the extents to the same SRID. You can also directly update the spatial extents using a right/appropriate geometry.
    2. Spatially query the GeoRaster table using your area-of-interest geometry in a single sql stmt to filter out all the georaster objects which overlap or partially overlap your AOI.
    3. call getRasterSubset on each georaster object of the above result set with a proper window.
    4. the BLOBs returned by getrastersubset don't have any metadata inside them, but you can easily and precisely figure out their dimension sizes, cell depth, interleaving etc based on the metadata of the georaster objects as well as your query criteria (i.e., band numbers, window sizes and pyramid levels).
    5. get all blobs into your app. then you can either directly work on them, such as mosaick them into one image for display, OR you can generate RenderedImages (very easy to do thru JAI) and directly display them into one image (ie, simply render the images in a window) or call JAI rotate/tranform/mosaic to create a single image.
    The above approach has been done in many of our partner products, such as PCI FOCUS and Geomatica, Leica ERDAS Imagine and LPS.
    In addition, Oracle Applicattion Server MapViewer has this capability as well, which you might consider to use.
    Hope this helps.
    Best Regards,
    Jeffrey

Maybe you are looking for