Menggunakan Pemakaian Function (Fungsi) di ORACLE

Secara umum pemakaian

Nama_Fungsi [(Ekspresi1, Ekspersi2,.....)]

Contoh Penggunaan :
SELECT Last_Name, Job_Id, Salary, Length(Last_Name) "Muqorrobin" FROM Employees WHERE Length (Last_Name) = 10


SELECT First_Name, Last_Name, Replace (Last_Name,'en','MU') "en Diganti MU" FROM Employees WHERE Last_Name LIKE '%en%' AND Last_Name LIKE 'M%'

Select months_between('03-MAY-16','07-oct-95')*30 "Usia Dalam Hari", months_between('03-MAY-16','07-oct-95') "Usia Dalam Bulan", months_between('03-MAY-16','07-oct-95')/12 "Usia Dalam Tahun" FROM DUAL

Select last_name, job_id, to_char(NVL(COMMISSION_PCT,0),'0.99') "Commission_PCT", to_char(NVL(COMMISSION_PCT,0)+0.1,'0.99') "Commission_PCT+0.1" from employees where last_name like 'M%'
  
Select sysdate "Tanggal Hari Ini", sysdate-14 "2 minggu lalu", sysdate+10 "10 hari lagi" from dual

Select last_name, hire_date, job_id, concat('Rp.',to_char(SALARY,'99,999.0')) "Gaji" from employees where job_id='PU_CLERK'

         Select last_name, job_id, commission_pct, case NVL(commission_pct,0) when 0 then 'Tidak Ada Bonus' else 'Ada Bonus' END "Keterangan" from employees


Silahkan bertanya jika kurang mengerti dan kita akan menjawab bersama sama, terimakasih

Postingan terkait:

Belum ada tanggapan untuk "Menggunakan Pemakaian Function (Fungsi) di ORACLE"

Post a Comment