Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a script that creates and calls a stored procedure named insert_terms. Fir

ID: 3815597 • Letter: W

Question

Write a script that creates and calls a stored procedure named insert_terms. First, code a statement that creates a procedure that adds a new row to the TERMS table in the AP schema. To do that, this procedure should have two parameters: one for the terms_due_days column and another for the terms_description column. IF the value for the description column is NULL, the stored procedure should be able to create a default value for the description column based on the value of the due days column. For example, for a due days column of 120, the description column should have a default value of "Net due 120 days",. Then code a CALL statement that tests this procedure.

Explanation / Answer

CREATE OR REPLACE PROCEDURE INSERTTERMS (  
in_terms_due_days      IN    AP.TERMS.terms_due_days %TYPE,  
in_terms_description   IN    AP.TERMS.terms_description%TYPE
)    
IS  
BEGIN


INSERT
INTO AP.TERMS (terms_due_days,terms_description )  
       VALUES (in_terms_due_days,NVL(terms_description,concat(concat('Net due', in_terms_due_days),' days')));  
COMMIT;  
END;  
/   

EXECUTE AP.INSERTTERMS(120,NULL);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote