rwhn.net
当前位置:首页 >> orAClE中怎样分割字符串 >>

orAClE中怎样分割字符串

(1)定义split_type类型: CREATE OR REPLACE TYPE split_type IS TABLE OF VARCHAR2 (4000) / (2)定义split函数: CREATE OR REPLACE FUNCTION split (p_str IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN split_type IS j INT := 0; i INT...

SELECT REGEXP_SUBSTR('奥迪-A5-Coupe Qu-2.0T-7档自动-两门四驱-西拉红-深内饰', '[^-]+', 1, LEVEL, 'i') AS STR FROM DUAL CONNECT BY LEVEL

代码如下: CREATE OR REPLACE TYPE str_split IS TABLE OF VARCHAR2 (4000); CREATE OR REPLACE FUNCTION splitstr(p_string IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN str_split PIPELINED AS v_length NUMBER := LENGTH(p_string); v_st...

oracle 中可以用connect by把字符串按都好分割: 比如定义字符串: pv_no_list :='23,34,45,56'; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) as "token" FROM DUAL CONNECT BY REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) IS...

-- 定义一个对象类型.CREATE OR REPLACE TYPE ty_row_str_split as object (strValue VARCHAR2 (4000));/-- 定义一个 表/数组类型, 内容是前面定义的那个对象.CREATE OR REPLACE TYPE ty_tbl_str_split IS TABLE OF ty_row_str_split;/--------...

oracle 中可以用connect by把字符串按都好分割: 比如定义字符串: pv_no_list :='23,34,45,56'; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) as "token" FROM DUAL CONNECT BY REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) IS...

select Substr(字段,1,INSTR(字段,'/')-1) from 表名 eg:select Substr('sdhfuiasdh/asdfsadf',1,INST('sdhfuiasdh/asdfsadf','/')-1) from HelloWord

之前我保存的经典的方法,你可以参考下 首先创建一张表t_al_test_sy 字段分别为:pid,str_id,str_dm,str_mc; 存储过程如下: create or replace procedure p_al_output as str_id varchar(60); str_dm varchar(60); str_mc varchar(800); str_s...

用right就行了 right(字符串,10)

网站首页 | 网站地图
All rights reserved Powered by www.rwhn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com