Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> CONSTRAINTS

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: CONSTRAINTS
 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

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software