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

(a) Write an Oracle-compatible SQL command to create a stored procedure that let

ID: 3705969 • Letter: #

Question

(a) Write an Oracle-compatible SQL command to create a stored procedure that lets a user add a new row to the general_ledger_accounts table. Name the procedure whatever you want. The procedure will need two input parameters, one for each column of the table.

(b) Write a statement that calls the stored procedure and that passes it two appropriate values.

Consider the table structure shown in the figure ?GENEALAEDGER-ACCOUNTS Columns Data lConstraints Grants Statistics ITriggers IFlashback IDependencies |Detals Partitons indexes Isqu COLUMIN NAME 1 ACCOUNT NUMBE DATA TYPE NUMBER MIULABLE OATA DEFAULT COLMN JD COMMENTS 1 (null) A DEFALLT COLUMN D (null) (null) No ACCOUNT DESCRIPTION VARCHAR2 (50 BYTE)No 2 (null) (a) Write an Oracle-compatible SQL command to create a stored procedure that lets a user add a new row to the general ledger accounts table. Name the procedure whatever you want. The procedure will need two input parameters, one for each column of the table (b) Write a statement that calls the stored procedure and that passes it two appropriate values.

Explanation / Answer

a)

CREATE PROCEDURE insert_acc (acc_no NUMBER, acc_des VARCHAR(50)) AS

BEGIN

INSERT INTO GENERAL_LEDGER_ACCOUNTS

(ACCOUNT NUMBER, ACCOUNT DESCRIPTION)

VALUES

(acc_no, acc_des);

END;

b)

insert_acc(1, 'This is test account')