ORA-01008: not all variables bound. They are bound

前端 未结 8 1391
青春惊慌失措
青春惊慌失措 2020-11-29 08:01

I have come across an Oracle problem for which I have so far been unable to find the cause. The query below works in Oracle SQL developer, but when running in .NET it throws

8条回答
  •  [愿得一人]
    2020-11-29 08:49

    I'd a similar problem in a legacy application, but de "--" was string parameter.

    Ex.:

    Dim cmd As New OracleCommand("INSERT INTO USER (name, address, photo) VALUES ('User1', '--', :photo)", oracleConnection)
    Dim fs As IO.FileStream = New IO.FileStream("c:\img.jpg", IO.FileMode.Open)
    Dim br As New IO.BinaryReader(fs)
    cmd.Parameters.Add(New OracleParameter("photo", OracleDbType.Blob)).Value = br.ReadBytes(fs.Length)
    cmd.ExecuteNonQuery() 'here throws ORA-01008
    

    Changing address parameter value '--' to '00' or other thing, works.

提交回复
热议问题