A function that takes a parameter, performs an operation using an SQL function, and returns the result : Function : Procedure Function MySQL TUTORIALS


MySQL TUTORIALS » Procedure Function » Function »

 

A function that takes a parameter, performs an operation using an SQL function, and returns the result


In this case, it is unnecessary to use delimiter because the function definition contains no internal ; statement delimiters:

mysql>
mysql>
mysql> CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
    ->     RETURN CONCAT('Hello, ',s,'!');
Query OK, rows affected (0.00 sec)

mysql>
mysql>
mysql> SELECT hello('world');
+----------------+
| hello('world') |
+----------------+
| Hello, world!  |
+----------------+
row in set (0.00 sec)

mysql>
mysql>
mysql> drop function hello;
Query OK, rows affected (0.00 sec)

mysql>
mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Procedure Function
» Function