Schema names hard coded into procedures
I have 4 ECC systems coming in via SLT to four target schemas. Lets call them schema A, B, C and D. I have the same table..lets say VBAK in all of them.
Now I have a stored procedure which takes an input parameter called schemaName
The procedure has logic like:
if schemaName = 'A'
select from A.VBAK
elseif schemaName = 'B'
select from B.VBAK
elseif schemaName = 'C'
select from C.VBAK
elseif schemaName = 'D'
select from D.VBAK
Now the problem is that A,B,C,D map to M,N,O,P in the Quality environment and W,X,Y,Z in the prod.
Hard coded values won't undergo schema mapping upon transport and mentioning a default schema doesn't help since I have multiple schemas.
Confused on what to do.. How do i make the schema names switch in the If condition and in the select statement?
Let me know your thoughts on this.