Answer to Question #273224 in Databases | SQL | Oracle | MS Access for Ampfarisaho

Question #273224

Explain the role and purpose of the two codes provided below.

Create or Replace Trigger Purchase_Entry

After Insert or Update of Purchase_Amt on PURCHASE_AGREEMENT

For Each Row

Begin

  if(:New.Purchase_Amt < 0) Then

   RAISE_APPLICATION_ERROR(‐20100,  

     'Cannot enter a purchase agreement amount less than zero.');

  end if;

End;

insert into PURCHASE_AGREEMENT values (559, '27 May 2020', ‐1, 12350,'C122',1)


1
Expert's answer
2021-11-30T00:37:09-0500

The role and purpose of the first code is to check the purchase amount of each row. In every row if the purchase amount is less than zero, then raise application error by displaying error message as "Cannot enter a purchase agreement amount less than zero".

The role and purpose of the second code is an insert statement used to insert values in to the table. Here PURCHASE_AGREEMENT is a table. The values in the parenthesis are inserted according to the PURCHASE_AGREEMENT table.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS