Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: using User defined functions in Check constraint

RE: using User defined functions in Check constraint

From: Mercadante, Thomas F <NDATFM_at_labor.state.ny.us>
Date: Tue, 19 Jun 2001 09:47:16 -0700
Message-ID: <F001.0032EF66.20010619095934@fatcity.com>

Hussain
While
you can use any Oracle supplied function within a check constraint, you cannot use a self-written function. 
But
you can perform the same thing by using a database table trigger on the table itself.<SPAN
class=120065316-19062001>  You can basically validate anything you want from any schema you wish using a database trigger (with some exceptions).
<SPAN

class=120065316-19062001> 
A
pre-insert trigger on the table would work just fine.  Check them out in the documentation.
<SPAN

class=120065316-19062001> 
hope
this helps
Tom
Mercadante Oracle Certified
Professional

  <FONT face=Tahoma
  size=2>-----Original Message-----From: Arslan Dar   [mailto:arslandar_at_skm.org.pk]Sent: Tuesday, June 19, 2001 1:14   PMTo: Multiple recipients of list ORACLE-LSubject: using   User defined functions in Check constraint   Hello All
  Can we use user made functions in the check   constraints?. Like In the check constraitns, we can use oracle functions, like   LENGTH(NAME)=9. What we want to do is to check a value, which before being   saved in the database(when we press save, registration no. of a patient, gets   prefixed with the area code where the patient is being registrered), checks   whether the values prefixed with the data are present in a table in another   schema, for this purpose we want to use a function(selfmade). This we do to   get a unique value irrespective of the area.   If not, is there a work around, to check such a   value from a different schema&table in a check constraint.<FONT   face="Times New Roman">Oracle 8.1.7 on   winnt 4 <FONT face=Arial
  size=2>TIAHussainDBA SKMCH &
  RC Received on Tue Jun 19 2001 - 11:47:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US