I'm writting a BASH script who requests to an user some information (date & time hour). I need this data to be processed and inserted into a SQL query. The format for this information has to be DD/MM/YYYY HH/MM
...
echo "Insert day"
read day
echo "Insert month"
read month
echo "Insert year"
read year
echo "Insert hour"
read hour
echo "Insert minute"
read minute
Once the user has inserted the information I'm trying to pass the info to the SQL query using variables like this:
consultaSQL="select TO_CHAR(FROM_TZ( CAST( log_time_stamp AS TIMESTAMP ), 'UTC' ) AT TIME ZONE 'EUROPE/LONDON','YYYY/MM/DD HH24:MI:SS ') AS UK_time, msg_id, msg_tp, init_ch_id, status_code, status_reason from FPS_LOG_PAYMENT where LOG_TIME_STAMP >=TO_DATE('**"$day"**/**"$month"**/**"$year"** **"$hour"**:**"$minute"**) and LOG_TIME_STAMP <TO_DATE('**"$day"**,**"$month"**,**"$year"** **"$hour"**,**"$minute"**','DD/MM/YYYY HH24:MI') and status_code='RJCT' order by log_time_stamp;"
Yes, will be requested initial and end info, this is just an example.
I'm not sure if special characters from SQL affect to BASH and variable values can be inserted.
Another way I supposed I will be able to try is sending every data introduced by user into a txt file and process it with sed and print it to the query, but I'm not so much familiar with the use of sed.
Any sugestion/help will be very appreciated.