sql - Oracle and Powershell return only the first line -
i have problem powershell , oracle.
this 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 all_tables table_name = 'mytable'" $rdr=$cmd.executereader() if ($rdr.read()) { $rdr.getstring(0) } $con.close()
when execute query directly sqlplus, have :
rs123 rs456 rs789 rs741 rs963
with powershell, can't view data returned query, first line.
rs123
how can this?
thanks
i think in place of if($rdr.read())
have write while($rdr.read())
read , work value output of query.
actually new in powershell in general language have put condition in loop.
Comments
Post a Comment