{"id":343,"date":"2014-06-03T18:46:05","date_gmt":"2014-06-03T18:46:05","guid":{"rendered":"http:\/\/localhost\/__sites\/3d_blog\/?p=343"},"modified":"2014-06-03T18:46:05","modified_gmt":"2014-06-03T18:46:05","slug":"split-string-to-array","status":"publish","type":"post","link":"https:\/\/blog.silverterra.net\/?p=343","title":{"rendered":"split string to array"},"content":{"rendered":"<blockquote><p>Goal: create array from a long string<\/p><\/blockquote>\n<pre data-enlighter-language=\"sql\" class=\"EnlighterJSRAW\">\r\nCREATE OR REPLACE PACKAGE STRING_FNC IS \r\n  TYPE t_array IS TABLE OF VARCHAR2(32000) INDEX BY BINARY_INTEGER; \r\n  FUNCTION SPLIT (p_in_string long, p_delim VARCHAR2) RETURN t_array; \r\nEND;\r\n\/\r\n\r\nCREATE OR REPLACE PACKAGE BODY STRING_FNC IS \r\nFUNCTION SPLIT (p_in_string long, p_delim VARCHAR2) RETURN t_array IS \r\n  i       number :=0; \r\n  pos     number :=0; \r\n  lv_str  varchar2(32000) := p_in_string; \r\n  strings t_array; \r\nBEGIN \r\n  pos := instr(lv_str,p_delim,1,1); -- determine first chuck of string   \r\n  WHILE ( pos != 0) LOOP -- while there are chunks left, loop \r\n    i := i + 1; -- increment counter \r\n    strings(i) := substr(lv_str,1,pos); -- create array element for chuck of string\r\n    lv_str := substr(lv_str,pos+1,length(lv_str)); -- remove chunk from string\r\n    pos := instr(lv_str,p_delim,1,1); -- determine next chunk\r\n    IF pos = 0 THEN -- no last chunk, add to array \r\n      strings(i+1) := lv_str; \r\n    END IF; \r\n  END LOOP; \r\n\r\n  RETURN strings; -- return array \r\n    \r\nEND SPLIT; \r\n\r\nEND;\r\n\/\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Goal: create array from a long string<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-oracle"],"_links":{"self":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343"}],"version-history":[{"count":1,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}