Rubab
Rubab

Reputation: 27

How to connect oracle from unix

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

Upvotes: 0

Views: 1956

Answers (2)

Alexander Kohler
Alexander Kohler

Reputation: 1967

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;

Upvotes: 1

Lalit Kumar B
Lalit Kumar B

Reputation: 49062

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

Upvotes: 2

Related Questions