J'écris un script powershell qui doit lancer un script sql mais je n'arrive pas à le lancer correctement, voic ma fonction :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
[Reflection.Assembly]::LoadFile("$ORACLE_HOME\ODP.NET\bin\2.x\Oracle.DataAccess.dll")
	$constr = "User Id=script;Password=scripted;Data Source=orcl"
	$conn= New-Object Oracle.DataAccess.Client.OracleConnection($constr)
	$conn.Open()
	$sql= Get-Content .\serv.sql
	$command = New-Object Oracle.DataAccess.Client.OracleCommand($sql,$conn)
	$reader=$command.ExecuteReader()
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
Exception calling "ExecuteReader" with "0" argument(s): "ORA-00900: invalid SQL
 statement"
At line:1 char:31
+ $reader=$command.ExecuteReader <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
Je comprends pas ce qui ne va pas, mon script sql fonctionne je peux le lancer à la mano depuis sqlplus.