Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to connect/use oracle store procedure in VB

Status
Not open for further replies.

tkyap

Programmer
Sep 26, 2001
7
0
0
MY
Dear All
how to connect/use oracle store procedure in VB??
 
Hi,


'How to call a function in oracle (and return a value)

'call function ORA_FUNC

Code:
strSQL = "{?=call ORA_FUNC ('" & strVar1 & "','" & _
         strVar2 & "')}"
' use the initialised command object

Code:
objCMD.ActiveConnection = OraDb
 [/code=]
[COLOR=green] ' set the properties of the command
 [/color]
 [code]
OraDb.BeginTrans
    blnTrans = True
    With objCMD
        .CommandText = strSQL
        .CommandType = adCmdText

' set the return value of the procedure

Code:
        Set objParam = .CreateParameter("RETURN_VALUE", _
                       adVarChar, adParamReturnValue, 500)
       .Parameters.Append objParam

' run the stored procedure

Code:
       .Execute

' extract the return value

Code:
       strErrReturned = .Parameters("RETURN_VALUE").Value
    End With
Set objCMD = Nothing

'How To Call A Stored Procedure in Oracle

'Call Stored Proc oracleprocname


Code:
strSQL="BEGIN oracleprocnname(inVar,inVar2); End;"

OraDB.execute strSQL

Ciao
Phathi >:):O>
 
Hi,


'How to call a function in oracle (and return a value)

'call function ORA_FUNC

Code:
strSQL = "{?=call ORA_FUNC ('" & strVar1 & "','" & _
         strVar2 & "')}"
' use the initialised command object

Code:
objCMD.ActiveConnection = OraDb
' set the properties of the command

Code:
OraDb.BeginTrans
    blnTrans = True
    With objCMD
        .CommandText = strSQL
        .CommandType = adCmdText

' set the return value of the procedure

Code:
        Set objParam = .CreateParameter("RETURN_VALUE", _
                       adVarChar, adParamReturnValue, 500)
       .Parameters.Append objParam

' run the stored procedure

Code:
       .Execute

' extract the return value

Code:
       strErrReturned = .Parameters("RETURN_VALUE").Value
    End With
Set objCMD = Nothing

'How To Call A Stored Procedure in Oracle

'Call Stored Proc oracleprocname


Code:
strSQL="BEGIN oracleprocnname(inVar,inVar2); End;"

OraDB.execute strSQL

Ciao
Phathi >:):O>
 
Hello,

Code:
* What do you want to do?
* Do you want to insert/update/delete row(s)?
* Do you want to retrieve a recordset back from the Procedure?
* What version of ORACLE?
* What version of ADO?

scott #-)
 
hi SLAbel, i want to manipulate data in oracle, may be insert or update, it will return a boolean variable to indicate the success or fail of transaction,
oracle 8,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top