- 3,715,753 Users
- 2,242,856 Discussions
- 7,845,550 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 467 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 3 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 416 SQLcl
- 42 SQL Developer Data Modeler
- 184.9K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 9 DevOps
- 3K QA/Testing
- 250 Java
- 5 Java Learning Subscription
- 10 Database Connectivity
- 66 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 10 Español
- 1.9K Japanese
- 2 Portuguese
Script-Migration -i returns invalid SQL Script

Hi,
I have used Script-Migration to generate the SQL script to update databases, no matter what migration level they are.
For this I used the switch -i (--idempotent).
Extract of the generated script:
DECLARE v_Count INTEGER;BEGINSELECT COUNT(*) INTO v_Count FROM "__EFMigrationsHistory" WHERE "MigrationId" = N'20190523102943_Initial'IF v_Count = 0 THEN BEGIN EXECUTE IMMEDIATE 'CREATE TABLE "AP_ApplicationGroups" ( "ApplicationGroupId" RAW(16) NOT NULL, "DSCreated" TIMESTAMP(7), "DSCreatedBy" NVARCHAR2(20), "DSModified" TIMESTAMP(7), "DSModifiedBy" NVARCHAR2(20), "Name" NVARCHAR2(64) NOT NULL, "Position" NUMBER(10) NOT NULL, CONSTRAINT "PK_AP_ApplicationGroups" PRIMARY KEY ("ApplicationGroupId") )'; END; END IFEND/
The generated script is wrong.
A semicolon is missing in line 4, 21 and 22.
DECLARE v_Count INTEGER;BEGINSELECT COUNT(*) INTO v_Count FROM "__EFMigrationsHistory" WHERE "MigrationId" = N'20190523102943_Initial'IF v_Count = 0 THEN CREATE UNIQUE INDEX "IX_AP_ApplicationGroups_Name" ON "AP_ApplicationGroups" ("Name") END IFEND/
A semicolon is missing in line 4, 9 and 10.
Line 8 (Create Unique Index") has to been executed with "execute immediate".
Tested with .net Core 3.1 and Oracle.EntityFrameworkCore 3.19-beta2
Best Answer
-
Thanks for reporting. I was able to reproduce the problem in a couple of EF Core samples. I filed bug 31726832 to track the issue.
In my testing, I found that leaving out the Idempotent parameter generated a valid script that can be applied in the ODT Query Window or SQLPlus. For now, please use that as a workaround while my team investigates.
Answers
-
Thanks for reporting. I was able to reproduce the problem in a couple of EF Core samples. I filed bug 31726832 to track the issue.
In my testing, I found that leaving out the Idempotent parameter generated a valid script that can be applied in the ODT Query Window or SQLPlus. For now, please use that as a workaround while my team investigates.
-
Hi Alex,
for completeness:
after updating my application to the production release of Oracle EF Core 3.1 (3.19.80), the output of Script-Migration is valid.
Thanks for the Bugfix.