当前位置:网站首页>Oracle column to row -- a field is converted to multiple rows according to the specified separator
Oracle column to row -- a field is converted to multiple rows according to the specified separator
2022-07-06 07:15:00 【Game programming】
In the data storage database , There is often information to Special symbols The separated form is stored in a field
When copying code for use , The table name needs to be changed 、 Field name 、 Separator characters, etc ( notes : When you use it, you need to put N Replace with Separator The length of , Such as separator “,”, Length bit 1, Will N Replace bit 1, altogether 4 It's about ).
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;
author :LW_dcwange
Game programming , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
边栏推荐
- Simple and understandable high-precision addition in C language
- SSM学习
- Jerry needs to modify the profile definition of GATT [chapter]
- RichView TRVStyle 模板样式的设置与使用
- Prefix and array series
- Refer to how customer push e-commerce does content operation
- Arduino tutorial - Simon games
- “无聊猿” BAYC 的内忧与外患
- How are the open source Netease cloud music API projects implemented?
- The differences and advantages and disadvantages between cookies, seeion and token
猜你喜欢
C - Inheritance - polymorphism - virtual function member (lower)
杰理之如若需要大包发送,需要手机端修改 MTU【篇】
变量的命名规则十二条
Internal and external troubles of "boring ape" bayc
You deserve this high-value open-source third-party Netease cloud music player
C language_ Double create, pre insert, post insert, traverse, delete
[daily question] 729 My schedule I
18. Multi level page table and fast table
SSM学习
微信脑力比拼答题小程序_支持流量主带最新题库文件
随机推荐
Go learning --- use reflection to judge whether the value is valid
Misc of BUU (update from time to time)
Crawling exercise: Notice of crawling Henan Agricultural University
【MySQL学习笔记32】mvcc
杰理之BLE【篇】
可变参数重载时的内存错误
RichView TRVStyle 模板样式的设置与使用
1189. Maximum number of "balloons"
Fast target recognition based on pytorch and fast RCNN
Leetcode35. search the insertion position (simple, find the insertion position, different writing methods)
(4) Web security | penetration testing | network security web site source code and related analysis
Simple use of JWT
Uncaught TypeError: Cannot red propertites of undefined(reading ‘beforeEach‘)解决方案
18. Multi level page table and fast table
Yield method of tread
OpenJudge NOI 2.1 1749:数字方格
SSM learning
Project GFS data download
PCL realizes frame selection and clipping point cloud
Introduction to the basics of network security