Welcome to Dream.In.Code
Become an Expert!

Join 149,889 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,298 people online right now. Registration is fast and FREE... Join Now!




check constraint in sql

 
Reply to this topicStart new topic

check constraint in sql, ckeck constraint

ankur
8 May, 2005 - 11:00 PM
Post #1

New D.I.C Head
*

Joined: 24 Apr, 2005
Posts: 2

i want to create a check constraint in sql to validate field contains
only values such as 'A1234' etc
the first character of value is always character and all other are numeric
in oracle 8i.


i have tried
check( id like '[A-Z][0-9][0-9][0-9][0-9]' )

please help me!

This post has been edited by ankur: 10 May, 2005 - 09:10 PM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Check Constraint In Sql
9 May, 2005 - 05:42 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,351



Thanked: 51 times
Dream Kudos: 25
My Contributions
While SQL as a whole supports many standard options, some flavours of SQL software support additonal, helpful functions...can you specify what db software you are using (MySQL, SQLServer,etc...)?
User is online!Profile CardPM
+Quote Post

blue basil
RE: Check Constraint In Sql
9 Nov, 2007 - 03:21 PM
Post #3

New D.I.C Head
*

Joined: 9 Nov, 2007
Posts: 1


My Contributions
[I think you could use the substr and is numeric functions in oracle like this
CODE

Is_numeric(substr(X,first_position_of_the_char,last_position_of_the_char));

smile.gif

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 12:27PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month