Unix Technical Forum

numerical range

This is a discussion on numerical range within the MySQL General forum forums, part of the MySQL category; --> Is it possible to restrict the range that can be put in a floating point, or other data type ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:23 AM
Christian High
 
Posts: n/a
Default numerical range

Is it possible to restrict the range that can be put in a floating point, or
other data type that allows decimal numbers. The data being stored will be
that of the result of chemical analysis. The result could very well be
2.41however it would never be
24.1 so i want to ensure that a simple typo like this is caught. the context
i am using this in would make validation at the front end very difficult so
i would like to use the tables definition to error on the insert rather than
except a value that is out of a realistic range.

Thanks,

Chris

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:23 AM
Dan Buettner
 
Posts: n/a
Default Re: numerical range

You could use triggers to check for sane values on fields and rollback
if not sane.
http://dev.mysql.com/doc/refman/5.0/en/triggers.html

You'd need to handle the rollback in your frontend app.

Dan


On 12/8/06, Christian High <cjhigh@gmail.com> wrote:
> Is it possible to restrict the range that can be put in a floating point, or
> other data type that allows decimal numbers. The data being stored will be
> that of the result of chemical analysis. The result could very well be
> 2.41however it would never be
> 24.1 so i want to ensure that a simple typo like this is caught. the context
> i am using this in would make validation at the front end very difficult so
> i would like to use the tables definition to error on the insert rather than
> except a value that is out of a realistic range.
>
> Thanks,
>
> Chris
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com