WHENEVER SQLERROR EXIT SQL.SQLCODE

INSERT INTO dds_legacy_customers (customer_name, country, region, account_owner, risk_rating, revenue, margin, legal_hold)
VALUES ('Banco Aurora', 'Brazil', 'LATAM', 'joao', 'HIGH', 2500000, 620000, 'Y');

INSERT INTO dds_legacy_customers (customer_name, country, region, account_owner, risk_rating, revenue, margin, legal_hold)
VALUES ('Varejo Sol', 'Brazil', 'LATAM', 'joao', 'MEDIUM', 900000, 150000, 'N');

INSERT INTO dds_legacy_customers (customer_name, country, region, account_owner, risk_rating, revenue, margin, legal_hold)
VALUES ('Andes Pay', 'Chile', 'LATAM', 'carla', 'HIGH', 1800000, 410000, 'N');

INSERT INTO dds_legacy_customers (customer_name, country, region, account_owner, risk_rating, revenue, margin, legal_hold)
VALUES ('Northwind Insurance', 'USA', 'NA', 'natalie', 'HIGH', 3300000, 900000, 'Y');

INSERT INTO dds_legacy_contracts (customer_id, contract_status, renewal_date, legal_clause, contract_value)
SELECT customer_id, 'RENEWAL', DATE '2026-10-31', 'Penalty clause under legal review', 2500000
FROM dds_legacy_customers WHERE customer_name = 'Banco Aurora';

INSERT INTO dds_legacy_contracts (customer_id, contract_status, renewal_date, legal_clause, contract_value)
SELECT customer_id, 'ACTIVE', DATE '2027-03-15', 'Standard commercial clause', 900000
FROM dds_legacy_customers WHERE customer_name = 'Varejo Sol';

INSERT INTO dds_legacy_contracts (customer_id, contract_status, renewal_date, legal_clause, contract_value)
SELECT customer_id, 'RENEWAL', DATE '2026-08-20', 'Cross-border data clause', 1800000
FROM dds_legacy_customers WHERE customer_name = 'Andes Pay';

INSERT INTO dds_legacy_tickets (customer_id, assigned_group, severity, summary, private_note)
SELECT customer_id, 'SUPPORT', 'HIGH', 'API latency in payment flow', 'Customer reported escalation to board'
FROM dds_legacy_customers WHERE customer_name = 'Banco Aurora';

INSERT INTO dds_legacy_tickets (customer_id, assigned_group, severity, summary, private_note)
SELECT customer_id, 'SUPPORT', 'MEDIUM', 'Portal access issue', 'No sensitive escalation'
FROM dds_legacy_customers WHERE customer_name = 'Varejo Sol';

COMMIT;

