473,412 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,412 developers and data experts.

Executing Oracle Stored Functions.

debasisdas
8,127 Expert 4TB
Oracle Function with IN type as parameter mode.
========================================
Expand|Select|Wrap|Line Numbers
  1. create or replace function mydatefun(dt date) return varchar2
  2. as
  3. mdate varchar2(50);
  4. begin
  5. select to_char(dt,'ddspth month year') into mdate from dual;
  6. return mdate;
  7. end;
To call the above Oracle Function from VB.
================================
Expand|Select|Wrap|Line Numbers
  1. 'general declaration
  2. Dim CON As New ADODB.Connection
  3. Dim PR As New ADODB.Parameter
  4. Dim PR1 As New ADODB.Parameter
  5.  
  6. Private Sub Command1_Click()
  7. CON.Open "Provider=MSDAORA.1;Password=DEBASIS;User ID=DEBASIS;Data Source=OM;Persist Security Info=True"
  8. Dim CMD As New ADODB.Command
  9. Dim RS As ADODB.Recordset
  10. CMD.ActiveConnection = CON
  11. CMD.CommandType = adCmdText
  12. 'DT---This is the datepicker control
  13. CMD.CommandText = "select mydatefun(to_date('" & DT.Value & "','mm/dd/yyyy')) from dual"
  14. Set RS = CMD.Execute
  15. If RS.EOF = False Then
  16. If Not IsNull(RS(0)) Then
  17. Text2.Text = RS(0)
  18. Else
  19. Text2.Text = "Invalid date"
  20. End If
  21. End If
  22. CMD.Cancel
  23. CON.Close
  24. End Sub
Sep 8 '07 #1
0 8608

Sign in to post your reply or Sign up for a free account.

Similar topics

100
by: Peter | last post by:
Company thought DB2 will be better than Oracle. The bottom line is when you do select, the system crash. I think it may take 4-5 years for DB2 to reach Oracle standard. Peter
125
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup...
133
by: jonathan | last post by:
hey all, I realize that this question might pop up from time to time, but I haven't seen it a while and things might of changed, so - Right now (July 2004) how does mysql stand up in...
4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
2
by: gimme_this_gimme_that | last post by:
Assuming data is being stored in a DB2 TIMESTAMP what is the equivalent of Oracle's to_date function : to_date('03/04/2005','MM/DD/YYYY') It's OK if MM/DD/YYYY is the only supported format....
4
by: Stuart Ferguson | last post by:
I am currently writing code to execute SQL Server 2000 Stored procedured using the ODBC.NET SQL Server Driver. The particular stored procedure I am using has multiple paramaters which I have...
0
by: Brew | last post by:
Hello, I'm writing an ASP.NET 2005 (VB) Website with an Oracle 9i backend I have an oracle package with stored procedures and functions I need to use from the VB Code, I'm trying to use the...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
0
debasisdas
by: debasisdas | last post by:
This thread contains some of the sample code showing the method of executing Oracle stored procedures and functions from VB . Hope the user finds them useful. Oracle Procedure with only IN...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.