1

The title says it all really, I have been trying to execute a SQL Oracle script through PowerShell, but it is not working. I am not getting an error, it just says 'running script/selection' at the bottom right hand corner. However I do not think it is correctly connecting to Oracle.

Please see the code in the .ps1 file:

sqlplus Username\Password "@C:\Users\...\script1.sql"

In the sql script there is:

CREATE TABLE DEPT 
(
  DEPTNO VARCHAR2(20) 
, DNAME VARCHAR2(20) 
, LOC VARCHAR2(20) 
);
3

1 Answer 1

0

You can use the following

sqlplus <<UserName>>/<<Password>>@<<Database>> @"<<ScriptFilePath>>"

Database should be tnsnames.ora entry. You can use the following directly.

Sign up to request clarification or add additional context in comments.

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.