What exactly got migrated? Your datacenter or database? In your open cursor you have an Oracle specific statement (%_HINTS ORACLE) which other database won't be able to cope with.
Also, it doesn't really help when you change the actual table names in XXX...