However the DB2 database had materialized views that were crucial to the business.
Porting those over was non-trivial. Oracle returned a different value for null fields than DB2 (empty strings for null strings vs actual null in one case) did so various portions of the code would fail seemingly randomly.
Some of the constraints didn't map quite as cleanly as the others.
And we haven't even started on the performance tuning and how your schema affects them.
Sure you may be able to port all or most of your schema and queries over to another database but you'll have a lot of work to do after that verifying that nothing is broken and your performance is still acceptable.
SQL is not even close to a guarantee of portability.