0

I have an update sql statement and I have to run this sql script through linux script.. What will be the shell script to do such a task?

update inventories
set reserveddate is null,
     purchasedid is null,
where purchased is null
and (TO_CHAR(SYSTIMESTAMP,'HH24') - TO_CHAR(reserveddate ,'HH24')) > 1;

1 Answer 1

1

Try like this,

#!/bin/bash

mysql -uroot -p<YOUR_PASS> -e <DB_NAME> "update inventories set reserveddate is null, purchasedid is null, where purchased is null and (TO_CHAR(SYSTIMESTAMP,'HH24') - TO_CHAR(reserveddate ,'HH24')) > 1;"
Sign up to request clarification or add additional context in comments.

1 Comment

thank you. How can we do the same thing in Oracle database?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.