locked
Error on connecting to stored procedure RRS feed

  • Question

  • User-200665318 posted

    Appreciate it if anyone could advise me on this (I am trying to connect to an oracle db and the stored procedure is in a package):

    Error msg: ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00900: invalid SQL statement

    Code:

    Dim conn As OdbcConnection = New OdbcConnection(sConnString)
    Dim cmd As OdbcCommand = conn.CreateCommand

    cmd.CommandText = "packagename.Storedprocedurename"
    cmd.CommandType = CommandType.StoredProcedure

    cmd.Parameters.Add(New OdbcParameter("Para1", OdbcType.varchar, 20))
    cmd.Parameters("Para1").Value = me.ddlSelect.selectedvalue
    cmd.Parameters.Add(New OdbcParameter("Para2", OdbcType.varchar, 20))
    cmd.Parameters("Para2").Value = checknull(me.txtbox1.text, "")

    Try conn.Open()

    Dim dr As OdbcDataReader = cmd.ExecuteReader

    If dr.Read Then
    Me.txtresult.Text = dr.Item("OutputParaName")
    Else
    End If
    dr.Close()
    conn.Close()

    Catch ex As OdbcException
    Response.write(ex.message.tostring)
    End Try

    Wednesday, September 17, 2008 6:06 AM

All replies

  • User-1239462100 posted

     please write ir in formated way, so easy to read and easy to understanding....

    Wednesday, September 17, 2008 6:41 AM
  • User-200665318 posted

    Oops. Didn't realize that.[:$]

    Wednesday, September 17, 2008 9:54 PM
  • User-595745061 posted

    ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00900: invalid SQL statement
     

    The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.

    install the Procedural Option.

    Thursday, September 18, 2008 2:18 AM
  • User-200665318 posted
    Thanks. This is not it. But I have used another method to call the stored procedure. It works fine now. Thanks.
    Thursday, September 18, 2008 2:53 AM