0

How to connect oracle from unix script? I am updating one column of table emp from unix script. for example: table is emp. I am updating table for the column salary where emp_id is PK. How could i do this? Any help guys? Thanks in advance

2 Answers 2

2

You need to take care of the environment variables like export ORACLE_HOME and PATH etc. properly. And then invoke SQLPLUS.

For example,

#!/bin/ksh

sqlplus -s /nolog << EOF
CONNECT user/password@service_name
update table set column = ....;
EXIT;
EOF
Sign up to request clarification or add additional context in comments.

Comments

1

Download sqlplus and follow this tutorial.

A sample script would something look like so

CONNECT user/password(@servicename if using a pluggable database) ALTER TABLE Emp PRIMARY KEY (emp_id)/*Or whatever updates you want here*/ EXIT;

Comments

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.