-
column constraints
Hi Firends,
We have a table emp with a primary key (empno varchar2).
I want to put a constraint on this column so that all its value
is numeric and has fixed length of 10. Can you pls help me
how to code this pls?
Thank you all.
-
Hi
Since you want the column to be numeric, then why not use the type number(10) instead?
-
Hi Friend,
The column values allow leading zeroes and fixed length of 10
-
Hi,
You might need to write a procedure instead. Please refer to my posting below.
http://www.dbasupport.com/forums/sho...threadid=41524
-
Originally posted by rommel
Hi Friend,
The column values allow leading zeroes and fixed length of 10
why does this matter? You should use a number colum for this ... if you need to you can manipulate it to leading zeroes for display purposes.
Anyhoo, the constraint would be ...
Code:
check(translate(empno,'0123456789','0000000000') = '0000000000')
... but it's still a bad design.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|