Looking for a data type that is similar to VARCHAR as to the values I would like, but is there a way to have a MIN/MAX character length?
VARCHAR(6,10)
This would have a minimum of 6 characters and a maximum of 10 characters.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could add a trigger to throw an exception when the values are outside of the range, e.g.
Whilst SIGNAL is not available, calling an undefined stored procedure would suffice (in this case
col_length_outside_range_error). Otherwise, I think that the application using the database is going to need to do the checks.