I'm writing a trigger and that i possess some problem. The trigger executes and compiles without errors however for some reasons it does not result in the job I wish to. If a person may help me.

This is actually the question:

Write a trigger to become performed on place, update of the PROPERTY. Every property that will get joined will get checked against other qualities of getting exactly the same: Agent(s), Owner(s), Address, if you discover one then update Property Status to “Double” like a duplicate.

I'm placing exactly the same data also it allow me to achieve this, however it may not!

Listed here are my tables:

create table Properties(  
            idProperties number(10) NOT NULL,
        Type varchar2(45) NOT NULL,
        SquareMeters varchar2(10) NOT NULL,
        Rooms number(10) NOT NULL,
        ConstructionDate date NOT NULL,
        FloorLocation varchar(20),
        Price number(10) NOT NULL,
        CityView varchar2(20),
        DateOfInsert date NOT NULL,
        DateOfExiration date NOT NULL,
        Address_FK number(20),
        Service_FK number(20),
        Ownership_FK number(20),
        Status_FK number(20),
        PropertyService_FK number(20))

create table Address(
          idAddress number(10) NOT NULL,
          address_name varchar2(20),
          City_FK number(20))

create table OwnerAgent(
           idOwnerAgent number(10) NOT NULL,
           Name varchar2(50)  NOT NULL,
           LastName varchar2(50)  NOT NULL,
           PhoneNr number(20),  
           Email varchar2(20),
           Sex varchar2(10),
           Profesion varchar2(20),
           Birthdate date,
           LastLogInDate date NOT NULL,
           Status varchar2(20),
           Address_FK number(20))

create table Ownership(
            idOwnership number(10) NOT NULL,
            PercentageOwed number(10)NOT NULL,
            RequiredPercentage number(10) NOT NULL,
        OwnerAgent_FK number(20))

Here's my trigger:

before insert or update on properties
FOR each ROW

v_dup number;

    select count(idProperties) INTO v_dup from properties where Address_FK=:NEW.Address_FK and 

 if v_dup > 0 then
   Raise_Application_Error (-20100, 'This property already exists. The insert is cancelled.');
end if;