DATE type variable : DATE « Procedure Function « SQL / MySQL






DATE type variable

 
mysql>
mysql> delimiter $$
mysql>
mysql> CREATE PROCEDURE myProc()
    -> BEGIN
    ->     DECLARE my_dob         DATE
    ->             DEFAULT '1960-06-21';         /* My Birthday */
    ->
    ->     select my_dob;
    -> END$$
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql>
mysql> call myProc();
+------------+
| my_dob     |
+------------+
| 1960-06-21 |
+------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> drop procedure myProc;
Query OK, 0 rows affected (0.02 sec)

mysql>
mysql>

        








Related examples in the same category

1.DATE DEFAULT '1999-12-31'
2.Date calculation in a procedure