Quantcast
Channel: The Multifunctioning DBA » Oracle
Viewing all articles
Browse latest Browse all 10

Query Oracle with Powershell

$
0
0

I have a small project that I am working on and it requires that I pull data from Oracle from within a Powershell script. This is not something that is fun but it can be done and it is not really that difficult to get the data out of Oracle, it is dealing with the data once you have the data out.

$query = “select * from table;”
$query | sqlplus username/password@SID
that will push the data back for you but it is ugly and you are going to have to parse that data somehow to get it into a format that is useful to you. It all depends on what the query is and how you need the data. For me I ended up having to break my query down into two queries in order to deal with the data and get the output that I was after. The problem is that it returns as a giant string and the sting is not really formatted in any useful way. So you may have to be creative in order to get what you need but it can be done.

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images