How to call an Oracle function directly using OLEDB provider (or otherwise)?

I would like to call an Oracle function directly using OLEDB (or Oracle) connection|command objects?
I have seen examples using OLEDB and "{ call ? ? }" syntax but need one specific to below.

The Oracle function has the following signature is as follows:


                          FUNCTION get_sscc
                            RETURN VARCHAR2


Any help appreciated.
Cheers.
smaccaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DevastatedCommented:
Hi,

there is a forum at http://forums.asp.net/967327/ShowPost.aspx that discusses this in some detail;  ajagadeesh presents an oledb method for accessing oracle functions.

p.s. The policy of experts-exchange prohibits me infringing copyrights by copying/pasting code from another website to this website.

Hope this helps.
slyckboyCommented:
using a odp.net it would be as follows

dim cmd as new oraclecommand
dim strReturnedValue as string

cmd.connection = cn ' provided cn is defined earlier as an oracleconnection
cmd.commandtext = "get_sscc"
cmd.commandtype = commandtype.storedprocedure
cmd.parameters.add("returnvalue", oracledbtype.varchar2).direction = parameterdirection.returnvalue
cmd.parameters.add("inputparameter", oracledbtype.varchar2).value = {value input into the function} ' this is only necessary if the function has input parameters.  If so then they must be
                                                                                                                                                   ' entered in the order the function calls for them.
strReturnedValue = cmd.parameters.add("returnvalue").value

If there is no input parameters just omit the second cmd.parameters.add
Let me know if you have further questions.  



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
smaccaAuthor Commented:
Which execute statement - I assume ExecuteNonQuery
slyckboyCommented:
ExecuteNonQuery is correct.  Sorry I omitted that.  It should come before the

strReturnedValue = cmd.parameters.add("returnvalue").value

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.