把'空白'放进去

问题描述 投票:0回答:1

我有这样的表

A      B
0abc   3
1c     4

我想查询这样的空白10次;

A        
0abc          3
1c            4

这只是一个例子,这也可能是100个空白。我应该使用哪种功能?

sql oracle
1个回答
0
投票

使用你的例子应该是:

with sqf
  as (select --+ choose
             '0abc'       "A",
             3            "B"
        from dual
       where 1e1 = 1e1
       union all
      select --+ choose
             '1c'         "A",
             4            "B"
        from dual
       where 1e1 = 1e1
     )
select --+ choose
       rpad(s.a, 10) || to_char(s.b)   "PADDED_LINE"
  from sqf  s
 where 1e1 = 1e1;

https://docs.oracle.com/database/121/SQLRF/functions107.htm#SQLRF00663

© www.soinside.com 2019 - 2024. All rights reserved.