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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to enforce a string format in a field??

Re: How to enforce a string format in a field??

From: Alan <not.me_at_rcn.com>
Date: Sat, 27 Nov 2004 08:54:07 -0500
Message-ID: <30rf9lF33sr98U1@uni-berlin.de>

"Ramon F Herrera" <ramon_at_conexus.net> wrote in message news:c9bc36ff.0411270245.4145eb43_at_posting.google.com...
> My database contains a field called 'SSN' whose
> contents should be obvious.
>
> Is there any way to constrain that field to the
> following format: ddd-dd-dddd? That is: if there is
> an attempt to insert a value that doesn't have 9 digits
> with the hyphens in the proper places, the record should
> be rejected.
>
> Or is this something that I should check before inserting
> the data into the table (for instance, making sure that
> the *.dat file only contains proper SSN values)??
>
> TIA,
>
> -Ramon F Herrera

You should not be storing the hyphens. They are constants, so are merely a formatting issue for display. Your constraint should be for exactly 9 characters, and those characters must be between 0 and 9. Received on Sat Nov 27 2004 - 07:54:07 CST

Original text of this message

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