Home > Programming > WM_CONCAT

WM_CONCAT


WM_CONCAT merupakan fungsi Oracle untuk menggabungkan nilai dari banyak baris menjadi satu baris dengan koma sebagai pemisah datanya, berikut merupakan definisi dari Oracle:

Definition:

The Oracle PL/SQL WM_CONCAT function is used to aggregate data from a number of rows into a single row, giving a list of data associated with a specific value. In effect, it cross-tabulates a comma delimited list.

Note that WM_CONCAT is undocumented and unsupported by Oracle, meaning it should not be used in production systems. The LISTAGG function, which can produce the same output as WM_CONCAT is both documented and supported by Oracle.

Berikut ini merupakan contoh penggunaannya:

SELECT WM_CONCAT(CAST(DSCP AS VARCHAR2(50)))
FROM EBMAINT.TBL_MT_STATE
WHERE DSCP LIKE '%JA%';

Yang akan menghasilkan:

Jambi,Jakarta,West Java,Central Java,East Java
Categories: Programming Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: