当前位置:网站首页>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内核浏览器。
边栏推荐
- Raspberry pie serial port login and SSH login methods
- [daily question] 729 My schedule I
- 开源的网易云音乐API项目都是怎么实现的?
- On the world of NDK (2)
- [server data recovery] case of offline data recovery of two hard disks of IBM server RAID5
- Librosa audio processing tutorial
- Misc of BUU (update from time to time)
- 【JDBC】快速入门教程
- Entity Developer数据库应用程序的开发
- MVVM of WPF
猜你喜欢

“无聊猿” BAYC 的内忧与外患

(4) Web security | penetration testing | network security web site source code and related analysis

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

ROS学习_基础

Missing monitoring: ZABBIX monitors the status of Eureka instance

The first Baidu push plug-in of dream weaving fully automatic collection Optimization SEO collection module

MPLS experiment

因高额网络费用,Arbitrum 奥德赛活动暂停,Nitro 发行迫在眉睫

18. Multi level page table and fast table

kubernetes集群搭建Zabbix监控平台
随机推荐
Raspberry pie serial port login and SSH login methods
【每日一题】729. 我的日程安排表 I
【JDBC】快速入门教程
Cookie技术&Session技术&ServletContext对象
Due to high network costs, arbitrum Odyssey activities are suspended, and nitro release is imminent
因高额网络费用,Arbitrum 奥德赛活动暂停,Nitro 发行迫在眉睫
L'auteur est mort? Ai utilise l'art pour conquérir l'humanité
Blue Bridge Cup zero Foundation National Championship - day 20
攻防世界 MISC中reverseMe简述
Uncaught TypeError: Cannot red propertites of undefined(reading ‘beforeEach‘)解决方案
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
作者已死?AI正用艺术征服人类
开源的网易云音乐API项目都是怎么实现的?
leetcode1020. 飞地的数量(中等)
UDP攻击是什么意思?UDP攻击防范措施
Establishment and operation of cloud platform open source project environment
CDN acceleration and cracking anti-theft chain function
leetcode841. 钥匙和房间(中等)
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
1189. Maximum number of "balloons"