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
Contact:

FUNGSI SPLIT DI PL/SQL ORACLE

Post 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
ilham2930
Contact:

Post 22 Mar 2012, 08:33

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


User avatar
lisnux
Contact:

Post 22 Mar 2012, 11:37

Mastah database :D :D :D

Bookmark om ya :grin:


User avatar
abu_unaisah

Post 22 Mar 2012, 12:35

wah gak ngerti saiyah


User avatar
indraginanjar
Contact:

Post 23 Aug 2012, 22:05

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


User avatar
maspolhut

Post 16 May 2013, 22:30

ikutan aja


User avatar
aptfast
Contact:

Post 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 53 guests