Question: Write a procedure that automatically insert the paid invoices from invoices table into the paid_invoices table. Inserted Invoices should be unique ( no duplicate invoices).

Write a procedure that automatically insert the paid invoices from invoices table into the paid_invoices table.

Inserted Invoices should be unique ( no duplicate invoices).

Write a function that check whether or not an invoice exists in paid_invoices.

The "INVOICES" and "PAID_INVOICES" have the same data types.

Only invoices paid in full ( Invoice_total = payment_total + credit_total) should be transferred to "PAID_INVOICES" table

https://d2vlcm61l7u1fs.cloudfront.net/media%2F1ab%2F1ab0d823-3496-4c31-9803-dde76c505efa%2FphpDxaxvd.png

**** EDIT ****

The invoice_id is a number like (33) and the Primary Key

The invoice_number is a varchar2 like ('Qb3295jd')

The same invoice_id can have multiple invoice_numbers

COLUMN_NAME 1 INVOICE_ID 2 VENDOR_ID 3 INVOICE NUMBER 4 INVOICE_DATE 5 INVOICE TOTAL 6 PAYMENT TOTAL 7 CREDIT TOTAL 8 TERMS_ID 9 INVOICE_DUE_DATE 10 PAYMENT DATE DATA_TYPE NUMBER NUMBER No No VARCHAR2 (50 BYTE) No No No Yes Yes No No Yes DATE NUMBER (9,2) NUMBER (9, 2) NUMBER (9, 2) NUMBER NULLABLE DATA_DEFAULT (null) (null) (null) (null) (null) DATE DATE 0 0 (null) (null) (null) COLUMN_ID COMMENTS 1 (null) 2 (null) 3 (null) 4 (null) 5 (null) 6 (null) 7 (null) 8 (null) 9 (null) 10 (null)

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To achieve the task of inserting paid invoices into the PAIDINVOICES table from the INVOICES table we can create a stored procedure in SQL Additionall... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!