My Little Spot on the Net

July 18, 2006

Fungsi PostgreSQL yang sama dengan NVL milik Oracle

Filed under: Howto's

Bagi anda yang sering berkutat dengan Oracle, pasti sering membutuhkan fungsi NVL dalam operasi query. NVL sangat berguna untuk operasi view data. Sayangnya fungsi ini tidak ada di PostgreSQL (atau saya yang tidak tahu?). Setelah berpusing-pusing ria dengan manual PostgreSQL, akhirnya saya menemukan satu fungsi yang memiliki perilaku sama. Yaitu fungsi COALESCE.
Deskripsi dari manual adalah sebagai berikut :

The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:

SELECT COALESCE(description, short_description, '(none)') ...

Like a CASE expression, COALESCE will not evaluate arguments that are not needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. This SQL-standard function provides capabilities similar to NVL and IFNULL, which are used in some other database systems.

2 Comments »

The URI to TrackBack this entry is: http://bayu.blogsome.com/2006/07/18/fungsi-postgresql-yang-sama-dengan-nvl-milik-oracle/trackback/

  1. sumpeh kagak ngerti SQL, NVL, …. apa itu ya ??? kalo functor ngerti gak ??? ;D. hahaha harus belajar nih keknya, duit IT ada di Database sih :p

    Comment by L_O_J — July 18, 2006 @ 5:31 am

  2. #1 : kekekekekeke, tapi gue juga ga’ ngerti algoritma game :D . Jadi 1 sama deh hehehe

    Comment by Arief Bayu Purwanto — July 18, 2006 @ 6:18 am

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>























Get free blog up and running in minutes with Blogsome
Theme designed by Ben de Groot