Use the script below to create an updateable view named balance_due_view. Then, create and test an INSTEAD OF trigger named invoices_instead_of_insert that lets the user update the columns in the view by directly updating the Invoices table. Within this trigger, you can call the stored procedure named insert_invoice that's created by the script for figure 15-5
CREATE OR REPLACE VIEW balance_due_view AS
SELECT vendor_name, invoice_number,
invoice_total, payment_total, credit_total,
invoice_total - payment_total - credit_total AS balance_due
FROM vendors JOIN invoices ON vendors.vendor_id = invoices.vendor_id
WHERE invoice_total - payment_total - credit_total > 0;