Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with function name quoting when mapping dbfunction to function in package

Andrew MoskevitzAug 5 2020 — edited Aug 7 2020

I am submitting this bug here as suggested in this blog post
https://medium.com/@alex.keh/oracle-ef-core-3-1-beta-2-now-available-254d306ff875
We are trying to map a dbfunction using the code below

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
            modelBuilder.HasDbFunction(typeof(DatabaseFunctions).GetMethod(nameof(DatabaseFunctions.GetNameId))).HasSchema("DBM").HasName("DBM_PKG.GETNAMEID");
}


this generates the error

ORA-00904: "DBM"."DBM_PKG.GETNAMEID": invalid identifier

as you can see it puts the quotes around the package name plus the function name, not each individually.
I have tried it several different ways to attempt to get it to work to no success

ORA-00904: "DBM.DBM_PKG"."GETNAMEID": invalid identifier

I have tried including the middle quotes in the name ,"DBM_PKG\".\"GETNAMEID but that results in

ORA-03001: unimplemented feature

an examination of the sql shows this attempt is generating

"DBM"."DBM_PKG"".""GETNAMEID"() 

The EF6 provider saw the . in the function name and correctly generated the quoting.

I would hope this can be fixed, either by detecting the package.functionname in the name, or by providing an additional .HasPackageName method on the DbFunctionBuilder, or some other method.

As a temporary workaround I created a wrapper function that is not in a package DBM.GETNAMEID, but doing that defeats the point of packages.

if there is a way to do this already that does not involve intercepting the generated SQL, then it is not obvious how to do so.

This post has been answered by Alex Keh-Oracle on Aug 5 2020
Jump to Answer

Comments

Post Details

Added on Aug 5 2020
2 comments
617 views