Re: Domain for numbers.
Date: Fri, 18 Jan 2008 10:21:48 -0800 (PST)
On Jan 17, 4:20 am, Naga lenoj <nagale..._at_gmail.com> wrote:
> Actually, i have a need to store the numbers like "AS2303",
> TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
> assign the integrity which can check the following values,
> 23334, ASDER, SDE23, 233A4 and like this.
> If i assign as a character type domain.Then i can't check the above
> Can anyone help me?
> I am using postgresql(for your information).
PostgreSQL was designed explicitly to handle this kind of problem.
Have a look at the entire manual section here:
with particular attention to:
and the few sections following.
What you want to do here is to define a new relational 'domain' (note: NOT a SQL DOMAIN, which is simply a renaming of another base type). Validity checking is done (mostly) when queries are parsed.
I am also going to guess that your new 'data type/DOMAIN' has other requirements, such as ordering. Does "AA123" come before or after "12345", for example?
You can define your new data type / domain and any rules that you wish to apply over it in 'C', PL or Tcl. Received on Fri Jan 18 2008 - 19:21:48 CET