Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:30:09+00:00 2026-05-23T07:30:09+00:00

I’m working on an application which accesses data from an Oracle 11g database. I’m

  • 0

I’m working on an application which accesses data from an Oracle 11g database. I’m using EF4 and data is accessed using LINQ.
I have come across a scenario where I need to call a function stored in a package. This function also has a return value. I have added this function to the entity data model but am unable to perform “Add Function Import” on it. Hence I’m unable to access it using LINQ.
How can I call this function and also get it’s return value?

I asked this question a while back, but have not got any answer for it yet. Anyways, I’m updating it with some details so that it becomes convenient for others to understand the issue and guide me in the right direction. I have tried to implement the solution proposed in this question, but am getting an exception.

I’ve added the following to the designer.cs file of my entity data model:

   [EdmFunction("TestModel.Store", "TestFunction")]
    public int TestFunction(decimal ALNR, decimal ATID, decimal AUKENR)
    {
        throw new ApplicationException();
    }

Following is a small portion of the edmx file:

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<!-- EF Runtime content -->
    <edmx:Runtime>
    <!-- SSDL content -->
        <edmx:StorageModels>
           <Schema Namespace="TestModel.Store" Alias="Self" Provider="Oracle.DataAccess.Client" ProviderManifestToken="11g" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
               <Function Name="TestFunction" ReturnType="number" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" StoreFunctionName="PKG_TURNUS.SUMUKE" Schema="SYSTEM">
      <Parameter Name="ATID" Type="number" Mode="In" />
      <Parameter Name="ALNR" Type="number" Mode="In" />
      <Parameter Name="AUKENR" Type="number" Mode="In" />
    </Function>

Here is how I am calling this function:

var selectQuery = from T in _context.Table1
                  join A in _context.Table2 on T.columnA equals A.columnB
                  join TU in _context.Table3 on T.columnC equals TU.columnD
                  where T.columnD == 5 && T.columnE == someVariable
                  select new someType
                  {
                      propertyA = A.columnG,
                      propertyB = _context.TestFunction(T.columnE, A.columnF, TU.columnH) 
                  };  

But when I do any of the following:

ObservableCollection<someType> weekTotaldata = new ObservableCollection<someType>(selectQuery);  //Exception thrown at runtime

or

foreach (var ttu in selectQuery) //Exception thrown at runtime
{
    double testval = ttu.propertyB;
} 

I get the exception that is thrown in that function “ApplicationException”. Shouldn’t this
exception be thrown when this function is called anywhere else exception the L2E query?

What am I doing wrong? How can I call an oracle function from Linq-To-Entities? Please note that the function that I am trying to call is not a built-in oracle function, but a user-defined function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:30:10+00:00Added an answer on May 23, 2026 at 7:30 am

    As far as i have worked on EF4 using Oracle , Function importing doesn’t seems to work here. I faced the same problem few months back and tried many ways to import a function but without any luck. But during searching I found a link on OTN which states that (Oracle Stored Functions are not supported). EF4 doesn’t give us the option to call oracle function yet. Even using Stored Procedures, you will need to select stored procedures that return a ref cursor. Supported Stored procedures include procedures and package methods that do not have a return value, but may have OUT or IN OUT parameters.

    Here is the link

    But if you are using Sql server some how you can accomplish the User Defined Function import in EF4. Here are some links that might helps you:

    Link1

    Link2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.