Cant commit in trigger

Hi
I am trying to get around mutating table problem. I have a before trigger on tableA that calls a procedure that creates a temp global table to store the :new values updated on tableA.
Here is the trigger code and the procedure code..
Anyone know what the problem is..
Thanks
create or replace trigger postaladdress_before
before insert or update
OF ADDRESS1 ,ADDRESS2 ,ADDRESS3 ,ADDRESS4 ,ADDRESS5 ,ADDRESS6 ,ADDRESS7
on tocpostaladdress
for each row
begin
postcode_temp_work ('new',:new.c, :new.i, :new.ADDRESS1 ,:new.ADDRESS2 ,:new.ADDRESS3 ,:new.ADDRESS4 ,:new.ADDRESS5 ,:new.ADDRESS6 ,:new.ADDRESS7);
end;
CREATE OR REPLACE Procedure postcode_temp_work ( tmode IN varchar2,pc IN Number, piin in Number, pADDRESS1 IN varchar2 ,pADDRESS2 IN varchar2 ,pADDRESS3 IN varchar2 , pADDRESS4 IN varchar2 ,pADDRESS5 IN varchar2 ,pADDRESS6 IN varchar2 ,pADDRESS7 IN varchar2 )
IS
          vc NUMBER := pc;
          vi NUMBER := piin;
          vaddress1 VARCHAR2(40) := pADDRESS1;
          vaddress2 VARCHAR2(40) := pADDRESS2;
          vaddress3 VARCHAR2(40) := pADDRESS3;
          vaddress4 VARCHAR2(40) := pADDRESS4;
          vaddress5 VARCHAR2(40) := pADDRESS5;
          vaddress6 VARCHAR2(40) := pADDRESS6;
          vaddress7 VARCHAR2(40) := pADDRESS7;
          vtmode VARCHAR2(40) := tmode;
BEGIN
     dbms_output.put_line(vc);
     dbms_output.put_line(vi);
     dbms_output.put_line(vaddress1);
     IF vtmode = 'new' THEN
     EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE t_my_postcode_update ( c NUMBER, i NUMBER, address1 VARCHAR2(40), address2 VARCHAR2(40), address3 VARCHAR2(40), address4 VARCHAR2(40), address5 VARCHAR2(40), address6 VARCHAR2(40), address7 VARCHAR2(40) )';
     EXECUTE IMMEDIATE( 'Insert into t_my_postcode_update ( C, I, ADDRESS1, ADDRESS2, ADDRESS3, ADDRESS4, ADDRESS5, ADDRESS6, ADDRESS7)values( '''|| vc || ''' ,''' || vi || ''',''' || vaddress1 || ''' , ''' || vaddress2 || ''','''|| vaddress3||''' ,'''|| vaddress4 ||''' ,'''|| vaddress5||''' ,'''|| vaddress6||''' ,'''|| vaddress7||''')');
     END IF;
     IF vtmode = 'kill' THEN
     EXECUTE IMMEDIATE 'DROP TABLE t_my_postcode_update';
     END IF;
END;
show errors;

superkav wrote:
EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE
EXECUTE IMMEDIATE 'DROP TABLE
I realise its not the best way to do it. However Its how the customer want it..
Well, create a temporary table on the fly cannot be a customer requirement, is it ?
1. it is often a lack of Oracle knowledge to make such thing, especially people coming from MS SQL.
2. you could give some good advices to your client about the Oracle technical behaviour
A global temporary table should exists in a permanent fashion. The data are volatile (transaction or session) which is why the GTT exists, but the GTT must exists permanently.
Then you should think about multi-session env, what'll happen if with the same user account, two people are connected, one is making a new, one is making a kill ? One of them, do not say both of them, will be in trouble. Without saying about the possible nightmare to debug dynamic sql - especially inside a trigger - especially for "temporary" object.
In many place such horrible code could not be installed in UAT env, even less in production.
Nicolas.

Similar Messages

  • Why we cant use commit in trigger, can any one give proper explanation

    Why we cant use commit in trigger, can any one give proper explanation

    You shouldn't use a commit in a trigger if it's part of the same transaction as the action happening on the table.
    Eg. Suppose you have a table that stores details of orders, and it has a trigger that updates the stock table.
    If a customer comes along and creates an order but decides part way through that actually, they don't want the order after all, the transaction is rolled back.
    If you don't put a commit in the transaction, then the stock table details remain unchanged - no order, so no stock reduction. If, however, you forced the commit to happen in the trigger, you now have no order, but the stock table details have changed.
    That's not what you want to happen!
    Sometimes it does make sense to have a commit in the trigger, but this is very much the exception. If you come across a table mutating error, it usually means that you have a problem with your design and that you need to rethink it, NOT bodge it by using autonomous_transaction and a commit.
    Of course, the times when you'd use triggers should be few and far between - the above example is NOT how I'd code an orders-stock transaction; I'd have some PL/SQL that handled the transaction, rather than direct inserts onto the table.

  • No commit in trigger

    I have seen that there is no commit reqd. in trigger, the statements get auto-committed.
    Is it true?
    I hope, my question is clear. Please help in solving the doubt.
    regards.

    The trigger code executes in the same transaction the
    actula DML statements is running. Any commit or
    rollback to the actual DML statement equally applies
    to the statements in the triggerUnless trigger use AUTONOMOUS TRANSACTION - in this case you have to commit or rollback inside the trigger.

  • Commit in trigger

    I want to delete rows in a table and then commit it using a procedure and a trigger. Documentation says we cannot use commit in a trigger. Can we use truncate instead? If yes how?

    Thanks for your response.
    I want to collect the list of procedures and packages in shared pool before shutting down the database and have created a table (coll_table) to collect this list. I have created a procedure for the same and in this procedure I said
    delete from coll_table;
    commit;
    To run this procedure I have created a trigger which fires at the database shutdown event. This trigger is giving me an error in alert log file. I studied on that error and came to know that I cannot use a commit in a trigger,now I want to know can I use a truncate instead of "delete from coll_table; commit;"?

  • [SOLVED] SVNServe + Apache (DAV) error 503 cant commit ONLY php file!

    Hi guys and .. first of all, sorry for my poor english.
    Here my problem, and i will hope someone can help me go out from this hell!!!
    Until Yesterday i've used Apache + DAV module + svnserve to host my SVN repository.
    I've used to commit and update every day all my works, and... all goes fine!
    Today (without making any update) a new error appears while attempting to commit file: "[08/Aug/2014:19:48:51 +0200] "PUT /svn/Sources/!svn/txr/1038-ws/Nuovo%20documento%20di%20testo.php HTTP/1.1" 503 1014" (apache access_log)
    I figure out that this error appears only when i try to commit a file with ".php" extension (if i rename this file into .txt all is ok!).
    So, someone can help me to solve this?
    I want add some additional info:
    - error_log
    [Fri Aug 08 20:04:54.161477 2014] [proxy_fcgi:error] [pid 970] [client 192.168.1.147:32182] AH01071: Got error 'Primary script unknown\n'
    [Fri Aug 08 20:04:54.198613 2014] [proxy_fcgi:error] [pid 970] [client 192.168.1.147:32182] AH01071: Got error 'Primary script unknown\nsdf sd\x7f'
    [Fri Aug 08 20:04:54.198681 2014] [proxy_fcgi:error] [pid 970] (104)Connection reset by peer: [client 192.168.1.147:32182] AH01075: Error dispatching request to : (sending empty stdin)
    - http-conf file
    <Directory "/archive/SVNRepository/repositories">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
    Order allow,deny
    Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
    Order deny,allow
    Deny from all
    </LimitExcept>
    </Directory>
    <Location /svn>
    DAV svn
    SVNParentPath /archive/SVNRepository/repositories
    AuthzSVNAccessFile /archive/SVNRepository/.svn-policy-file
    AuthName "Magius(CHE) - SVN Repositories"
    AuthType Basic
    AuthUserFile /archive/SVNRepository/.svn-auth-file
    Satisfy Any
    Require valid-user
    </Location>
    CustomLog /var/log/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
    Thx in advance for all your help.
    Desperated Programmer! :-)
    Last edited by magiusche (2014-08-11 14:07:22)

    After 1 week of research i've found the source of the problem and fixed. I write down the soluzion if someone is interested.
    1) I've installed fcgi module for php so, in order to work i've added this line into httpd.conf
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/$1
    this setting transfer all http request with ".php" to the fcgi proxy for PHP.
    2) I've installed SVNServe with dav module and the url is "http://myserver/svn/" so every commit call to the sever that includes ".php" will be parsed by fcgi and returns strange errors (see step 1)
    3) to solve the iussue just put IGNORE proxy rule into your httpd.conf like that
    ProxyPass /svn !
    so every http request that include svn in the url will be NOT parsed by fcgi and SVNServe can operate correctly.

  • Can we call the procedure which contain commit  in trigger

    can we call the procedure which contain commit in trigger

    Well, what i've noticed from op's past post - whenever op post - he/she posts multiple short questions here. This may be indication of some sort of assignment or any kind of online exam's ...... :?)
    Regards.
    Satyaki De.

  • Cant commit with svn

    Hello,
    i use the version 1.5.1.54.40 and now i am test the svn versioning function.
    I create a repository with sql developer on my local hard drive. After this i check out this repository in a folder. In this folder i create a new file, save and add this. If i would like to commit this file a error message shows me:
    commit -m "" C:/...myfolder
    svn: authentication cancelled
    svn: authentication cancelled
    In my repository-properties the items for username/password are empy. I dont like authentication. Its only for my private.
    Can anybody help me with this error message?
    best regards
    carsten

    I seem to be having a similar problem.
    On our system, we are trying to get versioning going. We do not have it set up as a server, rather as a repository on a network drive.
    It used to work great. However, I haven't used it in a while. I've tried a couple of times in the last couple of weeks to check a file in and I get the authentication cancelled error. I downloaded the current version of SQLDeveloper (Check for Updates failed), installed in a clean directory, imported settings.
    I tried to check in a file, and still got the error. Here are the details:
    org.tigris.subversion.svnclientadapter.SVNClientException: org.tigris.subversion.javahl.ClientException: svn: authentication cancelled
         at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.commit(AbstractJhlClientAdapter.java:316)
         at oracle.jdevimpl.vcs.svn.op.SVNOperationCommit.invokeCommit(SVNOperationCommit.java:206)
         at oracle.jdevimpl.vcs.svn.op.SVNOperationCommit.invokeCommandImpl(SVNOperationCommit.java:72)
         at oracle.jdevimpl.vcs.svn.op.AbstractSVNOperation.mav$invokeCommandImpl(AbstractSVNOperation.java:46)
         at oracle.jdevimpl.vcs.svn.op.AbstractSVNOperation$1.doCommitOperation(AbstractSVNOperation.java:105)
         at oracle.jdeveloper.vcs.spi.VCSDialogCommitter$1.run(VCSDialogCommitter.java:82)
    Caused by: org.tigris.subversion.javahl.ClientException: svn: authentication cancelled
         at org.tigris.subversion.javahl.JavaHLObjectFactory.throwException(JavaHLObjectFactory.java:723)
         at org.tmatesoft.svn.core.javahl.SVNClientImpl.throwException(SVNClientImpl.java:1852)
         at org.tmatesoft.svn.core.javahl.SVNClientImpl.commit(SVNClientImpl.java:667)
         at org.tmatesoft.svn.core.javahl.SVNClientImpl.commit(SVNClientImpl.java:648)
         at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.commit(AbstractJhlClientAdapter.java:310)
         ... 5 more
    Caused by: org.tmatesoft.svn.core.SVNCancelException: svn: authentication cancelled
         at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:37)
         at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:32)
         at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:167)
         at org.tmatesoft.svn.core.internal.io.fs.FSRepository.getUserName(FSRepository.java:886)
         at org.tmatesoft.svn.core.internal.io.fs.FSRepository.getCommitEditorInternal(FSRepository.java:708)
         at org.tmatesoft.svn.core.io.SVNRepository.getCommitEditor(SVNRepository.java:2473)
         at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:997)
         at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:891)
         at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:823)
         at org.tmatesoft.svn.core.javahl.SVNClientImpl.commit(SVNClientImpl.java:665)
         ... 7 more

  • Commit a statement in  trigger

    i have a trigger on a table like
    create or replace trig_1
    after insert
    ON t1
    referencing new as new old as old
    for each row
    begin
    INSERT INTO t2 VALUES (:new.abd);
    commit;
    end;
    this is working fine when i insert records in the main table with out commit in trigger .But when i place commit in trigger the insert statement fails showing commit exists on the trigger.
    but i need to commit every row as soon as it is inserted

    > Can you give some more information about the material, manufacturing and the like?
    Quality craftsmanship goes into creating a finely balanced round pipe made of the highest grade of lead.
    > Is it possible to get it colored (are there spring-time colors available)?
    No!! <horrified expression>
    It needs to be in harmony with the universe.. and thus is in the only perfect colour suited for a lead pipe. Gray.
    > Is there any maintenance needed?
    Yes, Cleaning the blood and miscellaneous "bits" from it. May I suggest our lead pipe cleaning kit for a mere $29.99?
    > Are you delivering in non-EU countries?
    As long as you pay in good old fashioned US dollars or Euros, it is not a problem.
    > Will this lead pipe do any harm to the owner?
    Only if you neglect the warning that lead pipes should only be used for situations that demand the dedicated, focussed and lovingly application of sheer bloody mindless violence... using the lead pipe of course.
    > Is there a discount if you have more than 500 posts in this forum ;-)
    ROFL!
    :-)

  • Oracle 9i Trigger not updating first time through

    Hi,
    I have read a lot of postings but this one seems to be unique. I am trying to update using from Access to Oracle backend database with a Trigger. When I put the code from the update in a test window in the PL/SQL, I step through the code and it doesn't update the first time through. The values from my :old and :new fields are null the first time through. When I change either proj_part_ppv_adj, incorp_date or end_date in the test window and step through the code again, it updates my table.
    update statement:
    -- Created on 10/17/2005
    declare
    -- Local variables here
    i integer;
    begin
    -- Test statements here
    update pcrit.tpcrit_proj_part
    set proj_no = 'TestChris',
    mat = '1080373',
    plant = 'COR1',
    vndr_code = '0000000564',
    it_cat = '0',
    incorp_date = '15-OCT-2005',
    end_date = '31-DEC-2005',
    unit_prce_chg = null,
    proj_part_ppv_adj = 32500,
    edit_id = 'XXXXXX',
    edit_dt = to_date('17-OCT-2005 08:10:32 AM',
    'DD-MON-YYYY HH:MI:SS AM')
    where proj_no = 'TestChris'
    and mat = '1080373'
    and plant = 'COR1'
    and vndr_code = '0000000564'
    and it_cat = '0';
    commit;
    end;
    Trigger:
    create or replace trigger tpcrit_proj_part_trg_ubr
    before update on tpcrit_proj_part
    for each row
    /* This trigger stores the key values of TPCRIT_PROJ_PART records for
    later use by the after-update trigger.
    The trigger must be disabled when running the loader or it will
    interfere with loading documents from SAP/ODM.
    declare
    rowParts pcrit_mod_proj_part.typProjPartRowKey;
    begin
    if :new.proj_no <> :old.proj_no or :new.mat <> :old.mat or
    :new.plant <> :old.plant or :new.vndr_code <> :old.vndr_code or
    :new.it_cat <> :old.it_cat or :new.incorp_date <> :old.incorp_date or
    :new.end_date <> :old.end_date or
    :new.proj_part_ppv_adj <> :old.proj_part_ppv_adj then
    -- Only perform the task if something other than the comment has changed.
    -- Initialize the rowParts record to be added to the list.
    rowParts.proj_no := :new.proj_no;
    rowParts.mat := :new.mat;
    rowParts.plant := :new.plant;
    rowParts.vndr_code := :new.vndr_code;
    rowParts.it_cat := :new.it_cat;
    rowParts.incorp_date := :new.incorp_date;
    rowParts.end_date := :new.end_date;
    rowParts.proj_part_ppv_adj := :new.proj_part_ppv_adj;
    -- Get the project type for this project.
    begin
    select proj_type
    into rowParts.proj_type
    from tpcrit_proj
    where proj_no = :new.proj_no;
    exception
    when no_data_found then
    rowParts.proj_type := null;
    end;
    -- Add this part row to the list for after-statement processing.
    pcrit_mod_proj_part.add_to_list(rowParts);
    end if;
    end tpcrit_proj_part_trg_ubr;

    Are you lookng at tpcrit_proj_part to see if the update happend, or are you looking for the results of the after update trigger?
    I believe that this is exactly what you are doing, except I have left out the after update trigger.
    SQL> CREATE TABLE t (id number, id_dt DATE,
      2                  descr varchar2(10), desc2 varchar2(10));
    Table created.
    SQL> CREATE TRIGGER t_bu
      2     BEFORE UPDATE ON t
      3     FOR EACH ROW
      4  BEGIN
      5     IF :new.id <> :old.id or
      6        :new.id_dt <> :old.id_dt or
      7        :new.descr <> :old.descr or
      8        :new.desc2 <> :old.desc2 THEN
      9        DBMS_OUTPUT.Put_Line('This is all your proceesing');
    10     END IF;
    11  END;
    12  /
    Trigger created.
    SQL> INSERT INTO t (id, id_dt) VALUES(1, TRUNC(sysdate));
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM t;
            ID ID_DT       DESCR      DESC2
             1 09-NOV-2005
    SQL> UPDATE t
      2  SET descr = 'Descr',
      3      desc2 = 'Desc2'
      4  WHERE id = 1 and
      5        id_dt = TRUNC(sysdate);
    1 row updated.So your processing never happened but the update certainly did:
    SQL> SELECT * FROM t;
            ID ID_DT       DESCR      DESC2
             1 09-NOV-2005 Descr      Desc2Now, even without a commit:
    SQL> UPDATE t
      2  SET descr = 'CHANGED'
      3  WHERE id = 1 and
      4        id_dt = TRUNC(sysdate);
    This is all your proceesing
    1 row updated.Now, fix the trigger to take NULL into account:
    SQL> ROLLBACK;
    Rollback complete.
    SQL> SELECT * FROM t;
            ID ID_DT       DESCR      DESC2
             1 09-NOV-2005
    SQL> CREATE OR REPLACE TRIGGER t_bu
      2     BEFORE UPDATE ON t
      3     FOR EACH ROW
      4  BEGIN
      5     IF (:new.id <> :old.id or
      6         (:new.id IS NULL and :old.id IS NOT NULL) or
      7         (:new.id IS NOT NULL and :old.id IS NULL)) or
      8        (:new.id_dt <> :old.id_dt or
      9         (:new.id_dt IS NULL and :old.id_dt IS NOT NULL) or
    10         (:new.id_dt IS NOT NULL and :old.id_dt IS NULL)) or
    11        (:new.descr <> :old.descr or
    12         (:new.descr IS NULL and :old.descr IS NOT NULL) or
    13         (:new.descr IS NOT NULL and :old.descr IS NULL)) or
    14        (:new.desc2 <> :old.desc2 or
    15         (:new.desc2 IS NULL and :old.desc2 IS NOT NULL) or
    16         (:new.desc2 IS NOT NULL and :old.desc2 IS NULL)) THEN
    17        DBMS_OUTPUT.Put_Line('This is all your proceesing');
    18     END IF;
    19  END;
    20  /
    Trigger created.
    SQL> UPDATE t
      2  SET descr = 'Descr',
      3      desc2 = 'Desc2'
      4  WHERE id = 1 and
      5        id_dt = TRUNC(sysdate);
    This is all your proceesing
    1 row updated.Now, all your processing happens on the first update, and all others:
    SQL> SELECT * FROM t;
            ID ID_DT       DESCR      DESC2
             1 09-NOV-2005 Descr      Desc2
    SQL> UPDATE t
      2  SET descr = 'CHANGED'
      3  WHERE id = 1 and
      4        id_dt = TRUNC(sysdate);
    This is all your proceesing
    1 row updated.But only when something changes:
    SQL> UPDATE t
      2  SET descr = 'CHANGED'
      3  WHERE id = 1 and
      4        id_dt = TRUNC(sysdate);
    1 row updated.If you really see something different, then post a cut and paste of a sqlplus session as I did showing the behaviour you are getting.
    TTFN
    John

  • Error: cannot commit (when inserting the row)

    hai,
    I create the trigger like below.
    create or replace trigger proce
    after insert on samp3
    declare
    ass date;
    begin
    select d into ass from samp3;
    updatecourse(ass);
    end;
    when I try to insert the row then the error is come;
    ERROR at line 1:
    ORA-20001: An error was encountered - -4092 -ERROR- ORA-04092: cannot COMMIT in a trigger
    ORA-06512: at "AUROLIVE.UPDATECOURSE", line 22
    ORA-06512: at "AUROLIVE.PROCE", line 5
    ORA-04088: error during execution of trigger 'AUROLIVE.PROCE'
    can any one help me?
    Regards,
    Ramya.S

    If u want to put commit on trigger use pragma
    autonomous_transaction.what it does,it leave the main
    transaction and commit the second transaction.Which can lead to logic problems and corruption of your business data if not used extremely carefully.
    If you start transaction 1 and during that write some other data as transaction 2 using autonomous transactions and then subsequently find that there is an error or some reason not to commit transaction 1 then you cannot automatically roll back transaction 2 and would have to take care of it manually.
    I see too many occurences of developers using autonomous transaction all over the place just because they want to get the data written to the database and then they're wondering why there is so much clutter in their data and the database integrity is poor from a business/logical point of view. The first thing any good design includes is a knowledge of the business transactions and when data should be committed and what the implications of using autonomous transactions are.

  • XML Status : 'Message recorded, commit missing"

    Hi,
    I am calling my proxy in a BADI. After triggering it, when I go and check in SXMB_MONI, the status of XML message is "Message recorded, commit missing". And it is in Scheduled status.
    Could you please let me know, why this message will come, and how to make it run successfully.
    Thanks,
    Sandeep

    I think you are gettking this error in transaction SXI_MONITOR in ERP system. As replied earlier by Divyesh, you need to write commit work statement in ur BADI after calling the proxy method.
    If you test this proxy from transaction SPROXY, then also u will see this error with ur message and u need to trigger Commit work/Rollback explicitly to send message to central PI server. While testing ur proxy from SPROXY u can trigger Commit/Rollback from menu
    Extras - > Trigger COMMIT WORK / Trigger ROLLBACK WORK

  • [Forms6]Select for update before update and commit

    Hi,
    In the KEY-COMMIT forms trigger
    My code finds the primary keys of the rows to be updated,
    then there is "select ...where "these keys".. for update nowait"
    then there is a commit
    (There also is a pragma exception init -54 "Resource Busy")
    At runtime I get an error:
    "Cannot insert rows here".
    Maybe I should lock these rows before triggering the Key-commit?
    --> message edited
    Oops, I just reproduced the code in Forms 10,
    I select for update from emp where empno=7839 then update King's sal then commit_form;
    and everything works fine.
    So I have to locate where this error message comes from.
    --< End of edit
    Many thanks for your help.
    Edited by: JeanParis on Dec 23, 2009 10:31 PM

    Hi,
    The issue is solved on my Developer 2000 10 installed on Windows XP.
    At work on Forms 6 I have hidden the warning with a :system.message_level.
    What I'm searching now is a script to check the locks in the situation where
    I don't have access to the catblock.sql script because I'm not DBA on the database. (but I can see DBA_LOCKS).
    The problem starts because on the master block there is an item that can ben changed
    from 'CREAT' to 'VALID', and in the When Validate Item trigger on that item I cannot issue a go_block( 'xxx' ).
    I have to go to the 'xxx' block in order to start a first record - next loop to gather values and update a table accordingly.
    Many thanks for your care.
    JBM.

  • Please Help - How do I create a VIEW through a trigger

    I'm trying update a view under the following circumstances
    I have a table, TABLE1, with about 50 columns. I have another table, TABLE2, with a list of columns from TABLE1 that I want to include in the view. Whenenver I add or delete an entry in TABLE2, I want to update the view with the new set of columns from TABLE1.
    I'm getting "cannot commit in trigger" (ORA-04092) error.
    Please help
    I tried the following trigger and the procedure
    TRIGGER
    CREATE OR REPLACE TRIGGER MAPPING_FIELDUPDATE
    AFTER insert or DELETE OR update of DISPLAY_COLUMN_NAME, TABLE1_COLUMN_NAME
    on TABLE2
    begin
    TABLE1_MAPPING;
    end;
    Procedure TABLE2_MAPPING
    IS
    CURSOR MYCUR IS SELECT * FROM MYDATBASE.TABLE1;RowInfo MYCUR%ROWTYPE;
    FIELDLIST VARCHAR2(5000);
    SQLSTRING VARCHAR2(5000);
    BEGIN
    OPEN MYCUR;
    LOOP
    FETCH MYCUR INTO RowInfo;
    EXIT WHEN MYCUR%NOTFOUND;
    IF (FIELDLIST IS NULL) THEN
    FIELDLIST :=RowInfo.TABLE1_COLUMN_NAME||' '||RowInfo.DISPLAY_COLUMN_NAME;
    ELSE
    FIELDLIST :=FIELDLIST||','||RowInfo.TABLE1_COLUMN_NAME||' '||RowInfo.DISPLAY_COLUMN_NAME;
    END IF;
    END LOOP;
    CLOSE MYCUR;
    SQLSTRING:= 'CREATE OR REPLACE VIEW SELECTTABLE1 AS SELECT '||FIELDLIST||' FROM TABLE1';
    DBMS_OUTPUT.PUT_LINE(SQLSTRING);
    EXECUTE IMMEDIATE SQLSTRING;
    END;

    or does anybody know any work-around.Sure. Don't use a trigger to create a view. Build a view that selects from a function that returns a ref cursor. Have the function assemble the query dynamically from the values in TABLE 2.
    Although I still think this kind of dynamic configuration is a design smell.
    Cheers, APC

  • After insert or update calculate column

    question about a table.
    I have a table called table1
    AFTER data is inserted or updated into the table1
    I want to run an update on the same table (table1) with a case statement
    update table1
    set column2 = case
    WHEN column1 = 'abc' THEN 'testl'
    WHEN column1 = 'def' THEN 'test2'
    ELSE 'test3'
    END;
    commit;
    END;
    i cant use a trigger because i get error since the insert would be on same table.
    What else can i use for this update ? I cant use a stored procedure that runs daily or something like that because the column2 in the table needs to be populated immediately after an insert or update
    thanks for any ideas

    SQL>  CREATE TABLE TABLE1
      2  (
      3    COLUMN1 VARCHAR2(10),
      4    COLUMN2 VARCHAR2(10)
      5  );
    Table created.
    SQL> CREATE OR REPLACE TRIGGER TRG_TABLE1
      2  BEFORE INSERT OR UPDATE OF COLUMN1 ON TABLE1
      3  FOR EACH ROW
      4  BEGIN
      5
      6  IF :NEW.COLUMN1 = 'abc' THEN
      7     :NEW.COLUMN2 := 'test1';
      8  ELSIF :NEW.COLUMN1 = 'def' THEN
      9     :NEW.COLUMN2 := 'test2';
    10  ELSE
    11     :NEW.COLUMN2 := 'test3';
    12  END IF;
    13
    14  END;
    15  /
    Trigger created.
    SQL> INSERT INTO TABLE1(COLUMN1) VALUES('abc');
    1 row created.
    SQL> SELECT * FROM TABLE1;
    COLUMN1    COLUMN2
    abc        test1
    SQL> UPDATE TABLE1 SET COLUMN1 = 'def';
    1 row updated.
    SQL> SELECT * FROM TABLE1;
    COLUMN1    COLUMN2
    def        test2
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Saving data in same table simultaneously

    Hi All
    I have a question and here it goes. Suppose I have two users who are updating the same table through forms and Saving or commiting at the same time, exactly same time. What will happen in this kind of situation. Both of them will get error or one will get and the other will be able to commit or both will commit. Though i am quite sure that both cant commit at the same time. So my question to all is what will happen in this kind of a situation and what can i do to avoid this kind of situation. I have heard something about On-Lock trigger. Does this comes into picture during this situation.
    Any kind of suggestion is appreciated. Thanks in advance.

    Thanks Francois
    <<<You can delay this locking process to the commit time.>>>
    1. I am sorry but i couldnt figure out what you mean by this.
    2. Also if suppose i overload the ON-LOCK trigger, i will writing a code to throw an error msg to both the users and ask them to try later.
    3. By the way, is there a way by which i can just randomly select one of the user to have commit first and then process commit for the second one.
    Please advise. Thanks for the help.

Maybe you are looking for

  • HT1369 My apple ID has been disabled so I can not update my apps.  I went to AT&T store 4 days ago and reset it but I still can't get my apps to upgrade?

    My Apple ID was disabled per my request because someone kept hacking into my icloud account and charging over $1000 worth of games.  I went to AT&T yesterday and had them reset my password and said everything would be fine now.  Well, its not.  Nothi

  • Unable to install Cisco Connect

    I am trying to install Cisco Connect for my E1000 but I get the following error each attempt  "An HNAP Call to the device failed for unknown reasons" I've already updated the router to 2.1 version of the Firmware. Full Details Error code: 82BD0305 Er

  • Portal Security document

    I looked at the document under the link security alerts > webdb/portal30. The workaround for the problem about hiding listener configuration files from unauthorized users is wrong. I got the correct response on this forum for that particular problem.

  • Portrait orientated Fotos are mainly white after synch with iPad2

    Hello Folks! Perhaps another one have the same problem as me: After synching my iPad2 under 10.6.8 with a MacPro 99 portrait orientated fotos from 100 are with huge white areas sometimes at the top, at the bottom or even both sides. Non of the horizo

  • Download dynpro fields to flat file

    Hi, I have a requirement to capture the value of fields like customer, job name and functional location from a service notification (IW51-create/ IW52- change/ IW53 - display) and download them to a flat file. As it is a common requirement for create