I have a requirement in a SQL environment that under specific circumstances, all references to table (or view) A in a procedure actually use table (or view) B. On the iSeries I would have used the OVRDBF command to override references to table A with table B: OVRDBF FILE(A) TOFILE(B). What would be the equivalent to this in SQL? Is there one?
My goal is to end up with a procedure that is ignorant of the override. I don't want conditional logic inside the procedure that directs processing at table B when certain conditions are met. The vision:
Under typical circumstances: Just invoke the procedure
Under specific alternative circumstances: Perform the OVRDBF equivalent and then Invoke the procedure
As Ed mentions if you can modify your procedure:
1) Create an alias for file(A)
2) Modify the procedure to reference XYZ instead of A.
3) When running the procedure to use file B execute
If you can't modify the procedure and you're not worried about simultaneous access to table A you could use: