以IN类型作为参数模式的Oracle Function。
========================================
create or replace function mydatefun(dt date) return varchar2
as
mdate varchar2(50);
begin
select to_char(dt,'ddspth month year') into mdate from dual;
return mdate;
end;
从VB调用上述Oracle函数。
================================
'general declaration
Dim CON As New ADODB.Connection
Dim PR As New ADODB.Parameter
Dim PR1 As New ADODB.Parameter
Private Sub Command1_Click()
CON.Open "Provider=MSDAORA.1;Password=DEBASIS;User ID=DEBASIS;Data Source=OM;Persist Security Info=True"
Dim CMD As New ADODB.Command
Dim RS As ADODB.Recordset
CMD.ActiveConnection = CON
CMD.CommandType = adCmdText
'DT---This is the datepicker control
CMD.CommandText = "select mydatefun(to_date('" & DT.Value & "','mm/dd/yyyy')) from dual"
Set RS = CMD.Execute
If RS.EOF = False Then
If Not IsNull(RS(0)) Then
Text2.Text = RS(0)
Else
Text2.Text = "Invalid date"
End If
End If
CMD.Cancel
CON.Close
End Sub
From: https://bytes.com/topic/visual-basic/insights/705034-executing-oracle-stored-functions
本文介绍了一个Oracle函数的创建与使用示例,该函数接收日期参数并返回格式化的字符串。此外,还展示了如何从Visual Basic环境中调用这个Oracle函数,包括连接配置和执行查询的具体代码。
988

被折叠的 条评论
为什么被折叠?



