MYSQL: Validate Input Values in Specific Format within a FUNCTION

MYSQL: Validate Input Values in Specific Format within a FUNCTION

i have one question with regard to MYSQL. I want to create a function that is able to check whether an Input is given in a specific format.

i have one question with regard to MYSQL. I want to create a function that is able to check whether an Input is given in a specific format.

The output should be in the following shape:

***x x (a) n (n) (n) (n)
with :
x = letters and numbers
n = numbers
a = letters
brackets = optional Values***

my code is written below this.

CREATE FUNCTION validate_of_number(testnumber VARCHAR(7))
RETURNS INT
DETERMINISTIC
RETURN
    CASE
        WHEN
            (SELECT * FROM flightexecution WHERE FlightNo REGEXP 
            '^[[:alnum:]+[:alnum:]] + [[:alpha:]|''] + [:digit:] + 
            [[:digit:]|''] + [[:digit:]|''] + [[:digit:]|'']') > 0
            Then 1
            Else 0
            END;`

However, it does not work and i donĀ“t know why. The Output is just a 'OK' without any further information.

mysql sql database

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

MySQL Database Bootcamp: Go from SQL Beginner to Expert | Simpliv

MySQL Database Bootcamp: Go from SQL Beginner to Expert

SQL Full Course - SQL Tutorial For Beginners - MySQL Essentials - SQL Training

This SQL Full Course video will cover all the topics of SQL starting from scratch. This video is great for beginners who want to learn SQL and for advanced people to brush up their skills.

Writing a SQL Database from scratch in Go: A Database/SQL Driver

Writing a SQL Database from scratch in Go, we'll extend gosql to implement the database/sql driver interface. This will allow us to interact with gosql the same way we would interact with any other database.

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts|Simpliv

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts

What are the differences between Standard SQL and Transact-SQL?

In this article, we'll explain syntax differences between standard SQL and the Transact-SQL language dedicated to interacting with the SQL