如何在甲骨文中分开的两个字符串之间做事
我该如何获取所有值的列表
我在数据库中具有存储为1234,5678的字符串中的值,如果我确实从room_number这样的学生中选择 * * 1234,5678'的学生,
;它只给出一个空的值,这两个数字如何使所有属于“ 1234”'5678'和'1234,5678'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您描述的方式,必须将逗号分隔的值分为行。
我不确定您的意思是说某人的房间编号真的可以是
1234,5678
,但是 - 您可能会这样做;这就是联合所有查询的一部分。
The way you described it, you'll have to split comma-separated values into rows.
I'm not sure what you mean by saying that someone's room number can really be
1234,5678
but hey - you probably do; that's what theUNION ALL
part of the query does.您无需将列表分为单独的条款。
您可以使用
喜欢
,并包围列表和匹配值与列表定界符:对于(硬编码的)值,它将是:
如果您将存储在另一个表中的值,则可以
基于
喜欢的加入:对于示例数据:
输出:
db<这里
You do not need to split the list into separate terms.
You can use
LIKE
and surround the list and the matching values with the list delimiter:Which for your (hard-coded) values would be:
If you have the values stored in another table then you can
JOIN
based onLIKE
:Which, for the sample data:
Outputs:
db<>fiddle here