当前位置:网站首页>ORACLE列转行--某字段按指定分隔符转多行
ORACLE列转行--某字段按指定分隔符转多行
2022-07-06 07:11:00 【游戏编程】
在数据存储数据库中,常常存在信息以特殊符号隔开形式存储在一个字段里
将代码拷贝使用时,需要更改表名、字段名、分隔字符等(注:使用的时候还需将将N替换为分隔符的长度,如分割符“,”,长度位1,则将N替换位1,一共4处)。
SELECT id,substr(a.city, instr(a.city, '、', 1, levels.lvl) + N, instr(a.city, '、', 1, levels.lvl + 1) -(instr(a.city, '、', 1, levels.lvl) + 1)-(N-1)) as city,usernameFROM(SELECT id,'、' || city || '、' AS city,username,(length(city || '、') - nvl(length(REPLACE(city, '、')), 0))/N AS cntFROM userinfomation) a,(SELECT rownum AS lvlFROM (SELECT (MAX(length(city || '、') - nvl(length(REPLACE(city, '、')), 0)))/N max_len FROM userinfomation)CONNECT BY LEVEL <= max_len) levelsWHERE levels.lvl <= a.cntORDER BY id,levels.lvl;
作者:LW_dcwange
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- Kubernetes cluster builds ZABBIX monitoring platform
- kubernetes集群搭建Zabbix监控平台
- 【每日一题】729. 我的日程安排表 I
- SEO学习的最好方式:搜索引擎
- Bio model realizes multi person chat
- Wechat brain competition answer applet_ Support the flow main belt with the latest question bank file
- 漏了监控:Zabbix对Eureka instance状态监控
- 接口自动化测试框架:Pytest+Allure+Excel
- leetcode1020. Number of enclaves (medium)
- Zhongqing reading news
猜你喜欢

Configure raspberry pie access network

变量的命名规则十二条

Setting and using richview trvstyle template style

Interface automation test framework: pytest+allure+excel

Leetcode35. search the insertion position (simple, find the insertion position, different writing methods)

Babbitt | metauniverse daily must read: the group image of Chinese Internet enterprises pouring into metauniverse: "there are only various survival desires, and there is no ambition for forward-lookin

首发织梦百度推送插件全自动收录优化seo收录模块

Short video, more and more boring?

【每日一题】729. 我的日程安排表 I

Uncaught TypeError: Cannot red propertites of undefined(reading ‘beforeEach‘)解决方案
随机推荐
简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
leetcode6109. 知道秘密的人数(中等,周赛)
LeetCode 78:子集
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Due to high network costs, arbitrum Odyssey activities are suspended, and nitro release is imminent
supervisor 使用文档
Short video, more and more boring?
作者已死?AI正用藝術征服人類
树莓派3B更新vim
Uncaught TypeError: Cannot red propertites of undefined(reading ‘beforeEach‘)解决方案
librosa音频处理教程
Depth residual network
SEO学习的最好方式:搜索引擎
巴比特 | 元宇宙每日必读:中国互联网企业涌入元宇宙的群像:“只有各种求生欲,没有前瞻创新的雄心”...
Is software testing outsourcing going or not? Three years' real outsourcing experience tells you
C - Inheritance - hidden method
kubernetes集群搭建Zabbix监控平台
因高额网络费用,Arbitrum 奥德赛活动暂停,Nitro 发行迫在眉睫
顶测分享:想转行,这些问题一定要考虑清楚!
Librosa audio processing tutorial