Results 1 to 4 of 4

Thread: ODBC Driver For Oracle That Executes Multiple Statements

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    9

    ODBC Driver For Oracle That Executes Multiple Statements

    I am writing a VB2010 app that reads a SQL command file that contains multiple SQL statements. I've tried multiple ODBC drivers but can't find one that executes multiple statements. Does anyone have any ideas? Am I going down the wrong path?

    Sample Code:

    ' Define variables:
    Dim dbORA As New OdbcConnection
    Dim rsORA As New OdbcCommand("", dbORA)
    Dim srORA As StreamReader

    ' Create connection string & open connection:
    dbORA.ConnectionString = "Driver={Oracle in OraClient11g_home1};Dbq=dbname;Uid=username;Pwd=password;"
    dbORA.Open()

    ' Create streamreader to read SQL statements and store statements in ODBC command variable:
    srORA = New StreamReader("C:\statements.sql")
    rsORA.CommandText = srORA.ReadToEnd
    srORA.Close()

    ' Execute SQL statements:
    rsORA.ExecuteNonQuery()

    ' Error message:
    ERROR [HY000] [Oracle][ODBC][Ora]ORA-00922: missing or invalid option

    The error message is misleading because the SQL statements are valid and can be run via SQL Developer or another Oracle utility

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: ODBC Driver For Oracle That Executes Multiple Statements

    It's nothing to do with the drivers. VB.Net doesn't do multiple SQL statements as a single command. You must set up an array or list of commands and execute them in turn.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    9

    Re: ODBC Driver For Oracle That Executes Multiple Statements

    I can execute multiple SQL statements against SQL Server in one command statement. Is this a limitation of VB & Oracle?

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: ODBC Driver For Oracle That Executes Multiple Statements

    VB yes. Oracle probably not although I've never used it so I can't be definitive about that.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width