Re: Call an Oracle Stored Procedure from Visual Basic?

From: Adrian Hands <AHands_at_sprynet.com>
Date: Sat, 17 Oct 1998 19:03:14 -0400
Message-ID: <36292232.15B9BDFA_at_sprynet.com>


John Livingstone wrote:

> On Mon, 12 Oct 1998 22:03:46 GMT, app1jhl_at_is.ups.com (John
> Livingstone) wrote: Please - Can anyone offer help on this topic?!!!
>
> >Does anybody know trhe syntax of calling an Oracle Stored Procedure
> >(that is contained in an Oracle Package) from Visual Basic (using the
> >Oracle ODBC driver)? Thanks in advance, John Livingstone
> >(app1jhl_at_is.ups.com)

I know there's better answer's than this...but on the assumption that this is (even slightly?) better than nothing:

If you're stored procedure has no parameter or "IN" parameters only (no "OUT"s or "IN/OUT"s) you can create a QueryDef, set the "CONNECT" property to something like "ODBC;DSN=foo", set the "ReturnsRecords" property to "False", set the SQL property to "BEGIN myschama.mypackage.myprocedure(300); END;" and, um, I think there's some kind of "Type" property that you may need to set to a vbODBC constant, and then call the EXECUTE method.

This works for VBA and older versions of VB too.

Of course, you need to install the Oracle TNS client software, the Oracle ODBC drivers and configure a ODBC data source first.

I'm sure you can find a better solution for VB 5, 6 or whatever they're up to now... I avoid coding on MS-Windows when I can help it.

Dim myQD01 as New QueryDef

myQD01.Connect = "ODBC; DSN=foo"
myQD01.Type = vbODBCQuery  '???
myQD01.ReturnsRecords = False
myQD01.SQL = "Begin scott.pkg_foo.pr_foo('blah'); End;"
myQD01.Execute
Received on Sun Oct 18 1998 - 01:03:14 CEST

Original text of this message