Skip to Main Content

Developer Community

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle.EntityFrameworkCore 8.23.40 .Any() returns ORA-00904: "FALSE": invalid ID

user4444778May 6 2024 — edited May 8 2024

updating from 8.21.140 results in ORA-00904

DbContext
.SubSiteGroupLevel
.Where(x => x.SubSiteId.Equals(subSiteId))
.Where(x => x.Group.GroupUser.Any(y => y.UserId.Equals(userId)))
.Any(x => x.Level <= level);

generates SQL

SELECT CASE
WHEN EXISTS (
SELECT 1
FROM "SubSiteGroupLevel" "s"
INNER JOIN "Group" "g" ON "s"."GroupId" = "g"."Id"
WHERE (((("s"."SubSiteId" = :subSiteId_0) AND (EXISTS (
SELECT 1
FROM "GroupUser" "g0"
WHERE (("g"."Id" = "g0"."GroupId") AND ("g0"."UserId" = :userId_1)))))) AND ("s"."Level" <= :level_2))) THEN true
ELSE false
END FROM DUAL;

which results in a ORA-00904

workaround :

DbContext
.SubSiteGroupLevel
.Where(x => x.SubSiteId.Equals(subSiteId))
.Where(x => x.Group.GroupUser.Any(y => y.UserId.Equals(userId)))
.Count(x => x.Level <= level) > 0;

which generates SQL:

SELECT COUNT(*)
FROM "SubSiteGroupLevel" "s"
INNER JOIN "Group" "g" ON "s"."GroupId" = "g"."Id"
WHERE (((("s"."SubSiteId" = :subSiteId_0) AND (EXISTS (
SELECT 1
FROM "GroupUser" "g0"
WHERE (("g"."Id" = "g0"."GroupId") AND ("g0"."UserId" = :userId_1)))))) AND ("s"."Level" <= :level_2));

This post has been answered by user4444778 on May 8 2024
Jump to Answer
Comments
Post Details
Added on May 6 2024
1 comment
210 views