Find Jobs
Hire Freelancers

prevent overlapping codes (EUP-2007-9-3)

$15-20 USD

In Progress
Posted over 16 years ago

$15-20 USD

Paid on delivery
I have the following table: create table TB_CON /* contracts */ ( id_dpt numeric(18) not null, /* department ID */ id_con numeric(18) not null, /* row ID */ contract varchar(13) not null, description varchar(40) not null, valid_fm date, /* validity start */ valid_to date, /* validity end */ work_hours integer primary key (id_con) ) ; Database is Firebird 1.5 I need After Insert and a After Update triggers that will prevent a user from inserting 2 equal codes in overlapping validity periods. you may find the following SP useful: ALTER PROCEDURE OVERLAP ( A1 INTEGER, B1 INTEGER, A2 INTEGER, B2 INTEGER ) RETURNS ( RESULT INTEGER ) AS declare variable a integer; declare variable b integer; begin result=0; if ( a1 is null ) then begin suspend; exit; end if ( b1 is null ) then begin suspend; exit; end if ( a2 is null ) then begin suspend; exit; end if ( b2 is null ) then begin suspend; exit; end if ( b1<=a2 ) then begin suspend; exit; end if ( a1>=b2 ) then begin suspend; exit; end if ( ( a2<=a1 ) and (b2>=b1) ) then begin result=b1-a1; suspend; exit; end if ( (a2>=a1) and (b1<=b2) ) then begin result= b1-a2; suspend; exit; end if ( (a1>=a2) and (b1>=b2) ) then begin result=b2 - a1; suspend; exit; end if ( (a1>=a2) and (b1<=b2) ) then begin result=b1 - a1; suspend; exit; end if ( (a2>=a1) and (b2<=b1) ) then begin result=b2 - a2; suspend; exit; end end^ The triggers should take into due account the following special cases: valid_fm null means 'no validity start' 'valid from the start of time' valid_to null means 'no validity end' 'valid to the end of time' ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables): a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform w32
Project ID: 3263830

About the project

Remote project
Active 17 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of ITALY
Italy
5.0
509
Member since Feb 20, 2005

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.