FUNGSI SPLIT DI PL/SQL ORACLE

Aplikasi-aplikasi diubuntu: • Aplikasi Grafis •
Aplikasi Internet •
Aplikasi Office •
Aplikasi Sound & Video •
Aplikasi Programming
Post Reply
User avatar
aptfast
Posts: 3847
Joined: 03 Jan 2010, 23:38
Location: Jakarta, Indonesia
Contact:

FUNGSI SPLIT DI PL/SQL ORACLE

Post by aptfast » 20 Mar 2012, 16:26

Saat ini belum ada fungsi SPLIT di pemrograman PL/SQL Oracle atau database yg lainnya. Berikut ini adalah kode fungsi split buatan yang saya temukan di sebuah forum diskusi database Oracle. Siapa tahu nanti dibutuhkan.

CREATE OR REPLACE PACKAGE STRING_FNC
IS

TYPE t_array IS TABLE OF VARCHAR2(50)
INDEX BY BINARY_INTEGER;

FUNCTION SPLIT (p_in_string VARCHAR2, p_delim VARCHAR2) RETURN t_array;

END;

CREATE OR REPLACE PACKAGE BODY STRING_FNC
IS

FUNCTION SPLIT (p_in_string VARCHAR2, p_delim VARCHAR2) RETURN t_array
IS

i number :=0;
pos number :=0;
lv_str varchar2(50) := p_in_string;

strings t_array;

BEGIN

-- determine first chuck of string
pos := instr(lv_str,p_delim,1,1);

-- while there are chunks left, loop
WHILE ( pos != 0) LOOP

-- increment counter
i := i + 1;

-- create array element for chuck of string
strings(i) := substr(lv_str,1,pos);

-- remove chunk from string
lv_str := substr(lv_str,pos+1,length(lv_str));

-- determine next chunk
pos := instr(lv_str,p_delim,1,1);

-- no last chunk, add to array
IF pos = 0 THEN

strings(i+1) := lv_str;

END IF;

END LOOP;

-- return array
RETURN strings;

END SPLIT;

END;


Sumber : http://www.dbforums.com/oracle/998642-p ... array.html


User avatar
santenkelapa
Posts: 182
Joined: 29 Jan 2012, 03:47
Location: pondok labu
Contact:

Post by santenkelapa » 21 Mar 2012, 18:23

control + D


User avatar
ilham2930
Posts: 1123
Joined: 02 Jan 2010, 19:30
Location: /indonesia/tangerang/bonank_city
Contact:

Post by ilham2930 » 22 Mar 2012, 08:33

weih mantebs kang, walaupun sy g ngerti maenan database, yg penting mantebs dl dah... :grin:


User avatar
lisnux
Posts: 1763
Joined: 02 Jan 2010, 16:26
Location: Samarinda
Contact:

Post by lisnux » 22 Mar 2012, 11:37

Mastah database :D :D :D

Bookmark om ya :grin:


User avatar
abu_unaisah
Posts: 1621
Joined: 24 Nov 2011, 14:07

Post by abu_unaisah » 22 Mar 2012, 12:35

wah gak ngerti saiyah


User avatar
indraginanjar
Posts: 183
Joined: 17 Mar 2010, 13:49
Location: Padang, Indonesia
Contact:

Post by indraginanjar » 23 Aug 2012, 22:05

aih asyiknya pake oracle, punya array. Di mysql mesti pake table :(


User avatar
samsulmaarif
Posts: 5
Joined: 25 Apr 2011, 20:12
Location: Cilacap
Contact:

Post by samsulmaarif » 22 Oct 2012, 12:50

ikut nyimak om-om... :D


User avatar
maspolhut
Posts: 5
Joined: 15 Apr 2013, 14:20
Location: di bawah langit

Post by maspolhut » 16 May 2013, 22:30

ikutan aja


User avatar
aptfast
Posts: 3847
Joined: 03 Jan 2010, 23:38
Location: Jakarta, Indonesia
Contact:

Post by aptfast » 17 May 2013, 14:21

Alhamdulillah thread nya masih bisa diakses. :D
Semoga bermanfaat.


Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests