473,545 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to call an oracle function with a in C#.


Hello,
Assum i have an oracle function called ofunction.

Can someone tell me how i can call this function assuming it take the
parameter in_param of type clob.

Any help will be highly appreciated

C# .ADO.NET 2.0

jj
May 3 '06 #1
4 29323
Which data connection are you using, System.Data.Ora cleClient or
System.Data.Ole Db?

I'll take a guess. Here's an example that uses OracleClient to delete a
record from the database. It needs the primary key of the record to be
deleted passed in.

OracleCommand cmd = new OracleCommand(" DeleteStoredPro cedureName",
connOracleConne ctionObject);
cmd.CommandType = CommandType.Sto redProcedure;

OracleParameter p_ID = new OracleParameter ("PrimaryKeyID" ,
OracleType.Int3 2);
p_ID.Value = _ID; // _ID is class level variable (aka field) that
holds the id for the record to be deleted

cmd.Parameters. Add(p_ID);

cmd.ExecuteNonQ uery();

To adapt my example for your code, you'd put ofunction where
DeleteStoredPro cedureName is, change OracleType.Int3 2 to OracleType.Clob ,
and change PrimaryKeyID to in_param. Oh, and of course change the assignment
of p_ID.Value from _ID to whatever your variable name is in C# that holds
the data.

For more info, check out Pro Oracle .Net Programming from APress
(http://www.apress.com/book/bookDisplay.html?bID=378). It was nice because
it taught ADO.Net from the Oracle perspective (virtually every other book
I've seen used SQL Server, which is nice as I like SQL Server, but in my
experience Oracle is used just as much).

Hope this helps,

Robert

"jens Jensen" <je**@jensen.dk > wrote in message
news:et******** ******@TK2MSFTN GP02.phx.gbl...

Hello,
Assum i have an oracle function called ofunction.

Can someone tell me how i can call this function assuming it take the
parameter in_param of type clob.

Any help will be highly appreciated

C# .ADO.NET 2.0

jj



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
May 4 '06 #2
here is the function.

just assum you have a connection string:

FUNCTION process_message (

in_message IN CLOB

)

RETURN CLOB;

There seem to be no support to call a function.


May 4 '06 #3

"jens Jensen" wrote...
here is the function.

just assum you have a connection string:

FUNCTION process_message (

in_message IN CLOB

)

RETURN CLOB;

There seem to be no support to call a function.


Yes, in ADO.NET there is.

You call it the same way as you call stored procedures, but add a special
parameter for the return value.

Something like this should work:

OracleCommand cmd = new OracleCommand(" process_message ", conn);
cmd.CommandType = CommandType.Sto redProcedure;

OracleParameter par =
new OracleParameter ("RETURN_VALUE" , OracleType.Clob );
par.Direction = ParameterDirect ion.ReturnValue ;
cmd.Parameters. Add(par);

par = new OracleParameter ("IN_MESSAGE ", OracleType.Clob );
par.Value = myLargeObjectTo Pass;
par.Direction = ParameterDirect ion.Input;
cmd.Parameters. Add(par);

cmd.ExecuteNonQ uery();

OracleLob myReturnValue =
(OracleLob) cmd.Parameters["RETURN_VAL UE"].Value;
/// Bjorn A
May 4 '06 #4
1000 Thanks,
this made my day.
jj
May 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5204
by: Jan Bols | last post by:
I've been trying to install Oracle 8.1.7 on a fresh Mandrake 9.1 O.S for days, but I'm still not able to get it running. I've tried several install instructions that I found on the internet but no luck yet. Here is a short description of what I did so far: 1. I installed the jdk118_v3-glibc-2.1.3.tar in the /usr/local/ dir and made a...
4
2020
by: Gnanaprakash Rathinam | last post by:
Hi Expert, Is there a way to obtain assembly name in an unmanaged call? During Interop call between managed to unmanaged, I would like to know in unmanaged code about the caller of assembly file name? Thanks, GP.
9
17009
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC...
12
9472
by: Newbie | last post by:
how can i call an oracle function to get data without using a select statement or stored procedures? given a project_no, i need to call the function: ops$sqltime.pa_new_job_no_fn which will return the next job_no thanks in advance.
2
1612
by: Newbie | last post by:
how can i call an oracle function? given a project_no, i need to call the function: ops$sqltime.pa_new_job_no_fn which will return the next job_no thanks in advance.
2
6662
by: Gary | last post by:
Hi Al I have the following parameters in an oracle function PACKAGE BODY ALLO A ------------------------------------------------------------------------------- FUNCTION ITEM (O_error_message OUT VARCHAR2 O_item IN OUT item.item%TYPE RETURN BOOLEAN IS......
2
14757
by: John | last post by:
My application needs to call Oracle function using oracle client 9.2. The oracle function returns boolean value from its returned parameter. The name space that I used is system.data.oracleclient. found out there is no boolean type in Oracle parameter in OracleType. How can I get the returned value from function call in my code? Thanks in...
3
13716
by: Steve Kershaw | last post by:
I'm not even sure this can be done. I have a requirement to call an Oracle function (that returns a value) from C# code. The Oracle function is as follows: FUNCTION get_rec_final_qtr_count ( "P_YEAR" IN NUMBER, "P_QUARTER" IN NUMBER ) RETURN Int
0
3797
by: pbaillard | last post by:
Here a sample to call a stored procedure with an Oracle Database. odc.Connection = m_cDb ' use an open connection to your database odc.CommandType = CommandType.StoredProcedure odc.CommandText = "pkg_func.GetReqStatus" ' just set the name of the function, don't used syntax like {? = call pkg_func.GetReqStatus(?,?,?)} ' the return...
0
7470
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7405
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7811
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3455
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1019
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.