PL/Sql error when creating a trigger

Hello everyone m trying to set a trigger whose goal is to not allow any update insert or remove on the work table, if the day is Sunday. I tried this code but it gives me error
 create or replace trigger No_work_on_Sunday
 After insert or update or delete
on Work When owner='MAX'
for each row
begin
        if (select to_char(sysdate,'D')=1) then
                 raise_application_error(-20001,'no work on sunday');
      end if;
 end;

 
 on Work when owner='MAX'
         *
ERROR at line 3:
ORA-04077: WHEN clause cannot be used with table level triggers
Pls help

Published by: 781207 on July 16, 2010 07:43
create or replace trigger No_work_on_Sunday
 After logon on DATABASE
 begin
       if to_char(sysdate,'D')=1 then
                 if ora_login_user IN ('Jake','MAX') THEN
                     RAISE_APPLICATION_ERROR(-20001,'No work on sunday');
               end if;
      end if;
end;
/

SY.

Tags: Database

Similar Questions

  • What is this error when creating a trigger

    Hello

    I have create a trigger and get the following error. What is - c

    1 CREATE OR REPLACE TRIGGER TRG_AUDIT_LOGON AFTER
    2 LOG ON TO THE DATABASE
    3 Declare
    4 v_sid v$session.sid%type;
    type of v_serial 5 v$ session.serial # %;
    v_username 6 v$session.username%type;
    v_osuserid 7 v$session.osuser%type;
    8 v_machinename v$session.machine%type.
    v_PROGRAM 9 v$session.program%type;
    v_TERMINAL 10 v$session.terminal%type;
    11 v_hostname v$instance.host_name%type;
    v_instance_name 12 v$instance.instance_name%type;
    13 v_application_id v$database.dbid%type;
    date of v_logon_time 14;
    15 v_Audit_tab_check varchar2 (30);
    16 v_system_users_tab_check varchar2 (30);
    17 v_sql_Audit_upload varchar2 (1000): = "INSERT INTO dbaoper. T_AUDIT (HOST_NAME, APPLICATION_ID, INSTANCE_NAME, SID, SERIAL #, username, OSUSERID, MACHINENAME, PROGRAM, TERMINAL, LOGON_TIME) VALUES (: v_hostname,: v_application_id,: v_instance_name,: v_sid,: v_serial,: v_username,: v_osuserid,: v_machinename,: v_program,: v_TERMINAL,: v_logon_time) ';
    18 type c_audit_cur_typ is ref cursor;
    19 C_Audit c_audit_cur_typ;
    20 V_system_users_tab: = "T_SYSTEM_USERS";
    21 No_Audit_records Exception;
    Begin 22
    23 select table_name in v_Audit_tab_check from dba_tables where owner = 'DBAOPER' and table_name = "T_AUDIT";
    24 select table_name in v_system_users_tab_check from dba_tables where owner = 'DBAOPER' and table_name = "T_SYSTEM_USERS";
    25 c_Audit open for ' SELECT sid, serial # username, osuser, machine, terminal program v $ session WHERE audsid = userenv ("' sessionid" ') and program not as "'oracle@%J0%"' and no user name (select * from dbaoper.' |) V_system_users_tab |') and type! = "' BACKGROUND"' ';
    26 c_Audit of fetch in v_sid, v_serial, v_username, v_osuserid, v_machinename, v_program, v_TERMINAL;
    27 if c_Audit % Notfound then
    28 lift No_Audit_records;
    Else 29
    30 select host_name, instance_name in v_hostname, v_instance_name from v$ instance;
    31 select dbid from v_application_id from v$ database;
    32 select sysdate in double v_logon_time;
    33 execute immediate v_sql_Audit_upload using v_hostname, v_application_id, v_instance_name, v_sid, v_serial, v_username, v_osuserid, v_machinename, v_program, v_TERMINAL, v_logon_time;
    34 end if;
    35 close C_Audit;
    exception of 36
    37 when no_data_found then
    38 dbms_system.ksdwrt (2, 'ORA-20001 Audit T_AUDIT or T_SYSTEM_USERS not found Audit information tables are not entered'
    (39);
    40 what then No_Audit_records
    41 dbms_output.put_line ('Audit number to insert records");
    42 * end;
    SQL > /.

    WARNING: Trigger created with compilation errors.

    SQL > sho err
    Errors for TRG_AUDIT_LOGON TRIGGER:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    18/20 PLS-00103: encountered the symbol "=" when expecting one of the
    Next:
    constant exception < an ID >
    < a between double quote delimited identifiers > double Ref table Fedya
    char time timestamp interval date binary national character
    NCHAR
    The '< an identifier >' replaced with '=' to
    continue.


    Thank you
    Pramod

    replace * "' * with *" *. For example userenv ("' sessionid" ') to userenv ("sessionid")

  • New to OAF - oracle.jbo.RowCreateException: Houston-25017: error when creating a new entity for HeaderTableEO line

    Hi I'm new to OFA. I am trying to create a master-details form based on the example given on Youtube (but using my own paintings).

    I have already defined in table colums.

    AM code is as follows:

    Public Sub CreateEmailHdrRow()

    {

    xxVmmcSendEmailDefHdrVOImpl vo = getxxVmmcSendEmailDefHdrVO1();

    String s = "Test";

    Line = vo.createRow ();

    If (!) VO.isPreparedForExecution ())

    {

    vo.setMaxFetchSize (0);

    }

    row.setAttribute ("EmailDefName", s);

    row.setNewRowState (Row.STATUS_INITIALIZED);

    }

    When I run, the error occurs at the level of line (rank rank = vo.createRow ();)

    Error message: oracle.jbo.RowCreateException: Houston-25017: error when creating a new entity for xxVmmcSendEmailDefHdrEO line.

    Any help is appreciated.

    Anjan,

    Please check that the type of the CreatedBy attribute is a number representing the id in FND_USER and not the actual text of the name of the user. Standard Oracle columns that use a number for this value not varchar.

    Kristofer Cruz

  • oracle.jbo.RowCreateException: Houston-25017: error when creating a new entity.

    Hi all

    I get the following error when executing the Page create purchase orders. I extended the standard EntityObject class: Purchase Order Header to my EO custom, make one here to this EO origin.
    oracle.jbo.RowCreateException: Houston-25017: error when creating a new entity for CustomPurchaseOrderHeaderEO line

    Thank you

    Hi SumitSharma,

    Added the following line to the file Extended Entity Object.xml
    "DefClass ="oracle.apps.fnd.framework.server.OAEntityDefImpl"xx.oracle.apps"below the RowClass ="... "package line.

    This solved my error, but I can't do it this way is fair or unfair suggestions.

    Thank you

    Published by: 995022 on May 14, 2013 22:13

  • Error when creating an application of FDM on SQL Server 2005

    Hello

    We receive this error when you create an application of FDM on SQL Server 2005


    Error: EPMCSS-07003: unable to validate identity. Invalid identity. Verify the identity. [SET_ROLES_LIST]


    We use the integration of Windows system even if we also tested with the user's.

    Any ideas?

    Thank you

    Based on the error message that seems to have a problem of Shared Services. Check that the "ADMIN" account is used for the connection of HSS and that you are using "ADMIN" to create the application and see if the same error is returned.

  • problem when creating a trigger: SQL statement ignored

    Hello people,

    I am trying to create a trigger, but it is not created. Instead, I get the error message that a SQL statement at line 22 was ignored. It's the line indicating IF num2 = 1 THEN. I'd be happy if someone could point me in the right direction or solve my problem.

    CREATE OR REPLACE TRIGGER TriggerLogement BEFORE INSERT OR update ON tenants
    FOR EACH LINE
    DECLARE
    NUM INTEGER;
    num2 INTEGER;
    NUM3 INTEGER;
    paysLocataire VARCHAR2 (255);
    categorieLocataire VARCHAR2 (1);
    BEGIN
    SELECT COUNT (ns) IN the number OF tenants WHERE nomBat =: new.nomBat;

    IF num > 0 THEN
    SELECT paid IN the country OF sports WHERE ns =: new.ns;
    SELECT COUNT (country) IN number OF athletes sp, tenants lo WHERE sp.ns = lo.ns AND paysLocataire AND lo.nomBat = pays =: new.nomBat;
    IF num = 0 THEN
    raise_application_error (-20000, "building already in use for another nationality");
    ON THE OTHER
    SELECT COUNT (ns) IN num2 OF tenants WHERE nLogement =: new. NLogement AND nomBat =: new.nomBat;
    IF num2 = 2 THEN
    raise_application_error (-20000, 'full accommodation');
    ON THE OTHER
    IF num2 = 1 THEN
    CateogrieLocataire INTO SELECT category OF athletes WHERE ns = new.ns;
    SELECT COUNT (ns) IN num3 FROM tenant lo, sportsmen sp WHERE lo.ns = sp.ns
    AND lo.nLogement =: new. NLogement AND lo.nomBat =: new.nomBat AND sp.categorie = categorieLocataire;
    IF num3 = 0 THEN
    raise_application_error ("-20000, ' already in use for the other sex");
    END IF;
    END IF;
    END IF;
    END IF;
    END IF;
    END;

    If you need more information or if you have any questions about my posts please leave your questions or comments. I hope this isn't how completely wrong to enforce some constraints that I can't do with CONSTRAINT and CHECK in the schema definition.

    Thanks for your help and your attention.

    Sebastian

    Hello

    Whenever you have a problem that raises an error, display the full error message; do not paraphrase just part of it.

    In the triggers line numbers from the first statement DECLARE or BEGIN, so line 22 of your trigger is:

    SELECT categorie INTO cateogrieLocataire FROM Sportifs WHERE ns = new.ns;
    

    You are missing a colon before 'new': it should be:

    SELECT categorie INTO cateogrieLocataire FROM Sportifs WHERE ns = :new.ns;
    

    A FOR EACH ROW trigger on tenants cannot ask tenants. It's a shame: there are many useful things, you could do if that were allowed, but it's not.
    I'm not sure of what all queries. At least one of them:

    SELECT  COUNT (ns)
    INTO    num2
    FROM    Locataires
    WHERE   nLogement = :new.NLogement
    AND     nomBat    = :new.nomBat;
    
    IF num2 = 2 THEN
        raise_application_error(-20000,'accomodation full');
    

    can be replaced by a UNIQUE constraint. (Constraints are better than triggers, in any case.)

    If you can't do what you want with constraints, you can leave anyone directly INSERT or update the table: force them to use a procedure stored instead. You can have an INSTEAD OF trigger on a view, which is essentially the same, but allows you to use DML commands.

    If you need help, post some sample data and some examples of DML operations that must be allowed, given the data and some examples of DML operations that should not be allowed.

  • Get the error when creating indexes in RAC environment in 11 g

    Hi all

    I'm new concept CARS when creating index get below error

    Error: AX_DISABLE_HIST - a SQL error. Position of the error: 0
    Return: 12801 - ORA-12801: error reported in the P146, proceeding parallel query server
    ORA-12853: insufficient memory for buffers PX: run 425904K,.
    Max needed 11105280 K ORA-04031: unable to allocate 32792 bytes of memory ('', 'unknow shared pool
    UNIQUE INDEX CREATE PS_AX_DISABLE_HIST WE PS_AX_DISABLE_HIST (EMPLID) TABLESPACE PSINDEX STORAGE
    (MAXEXTENTS THEN 65536 40000 INITIAL UNLIMITED PCTINCREASE 0) PCTFREE 10 NOLOGGING PARALLEL

    am not able to understand, it's this problem is related to the index or sga memory. can any time help me on that.

    Thanks in advance
    Prabhakar

    Published by: 889571 on May 16, 2013 07:41

    You probably need SGA more because you have a lot of Parallels/slave servers in your instance. I see that you have at least 146. How many processors do you have? Do you need so many parallel servers?

    Lordane Iotzov

  • Error when creating a new DAC connection using the MSSQL connection type

    Hello

    I am trying to create a connection DAC, i.e. a new repository DAC in the SQL Server 2008 database.
    Version of the DAC: 10.1.3.4.1
    Database: SQL Server 2008


    I downloaded from the link below sqljdbc4.jar file and placed it in the D:\orahome\10gR3_1\bifoundation\dac\lib folder.
    [http://www.microsoft.com/en-us/download/details.aspx?displaylang=en & id = 11774]

    I entered all the details correctly to the name of the database, the database host, port of the database. I created a new file for authentication.

    I get error when I try to test the connection below.

    Driver MESSAGE: MSSQL not available!
    CLASS EXCEPTION: java.lang.IllegalArgumentException

    com.siebel.etl.gui.login.LoginDataHandler$ LoginStructure.testConnection (LoginDataHandler.java:512)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$ Executor.run (ConnectionTestDialog.java:290)

    : CAUSE:
    MESSAGE: com. Microsoft.SqlServer.JDBC.SQLServerDriver
    EXCEPTION CLASS: java.lang.ClassNotFoundException

    java.net.URLClassLoader$ 1.run(URLClassLoader.java:200)
    java.security.AccessController.doPrivileged (Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:276)
    java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    java.lang.Class.forName0 (Native Method)
    java.lang.Class.forName(Class.java:169)
    com.siebel.etl.gui.login.LoginDataHandler$ LoginStructure.testConnection (LoginDataHandler.java:510)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$ Executor.run (ConnectionTestDialog.java:290)


    The error seems to be a problem of connectivity to SQL Server. I use the correct jar file?

    Please, help me to solve this problem. Appreciate the help given on this forum earlier.

    Thank you

    Add
    .\lib\sqljdbc4.jar
    at the end of the line beginning with SQLSERVERLIB in the file config.bat

    Pls correct brand

  • Error when create control LabVIEW FPGA CompactRIO

    I have error when you try to create a new model of LabVIEW FPGA CompactRIO control project. I tried with LabVIEW 2014 and 2014 SP1 update. This error always occurs.

    Please help me with this.

    Kind regards

    Thang Nguyen

    Hello

    I fix the problem by removing LabVIEW 2014 SP1 and reinstall again. After the reinstallation of LabVIEW, I create the project template.

    Kind regards

  • error when creating a new partition "the operation you selected will convert the selected disk from basic to dynamic disk...". »

    Original title: getting the error while creating a new partition

    here to create a new partition get the error "the operation you selected will convert the disc selected basic to dynamic disk... etc" Please help.

    I would like to join the screenshot of the error, how?

    Hello

    1 have had any changes made on the computer before the show?

    2. how many partitions are there currently on the computer?

    3. how many hard disks on the computer do you use?

    4. when exactly you get the error message?

    I suggest you refer to the article and try to follow the steps and check if you are able to create a partition:

    Create a new Partition on a hard disk in Windows 7

    http://TechNet.Microsoft.com/en-us/magazine/gg309170.aspx

    I also suggest you the link and attach a screenshot of the screen.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/how-do-i-post-a-screen-shot-on-this-forum/c86de820-C620-401c-A804-9f6337cd3053

  • Error when creating a playlist

    trying to create another playlist and error says: Windows media player encountered a problem while creating or save the playlist

    When trying to create an other error playlist says: Windows media player encounter a problem when creating or saving the playlist

    Hi Dexter Moore,

    ·         You save the list of reading in a different format?

    ·         If Yes, what is the format of the playlist?

    ·         You receive an error with the error code?

    Rebuild the media database and check if that helps. Follow these steps to rebuild the database:

    i. Click Start, in the search box, type in %LOCALAPPDATA%\Microsoft\Media Player

    II. remove the Media player folder

    III. to restart the computer, the Media player folder will be automatically recreated. Check whether the problem is resolved.

    NOTE: Before rebuild you the library, make sure you only saved the data associated with the library.

    You can check the link below: Windows Media Player playlist: frequently asked questions: http://windows.microsoft.com/en-us/windows7/Windows-Media-Player-playlist-frequently-asked-questions

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • "APP-OFA-48289: unknown error when creating control systems (immobilization).

    Hello

    I have problem

    Navigator: Fixed Asset Manager > Setup > system > control systems

    When I tried to create in the system controls are error message:

    "APP-OFA-48289: unknown error." Please contact your system administrator. »


    OS: Linux
    EBS: Oracle R12.1.3
    Database: 10g


    Thank you

    Escaline

    Navigator: Fixed Asset Manager > Setup > active system > system controls

    When I tried to create in the system controls are error message:

    "APP-OFA-48289: unknown error." Please contact your system administrator. »

    OS: Linux
    EBS: Oracle R12.1.3
    Database: 10g

    Please see (APP-OFA-48289 unknown error when recording data in system controls form FAXSUSTL.) [ID] 966382.1).

    Thank you
    Hussein

  • Error when creating new record in the jspx page.

    Hello! I have error when you try to post the new record in the jspx page (see: http://my.jetscreenshot.com/2677/20100820-oo8z-19kb)

    DB I trigger and in the EO primary key attribute I Type set to DBSequence.

    Where is the problem and what to do?

    Best regards, Debuger

    @Sireesha excellent point!

    @Debugger the reason why you get the error, it is you're missing an af:convertNumber, however, as said Jean Lou, why even put a DBSequence field on your screen?

    John

  • Error when creating connections of system files

    I am currently trying UI lapoursuitedes with ADF faces.

    I have encounter this error when I try to create a connection to file system to a JAR file that I was sent successfully, but when I try to test the connection I got this msg: the path of the specified file system is a directory. Basic path=[C:\Infrastructure\UIResources\deploy\adflibUIResources1.jar] solved path=[C:\Infrastructure\UIResources\deploy\adflibUIResources1.jar]. This indicates succeeded my link with the jar file that I created earlier. The directory of the path here is exactly the same, as I deloyed.

    Please help me

    Thank you
    Shirleen

    Published by: Shirleen on July 16, 2009 10:59

    Shirleen salvation,

    You must give only until the directory path, does not include the file. Try Don 'C:\Infrastructure\UIResources\deploy' for the path of the directory, once the connection is created, you should be able to see the jar under the connection.

    Jean Lou

  • Error when creating custom text field

    HI Guyz,

    I am getting below error while creating a new custom UDF text field. All the world is facing this problem earlier?

    "Houston-COLUMN_UNAVAILABLE: no additional custom attributes of this type cannot be created"

    Swati - PÉAN

    The problem is finally solved.

    Yes, there are several udf to IOM. However, it stores the details in a table of the adf. Cleaning of the custom fields were created.

    TRUNCATE TABLE ADF_EXTENSION_COLUMN_USAGE;

    DELETE ADF_EXTENSIBLE_TABLE_USAGE;

    COMMIT;

    -Swati Pandey

Maybe you are looking for

  • Need the latest version of the video driver for Satellite A200

    Excuse for my English PLZ! I need the latest driver for 7300 Go (for most games and AutoCad).Now it is my driver: NVIDIA, 23.08.2007, 6.14.11.5655, Microsoft Windows Hardware Compatibility Publisher.Thank you very much.

  • Cannot install the update system for Xperia E1

    I can't upgrade my Xperia E1 to the latest version 20.1.A.2.13. My mobile Update Center shows me the update of the system. I can download the update, but when I click on install I get an error it says not able to install the new version of the softwa

  • Or is the firmware of the cisco SRP527W please?

    Hello Now everything is in the title, indeed after a google search I find this page here: https://supportforums.cisco.com/docs/DOC-13853, I think that it is the privilege downloads Firmware SRP520 but it's 404 error. I'm afraid of being mistaken as t

  • Could not save the sound in windows 7 64 bit with Conexant Smartaudio HD

    Facing problem in sound recording & speech recognition in my laptop installed with Windows 7 Home Premium (64-bit). Audio by default in my portable device is HD(Driver version 8.54.0.53; date 18-02-2011) Conexant Smartaudio. The system is not able to

  • The screen display is upside down when the laptop is turned on

    Whenever I turn on the laptop, the display shows an upside, I have to press the key (f4) projector whenever I start up the screen in the right way and when I always play games on your laptop, they appear backwards and cannot be overturned around back