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 1042447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:30:39+00:00 2026-05-16T15:30:39+00:00

I am trying to add a check constraint which verity if after an update

  • 0

I am trying to add a check constraint which verity if after an update the new value (which was inserted) is greater than old values which is already stored in table.

For example i have a “price” column which already stores value 100, if the update comes with 101 the is ok, if 99 comes then my constraint should reject the update process. Can this behavior be achieved using check constraints or should i try to use triggers or functions ?

Please advice me regarding this…

Thanks,
Mircea

  • 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-16T15:30:40+00:00Added an answer on May 16, 2026 at 3:30 pm

    Check constraints can’t access the previous value of the column. You would need to use a trigger for this.

    An example of such a trigger would be

    CREATE TRIGGER DisallowPriceDecrease
    ON Products
    AFTER UPDATE
    AS
    IF NOT UPDATE(price) 
       RETURN
    
    IF EXISTS(SELECT * FROM inserted i 
                         JOIN deleted d 
                         ON i.primarykey = d.primarykey 
                          AND i.price< d.price)
    BEGIN
        ROLLBACK TRANSACTION
        RAISERROR('Prices may not be decreased', 16, 1)
    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 check add the following constraint but Oracle returns the error
Trying to add a dynamic class value to one of my columns in CGridView:
Im trying to add an element to a database and then return a new
Im trying to add a constraint to a reservation table, the reservation can either
Im am trying to add a check box that will enable/disable the edit button.
I am trying to add javascript validation to a bunch of check boxes, basically
I am trying to add a constraint (in Oracle), that restricts the user from
I'm fairly new to Oracle and very new to APEX. I'm trying to add
I am trying to add a check availability option for the username in my
I am trying to add a magic fields plugin image code that will check

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.