Home » SQL & PL/SQL » SQL & PL/SQL » Oracle User Defined Function
Oracle User Defined Function [message #2465] Thu, 18 July 2002 02:55 Go to next message
Nizam
Messages: 1
Registered: July 2002
Junior Member
Hi,
I am new to Oracle programming.I have a oracle user defined function which takes two input parameters which are both numbers and returns a number.
say for ex:
function packagename.functionName(param1 as number,param2 as number) as number

I want to call this function in my VB Program
and i am using ODBC provider.

Thanks in advance
Re: Oracle User Defined Function [message #2504 is a reply to message #2465] Sun, 21 July 2002 23:15 Go to previous message
koteswara rao p.
Messages: 10
Registered: June 2002
Junior Member
hi
nizam

you can't call a function in vb which is defined
in a package.
but you can call a stored procedure from vb.

the code for this is follows.

declare the following in general declaration section.

Dim cmd As New ADODB.Command
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim par As ADODB.Parameter

paste the following code in a sub from where you
want to call the stored procedure.

cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=dinesh;Persist Security Info=True"

cmd.CommandType = adCmdStoredProc
cmd.CommandText = "storedProcedurename" 'Enter your stored procedure name here

Set par = cmd.CreateParameter("parameterName", adInteger, adParamInputOutput)

cmd.Parameters.Append par
par.Value = InputBox("Input value for parameter", "Calling Stored Procedure")
Set rs = cmd.Execute
Previous Topic: To Retrieve a single row ; Urgent
Next Topic: Trigger created with compilation errors
Goto Forum:
  


Current Time: Thu Apr 25 12:36:58 CDT 2024