需要查询从dba_tables中获取表名,但想要分配序列号(重复1.2.3 ...作为表名的前缀,如下所示。)
1:table_name1
2:table_name2
3:table_name3
1:table_name4
2:table_name5
3:table_name6
等等。
答案 0 :(得分:1)
假设您想按表名排序,可以使用:
select case when mod(row_number() over ( order by table_name), 3) = 0
then 3
else
mod(row_number() over ( order by table_name), 3)
end case,
table_name
from dba_tables