Using the DUAL table, how can I get a list of numbers from 1 to 100?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
I created an Oracle function that returns a table of numbers
Is necessary create a new data type:
Usage:
And if you need decimals between numbers by exponencial notation:
Here is a fun way to generate a number table. It doesn't use the DUAL table, but should the DUAL table ever disappear then this could be a back-up plan.
It's probably nonsense, but it is a working solution and it was fun to write.
Using Oracle's sub query factory clause: "WITH", you can select numbers from 1 to 100:
The above query is written in SQL in the database.
You could use
XMLTABLE
:DBFiddle Demo
Do it the hard way. Use the awesome
MODEL
clause:Proof: http://sqlfiddle.com/#!4/d41d8/20837