+ Reply to Thread
Results 1 to 2 of 2

Executing a stored procedure in ORACLE from an EXCEL Macro thru ODBC.

  1. #1
    Registered User
    Join Date
    05-14-2007
    Posts
    8

    Executing a stored procedure in ORACLE from an EXCEL Macro thru ODBC.

    The following macro returns the message "Run-time error '1004' SQL Syntax Error". It works for SQL DML statements such as a "Select". Can one execute a stored procedure in ORACLE via an EXCEL macro, and if so, how?
    The SQL "EXECUTE DROPTABLE" does work in SQL*Plus.


    Many thanks!

    Sub Drop_Table()
    '
    Dim str1 As String


    str1 = "EXECUTE DROPTABLE"
    '
    sConn = "ODBC;DSN=ORADEV;UID=?;PWD=?;"
    sConn = sConn & "DBQ=ORADEV"

    Set oQt = Sheets("Sheet1").QueryTables.Add( _
    Connection:=sConn, _
    Destination:=Range("A1"), _
    Sql:=Array(str1))
    oQt.Refresh 'BackgroundQuery:=False

    End Sub

  2. #2
    Registered User
    Join Date
    02-09-2005
    Posts
    63
    I'm no expert, but have executed passthru Qs, ADO Qs, & Access Qs against Oracle but never a stored procedure. My guess is that
    1) you don't have permissions to drop a table or
    2) array is not needed, I would try sql:=str1

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1