Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 798579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:59:41+00:00 2026-05-14T22:59:41+00:00

Looking for a data type that is similar to VARCHAR as to the values

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:59:41+00:00Added an answer on May 14, 2026 at 10:59 pm

    You could add a trigger to throw an exception when the values are outside of the range, e.g.

    DELIMITER $$
    
    CREATE TRIGGER `insert_table_var` BEFORE INSERT ON `table` 
    FOR EACH ROW
    BEGIN
         DECLARE str_len INT DEFAULT 0;
         DECLARE max_len INT DEFAULT 10;
         DECLARE min_len INT DEFAULT 6;
    
         SET str_len = LENGTH(NEW.col);
    
         IF str_len > max_len OR str_len < min_len 
         THEN
               CALL col_length_outside_range_error();
         END IF;
    END $$
    DELIMITER ;;
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a kind of array data-type that can easily have items added,
I am looking for a C++ data type similar to std::vector but without the
I am looking for a data structure that operates similar to a hash table,
I'm looking for a data structure (or structures) that would allow me keep me
Is there a plug-in for Firefox that would allow user's Javascript code like Greasemonkey
I am looking for a better primary key than the autonumber data type, namely
I'm looking to persist and retrieve a large amount of key-value pair(s) type data
I'm looking for a data structure that provides indexing for Rectangles. I need the
I would like to build something similar to the code-completion feature in Xcode 4.
I have some data in mysql that I load up in php and draw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.