Error on the trigger creat

create or replace
TRIGGER wcowner.t_ins_wc_prd_mdl
AFTER INSERT on vinapp.model
FOR EACH ROW
DECLARE
v_model vinapp.model.model%type;
v_make vinapp.make.make%type;
v_category vinapp.category.category%type;
v_subcategory vinapp.sub_category.sub_category%type;
v_family vinapp.product_family.product_family%type;
v_is_serviceable vinapp.model.attachment%type;
v_is_regn_reqd vinapp.model.registration_required%type;
v_is_serialized vinapp.model.serialized%type;
v_is_active vinapp.model.active%type;
v_eff_bgn_dt date;
v_eff_end_dt date;
v_agc vinapp.model.agc%type;
BEGIN
select a.model
, e.make
, c.category
, d.sub_category
, f.PRODUCT_FAMILY
, a.attachment
, a.registration_required
, a.serialized
, a.active
, a.begin_date
, a.end_date
, a.agc
INTO v_model
, v_make
, v_category
, v_subcategory
, v_family
, v_is_serviceable
, v_is_regn_reqd
, v_is_serialized
, v_is_active
, v_eff_bgn_dt
, v_eff_end_dt
, v_agc
from vinapp.model a, vinapp.group_code b, vinapp.category c, vinapp.sub_category d, vinapp.make e, vinapp.product_family f
where a.model_id = new.model_id
and a.group_code_id = b.group_code_id
and b.category_id = c.category_id
and b.sub_category_id = d.sub_category_id
and b.make_id = e.make_id
and a.family_id = f.PRODUCT_FAMILY_ID;
wcowner.STP_INS_PRD_MDL_0010 (v_model
, v_make
, v_category
, v_subcategory
, v_family
, v_is_serviceable
, v_is_regn_reqd
, v_is_serialized
, v_is_active
, v_eff_bgn_dt
, v_eff_end_dt
, v_agc);
END;
but got error:
Error(48,24): PL/SQL: ORA-00904: "NEW"."MODEL_ID": invalid identifier
any sense

Hi,
It might be easier for us to spot if you could deliver your post as formatted SQL*Plus. Like this
SQL> CREATE OR REPLACE TRIGGER wcowner.t_ins_wc_prd_m
  2     AFTER INSERT
  3     ON vinapp.model
  4     FOR EACH ROW
  5  DECLARE
  6     v_model            vinapp.model.model%TYPE;
  7     v_make             vinapp.make.make%TYPE;
  8     v_category         vinapp.CATEGORY.CATEGORY%TYPE;
  9     v_subcategory      vinapp.sub_category.sub_category%TYPE;
10     v_family           vinapp.product_family.product_family%TYPE;
11     v_is_serviceable   vinapp.model.attachment%TYPE;
12     v_is_regn_reqd     vinapp.model.registration_required%TYPE;
13     v_is_serialized    vinapp.model.serialized%TYPE;
14     v_is_active        vinapp.model.active%TYPE;
15     v_eff_bgn_dt       DATE;
16     v_eff_end_dt       DATE;
17     v_agc              vinapp.model.agc%TYPE;
18  BEGIN
19     SELECT a.model
20           ,e.make
21           ,c.CATEGORY
22           ,d.sub_category
23           ,f.product_family
24           ,a.attachment
25           ,a.registration_required
26           ,a.serialized
27           ,a.active
28           ,a.begin_date
29           ,a.end_date
30           ,a.agc
31       INTO v_model
32           ,v_make
33           ,v_category
34           ,v_subcategory
35           ,v_family
36           ,v_is_serviceable
37           ,v_is_regn_reqd
38           ,v_is_serialized
39           ,v_is_active
40           ,v_eff_bgn_dt
41           ,v_eff_end_dt
42           ,v_agc
43       FROM vinapp.model a
44           ,vinapp.group_code b
45           ,vinapp.CATEGORY c
46           ,vinapp.sub_category d
47           ,vinapp.make e
48           ,vinapp.product_family f
49      WHERE a.model_id = :new.model_id
50        AND a.group_code_id = b.group_code_id
51        AND b.category_id = c.category_id
52        AND b.sub_category_id = d.sub_category_id
53        AND b.make_id = e.make_id
54        AND a.family_id = f.product_family_id;
55
56     wcowner.stp_ins_prd_mdl_0010(v_model
57                                 ,v_make
58                                 ,v_category
59                                 ,v_subcategory
60                                 ,v_family
61                                 ,v_is_serviceable
62                                 ,v_is_regn_reqd
63                                 ,v_is_serialized
64                                 ,v_is_active
65                                 ,v_eff_bgn_dt
66                                 ,v_eff_end_dt
67                                 ,v_agc);
68  END;
69  /
   ON vinapp.model
FEJL i linie 3:
ORA-00942: table or view does not existRegards
Peter

Similar Messages

  • Oracle BI 11g: Error at the step - "Creating BI Server System Components"

    I am attempting to install Oracle BI 11g on a Windows VM. The installation process completes successfully. However, the configuration process errors out at the step - Creating BI Server System Components. The last entry in the install log is as below:
    [2010-09-24T18:26:12.107+05:30] [as] [NOTIFICATION] [] [oracle.as.install.bi] [tid: 26] [ecid: 0000Ih3l5E00vlx6wBedMG1Cb79200000H,0] Install handler params :-componentName coreapplication_obis1 -componentType OracleBIServerComponent -biApplicationName coreapplication -fmwConfigPath C:\Middleware\user_projects\domains\bifoundation_domain\config\fmwconfig -appServerUsername <Secure value. Cannot be logged> -appServerPassword <Secure value. Cannot be logged> -appServerAdminPort 7001 -appServerManagedPort 9704 -systemAdministratorUsername <Secure value. Cannot be logged> -systemAdministratorPassword <Secure value. Cannot be logged> -repositoryPassword <Secure value. Cannot be logged> -biServerRepositoryFile SampleAppLite.rpd -biPresentationServicesCatalogName SampleAppLite -biPresentationServicesCatalogZipFileName SampleAppLiteCatalog.zip -biSchedulerSchemaUser <Secure value. Cannot be logged> -biSchedulerSchemaPassword <Secure value. Cannot be logged> -actionFrameworkWorkflowServer http://host-name:7001 -actionFrameworkWorkflowService ANALYTICS -actionFrameworkWorkflowSystem obiaftests -databaseType Microsoft SQL Server -connectString sqlservername:port:db -autoCreatePorts -biServerPort 9703 -biServerMonitorPort 9701 -biPresentationServerPort 9710 -biClusterControllerPort 9706 -biClusterControllerMonitorPort 9700 -biJavaHostPort 9810 -biSchedulerPort 9705 -biSchedulerMonitorPort 9708 -biSchedulerScriptRPCPort 9707 -portRangeStart 9700 -portRangeEnd 10000 -skipDomainProvisioning true
    The resource utilization seems to be normal. Netstat confirms that all of the above ports are free. Since there is no explicit error message in the log, we are unable to decipher the exact source for this error.
    Virtual Machine details: Intel Xeon @ 2.67 GHz, Windows Server 2003 SP2, 4GB RAM, 50GB HDD, Static IP
    Oracle BI Schema DB: MS SQL Server
    Any inputs on this error will be greatly appreciated.
    Edited by: OBIGuy on Sep 27, 2010 2:37 PM

    Hi,
    I recenty started instaling OBIEE 11g and got the same error : "Creating BI server system components". I read your solution and would like to know that if this patch is okay to install on a Windows VM (win server 2003 EE, SP2). If yes, after rebooting, do we reinstall ?
    I am also getting the following errors:
    -Executing: opmnctl start coreapplication_obiccs1
    -Executing: opmnctl start coreapplication_obis1
    -Executing: opmnctl start coreapplication_obips1
    -Executing: opmnctl start coreapplication_obisch1
    Thanks in advance.
    HG

  • Error in the PRAA (create vendors from employees).

    Hi to all!
    I have a problem: I run the transaction PRAA (create vendors from employees) and receive the message about  error:  "Reference vendor E000REFER0 , company code 1320 do not exist".
    Please let me know how correctly run the transaction?
    Thank.

    Hi,
    Reference Vendor of Fi should have the same Company Code of the Employee in Personnel Admin. The purpose of reference vendor is that, the system picks all the features that exist for the reference vendor while creating a new vendor for the employee. To solve your problem, check with your Fi person, the list of vendors that exist for Company code 1320. Take one Person as reference employee from the list. Fi Person will also assist you in giving one reference person if you tell him the scenario.
    Regards,
    Suhasini

  • CRS-0215 error in the step:Create the TNS Listener Process

    Error listening on: (ADDRESS=(PROTOCOL=TCP)(Host= 192.168.x.xxx)(Port=1521))
    TNS-12545: Connect failed because target host or object does not exist
    TNS-12560: TNS:protocol adapter error
    TNS-00515: Connect failed because target host or object does not exist
    Linux Error: 9: Cannot assign requested address
    I am getting the above error when starting the listener_linux2 on linux2 node. I ran the netca configuration tool on linux1 to configure the listener. It ends in error with CRS-0215.
    According to metalink note 339600.1 i should
    request the interface corresponding to the VIP Address be moved to/enabled on cluster server, where the TNS Listener is being started. Once the interface is enabled on cluster server, then start the TNS Listener.
    but how do i do that ?
    I am going to reboot the linux1 and linux2 boxes to see if that helps/solves the issue.
    Running Oracle Enterprise Linux 4 update 5 with oracle 10g R2
    Thanks
    Edited by: ow001294 on Aug 24, 2008 12:33 PM

    you wrote :
    "Please check your listener.ora and tnsnames.ora to make sure they entries are correct.
    You can also try that from a client machine tnsping(<server name> and IP address) is ok."
    I responded :
    This is on a brand new installation of Oracle RAC at home on 2 desktop pc's using Jeff Hunter's article on OTN website for testing/playing with Oracle 10 RAC at home. I used netca (network configuration assistant) to configure the listener. So, the listener.ora file should be correct. I only have listener.ora and sqlnet.ora files. No tnsnames.ora file yet.
    I don't have another client pc to connect to the server. This is a home based installation NOT connected to internet.
    The metalink note suggested a solution but i am not that familiar with linux/unix to know how to enable the interfaces. I just rebooted the boxes to see if that would solve the situation. am going to try again.....
    thanks

  • Hide an error from the application using a servererror trigger?

    We have an application designed for an old oracle version which issues some sql which is no more supported in todays database version.
    We want to use the application unchanged with a new database server.
    Old Server Version: 7.3.4 (still in production...)
    New Server Version: 10.2 or 11.2
    The application issues an
    ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS ;
    which results in ORA-01986 and the application dies.
    We would like to hide the error 01986 from the application using a trigger:
    create or replace
    trigger catch01986
      after servererror
      on schema
      begin
        if (ora_is_servererror (1986)) then
          null; -- what to do here? we want clear the ora-01986 from the error stack
        end if;
      end catch01986;How to handle the error, so that the alter session set ... statement is just ignored and no error code is returned to the application?
    I asked already some days ago in Database-General Forum, but triggers belong to PL/SQL, so i repost here.
    Tnx for help in advance!

    Hi,
    hoek wrote:
    A totally weird and untested (and unable to test today) thought:
    http://technology.amis.nl/blog/447/how-to-drive-your-colleagues-nuts-dbms_advanced_rewrite-oracle-10g
    Very interesting for real dirty solution.
    Does not work for my problem, DBMS_ADVANCED_REWRITE works only for select statements.
    BEGIN
       SYS.DBMS_ADVANCED_REWRITE.DECLARE_REWRITE_EQUIVALENCE (
       'alter_session_equivalence',
       'ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS',
       'ALTER SESSION SET OPTIMIZER_MODE = RULE',
       FALSE);
    END;
    ORA-30389: the source statement is not compatible with the destination statement
    ORA-00903: invalid table name
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 29
    ORA-06512: at "SYS.DBMS_ADVANCED_REWRITE", line 185
    ORA-06512: at line 2
    30389. 00000 -  "the source statement is not compatible with the destination statement"
    *Cause:    The SELECT clause of the source statement is not compatible with
               the SELECT clause of the destination statement
    *Action:   Verify both SELECT clauses are compatible with each other such as
               numbers of SELECT list items are the same and the datatype for
               each SELECT list item is compatible
    hoek wrote:You already had some trigger code, catching the error and sending it to null, why didn't that work?The trigger is fired when the error occurs, but after completion of the trigger, the error code is still delivered to the client.
    I dont know how to handle the error within the trigger.
    Does the client read the error stack and does it die after reading an error from the stack?The client just checks the error code. On error it terminates.
    With the SERVERERROR TRIGGER i did the following tests:
    Test 1: trigger does nothing
    CREATE OR REPLACE
    TRIGGER CATCH01986
      AFTER SERVERERROR
      ON SCHEMA
      BEGIN
        IF (ORA_IS_SERVERERROR (1986)) THEN
          NULL;
        END IF;
      END CATCH01986;
    ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS;
    ORA-01986: OPTIMIZER_GOAL is obsolete
    01986. 00000 -  "OPTIMIZER_GOAL is obsolete"
    *Cause:    An obsolete parameter, OPTIMIZER_GOAL, was referenced.
    *Action:   Use the OPTIMIZER_MODE parameter.
    -- Client Application reports errorcode 1986Test 2: Trigger raises NO_DATA_FOUND
    CREATE OR REPLACE
    TRIGGER CATCH01986
      AFTER SERVERERROR
      ON SCHEMA
      BEGIN
        IF (ORA_IS_SERVERERROR (1986)) THEN
          RAISE NO_DATA_FOUND;
        END IF;
      END CATCH01986;
    ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS;
    ORA-04088: error during execution of trigger 'AH.CATCH01986'
    ORA-01403: no data found
    ORA-06512: at line 9
    ORA-01986: OPTIMIZER_GOAL is obsolete
    04088. 00000 -  "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    -- Client Application reports errorcode 4088Test 3: Trigger raising an APPLICATION ERROR
    CREATE OR REPLACE
    TRIGGER CATCH01986
      AFTER SERVERERROR
      ON SCHEMA
      BEGIN
        IF (ORA_IS_SERVERERROR (1986)) THEN
            DBMS_STANDARD.RAISE_APPLICATION_ERROR(-20999, 'this makes no sense', true);
        END IF;
      END CATCH01986;
    ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS;
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20999: this makes no sense
    ORA-06512: at line 10
    ORA-01986: OPTIMIZER_GOAL is obsolete
    00604. 00000 -  "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
               (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
               can be corrected, do so; otherwise contact Oracle Support.
    -- Client Application reports errorcode 604Test 4: Adding an EXCEPTION part to the trigger does not help, this will catch only exceptions raised while the trigger executes:
    CREATE OR REPLACE
    TRIGGER CATCH01986
      AFTER SERVERERROR
      ON SCHEMA
      BEGIN
        IF (ORA_IS_SERVERERROR (1986)) THEN
            DBMS_STANDARD.RAISE_APPLICATION_ERROR(-20999, 'this makes no sense', true);
        END IF;
      EXCEPTION
        WHEN OTHERS THEN
          NULL;
      END CATCH01986;
    ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS;
    ORA-01986: OPTIMIZER_GOAL is obsolete
    01986. 00000 -  "OPTIMIZER_GOAL is obsolete"
    *Cause:    An obsolete parameter, OPTIMIZER_GOAL, was referenced.
    *Action:   Use the OPTIMIZER_MODE parameter.
    -- Client Application reports errorcode 1986So i do not know what to do inside the trigger to clean the error stack so that the client will receive no errorcode.

  • If the trigger is not working what is the possible reason

    I update the form then suppose auto update the table PaymentRecords , but today it sudden not working , not error on the trigger , what is the possible mistake ??
    delimiter $$
    CREATE TRIGGER Date_PaymentRecord
    AFTER UPDATE ON tableA
    FOR EACH ROW BEGIN
    IF NEW.Ast= 'on' THEN
    UPDATE PaymentRecords SET DueDate = New.ADate
    WHERE FeeType = 'Fee 1st Instalment'
    and PaymentRecords.UserId=New.UserId;
    end if;
    END$$
    delimiter ;
    not error at all , just not work

    This is the forum for issues with the SQL Developer tool. You should ask your question in the SQL and PL/SQL forum.

  • Error in the procedure

    please find the error in the procedure
    CREATE OR REPLACE PROCEDURE MIS_TEST_3 AS
    CURSOR C2 IS SELECT EMP_PAY,EMP_GRD_PAY,EMP_BASIC FROM EMP_VIEW WHERE EMP_PAY_MONTH='FEB' AND EMP_PAY_YEAR='2011' AND EMP_CAT=5 ORDER BY EMP_NO;
    V_PAY NUMBER(12);
    V_GRD_PAY NUMBER(12);
    V_BASIC NUMBER(12);
    V_PAY_PAGE NUMBER(20);
    V_GRD_PAY_PAGE NUMBER(20);
    V_BASIC_PAGE NUMBER(20);
    V_PAY_LAST NUMBER(20);
    V_GRD_PAY_LAST NUMBER(20);
    V_BASIC_LAST NUMBER(20);
    I INTEGER;
    PAGE INTEGER;
    BEGIN
    OPEN C2;
    I:=0;
    V_PAY:=0;
    V_GRD_PAY:=0;
    V_BASIC:=0;
    V_PAY_PAGE:=0;
    V_GRD_PAY_PAGE:=0;
    V_BASIC_PAGE:=0;
    V_PAY_LAST:=0;
    V_GRD_PAY_LAST:=0;
    V_BASIC_LAST:=0;
    PAGE:=1;
    LOOP
    EXIT WHEN C2%NOTFOUND;
    FETCH C2 INTO V_PAY,V_GRD_PAY,V_BASIC ;
    DBMS_OUTPUT.PUT_LINE(LPAD(V_PAY,15,' '),LPAD(V_GRD_PAY,15,' '),LPAD(V_BASIC,15,' '));
    I:=I+1;
    V_PAY_PAGE:=V_PAY_PAGE+V_PAY;
    V_GRD_PAY_PAGE:=V_GRD_PAY_PAGE+V_GRD_PAY;
    V_BASIC_PAGE:=V_BASIC_PAGE+V_BASIC;
    V_PAY_LAST:=V_PAY_LAST+V_PAY;
    V_GRD_PAY_LAST:=V_GRD_PAY_LAST+V_GRD_PAY;
    V_BASIC_LAST:=V_BASIC_LAST+V_BASIC;
    IF MOD (I,10)=0 THEN
    DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('SUB TOTAL PAGE '||PAGE||' '||LPAD(V_PAY_PAGE,15,' '),LPAD(V_GRD_PAY_PAGE,15,' '),LPAD(V_BASIC_PAGE,15,' '));
    DBMS_OUTPUT.PUT_LINE('-------------------------------------------------------------------------------------------------------------------------------------------------------');
    PAGE:=PAGE+1;
    V_PAY_PAGE:=0;
    V_GRD_PAY_PAGE:=0;
    V_BASIC_PAGE:=0;
    END IF;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('SUB TOTAL PAGE '||PAGE||' '||LPAD(V_PAY_PAGE,15,' '),LPAD(V_GRD_PAY_PAGE,15,' '),LPAD(V_BASIC_PAGE,15,' '));
    DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('GRAND TOTAL '|| LPAD(V_PAY_LAST,15,' '),LPAD(V_GRD_PAY_LAST,15,' '),LPAD(V_BASIC_LAST,15,' '));
    DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------------------------------------------------------------------------------------');
    END ;

    user9950484 wrote:
    please find the error in the procedure
    CREATE OR REPLACE PROCEDURE MIS_TEST_3 AS
    CURSOR C2 IS SELECT EMP_PAY,EMP_GRD_PAY,EMP_BASIC FROM EMP_VIEW WHERE EMP_PAY_MONTH='FEB' AND EMP_PAY_YEAR='2011' AND EMP_CAT=5 ORDER BY EMP_NO;
    V_PAY NUMBER(12);
    V_GRD_PAY NUMBER(12);
    V_BASIC NUMBER(12);
    V_PAY_PAGE NUMBER(20);
    V_GRD_PAY_PAGE NUMBER(20);
    V_BASIC_PAGE NUMBER(20);
    V_PAY_LAST NUMBER(20);
    V_GRD_PAY_LAST NUMBER(20);
    V_BASIC_LAST NUMBER(20);
    I INTEGER;
    PAGE INTEGER;
    BEGIN
    OPEN C2;
    I:=0;
    V_PAY:=0;
    V_GRD_PAY:=0;
    V_BASIC:=0;
    V_PAY_PAGE:=0;
    V_GRD_PAY_PAGE:=0;
    V_BASIC_PAGE:=0;
    V_PAY_LAST:=0;
    V_GRD_PAY_LAST:=0;
    V_BASIC_LAST:=0;
    PAGE:=1;
    LOOP
    EXIT WHEN C2%NOTFOUND;
    FETCH C2 INTO V_PAY,V_GRD_PAY,V_BASIC ;
    DBMS_OUTPUT.PUT_LINE(LPAD(V_PAY,15,' '),LPAD(V_GRD_PAY,15,' '),LPAD(V_BASIC,15,' '));
    I:=I+1;
    V_PAY_PAGE:=V_PAY_PAGE+V_PAY;
    V_GRD_PAY_PAGE:=V_GRD_PAY_PAGE+V_GRD_PAY;
    V_BASIC_PAGE:=V_BASIC_PAGE+V_BASIC;
    V_PAY_LAST:=V_PAY_LAST+V_PAY;
    V_GRD_PAY_LAST:=V_GRD_PAY_LAST+V_GRD_PAY;
    V_BASIC_LAST:=V_BASIC_LAST+V_BASIC;
    IF MOD (I,10)=0 THEN
    DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('SUB TOTAL PAGE '||PAGE||' '||LPAD(V_PAY_PAGE,15,' '),LPAD(V_GRD_PAY_PAGE,15,' '),LPAD(V_BASIC_PAGE,15,' '));
    DBMS_OUTPUT.PUT_LINE('-------------------------------------------------------------------------------------------------------------------------------------------------------');
    PAGE:=PAGE+1;
    V_PAY_PAGE:=0;
    V_GRD_PAY_PAGE:=0;
    V_BASIC_PAGE:=0;
    END IF;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('SUB TOTAL PAGE '||PAGE||' '||LPAD(V_PAY_PAGE,15,' '),LPAD(V_GRD_PAY_PAGE,15,' '),LPAD(V_BASIC_PAGE,15,' '));
    DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------------------------------------------------------------------------------------');
    DBMS_OUTPUT.PUT_LINE('GRAND TOTAL '|| LPAD(V_PAY_LAST,15,' '),LPAD(V_GRD_PAY_LAST,15,' '),LPAD(V_BASIC_LAST,15,' '));
    DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------------------------------------------------------------------------------------');
    END ;Hi,
    Have you executed above procedure?? If so ,then please post the error what you are getting??
    Regards,
    Achyut

  • How to Commit transaction even the trigger fails?

    Hi Everyone,
    I got a situation here, i have two tables and a trigger. A main table and a log table. Whenever  a change happens in the main transaction ,   a log details will be inserted into the log table.
    Am using sql server 2000 and "For insert,update,delete" in one trigger. 
    I am in need of commiting the original transaction even if the trigger fails. I mean the main table is so important for me, so all the transaction should commit in the main table no matter if some transactions details missed in the log table.
    I tried with
    begin try
    -- statement
    end try
    begin catch
    commit transaction
    end catch.
    But it doesnt works. My insert fails whenever the trigger fails. i want the transaction should continue even if the trigger fails...
    Pls suggest me how to do it.. Thanx for your help

    If the trigger action is optional, it should not be in a trigger. The idea of a trigger is that it is part of the statement, so if the trigger fails, the statement fails.
    As for what your alternatives are, it depends on which version on SQL Server you are using. You first say SQL 2000, but then you discuss TRY CATCH which was added in SQL 2005.
    What always works is to have a separate process that scans the main table for changes and the update the log. It can be difficult to identify the changes, though. It helps if you are on SQL 2008 where you can use Change Tracking.
    Another solution is to put a message on a Service Broker queue in the trigger, and then you have an activation procedure where you perform the operation with the log table. Of course, the SEND operation may fail, and you are back on square one. But it may
    be less likely that this fails than producing the log operation if this is complex and fragile.
    Also, a possibility is to add this statement to the trigger:
    SET XACT_ABORT OFF
    In this case, some errors in the trigger will not cause the statement to fail. More precisely, not errors that under normal circumstances terminates only the current statement, for instance PK violations, NOT NULL errors. There are still
    plenty of errors that always aborts the batch and rolls back the open transaction. For instance, conversion errors often rolls back the transaction. Note that SET XACT_ABORT only has effect in SQL 2005 or later.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Encountered the symbol create

    Hi guys I am trying to :
    CREATE or replace TYPE Complex AS OBJECT (
    rpart REAL,
    ipart REAL,
    MEMBER FUNCTION plus (x Complex) RETURN Complex
    CREATE TYPE BODY Complex AS
    MEMBER FUNCTION plus (x Complex) RETURN Complex IS
    BEGIN
    RETURN Complex(rpart + x.rpart, ipart + x.ipart);
    END plus;
    end;
    with Oracle Sql Developer 2.1 and 11g, but I get Error(6,1): PLS-00103: encountered the symbol "CREATE".
    Note that the code above is cut and paste from the Oracle Docs!!! Is this a bug of SQL Developer?!?!?!

    Justin,
    Yep, I'm talking about SQL Developer (version 2.1.0.63), and when I refer to a PL/SQL window I mean a Code Worksheet as opposed to a SQL worksheet. (In the Code worksheet I've got the "gears" icon where I can compile or compile for debug.) It is the default editor that opens when I open a .pks file that has both my pl/sql spec and body in it.
    So when I try to compile one of these PKS files that has the spec and body separated by the slash I get "Encountered the symbol "/". When I remove the slash and try to compile I get the error "Encountered the symbol CREATE".
    I understand these errors, and understand that If I pasted this script into a SQL worksheet and used F5 the code will compile with the "/" in it.
    Here is my question:
    Can I work with a file in the Code worksheet that has both the spec and body in it? If so, how do I get around the two errors mentioned above? We've used TOAD to date here and I'd rather move to SQL Developer. Do I have to break apart my pl/sql code files into separate spec and body files to make this move?
    Thanks,
    Bruce

  • Error in Forms while creating the trigger- WHEN-CREATE-RECORD

    Hello,
    Right now I am using 11g client side and 10g database.
    I am constantly getting an error while creating triggers in 11g.
    I have created a sequence in SQL developer using the following code:
    create sequence loc_id_sequence
    start with 14;
    After creating the sequence. I am trying to write the PL/SQL code in forms builder for the trigger WHEN-CREATE-RECORD
    declare
    loc_id number;
    begin
    loc_id := loc_id_sequence.nextval;
    end;
    But I have been getting the following error constantly. Can anyone please help me?
    "Error 0 at line 5, column 4
    SQL statement ignored".
    Can anyone please tell me why I am getting that error

    In fact, even I thought there might be some problem with the connectivity with the 10g database and 11g client but the other DB related code works.
    I just have the problem with using sequence for the trigger WHEN-CREATE-RECORD.
    In fact I also tried using WHEN-NEW-RECORD-INSTANCE smart trigger instead of WHEN-CREATE-RECORD for the same sequence. But even that doesn't work.
    Do u have any idea of what that error means?
    "Error 0 at line 5, column 4
    SQL statement ignored"
    Edited by: Pooja 1985 on Feb 26, 2013 5:43 PM
    Edited by: Pooja 1985 on Feb 26, 2013 5:44 PM

  • Error while deploying the trigger

    Hi All,
    In the trigger given below I want to append the data from all the table columns , to convert the numeric data to string i am using to_char function , but when i try to deploy the trigger i am getting the error.
    What could be the problem here?
    Is there any alternate way to achieve the same??
    Trigger
    ==========================================================
    create or replace trigger emp_delete
    after delete
    on emp
    for each row
    begin
         insert into Event(EventId,TableName,Pkey,OldValues,NewValues,DateTime,ActionType) values
         (My_Event_ID_Seq.NEXTVAL ,'emp','EMPNO',
         TO_CHAR(:old.EMPNO) || TO_CHAR(:old.ENAME) ||
         TO_CHAR(:old.JOB) || TO_CHAR(:old.MGR) ||
         TO_CHAR(:old.HIREDATE) || TO_CHAR(:old.SAL) ||
         TO_CHAR(:old.COMM) || TO_CHAR(:old.DEPTNO),
         ' ',SYSDATE,'D');     
    end;
    Error
    ==========================================================
    LINE/COL ERROR
    3/2 PL/SQL: SQL Statement ignored
    5/25 PLS-00307: too many declarations of 'TO_CHAR' match this call
    SQL&gt; help helpindex
    SP2-0172: No HELP available.

    Check you proxy settings. Disable them in your deployment tool / JDeveloper

  • Trigger created with errors

    Hi All,
    I have created a new trigger but it has compilation errors, I get the error which says SQL command not properly ended when look up in toad.Can you please advise what's wrong in my syntax below.
    Also ,inorder for me to rollback the trigger I just created do I need to drop that trigger and run the create or replace trigger statement or the create or replace statement will replace the previous trigger that I created.
    Thanks !
    create or replace TRIGGER Abcd.lddp_tup
    BEFORE UPDATE ON lddp FOR EACH ROW
    declare timenow TIMESTAMP;
    begin
    SELECT CURRENT_TIMESTAMP INTO timenow FROM DUAL
    :new.create_sid := :old.create_sid;
    :new.create_date := :old.create_date;
    :new.saved_date := timenow;
    :new.par_num := :old.par_num;
    :new.af_id := :old.af_id;
    IF
    :new.locked_bemsid IS NOT NULL AND :old.locked_sid IS NULL
    THEN
    :new.locked_date := timenow;
    ELSE
    :new.locked_sid := :old.locked_sid;
    :new.locked_date := :old.locked_date;
    END IF;
    end;
    /

    877410 wrote:
    Hi ,
    can you be more specific how that statement should be altered?can you spell PL/SQL without assistance?
    CREATE OR replace TRIGGER abcd.lddp_tup
      before UPDATE ON lddp
      FOR each ROW
    DECLARE
        timenow TIMESTAMP;
    BEGIN
        timenow := current_timestamp;
        :new.create_sid := :old.create_sid;
        :new.create_date := :old.create_date;
        :new.saved_date := timenow;
        :new.par_num := :old.par_num;
        :new.af_id := :old.af_id;
        IF :new.locked_bemsid IS NOT NULL
           AND :old.locked_sid IS NULL THEN
          :new.locked_date := timenow;
        ELSE
          :new.locked_sid := :old.locked_sid;
          :new.locked_date := :old.locked_date;
        END IF;
    END;
    /

  • Keep getting an error message that reads, "LR An error has occurred while creating the book on Blurb" An error has occurred while trying to create texts and fonts.  Pleas advise as Blurb has said that it's a LR issue.

    Keep getting an error message that reads, "LR An error has occurred while creating the book on Blurb" An error has occurred while trying to create texts and fonts.  Pleas advise as Blurb has said that it's a LR issue.

    Are you behind a firewall or double NAT??
    What is the device that is immediately plugged into the main modem or router? Has that one been able to update?
    It is plugged in of course isn't it.. no nasty join wireless anywhere??
    The best way to work around these sort of problems is to simplify the network.. Plug each device directly into the main router.. by ethernet. You can trigger the firmware upgrade by wireless but use ipad or iphone version of airport utility and see what happens.

  • DB Trigger error - Updating same table in the trigger script

    Hi All,
    I have a table tab1, when ever any update is done on this table on column col1 then col2 also need to get update.(These are linked to forms so user can update only col1 from form frontend)
    so I created a trigger as follows.
    CREATE OR REPLACE TRIGGER tri1
    AFTER UPDATE
    ON tab1
    FOR EACH ROW
    WHEN (NEW.col1 = 'YES')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    UPDATE tab1 SET col2= 1
    WHERE transaction_id = :OLD.transaction_id;
    COMMIT;
    END;
    When there is any update on this table I get following error. Please let me know if I miss any thing.
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at "user1.tab1", line 5
    ORA-04088: error during execution of trigger 'user1.tab1'
    Please let me know if I am not clear. Thanks
    Edited by: DharV on Aug 23, 2011 5:17 AM

    Is your transaction_id unique?
    If that is the case then you could perhaps use BEFORE UPDATE instead of AFTER UPDATE:
    CREATE OR REPLACE TRIGGER tri1
    BEFORE UPDATE
    ON tab1
    FOR EACH ROW
    WHEN (NEW.col1 = 'YES')
    BEGIN
       :NEW.col2 := 1;
    END;If your transaction_id is not unique - so you really want to update more than one row in tab1 - your update cannot update the same row as the trigger reacted upon, even with the use of autonomous transaction. Then you could combine the above BEFORE UPDATE trigger with your own AFTER UPDATE, but then add ROWID != :OLD.ROWID to the where clause, but it would be a bad idea because some of your rows will be updated in one transaction and others in another transaction.
    In general autonomous transaction is not a great way to solve mutating table problem in a trigger. Hopefully you have a unique transaction_id and can do BEFORE UPDATE - if not then a better way is to save the id's to be updated in a package array in the FOR EACH ROW triggers, and then do a AFTER UPDATE trigger that is NOT "for each row" to update the list of saved id's.

  • Error inserting data after creating a trigger (caused by commit)

    Hi,
    I have registered a schema so that XML files are stored in a table XMLREADINGS. I create an AFTER INSERT tigger on this table. The trigger is very basic (inserting the system date into a test table). I discovered that it works fine so long as there is no COMMIT statement in the trigger (an implicit commit is carried out). However if I have a COMMIT then creation of the trigger is fine, but when I try to drop new XML files into the repository (using WebDav) I get a file copy error.
    For this simple case the lack of an explicit COMMIT statement is okay, but I want to increase the logic of the trigger and I can imagine that there will be COMMIT and ROLLBACK statements required.
    Has anyone experienced this before ?
    regards
    Stephen

    I've just discovered that you aren't supposed to use commit or rollback in triggers anyway!
    A possible solution (found on this forum) is to declare the trigger as a autonomous transaction:
    If you are using Oracle 8i, you can use an autonomous transaction:
    CREATE OR REPLACE TRIGGER trg
    DECLARE
    Pragma Autonomous_Transaction
    BEGIN
    I'll give that a try

Maybe you are looking for