Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4065390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:58:37+00:00 2026-05-20T15:58:37+00:00

I am trying to check add the following constraint but Oracle returns the error

  • 0

I am trying to check add the following constraint but Oracle returns the error shown below.

ALTER TABLE Table1
ADD (CONSTRAINT GT_Table1_CloseDate
CHECK (CloseDate > SYSDATE),
CONSTRAINT LT_Table1_CloseDate
CHECK (CloseDate <= SYSDATE + 365)),
CONSTRAINT GT_Table1_StartDate
CHECK (StartDate > (CloseDate + (SYSDATE + 730))));

Error:

Error report:
SQL Error: ORA-02436: date or system variable wrongly specified in CHECK constraint
02436. 00000 -  "date or system variable wrongly specified in CHECK constraint"
*Cause:    An attempt was made to use a date constant or system variable,
           such as USER, in a check constraint that was not completely
           specified in a CREATE TABLE or ALTER TABLE statement.  For
           example, a date was specified without the century.
*Action:   Completely specify the date constant or system variable.
           Setting the event 10149 allows constraints like "a1 > '10-MAY-96'",
           which a bug permitted to be created before version 8.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:58:38+00:00Added an answer on May 20, 2026 at 3:58 pm

    A check constraint, unfortunately, cannot reference a function like SYSDATE. You would need to create a trigger that checked these values when DML occurs, i.e.

    CREATE OR REPLACE TRIGGER trg_check_dates
      BEFORE INSERT OR UPDATE ON table1
      FOR EACH ROW
    BEGIN
      IF( :new.CloseDate <= SYSDATE )
      THEN
        RAISE_APPLICATION_ERROR( -20001, 
              'Invalid CloseDate: CloseDate must be greater than the current date - value = ' || 
              to_char( :new.CloseDate, 'YYYY-MM-DD HH24:MI:SS' ) );
      END IF;
      IF( :new.CloseDate > add_months(SYSDATE,12) )
      THEN
        RAISE_APPLICATION_ERROR( -20002, 
             'Invalid CloseDate: CloseDate must be within the next year - value = ' || 
             to_char( :new.CloseDate, 'YYYY-MM-DD HH24:MI:SS' ) );
      END IF;
      IF( :new.StartDate <= add_months(:new.CloseDate,24) )
      THEN
        RAISE_APPLICATION_ERROR( -20002, 
              'Invalid StartDate: StartDate must be within 24 months of the CloseDate - StartDate = ' || 
              to_char( :new.StartDate, 'YYYY-MM-DD HH24:MI:SS' ) ||
              ' CloseDate = ' || to_char( :new.CloseDate , 'YYYY-MM-DD HH24:MI:SS' ) );
      END IF;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to add following constraint to my DB2 table but it gives
I am trying to add following constraint to my DB2 table but it gives
I am trying to check the following and all throw an out of bounds
I'm trying to check a checkbox, i've tried doing the following :- $('#someId').attr('checked','checked'); $('#someId').attr('checked',
I'm trying to check network available or not. But in my emulator it always
I'm trying to add an check_esx3.pl script to my icinga. But trying to execute
I am trying to put String[] in jsonObject and getting following error java.lang.IllegalArgumentException: Invalid
I'm trying to check an images size in PHP but I'm getting a couple
I am trying to create a check contraint on a table by executing the
I am trying to add new elements to an unordered list with the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.