The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_update_reg_from_date DATE;
l_update_reg_to_date DATE;
select registration_id, registration_number, effective_from, effective_to,
LEGAL_LOCATION_ID, REGISTRATION_SOURCE_CODE, REGISTRATION_REASON_CODE,
REP_TAX_AUTHORITY_ID, COLL_TAX_AUTHORITY_ID
from zx_registrations reg, zx_party_tax_profile prof
where reg.PARTY_TAX_PROFILE_ID = prof.PARTY_TAX_PROFILE_ID
and prof.party_id = p_fk_id;
l_update_reg_from_date := l_to_start_date;
l_update_reg_from_date := l_from_start_date;
l_update_reg_to_date := null;
l_update_reg_to_date := l_from_end_date;
l_update_reg_to_date := l_to_end_date;
update zx_registrations
set merged_to_registration_id = l_registration_id_to,
effective_to = sysdate,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where registration_id = l_registration_id_from;
update zx_registrations
set effective_from = l_update_reg_from_date,
effective_to = l_update_reg_to_date,
LEGAL_LOCATION_ID = l_location_id_to,
REGISTRATION_SOURCE_CODE = l_reg_src_code_to,
REGISTRATION_REASON_CODE = l_reg_reason_code_to,
REP_TAX_AUTHORITY_ID = l_rep_tax_auth_id_to,
COLL_TAX_AUTHORITY_ID = l_coll_tax_auth_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where registration_id = l_registration_id_to;
arp_message.set_name('AR','AR_ROWS_UPDATED');
select Party_Tax_Profile_id
from zx_party_tax_profile prof
where prof.party_id = p_fk_id
and prof.party_type_code = 'THIRD_PARTY';
select code_assignment_id, class_category, class_code, END_DATE_ACTIVE
from hz_code_assignments
where owner_table_name = 'ZX_PARTY_TAX_PROFILE'
and owner_table_id = p_ptp_id
and NVL(END_DATE_ACTIVE,SYSDATE) >= sysdate;
select distinct class_category, class_code, END_DATE_ACTIVE
from hz_code_assignments
where owner_table_name = 'ZX_PARTY_TAX_PROFILE'
and owner_table_id = p_ptp_id
and NVL(END_DATE_ACTIVE,SYSDATE) >= NVL(p_end_date,SYSDATE)
and class_category = p_class_category
and class_code = p_class_code
group by class_category, class_code, END_DATE_ACTIVE;
update zx_party_tax_profile
set merged_to_ptp_id = l_ptp_id_to,
MERGED_STATUS_CODE = 'MERGED',
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where Party_Tax_Profile_id = l_ptp_id_from;
arp_message.set_name('AR','AR_ROWS_UPDATED');
update hz_code_assignments
set owner_table_id = l_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where code_assignment_id = code_assig.code_assignment_id;
update zx_registrations
set TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_registrations
set REP_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where REP_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_registrations
set COLL_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where COLL_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_taxes_b
set REP_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where REP_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_taxes_b
set COLL_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where COLL_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_regimes_b
set REP_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where REP_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_regimes_b
set COLL_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where COLL_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_jurisdictions_b
set REP_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where REP_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_jurisdictions_b
set COLL_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where COLL_TAX_AUTHORITY_ID = p_ptp_id_from;
update zx_exemptions
set ISSUING_TAX_AUTHORITY_ID = p_ptp_id_to,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where ISSUING_TAX_AUTHORITY_ID = p_ptp_id_from;
arp_message.set_name('AR','AR_ROWS_UPDATED');
select TAX_EXEMPTION_ID
, EXEMPT_CERTIFICATE_NUMBER
, effective_from
, effective_to
, EXEMPTION_TYPE_CODE
, EXEMPTION_STATUS_CODE
,TAX_REGIME_CODE
from zx_exemptions exemp
where party_tax_profile_id = p_fk_id;
select TAX_EXEMPTION_ID
from zx_exemptions exemp
where party_tax_profile_id = p_to_fk_id
and exempt_certificate_number = l_certificate_number
and effective_from = l_effective_from
and nvl(effective_to,l_effective_to) = l_effective_to
and exemption_type_code = l_type_code
and exemption_status_code = l_status_code
and tax_regime_code = l_tax_regime_code;
update zx_exemptions
set --merged_to_exemption_id = l_exemption_id_to,
party_tax_profile_id = p_to_fk_id,
last_update_date = sysdate,
last_updated_by = g_user_id,
last_update_login = g_login_id,
object_version_number = object_version_number+1
where TAX_EXEMPTION_ID = rec_exe.tax_exemption_id;
arp_message.set_name('AR','AR_ROWS_UPDATED');
select PROCESS_FOR_APPLICABILITY_FLAG
from zx_party_tax_profile ptp
where ptp.party_tax_profile_id = p_ptp_id;
select a.REGISTRATION_TYPE_CODE, a.REGISTRATION_NUMBER, a.ROUNDING_RULE_CODE,
a.SELF_ASSESS_FLAG, a.INCLUSIVE_TAX_FLAG
from zx_registrations a, zx_party_tax_profile b
where b.party_tax_profile_id = p_ptp_id
and a.party_tax_profile_id = b.party_tax_profile_id;
Commenting as per Nigel Updates 3511846
OPEN Calculate_Tax_Flag(p_ptp_id_from);
select Party_Tax_Profile_id, party_type_code
from zx_party_tax_profile prof
where prof.party_id = p_fk_id
and prof.party_type_code = 'THIRD_PARTY';