SHARE
TWEET

Untitled

a guest Nov 15th, 2019 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- operator dan fungsi baku
  2. SET serveroutput ON
  3. SET verify off
  4. DECLARE
  5.   -- deklarasi variable
  6.   vnomor NUMBER(3);  -- nomor karyawan
  7.   vnama VARCHAR2(20); -- nama karyawan
  8.   vtgl_bekerja DATE;  -- tgl mulai bekerja
  9.   vkode_jabatan VARCHAR2(50);
  10.   vnama_jabatan VARCHAR2(50);
  11.    
  12.   --deklarasi konstanta
  13.   kgaris CONSTANT VARCHAR2(50):=LPAD('-',40,'-');
  14. BEGIN
  15.   -- input nomor ke variable nomor
  16.   vnomor:= SUBSTR('&input_nomor_karyawan',1, 3);
  17.  
  18.   -- cari data karyawan yang sesuai dengan vnomor
  19.   SELECT E.last_name, E.hire_date,E.job_id, J.job_title
  20.   INTO vnama,vtgl_bekerja,vkode_jabatan,vnama_jabatan
  21.   FROM Employees E Join Jobs J
  22.   ON E.job_id=J.job_id
  23.   WHERE employee_id = vnomor;
  24.  
  25.  
  26.   --tampilkan record
  27.   dbms_output.put_line('Data Karyawan');
  28.   dbms_output.put_line(kgaris);
  29.   dbms_output.put_line('No. Karyawan : '||vnomor);
  30.   dbms_output.put_line('Nama Karyawan : '||UPPER(vnama));
  31.   dbms_output.put_line('Tgl Mulai Kerja : '||TO_CHAR(vtgl_bekerja, 'yyyy/MM/dd'));
  32.   dbms_output.put_line('Kode Jabatan : '||vkode_jabatan);
  33.   dbms_output.put_line('Nama Jabatan : '||vnama_jabatan);
  34.   dbms_output.put_line(kgaris);
  35.  
  36. EXCEPTION
  37.   WHEN NO_DATA_FOUND THEN dbms_output.put_line
  38.   ('Karyawan No. '||vnomor||' tidak ada...');
  39.    
  40. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top