Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Call procedures from VBasic

RE: Call procedures from VBasic

From: Paul van Dijken <paul.vandijken_at_sema.nl>
Date: Mon, 16 Oct 2000 12:10:48 +0200
Message-Id: <10651.119298@fatcity.com>


Using OO4O I normally use functions, but the technique is the same:

I already have a database connection named OraDatabase. Add a few parameters to the connection

       OraDatabase.Parameters.Add "ERROR", lError, ORAPARM_OUTPUT
       OraDatabase.Parameters("ERROR").ServerType = ORATYPE_VARCHAR2
       
       ' We have to convert the value to String
       OraDatabase.Parameters.Add "AFD_ID", CStr(AfdId), ORAPARM_OUTPUT
       OraDatabase.Parameters("AFD_ID").ServerType = ORATYPE_VARCHAR2
    
       OraDatabase.Parameters.Add "NAAM_AFD", CStr(NaamAfd), ORAPARM_INPUT
       OraDatabase.Parameters("NAAM_AFD").ServerType = ORATYPE_VARCHAR2
    
       OraDatabase.Parameters.Add "TELEFOON", CStr(TelefoonNrAfd),
ORAPARM_INPUT
       OraDatabase.Parameters("TELEFOON").ServerType = ORATYPE_VARCHAR2
Call the function
       OraDatabase.DbExecuteSQL ("declare ERROR varchar2(255); 
						Begin

:ERROR:=CEBES.PCK_CEBA_AFDELING.F_AFDELING_INSERT
( :AFD_ID,

:NAAM_AFD, :TELEFOON); end;")

Check if the function returned an error
       If Not (OraDatabase.Parameters("ERROR").Value = " ") Then
           lError = OraDatabase.Parameters("ERROR").Value
           MsgBox (lError)
       Else
           ' Retrieve the AFD_ID value from oracle
           AfdId = OraDatabase.Parameters("AFD_ID").Value
           ' Add the new values to the grid
	End If
Remove the parameters
       OraDatabase.Parameters.Remove "ERROR"
       OraDatabase.Parameters.Remove "AFD_ID"
       OraDatabase.Parameters.Remove "NAAM_AFD"
       OraDatabase.Parameters.Remove "TELEFOON"

Hope it helps,
Paul

-----Original Message-----
From: blackziggy [mailto:blackziggy_at_sammic.com] Sent: 16 October 2000 11:05
To: Multiple recipients of list ORACLE-L Subject: Call procedures from VBasic

Hello!
I'm working on a Windows-NT, and Oracle it's in a Unix computer. In this project i must call to a Oracle's stored procedure from a visual basic application. I can use PL/SQL in VB to insert, erase or modify registers in Oracle, but now, i want to call to a procedure. I'm trying with "execute proc_name(param1, param2)" but it doesn't work:

for example,

     dim SSQL as string

     SSQL=" execute proc_name(param1, param2) "
     Set vaanEskaria = vaanLotura.OpenResultSet(SSQL, rdOpenKeyset,
rdConcurValues)

In the SQL plus shell, i can use

SQL> execute proc_name(param1, param2);

and it works very well.

Can somebody help me?

Thanks

Iqaki Larraqaga

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: blackziggy
  INET: blackziggy_at_sammic.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
Received on Mon Oct 16 2000 - 05:10:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US