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

  • Home
  • SEARCH
  • 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 8180899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:20:56+00:00 2026-06-07T00:20:56+00:00

Hi im working on a trigger that will not allow inserts/updates when the newly

  • 0

Hi im working on a trigger that will not allow inserts/updates when the newly inserted data (address, listnumber, date, price) has a similar tuple.

Condition – a listing cannot be listed twice on the same day
table
123, jun 19 1992
123, jun 20 1990
insert: 123, Jun 20 1990 – wouldnt work already in table

The only problem with my code is that i cant get it work when my list table has no data to begin with

create or replace TRIGGER same_prop_listed BEFORE INSERT OR UPDATE  ON HasListing
FOR each ROW
DECLARE
    c_date VARCHAR2(20);
BEGIN
    SELECT LISTING_DATE
    INTO c_date
    FROM HasListing
    WHERE PROP_ADDRESS = :NEW.prop_address;
    IF (c_date = :NEW.listing_date) THEN
    RAISE_APPLICATION_ERROR(-20001,'Cannot list same property twice in  one day!');
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
        RAISE_APPLICATION_ERROR(-20003,'No DATA');

END;

This is in oracle.
So my errors are on – IF (c_date = :NEW.listing_date) because c_date is null

  • 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-07T00:20:58+00:00Added an answer on June 7, 2026 at 12:20 am

    Why don’t you just put a multiple column unique constraint ?

    ALTER TABLE YOUR_TABLE ADD CONSTRAINT UNI_CONSTR UNIQUE (COL1, COL2,
    COL3);

    ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an intermediary form that will gather some data from the user
I am working on a stored procedure that will trigger once a week so
I have a trigger for insert/update/delete. That is working fine. Also, I need the
I'm working on a trigger which needs to re-insert its data on another table.
I am working on a form with a bunch of selection criteria that will
I thought after delete meant that the trigger is not fired until after the
Im trying to make a trigger in mySQL that will update a colum with
I am working on a PowerShell script that will monitor a list of servers
I'm writing a trigger that will do a cross table update, but I can't
I'm trying to write an update trigger that will only update a password when

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.