| deva |
Posted: Feb 07, 2008 05:02:53 AM |
Total Post: 4
Joined: Jan, 2008
|
Hi all,
I want to create a table in which a column content only 'T' or 'F' if any one insert into that table and the value of that column is other then 'T' or 'F' then automatically it insert null. so plz help me out which constraint is working in this condition. |
|
|
Murtuja |
| Posted: Feb 07, 2008 07:06:18 AM | |
|
Total Post: 857
Joined: Jan, 2006
|
If you want to allow 'T' and 'F' only then Check constraint will work.
As per your question...You can incorporate this logic into trigger.
|
|
|
|
|
Garlapati |
| Posted: Feb 08, 2008 12:37:39 AM | |
|
Total Post: 30
Joined: Apr, 2007
|
Hi,
For this it is better to use check constraint only.
|
|
|
|
|
pammi |
| Posted: Feb 29, 2008 04:54:41 AM | |
|
Total Post: 21
Joined: Feb, 2008
|
You can implement this using a trigger. Try this
CREATE OR REPLACE TRIGGER TEST
BEFORE INSERT OR UPDATE OF P ON TEST_63 FOR EACH ROW
BEGIN
IF :NEW.P NOT IN('T','F') THEN
:NEW.P:=NULL;
END IF;
END;
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |