当前位置:网站首页>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 .
边栏推荐
- Raspberry pie 3B update VIM
- Proteus -- Serial Communication parity flag mode
- 首发织梦百度推送插件全自动收录优化seo收录模块
- Applied stochastic process 01: basic concepts of stochastic process
- On the world of NDK (2)
- SEO学习的最好方式:搜索引擎
- The author is dead? AI is conquering mankind with art
- [hot100] 739. Température quotidienne
- SSM学习
- [daily question] 729 My schedule I
猜你喜欢
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
NFT on fingertips | evaluate ambire on G2, and have the opportunity to obtain limited edition collections
数据仓库建设思维导图
Top test sharing: if you want to change careers, you must consider these issues clearly!
MPLS experiment
Raspberry pie serial port login and SSH login methods
开源的网易云音乐API项目都是怎么实现的?
leetcode704. Binary search (find an element, simple, different writing)
Wechat official account infinite callback authorization system source code, launched in the whole network
Seriously recommend several machine learning official account
随机推荐
navicat如何导入MySQL脚本
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
微信脑力比拼答题小程序_支持流量主带最新题库文件
Cookie技术&Session技术&ServletContext对象
BIO模型实现多人聊天
Establishment and operation of cloud platform open source project environment
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
网络安全基础介绍
The psychological process from autojs to ice fox intelligent assistance
编译,连接 -- 笔记 -2
Leetcode 78: subset
What does UDP attack mean? UDP attack prevention measures
Supporting title of the book from 0 to 1: ctfer's growth road (Zhou Geng)
TS基础篇
Wechat official account infinite callback authorization system source code, launched in the whole network
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
Twelve rules for naming variables
Zhongqing reading news
Due to high network costs, arbitrum Odyssey activities are suspended, and nitro release is imminent
Top test sharing: if you want to change careers, you must consider these issues clearly!