Hi,
I am migrating one of my application from Oracle to MySQL. We are using
user defined variable which we are using in the sql scripts.
In Oracle it is done using "DEFINE". The similar thing can be done in
MySQL using the SET command. But the catch here is I am invoking the
MySQL using a shell file which in turn is started by a cron job.
Here is what I need exactly, I am using some dummy file names for
reference.
-----------------------------------------------------
# myscript.sql
select MY_VARIABLE from dual;
-----------------------------------------------------
# wrapper.sh
mysql -vvv -u myuserid -ppwd123 -D test --force --set MY_VARIABLE='XY Z'
< myscript.sql
-----------------------------------------------------
I need the return value to be XYZ on running the wrapper.sh
Not sure about the syntax to be used for myscript.sql.
I will really appreciate your help in solving this problem.
Thanks in advance.
Amit
I am migrating one of my application from Oracle to MySQL. We are using
user defined variable which we are using in the sql scripts.
In Oracle it is done using "DEFINE". The similar thing can be done in
MySQL using the SET command. But the catch here is I am invoking the
MySQL using a shell file which in turn is started by a cron job.
Here is what I need exactly, I am using some dummy file names for
reference.
-----------------------------------------------------
# myscript.sql
select MY_VARIABLE from dual;
-----------------------------------------------------
# wrapper.sh
mysql -vvv -u myuserid -ppwd123 -D test --force --set MY_VARIABLE='XY Z'
< myscript.sql
-----------------------------------------------------
I need the return value to be XYZ on running the wrapper.sh
Not sure about the syntax to be used for myscript.sql.
I will really appreciate your help in solving this problem.
Thanks in advance.
Amit
Comment