Is there a SQL function to expand table?

后端 未结 4 773
面向向阳花
面向向阳花 2021-01-24 21:48

I vaguely remember there being a function that does this, but I think I may be going crazy.

Say I have a datatable, call it table1. It has three columns: column

4条回答
  •  遇见更好的自我
    2021-01-24 22:17

    Use union all

      Select * from table1
       Union all
       Select * from table1
        Union all
       Select * from table1
       Union all
       Select * from table1
    

    For reuse purposes can embed this code in a procedure like

       Create Procedure 
        expandTable(tablename 
         varchar2(50))
           As 
           Select * from table1
       Union all
       Select * from table1
        Union all
       Select * from table1
       Union all
       Select * from table1 
        End
        /
    

提交回复
热议问题