Strange SQL behavior in cloned databases
Bear with me as I'm going to post a lot of info to document the issue but in reality it's a pretty simple sql statement that is demonstrating odd behavior across almost identical databases.
I have query when I run it in my production database has this result:
SQL> select 'GP'
2 -- into v_person
3 from dual
4 where exists
5 (select tbraccd_pidm
6 from tbraccd, tzrclas, sgbstdn
7 where tbraccd_pidm = 1234567 and
8 tbraccd_pidm = tzrclas_pidm and
9 tbraccd_pidm = sgbstdn_pidm and
10 tbraccd_detail_code like 'T%' and
11 tbraccd_term_code = decode( substr(tzrclas_term_code, 5, 2), '45', decode(tzrclas_clas_code, 'FR', GZKTERM.F_CALC_TERM(tzrclas_term_code,-1), 'SR', tzrclas_term_code, decode(sgbstdn_majr_code_conc_1, 'NCOP', GZKTERM.F_CALC_TERM(tzrclas_term_code,-1), null, GZKTERM.F_CALC_TERM(tzrclas_term_code,-1), tzrclas_term_code)), tzrclas_term_code) and