Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as SQL by LAB 5 - PLSQL ( 9 years ago )
5.2 Write a procedure to accept customer name, address, and customer type
and account type. Insert the details into the respective tables. 

Solution :
-------------
CREATE OR REPLACE PROCEDURE insertDetails
AS
 v_cust_id customer_masters.cust_id%TYPE;
 v_cust_name customer_masters.cust_name%TYPE;
 v_address customer_masters.address%TYPE;
 v_cust_type customer_masters.customer_type%TYPE;
 v_acc_type account_masters.account_type%TYPE;
 v_balance account_masters.ledger_balance%TYPE;
BEGIN
 v_cust_name := '&customer_name';
 v_address := '&cust_address';
 v_cust_type := '&customer_type';
 v_acc_type := '&account_type';
 v_balance := &starting_balance;
 
 IF v_cust_type='IND' OR v_cust_type = 'NRI'
 THEN
  IF v_acc_type='SAV' OR v_acc_type='SAL'
  THEN
   IF v_acc_type = 'SAV'
   THEN
    IF v_balance<5000 xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed account_number=v_fromAccNum; xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> exec transactDetails;
Transaction recorded.

PL/SQL procedure successfully completed.

SQL> select *from transaction_masters;

TRANSACTION_ID ACCOUNT_NUMBER DATE_OF_T FROM_ACCOUNT_NUMBER TO_ACCOUNT_NUMBER
-------------- -------------- --------- ------------------- -----------------
    AMOUNT TR
---------- --
            23         100000 08-JUL-17              100000            789456
      2000 TR


SQL> select *from account_masters;

ACCOUNT_NUMBER    CUST_ID ACC LEDGER_BALANCE
-------------- ---------- --- --------------
        100007       1060 SAL           4000
        100000       1040 SAL           2000
  

  
5.4 Ensure all the Test cases defined are executed. Have appropriate Self/Peer to Peer 
Code Review and close any defects for the same. 

Done.

 

Revise this Paste

Your Name: Code Language: