Creating a trigger to enforce data validation

I would like to create a trigger to do some basic data validation. For example, to join an honors society a student must have a gpa between 3.7 and 4.0. I want this to fire before an insert on the table NatlHonSoc, and the field name is gpa.
Thanks!

user8775995 wrote:
I'm trying to learn how to use triggers and just made this example up. It always helps to state your real intent from the beginning.
All I have is the general syntax from a book <snip>"A" book? Which book? Just any old book?
There is no book better to start with than the official documentation.
Learning where to look things up in the documentation is time well spent investing in your career. To that end, you should drop everything else you are doing and do the following:
Go to tahiti.oracle.com. Drill down to your product and version.
Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab you will find the complete documentation library.
Spend a few minutes just getting familiar with what kind of documentation is available there by simply browsing the titles under the "Books" tab.
Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what kind of information is available there.
Do the same with the SQL Reference Manual.
Do the same with the Utilities manual.
You don't have to read the above in depth. They are reference manuals. Just get familiar with what is there to be referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
As pointed out by Centinul, for your purpose, you should include the Application Developer's Guide as part of your "must reference" books.
Then set yourself a plan to dig deeper.
- Read a chapter a day from the Concepts Manual.
- Look in your alert log and find all the non-default initialization parms listed at instance startup. Then read up on each one of them in the Reference Manual.
- Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
- When you have finished reading the Concepts Manual, do it again.
Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.

Similar Messages

  • Create Table Trigger to replicate data from MSSQL2K5 to Oracle 11G on Linux

    I am trying to create a trigger on my MSSQL 2k5 server so that when a record is inserted, a replicated record is created in a table on an Oracle 11g database on a Linux server (Oracle Linux 6).
    Creating the trigger is easy, but when I test it I am getting an error stating the following:
    .NetSqlClient Data Provider The operation could not be performed because OLE DB Provider 'OraOLEDB.Oracle' for linked server "<myserver>" was unable to begin the distributed transaction.
    OLEDB Provider "OraOLEDB.Oracle" for linked server "<myserver>" returned: "New transaction cannot enlist in the specified transaction coordinator"
    Here is the trigger (MSSQL):
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE insert_aban8_state
        @an8 int,
        @st nvarchar(3)
    AS
    BEGIN
        SET NOCOUNT ON;
        declare @c numeric
        select @c = count(*) from [e9db]..[CRPDTA].[ABAN8_STATE$] where alan8=@an8 and aladds=@st
        if(@c =0)
         begin
            insert into [e9db]..[CRPDTA].[ABAN8_STATE$]
            values(@an8, @st)
         end
        END
    GO
    After reviewing the MS Transaction Coordinator, I am now totally confused. I checked the services and have the MS DTC enabled and running, but am not sure what to do on the Linux side.
    Does the Oracle Services for Microsoft Transaction Server (OraMTS) work on Linux? I could only find references for this for Oracle 11g on Windows.
    What do I need to do to enable this replication via mssql table trigger to Oracle11g on Linux?

    nsidev wrote:
    While I would agree in part, it appears from the message that the trigger is requiring the Transaction Service to be enabled on both the host and target. The point of this post is to determine what, if anything, I need to do on my Oracle DB to allow the trigger to complete successfully.
    There are many posts found with Google concerning the OraMTS service on the Oracle system, but they all appear to be for Windows based systems. My question is, is this service part of the Linux based Oracle DB and if so, how do I initialize it?
    If I am mistaken and this is truly an issue with the MSSQL server, I will replicate the post in those forums. I am just looking for direction and help.
    1) I have NEVER heard that Oracle has, knows about, or supports any "Transaction Service".
    2) Consider what I previously posted regarding the flavor of client source.
    If your assertion about this mythical service were correct, then the Oracle DB would have to be able to "know" that this client connection was originated by SQL Server.
    I don't understand how or why Oracle should behave differently depending upon whether INSERT is done inside or outside a MS SQL Server trigger.
    Please explain & elaborate why Oracle should behave different depending upon the source of any INSERT statement.
    3) From Oracle DB standpoint an INSERT is an INSERT; regardless of the client.

  • Create a trigger to copy data from table A to table B

    Hi,
    I been trying with no success to create a trigger on table a , so when the user update or delete or insert data on that table, I would like to copy all data from table a to table b BEFORE, the statement execute, I am using Oracle database 10g XE. It's URGENT and I would appreciate any quick response.
    Thank you in advance.

    > All what I needed to do is to copy / beckup the tableA before any changes done to the table
    Why? You are not giving us a problem to look at, analyse, and assist with - you are giving us a solution. That solution says "backup table before changes are made".
    This solution sounds very strange in the context of a RDBMS. Even stranger when dealing with relational design as one would use date and time to keep track of how data is changing.
    This, and your implementation of the solution (using triggers and DDL inside it!), makes me question whether this solution is indeed at all a solution. I see flaws and problems all the way.
    What happens if two users inserts at the same time into table A? Two truncates will be fired on table B. Then the entire contents of A (and not the changes) inserted into table B? Ridiculous...
    Thus from my point of view, looking at what you have presented to the forum in this thread, you do not seem to have any grasp on how to correctly use a RDBMS, never mind use Oracle.
    Ignorance is not a problem. It is fairly easily curable. Which is why I referred you to the manuals.
    Alternatively, instead of asking the forum how to make a flawed solution works, how about instead telling us the actual problem you are trying to solve?

  • Create a trigger to check inserted date is before or after SYSDATE

    Hi,
    I am trying to create a trigger that will check an inserted date against SYSDATE and alter the value (i.e. make it SYSDATE) when the entered date is incorrect.
    For example, I have a Customer table with a record named MemberDate which, when a date is entered to it, will be checked by the trigger to ensure it is not before the current date.
    My code so far;
    CREATE OR REPLACE TRIGGER Customer
    BEFORE INSERT ON
    Customer
    FOR EACH ROW
    DECLARE
    e_invaliddate_ud EXCEPTION;
    BEGIN
    IF :NEW.MemberDate < SYSDATE THEN
    RAISE e_invaliddate_ud;
    END IF;
    EXCEPTION
    WHEN e_invaliddate_ud THEN
    DBMS_OUTPUT.PUT_LINE('The date entered for MemberDate is invalid. The
    MemberDate has been set to the current date');
    END;
    So far, this trigger only returns an error message but allows the date to be entered even if it is incorrect. I have tried a few ways of altering the entered date to SYSDATE but to no avail.
    I am running scripts using SQL PLUS and inserting data using
    INSERT INTO Customer
    VALUES(CustomerID, ..., MemberDate);
    Where the values entered will be checked to ensure the MemberDate is not before SYSDATE.
    The MemberDate data-type is DATE and has a rule that it must not be before the current date. I am aware that a constraint may not be used to perform a check using SYSDATE, this is why I am trying to make a trigger.
    However, my knowledge of triggers is limited
    If anyone can help, I will be very Happy.
    Thank you in advance.

    Use this if you want an error message that halts the execution:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      if :new.memberdate < sysdate
      then
        raise_application_error(-20000,'The date entered for MemberDate is invalid.');
      end if;
    end;Use this if you want to automatically to overwrite the MemberDate with sysdate without an error message:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      :new.memberdate := greatest(sysdate,:new.memberdate);
    end;Note: untested
    Regards,
    Rob.

  • List data validation failed when creating a new list item but does not fail when editing an existing item

    Dear SharePoint Experts,
    Please help.
    Why does my simple formula work in Excel but not-work in SharePoint?
    Why does this formula...
    =IF([Request Type]="Review",(IF(ISBLANK([Request Date]),FALSE,TRUE)),TRUE)
    ...work in Excel but fail when I try to use it in SharePoint?
    The intent of this formula is the following...
    If the field "Request Type" has the value "Review" and the field "Request Data" is blank then show FALSE, otherwise show TRUE.
    SharePoint saves the formula, but when a list item is saved where the formula is implemented, (under List Settings, List Validation), SharePoint does not, say anything other than that the formula failed.
    Note that the "list data validation failed" error only happens when I am creating a new item-- the formula above works just fine when one is trying to Save on the edit form. 
    Can you help?
    Thanks.
    -- Mark Kamoski

    Dear Jason,
    I appreciate your efforts.
    However, it seems to me that this statement of yours is not correct...
    "If it meet the validation formula, then you can new or edit the item, otherwise, it will throw the 'list data validation failed' error, it is by design".
    I believe this is NOT the answer for the following reasons.
    When I create a new item and click Save, the validation error is "list data validation failed".
    When I edit an existing item and click Save, the validation error is "my custom error message" and this is, I believe, the way it needs to work each time.
    I think, at the core, the error my formula does not handle some condition of null or blank or other default value.
    I tried a forumla that casts the date back to a string, and then checked the string for a default value, but that did not work.
    I tried looking up the Correlation ID in the ULS when "list data validation failed" occurs, but that gave no useful information because, even though logging was set to Verbose, the stack trace in the error log was truncated and did not given any
    good details.
    However, it seems to me that SharePoint 2013 is not well-suited for complex validation rules, because...
    SharePoint 2013 list-level validation (NOT column-level validation) allows only 1 input for all the multi-field validation formulas in a given list-- so, if I had more than 1 multi-field validation rule to implement on a given list, it would need to be packed
    into that single-line-of-code forumla style, like Excel does. That is not practice to write, debug, or maintain.
    SharePoint 2013 list-level validation only allows 1 block of text for all such multi-field validation rules. So that will not work because I would have something like "Validation failed for one or more of the following reasons-- withdrawal cannot exceed
    available balance, date-of-birth cannot be after date-of-death,... etc". That will not work for me.
    The real and awesome solution would simply be enhancing SP 2013 so that column-level validation forumlas are able to reference other columns.
    But, for now, my workaround solution is to use JavaScript and jQuery, hook the onclick handler on the Save button, and that works good. The only problem, is that the jQuery validation rules run before any of the column-level rules created  with OOTB
    SP 2013. So, in some cases, there is an extra click for the enduser.
    Thanks,
    Mark Kamoski
    -- Mark Kamoski

  • Acrobat 9.3.4 doesn't enforce Date Formating

    After we upgraded to Acrobat 9.3.4 from a previous version of 9.3 acrobat doesn't enforce date formating..before in a Text field formated as Date mm/dd/yyyy it would autocompelete if we typed in 9/21 to 9/21/2010.. now it doesn't, we can type any random text in the field and it isn't validated.
    Ideas?

    Just checked, its enabled.. when I say validate I'm referring to Acrobat's internal date format validation, not JavaScript.
    For example if you create a text box, goto properties, format tab, format category = date, date options mm/dd/yyyy
    now if you type:
    "abcdef" in that text box it should say, "Invalid Date/time: please ensure that the date/time exists.
    if you type 9/21 it will automatically turn it into 9/21/2010.
    After Appling the 9.3.4 update no such validation takes place, any value entered is accepted..

  • Enforce date datatype in oracle 11g

    Can I restrict database so that application can not enter date data in certain format.
    E.g. If I want that date enter should be registered in [year to minute] 'MM-DD-YYYY' hh:mm' only format and not in [year to second format]'MM-DD-YYYY' hh:mm:ss' then how I can do it in Oracle 11g.
    Currently I am using oracle sql developer to create data model and then I want to generate DDL from that to generate database. Is there is any facility in Oracle SQL developer to enforce format specification.
    thanks!

    This is not really related to SQLDeveloper, so you may find better answers in another forum but I'll try to give you an idea anyway.
    Actually the DATE datatype has no format, you use a format when you convert it to a string or vice versa, but the DATE itself is just a DATE.
    You could probably create a trigger to truncate your data as you see fit, but IMHO your best option would be to remove the seconds from your output queries using something like
    TO_CHAR(YOUR_DATE_FIELD,'MM-DD-YYYY HH24:MI')you can also set this output format for SQLDeveloper in
    Tools -> Preferences -> Database -> NLSbut this will work only for SQLDeveloper, it's up to you to determine the best way of setting the output/input date format in your specific application.

  • Basic help needed creating a trigger

    I'm completely new to SQL programming altogether, and I'm trying to set up a trigger that will make some checks before adding a new row to a given table. I am trying to do this because I need to enforce a CONSTRAINT that checks whether the dates entered for 'deadline' and 'startDate' are greater than sysdate and less than (sysdate + 365), and I found out that you cannot reference sysdate from a CONSTRAINT. Therefore I am now attempting to do this using a trigger, but I don't really know how to do this. Here is the sql code used to create the table:
    -- PLACEMENT TABLE
    DROP TABLE placement;
    CREATE TABLE placement
    contactId Int,
    placementId Int,
    position VARCHAR(60),
    description CLOB,
    lengMonths Int,
    salary Number(7,2),
    deadline DATE,
    startDate DATE,
    addrLine1 VARCHAR(120),
    postCd VARCHAR(10)
    And here is my attempt at creating the trigger that will only allow the deadline and startDate to be entered if they satisfy the following check: (sysdate < deadline/startDate <= sysdate+365)
    CREATE OR REPLACE TRIGGER trg_deadline_low BEFORE INSERT OR UPDATE OF deadline ON placement
    BEGIN
    IF :deadline <= SYSDATE THEN
    ROLLBACK;
    END IF;
    END;
    CREATE OR REPLACE TRIGGER trg_deadline_high BEFORE INSERT OR UPDATE OF deadline ON placement
    BEGIN
    IF :deadline > SYSDATE + 365 THEN
    ROLLBACK;
    END IF;
    END;
    If possible, I would like for these triggers to display an error rather than just using ROLLBACK, but I'm not sure how! At the moment, these triggers do not work at all; I get an error message "Warning: Trigger created with compilation errors." when I attempt to create the triggers in the first place.
    Can anyone tell me why I am seeing this error when trying to implement the triggers? And if anyone could also improve on my amateur attempt at coding a trigger, then that would be great! Thanks for any help!

    Oops!
    Nicolas, Thank you for correcting my mistake.
    SQL> edit
    Wrote file afiedt.buf
    1 CREATE TABLE placement
    2 (
    3 contactId Int,
    4 placementId Int,
    5 position VARCHAR(60),
    6 description CLOB,
    7 lengMonths Int,
    8 salary Number(7,2),
    9 deadline DATE check (deadline between sysdate and sysdate+365),
    10 startDate DATE,
    11 addrLine1 VARCHAR(120),
    12 postCd VARCHAR(10)
    13* )
    SQL> /
    deadline DATE check (deadline between sysdate and sysdate+365),
    ERROR at line 9:
    ORA-02436: date or system variable wrongly specified in CHECK constraint
    SQL> edit
    Wrote file afiedt.buf
    1 CREATE TABLE placement
    2 (
    3 contactId Int,
    4 placementId Int,
    5 position VARCHAR(60),
    6 description CLOB,
    7 lengMonths Int,
    8 salary Number(7,2),
    9 deadline DATE check (deadline between to_date('2007-03-21','yyyy-mm-dd') and to_date('2008-03-21','yyyy-mm-dd')
    10 startDate DATE,
    11 addrLine1 VARCHAR(120),
    12 postCd VARCHAR(10)
    13* )
    SQL> /
    Table created.
    On the contrary, I think that OP want an error instead of rollback : "I would like for these triggers to display an error rather than just using ROLLBACK"Ah, I had misread additionally. Sorry.

  • The timesheet creation failed, because of problems with the project I server or with data validation

    Hi,
    One of my user is facing issue in creating new time sheet,
    "The time sheet creation failed, because of problems with the project server or with data validations".
    This issue is coming to only few members out of 10000 members.
    Note: For the same user, can able to do in other machines. only the problem in his machine. Have ran the office diagnostics, but still the problem persists.
    Is any add-on's/any settings need to update in IE. Could any one please help me on how to fix this issue?
    Many thanks in advance.

    I would check the compatibility settings in IE etc, or try another browser (chrome, safari etc.)
    Ben Howard [MVP] | web |
    blog | book

  • Excise Invoice Cancellation on Date validation only

    Hi Experts,
    i am having critical requirement from Business, which is not available in SAP Standard, So i need help from you guys...
    Excise invoice can be cancelled on the same day of system/posting date. but when the system date and posting dates are not matching it should through error..
    Example  : i created Excise invoice on 17th june,2011 this is posting date of excise invoice, if i try to cancell on 17th june , it should allow.
                        but when i try to cancell the excise invoice on 18th june (system date) , it should not allow to cancell and it say Error !!!
    i heard there will be possible through User Exit  OR Function Module OR Routins ... Please help me
    Thanks and Regards
    Madhu

    Dear Madhusudhanan,
    Following are the list of User Exits available for J1IIN
    J_1I7_USEREXIT_EXCISE_BEF_SAVE User exit after the excise header and details are written and they can changed in J1IS  , J1IIN and Automatic creation of Excise Invoice.
    J_1I7_USEREXIT_EXINV_ADDL_DATA User exit for Excise Invoice Additional Data    in J1IS and J1IG                 
    J_1I7_USEREXIT_J1I5_MATFORM    User exit for J1I5 material form changes                           
    J_1I7_USEREXIT_J1I5_VALIDATE   User exit for subsequent J1I5 data validation                      
    J_1I7_USEREXIT_J1IEX_BEF_SAVE User exit for J1IEX before the data is saved                    
    J_1I7_USEREXIT_J1IEX_CHANGE    User exit for changing data before display             
    J_1I7_USEREXIT_J1IS_BASE_VALUE User exit to Change base value in J1IS                
    I strongly believe that the first exit will serve the purpose.
    Now if you are cancelling it using J1IH, Check the following thread.
    J1IH-User Exit
    Thanks & Regards,
    Hegal K Charles

  • Error in creating a trigger

    i am creating a trigger i am getting an error
    create or replace TRIGGER INS_Discharge
    AFTER INSERT
    ON Discharge
    FOR EACH ROW
    AS
    declare
    vr_DischargeType INT ;
    vr_Visit_ID INT ;
    vr_Discharge_Date DATE;
    vr_VisitDate DATE;
    vr_AdmTime varchar(5) ;
    vr_TransferID INT ;
    vr_BedID AS INT ;
    BEGIN
    select :NEW.DischargeType into vr_DischargeType
    from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date
    from dual;
    select :NEW.VisitDate into vr_VisitDate
    from dual;
    SELECT VisitDate into vr_VisitDate FROM Visit WHERE Visit_ID = vr_Visit_ID ;
    UPDATE Visit SET DischargeType = vr_DischargeType, DischargeDate = vr_Discharge_Date
    WHERE Visit_ID = vr_Visit_ID ;
    SELECT MAX(Transfer_ID)into vr_TransferID FROM BedSchedule WHERE VisitID = vr_Visit_ID ;
    IF vr_DischargeType = 2 then
    SELECT Bed_ID into vr_BedID FROM BedSchedule WHERE Transfer_ID = vr_TransferID ;
    UPDATE Bed_Mst SET Bed_Status_ID = 1 WHERE Bed_ID = vr_BedID ;
    :NEW.Bed_ID :=vr_BedID;
    end if;
    END ;
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    i have done you said .... i have oracle version 10g
    create or replace TRIGGER trUPD_Discharge
    AFTER UPDATE
    ON Discharge
    for each row
    AS
    declare
    vr_DischargeType INT ;
    vr_Discharge_Date DATE;
    vr_Visit_ID INT ;
    vr_CancelStatus INt;
    BEGIN
    /*select :NEW.DischargeType into vr_DischargeType from dual;
    select :NEW.Visit_ID into vr_Visit_ID from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date from dual;
    select nvl((select :NEW.CancelStatus from dual),0)
    into vr_CancelStatus from dual;
    If vr_CancelStatus = 0 then
    UPDATE Visit SET DischargeType = :NEW.DischargeType,
    DischargeDate =:NEW.Discharge_Date WHERE Visit_ID = :NEW.Visit_ID ;
    end if;
    END;
    but still getting same error
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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.

  • Whats this error while creating a trigger

    HI ,
    I was creating a trigger and getting the following Error . What is this
    1 CREATE OR REPLACE TRIGGER TRG_AUDIT_LOGON AFTER
    2 LOGON ON DATABASE
    3 Declare
    4 v_sid v$session.sid%type ;
    5 v_serial v$session.serial# %type;
    6 v_username v$session.username%type;
    7 v_osuserid v$session.osuser%type;
    8 v_machinename v$session.machine%type;
    9 v_PROGRAM v$session.program%type;
    10 v_TERMINAL v$session.terminal%type;
    11 v_hostname v$instance.host_name%type;
    12 v_instance_name v$instance.instance_name%type;
    13 v_application_id v$database.dbid%type;
    14 v_logon_time date;
    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;
    22 Begin
    23 Select table_name into v_Audit_tab_check from dba_tables where owner='DBAOPER' and table_name='T_AUDIT';
    24 Select table_name into v_system_users_tab_check from dba_tables where owner='DBAOPER' and table_name='T_SYSTEM_USERS';
    25 Open c_Audit for ' SELECT sid, serial#, username, osuser, machine, program, terminal FROM v$session WHERE audsid = userenv (''''sessionid'''') and program not like ''''oracle@%J0%'''' and username not in (select * from dbaoper.' || V_system_users_tab||' ) and type!=''''BACKGROUND'''' ' ;
    26 Fetch c_Audit into v_sid, v_serial, v_username, v_osuserid, v_machinename,v_program,v_TERMINAL ;
    27 If c_Audit%Notfound then
    28 Raise No_Audit_records ;
    29 Else
    30 Select host_name, instance_name into v_hostname, v_instance_name from v$instance;
    31 select dbid into v_application_id from v$database;
    32 select sysdate into v_logon_time from dual;
    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;
    36 exception
    37 when no_data_found then
    38 dbms_system.ksdwrt(2, ' ORA-20001 Audit tables T_AUDIT or T_SYSTEM_USERS not found Audit information is not being captured'
    39 );
    40 When No_Audit_records then
    41 dbms_output.put_line ('No Audit records to insert ');
    42* end;
    SQL> /
    Warning: Trigger created with compilation errors.
    SQL> sho err
    Errors for TRIGGER TRG_AUDIT_LOGON:
    LINE/COL ERROR
    18/20 PLS-00103: Encountered the symbol "=" when expecting one of the
    following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    The symbol "<an identifier>" was substituted for "=" to
    continue.
    Thanks
    Pramod

    Hi
    I am sorry...i am getting the following error once trigger is created and one of the user is trying to connect....what might be the reason ?
    Enter user-name: test
    Enter password:
    ERROR:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00907: missing right parenthesis
    ORA-06512: at line 23
    Thanks
    Prmaod

  • Date validation

    Hi ,
    I have a created an textbox with date picker as (dd-mon-yyyy) .
    Now i want to create a validation on it for the format (dd-mon-yyyy) .
    I have created a pl/sql code with type "function returning error text".
    Begin
    If :P4_END_DATE IS NOT NULL THEN
    if :P4_END_DATE <> to_date(:P4_END_DATE ,'DD-MON-YYYY') then
    return 'END DATE should be in "DD-MON-YYYY" Format';
    end if;
    END IF;
    End;
    When i type in like 20-NOV-08 it gives error as 'START DATE should be in "DD-MON-YYYY" Format',
    but when i change month like 20-11-2008 , it actually gives error
    ORA-01843: not a valid month
    Error ERR-1024 Unable to run "function body returning text" validation.

    Hello,
    You have duplicated this post, see my answer here -
    Re: Date validation in "DD-MON-YYYY" Format,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Date validation in " DD-MON-YYYY"

    Hi ,
    I have created a textbox with date picker as (dd-mon-yyyy) .
    Now i want to create a validation on it for the format (dd-mon-yyyy) .
    I have created a pl/sql code with type "function returning error text".
    Begin
    If :P4_END_DATE IS NOT NULL THEN
    if :P4_END_DATE != to_date(:P4_END_DATE ,'DD-MON-YYYY') then
    return 'END DATE should be in "DD-MON-YYYY" Format';
    end if;
    END IF;
    End;
    When i type in like 20-NOV-08 it gives error as 'START DATE should be in "DD-MON-YYYY" Format',
    but when i change month like 20-11-2008 , it actually gives error
    ORA-01843: not a valid month
    Error ERR-1024 Unable to run "function body returning text" validation.
    Edited by: Vaibss on Nov 25, 2008 2:09 AM
    Edited by: Vaibss on Nov 25, 2008 2:10 AM

    Hello,
    Duplicate post -
    Date validation in "DD-MON-YYYY" Format,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

Maybe you are looking for

  • Restoration after Hard Drive Failure

    Hello all. My Powerbook G4 suffered a hard drive failure a couple of months ago, and every bit of information was lost in no-man's land. After seeking help with Apple, I was sent to DriveSavers. Thankfully, they were able to recover 100% of my drive

  • Problem in navigating out of block

    Hi, There is a form created with the help of data block wizard. The form contains 4 data blocks. The entry is to be done in a way that the first threee fields are from the first data bolck and the 4th field is from the next data block. The problem I

  • Create PDF portfolios - Portfolios not listed under Create menu

    Upon purchase of Adobe Acrobat XI Standard, I was able to download PDF Portfolio templates. Under help file, instructions say to go to Create and select Portfolios. No Portfolio option is listed in the Create menu. How can I correct this?

  • I pre-ordered PS4 and Killzone game, can I upgrade to the bundle when I pick up?

    Hello, I pre-ordered a PS4 console and the game, Killzone: Shadow Fall separately.  When I go to pick up my PS4, can I upgrade to this bundle when I pick it up?  PS4 Killzone Bundle Looking at the SKUs for the items included in the bundle, it looks l

  • Click sound heard when clip audio is at 0

    I am using iMovie 9.0.4.  I have several video clips in my movie, with audio from a .aiff file througout.  The video clips I am using have audio, but I don't want to hear it, so it set it to zero for each one.  But with video clips with especially lo