SHARE
TWEET

Untitled

a guest Nov 14th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set serveroutput on
  2. declare
  3.   -- variable
  4.   vnik number(3);
  5.   vnama varchar2(10);
  6.   vpinjaman number(20);
  7.   vbunga number(20);
  8.   vlpinjaman number(20);
  9.   vtotal number(20);
  10.   vangsuran number(20);
  11.   -- konstanta
  12.   kgaris constant varchar2(90) :=LPAD ('-',90,'-');
  13.   klpinjaman Constant real :=60;
  14.   kbunga CONSTANT real:=0.2;
  15. begin
  16.   -- Field
  17.   dbms_output.put_line('Daftar Pinjaman Karyawan');
  18.   dbms_output.put_line(kgaris);
  19.   dbms_output.put_line(RPAD('NIK',5,' ' )|| RPAD ('NAMA',15,' ') || RPAD('PINJAMAN',15,' ') || RPAD('L.PINJAMAN',15,' ')
  20.   || RPAD('BUNGA',15,' ') || RPAD('TOTAL',15,' ') || RPAD('ANGSURAN',15,' ')) ;
  21.   dbms_output.put_line(kgaris);
  22.  
  23.   -- record
  24.   vnik := 100;
  25.   LOOP
  26.     Select Employee_id, Last_name, Salary
  27.     Into vnik, vnama, vpinjaman
  28.     From Employees
  29.     Where employee_id = vnik;
  30.    
  31.     vbunga:= (kbunga * vpinjaman);
  32.     vtotal:= (vpinjaman + vbunga);
  33.     vangsuran:= (vtotal / klpinjaman);
  34.    
  35.     dbms_output.put_line(RPAD(vnik,5,' ') || RPAD (vnama,15,' ') || RPAD(vpinjaman,15,' ')
  36.     || RPAD(klpinjaman,15,' ') || RPAD(vbunga,15,' ') || RPAD(vtotal,15,' ') || RPAD(vangsuran,15,' ')) ;
  37.     vnik := vnik + 1; --nomor induk selanjutnya
  38.     Exit when vnik > 120; -- proses akhir perulangan
  39.   END LOOP;
  40.  
  41.   -- Data Mahasiswa
  42.   dbms_output.put_line(kgaris);
  43.   dbms_output.put_line ('NIM      : 8040170092 ');
  44.   dbms_output.put_line ('NAMA     : YOSHO');
  45.   dbms_output.put_line ('KELAS    : 04PS5 ');
  46.   dbms_output.put_line(kgaris);
  47. END;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top