Database Administration (MOSC)

MOSC Banner

Check application constraint with trigger

edited Oct 1, 2014 8:52AM in Database Administration (MOSC) 5 commentsAnswered ✓

Hi,

Before inserting a new line in a table, I want to check if some columns values from that insert (on 2 columns and for only one type of value for one of these 2 columns) already exists in that table, and if so reject the insert. It's like a unique constraint but only on some couple values, not all values, so I can't use a unique constraint.

For exemple, I have the test table : test(c1 number(2) primary key, c2 varchar(10), c3 varcher(10)).

I don't want duplicate rows on columns c2 and c3 but only when c3 value is '1' !

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center