简体   繁体   English

我如何在序列中有 3 位数字的数字列(Oracle)中找到所有记录

[英]How would I find all records in a number column (Oracle) which have 3 digits in Sequence

How would I find all records in a number column (Oracle) which have 3 digits in Sequence.我如何在序列中有 3 位数字的数字列(Oracle)中找到所有记录。 Would I have to use substr to break down the number to individual digits and then subtract first and second digit to see if they are 1 or -1?我是否必须使用 substr 将数字分解为单个数字,然后减去第一个和第二个数字以查看它们是 1 还是 -1? Is there a better way to do it?有更好的方法吗? Could I break down the number into digits and pass them to a varray in a pl/sql block?我可以将数字分解为数字并将它们传递给 pl/sql 块中的 varray 吗? Please help.请帮忙。

在此处输入图像描述

Assuming that you mean "sequential" as in 1-2-3, then you can use brute force:假设您的意思是 1-2-3 中的“顺序”,那么您可以使用蛮力:

(case when regexp_like(ssn, '012|123|234|345|456|567|678|789')
      then 'in sequence' else 'not in sequence'
 end)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 POSTGRES SQL查询以查找具有一列的所有行包含格式为11位数-4位数的数字 - POSTGRES SQL query to find all the rows which have one column contains number with format like 11 digits - 4 digits 如何找到所有社会保险号的后四位数相同的记录? - How can I find all the records that has the same last four digits of social security number? 在SQL请求中,如何查找字符串的最后一部分(最后一个空格之后)中具有数字的所有记录。 - In a SQL request, how to find all the records that have digits in the last part of the string (after last whitespace) 如何查找列中所有值都包含在另一个表中的记录? - How to find records which ALL values in column are contained in another table? 如何使用序列号更新 oracle 列表列 - How to update oracle list column with sequence number 我如何找到列中哪些列具有数组中的所有数字 - How do I find column which columns have all numbers in an array 如何找到最小的缺失序列号 - How to find missing sequence number which is minimum 在Oracle SQL中,如何找到哪些表引用了特定的列(即将其作为外键)? - In Oracle SQL , how can I find which tables reference a specific column (i.e have it as foreign key )? 在 Oracle SQL 中,如何找到一列中的所有值,而另一列中存在多个不同值 - In Oracle SQL how can i find all values in one column for which in another column exist more than one distinct value 如何使用 SQL 从没有任何 id 列的两个不同表中找到完全匹配的记录 - How can I find exact matching records from two different table which doesn't have any id column using SQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM