Skip to content

Commit 5058480

Browse files
PhenXCopilot
andauthored
Update src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleBulkInsertProvider.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0b30e4f commit 5058480

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleBulkInsertProvider.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,19 @@ protected override Task BulkInsert<T>(
7272
}
7373

7474
/// <inheritdoc />
75-
protected override Task DropTempTableAsync(bool sync, DbContext dbContext, string tableName)
75+
protected override async Task DropTempTableAsync(bool sync, DbContext dbContext, string tableName)
7676
{
77-
return ExecuteAsync(sync, dbContext, $"DROP TABLE IF EXISTS {tableName}", default);
77+
var connection = (OracleConnection)dbContext.Database.GetDbConnection();
78+
var commandText = $@"
79+
BEGIN
80+
EXECUTE IMMEDIATE 'DROP TABLE ' || :tableName;
81+
EXCEPTION
82+
WHEN OTHERS THEN
83+
IF SQLCODE != -942 THEN -- ORA-00942: table or view does not exist
84+
RAISE;
85+
END IF;
86+
END;";
87+
88+
await ExecuteAsync(sync, dbContext, commandText, new OracleParameter("tableName", tableName));
7889
}
7990
}

0 commit comments

Comments
 (0)