0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Entity FrameworkとOracle使用時に「ORA-00904: "FALSE": 無効な識別子です。」が発生する

Last updated at Posted at 2025-03-04

使用バージョン

  • Blazor
  • Microsoft.EntityFrameworkCore : Version="8.0.11"
  • Oracle.EntityFrameworkCore : Version="8.21.170"

実行環境

  • Oracle Database 21c

発生するエラー

SQL実行時に以下のエラーが発生する。

ORA-00904: "FALSE": 無効な識別子です。

原因

EFにより自動生成されるCASE文の中でBoolean型が使用されているが、
Oracle Database 21cではBoolean型はサポートされていないためエラーになる。
→CASE文が生成されるコードを書いた場合のみエラーになる。

23c以降はサポートされるため、そちらの環境を前提に動作してしまっている。

改善方法

OracleSQLCompatibilityを設定する

【推奨!】
バージョン21を指定することにより、21環境での動作を考慮してくれる。

optionsBuilder.UseOracle("User Id=hr;Password=<password>;Data Source = inst1", b =>
b.UseOracleSQLCompatibility(OracleSQLCompatibility.DatabaseVersion21));

Oracle.EntityFrameworkCoreのダウングレード

Oracle.EntityFrameworkCoreをバージョン「8.21.150」にダウングレードする。
このメジャーバージョンは非同期処理がうまく動作しないため、おすすめしない。
うまく動作させる方法はあるのかも???

Oracle Databaseのバージョンアップ

Oracle Databaseを23c以降にバージョンアップする。

参考資料

stack overflow (Oracle EntityFramework can no longer handle boolean using EF)

Oracle

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?