I have a problem with powershell and oracle.
This is my code
Add-Type -Path "C:\app\aasif\product\11.2.0\client_2\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
$con = New-Object Oracle.ManagedDataAccess.Client.OracleConnection("User Id=sys;Password=password;Data Source=myserver/oracle;DBA privilege=SYSDBA")
$con.Open()
$cmd=$con.CreateCommand()
$cmd.CommandText="select distinct owner from all_tables where table_name = 'mytable'"
$rdr=$cmd.ExecuteReader()
if ($rdr.Read()) {
$rdr.GetString(0)
}
$con.Close()
When i execute this query directly with SQLPlus, i have :
RS123
RS456
RS789
RS741
RS963
With my powershell, i can't view all the data returned by the query, but only the first line.
RS123
How can i do this?
Thanks