Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2004, 07:27 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Constraint for names

Is is possible to create a constraint which checks that all characters in a string (e.g. a person's name) are letters or certain allowed characters such as an apostrophe or hyphen?

i.e.
John D'Arcy-Smith is allowed
Peter Sm1!th is not allowed.

Thanks!

Andy
 
Old April 13th, 2004, 07:37 AM
aas aas is offline
Authorized User
 
Join Date: Mar 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to aas
Default

why do you want create it is as constraint?
You can create trigger on your table (before insert or update) and check :new.name.


 
Old April 14th, 2004, 01:29 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have a type (UDT) for names, which is used in several tables. I would like the constraint to apply to the type so that I don't have to add a trigger for every table. Every time a table is created which uses the name type, the constraint will automatically apply.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I have a constraint like this.....? callagga SQL Language 7 August 13th, 2008 01:08 AM
Constraint Vs Index carumuga SQL Server 2000 2 December 4th, 2007 02:14 AM
Identity Constraint in DataSet anujrathi Pro VB.NET 2002/2003 1 June 21st, 2006 04:50 AM
CHECK Constraint Error Kep SQL Server 2000 5 April 11th, 2006 08:46 PM
constraint for 1-to-n relation j_yan MySQL 0 December 10th, 2004 11:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.