15 March 2016

Execute stored procedure in oracle database from powershell



 $connectionString =“User Id=username;Password=password;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=appname.domain.intra)(PORT=1523)))(CONNECT_DATA=(SID=sid)))”;

$oracleConnection = new-object System.Data.OracleClient.OracleConnection($connectionString);
$ProcName = "procedure_name";
$oracleConnection.Open();
$cmd = new-object System.Data.OracleClient.OracleCommand;
$cmd.Connection = $oracleConnection;
$cmd.CommandText = $ProcName;
$cmd.CommandType = [System.Data.CommandType]::StoredProcedure;
$cmd.ExecuteNonQuery();
$oracleConnection.Close();

No comments:

Post a Comment