在Oracle数据库中,有多种方法可以拆分字符串。以下是一些常见的方法:
SELECT
SUBSTR(column_name, 1, INSTR(column_name, ',') - 1) as first_part,
SUBSTR(column_name, INSTR(column_name, ',') + 1) as second_part
FROM table_name;
SELECT
REGEXP_SUBSTR(column_name, '[^,]+', 1, 1) as first_part,
REGEXP_SUBSTR(column_name, '[^,]+', 1, 2) as second_part
FROM table_name;
SELECT
x.first_part,
x.second_part
FROM table_name,
XMLTABLE(('"' || REPLACE(column_name, ',', '","') || '"')) AS x;
SELECT
SUBSTR(column_name, 1, INSTR(column_name, ',', 1, LEVEL) - 1) as part
FROM table_name
CONNECT BY LEVEL <= LENGTH(column_name) - LENGTH(REPLACE(column_name, ',', '')) + 1;
这些方法可以根据具体情况选择适合的方式来拆分字符串。