mysql-cli

skip-column-names not working for a call inside script


I have a stored procedure myProc defined within a file stored_proc.sql that has select statements to report on various things.

If call myProc within stored_proc.sql, skip-column-names works.

I'd like to call myProc within another file overall.sql, but, if I do SOURCE stored_proc.sql and CALL myProc() within overall.sql, skip-column-names stops working.

I'm executing overall.sql like this:

mysql <connection properties> --skip-column-names -e "SOURCE overall.sql"


Solution

  • Looks like --skip-column-names may not work with the -e option, but -skip-column-names does work, if the *.sql file's pipe through either through | or < (e.g. cat overall.sql | mysql <...> --skip-column-names). I was hoping to use -e to be able to set a session variable, but doing a sed replacement (like in this SO post) also works.