dbTalk Databases Forums  

Domain for numbers.

comp.databases.theory comp.databases.theory


Discuss Domain for numbers. in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #41  
Old   
DBMS_Plumber
 
Posts: n/a

Default Re: Domain for numbers. - 01-18-2008 , 12:21 PM






On Jan 17, 4:20 am, Naga lenoj <nagale... (AT) gmail (DOT) com> wrote:
Quote:
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
cases.
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:

http://www.postgresql.org/docs/8.1/static/extend.html

with particular attention to:

http://www.postgresql.org/docs/8.1/static/xtypes.html

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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.