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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:14:08+00:00 2026-06-14T11:14:08+00:00

i would like to create a simple trigger to check a stored variable from

  • 0

i would like to create a simple trigger to check a stored variable from a table.
if the value of the variable is ‘1’, then approve the insertion
else if the value of the variable is ‘2’, then prompt error message.

CREATE OR REPLACE TRIGGER approval 
BEFORE INSERT ON VIP
REFERENCING OLD AS MEMBER
FOR EACH ROW
DECLARE 
  CONDITION_CHECK NUMBER;
BEGIN
  SELECT CONDITION INTO CONDITION_CHECK FROM MEMBER; 
  IF CONDITION_CHECK = '2' THEN
    RAISE_APPLICATION_ERROR (-20000, ' UPGRADE DENIED!');
  END IF;
END;

But this trigger disable all the entries even when the condition value is ‘1’.

  • 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-06-14T11:14:09+00:00Added an answer on June 14, 2026 at 11:14 am

    Use AFTER triggers to check conditions: the values can be modified by other BEFORE triggers. In AFTER triggers, you are guaranteed that the value won’t be changed afterwards.

    It seems you’re missing a condition in your SELECT (if as I believe you’re trying to get the value from another table):

    CREATE OR REPLACE TRIGGER approval 
    AFTER INSERT ON VIP
    FOR EACH ROW
    DECLARE 
      CONDITION_CHECK NUMBER;
    BEGIN
      SELECT CONDITION 
        INTO CONDITION_CHECK 
        FROM MEMBER 
       WHERE member_id = :new.member_id; 
      IF CONDITION_CHECK = '2' THEN
        RAISE_APPLICATION_ERROR (-20000, 'UPGRADE DENIED!');
      END IF;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a simple control that inherits from HeaderedContentControl, and has
Using the Northwind sample: I would like to create an insert trigger on the
I would like to create simple objects at runtime (textbox, label, etc) and add
I would like to create a simple fluid layout whereby 4 columns of Equal
I would like to create a simple XMPP client in java that shares his
I would like to create a simple designer which looks like visual studio. Specifically,
I would like to create an online, simple WYSIWYG drawing editor allowing people to
I would like to create a small Windows Messenger Client that I can trigger
I'm trying to create a fairly simple trigger that would add one to a
When inserting a new row in a table T, I would like to 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.