--创建表类型 create or replace type mytype as table of number;--如果定义成varchar--CREATE OR REPLACE type mytype as table of varchar2(4000); -- 将字符串分割成数组 function my_split(piv_str in varchar2, piv_delimiter in varchar2) --piv_str 为字符串,piv_delimiter 为分隔符 return
代码:test.sh #!/bin/bash a="one,two,three,four" #要将$a分割开,可以这样: OLD_IFS="$IFS" IFS="," arr=($a) IFS="$OLD_IFS" for s in ${arr[@]} do echo "$s" done shell编程中,经常需要将由特定分割符分割的字符串分割成数组,多数情况下我们首先会想到使用awk但是实际上用shell
原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four" 要将$a分割开,可以这样: OLD_IFS="$IFS" IFS="," arr=($a) IFS="$OLD_IFS" for s in ${arr[@]} do echo "$s" done 上述代码会输出 one
原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four" 要将$a分割开,可以这样: OLD_IFS="$IFS" IFS="," arr=($a) IFS="$OLD_IFS" for s in ${arr[@]} do echo "$s" done 上述代码会输出 one
CREATE OR REPLACE TYPE CUX_STR_SPLIT_TYPE IS TABLE OF VARCHAR2 (4000); CREATE OR REPLACE PACKAGE cux_char_handle_util_pkg IS TYPE char_var_type IS RECORD( char_value )); TYPE char_var_tbl IS TABLE OF char_var_type INDEX BY BINARY_INTEGER; g_char_var_