Tuesday, November 18, 2014

MySQL Weirdness

Does anyone else think this is weird? It looks like the shortcut 'show create procedure' lacks the ability to go INTO OUTFILE. Maybe this is just me not understanding, but it seems like I should be able to INTO OUTFILE more than just a SELECT.

mysql> show create procedure mydbr.COMPANY_esnq_site INTO OUTFILE 'COMPANY_esnq_site.sp.sql';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'COMPANY_esnq_site.sp.sql'' at line 1
mysql>

mysql> SELECT routine_definition FROM information_schema.routines WHERE  routine_name = 'COMPANY_esnq_site' AND routine_schema = 'mydbr' INTO OUTFILE 'COMPANY_esnq_site.sp.sql';
Query OK, 1 row affected (0.27 sec)