Maybe (but I wouldn’t bet on it).
IF the SQL is all ANSI standard without any IBM extensions.
IF the datatypes all match up properly (Oracle DATE vs DB2 DATE don’t correspond).
IF all names match (this is the easy one).
The optimizers in the two different RDBMSes are most likely going to decide on different access paths, so watch out for that.
I would actually bet against it.
First likely issue would be having the Oracle database defined in the database directory. That would likely need DRDA connectivity which <i>I think</i> is available from Oracle though pricey. You might find an ARD that works elsewhere; you might write your own.
And IF that could be made to work, you’d need to set the Oracle database as the default database on that system. I suspect that every other app would quickly find reason to complain about that.
If Oracle as default DB won’t fly (and I’m pretty sure it won’t), it’s unlikely that there is any SQL in your RPG that allows choosing the database to CONNECT to nor any spec for user/password. If you don’t change the RPG, it’s going to continue connecting to the default *LOCAL database.
Unless your RPG is actually a front-end for JDBC access to your local DB2 database. Then maybe you do something at the Java level. But I’d be surprised.