当前位置:网站首页>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 .
边栏推荐
- LeetCode 78:子集
- Configure raspberry pie access network
- 18. Multi level page table and fast table
- [hot100] 739. Température quotidienne
- [server data recovery] case of offline data recovery of two hard disks of IBM server RAID5
- LeetCode Algorithm 2181. 合并零之间的节点
- SEO学习的最好方式:搜索引擎
- chrome查看页面fps
- Crawling exercise: Notice of crawling Henan Agricultural University
- Introduction to ros2 installation and basic knowledge
猜你喜欢

Leetcode 78: subset

win10 64位装三菱PLC软件出现oleaut32.dll拒绝访问

Fast target recognition based on pytorch and fast RCNN

UWA pipeline version 2.2.1 update instructions

配置树莓派接入网络

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

Wechat brain competition answer applet_ Support the flow main belt with the latest question bank file

作者已死?AI正用艺术征服人类

Prefix and array series

18. Multi level page table and fast table
随机推荐
The difference between get and post request types
【JDBC】快速入门教程
杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
Bloom taxonomy
win10 64位装三菱PLC软件出现oleaut32.dll拒绝访问
多线程和并发编程(二)
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
Jerry needs to modify the profile definition of GATT [chapter]
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
1091: two or three things in childhood (multi instance test)
leetcode841. Keys and rooms (medium)
Visitor tweets about how you can layout the metauniverse
UWA pipeline version 2.2.1 update instructions
作者已死?AI正用艺术征服人类
Leetcode59. spiral matrix II (medium)
leetcode1020. 飞地的数量(中等)
Upgraded wechat tool applet source code for mobile phone detection - supports a variety of main traffic modes
PCL realizes frame selection and clipping point cloud
NFT on fingertips | evaluate ambire on G2, and have the opportunity to obtain limited edition collections
杰理之BLE【篇】