zoukankan      html  css  js  c++  java
  • Oracle自定义数据类型

     1 CREATE OR REPLACE FUNCTION split(p_str       IN clob,
     2                                      p_delimiter IN VARCHAR2 default (',') --分隔符,默认逗号
     3                                      ) RETURN split_type IS
     4   j        INT := 0;
     5   i        INT := 1;
     6   len      INT := 0;
     7   len1     INT := 0;
     8   str      clob;
     9   my_split split_type := split_type();
    10 BEGIN
    11   len  := LENGTH(p_str);
    12   len1 := LENGTH(p_delimiter);
    13 
    14   WHILE j < len LOOP
    15     j := INSTR(p_str, p_delimiter, i);
    16 
    17     IF j = 0 THEN
    18       j   := len;
    19       str := SUBSTR(p_str, i);
    20       my_split.EXTEND;
    21       my_split(my_split.COUNT) := str;
    22 
    23       IF i >= len THEN
    24         EXIT;
    25       END IF;
    26     ELSE
    27       str := SUBSTR(p_str, i, j - i);
    28       i   := j + len1;
    29       my_split.EXTEND;
    30       my_split(my_split.COUNT) := str;
    31     END IF;
    32   END LOOP;
    33 
    34   RETURN my_split;
    35 END split;

     自定义Oracle数据类型

    1 CREATE OR REPLACE TYPE "SPLIT_TYPE" IS TABLE OF VARCHAR2 (4000);
    2 CREATE OR REPLACE TYPE "TYPE_STR_SPLIT" IS TABLE OF VARCHAR2 (4000);
    3 CREATE OR REPLACE TYPE "TY_ROW_STR_SPLIT" as object (strValue VARCHAR2 (4000));
    4 CREATE OR REPLACE TYPE "TY_TBL_STR_SPLIT" IS TABLE OF ty_row_str_split;
  • 相关阅读:
    html5传感器
    html5 canvas手写字代码(兼容手机端)
    PHP pdo单例模式连接数据库
    PHP变量回收
    PHP不过过滤防止xss攻击的方法
    jquery监听回车
    jquery预加载显示百分比
    创建自己的代码仓库
    Luxurious Houses
    Vasya the Hipster
  • 原文地址:https://www.cnblogs.com/chenyanbin/p/11677521.html
Copyright © 2011-2022 走看看