Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Praveen.

Asked: April 01, 2020 - 7:00 am UTC

Last updated: April 03, 2020 - 10:11 am UTC

Version: 12c

Viewed 1000+ times

You Asked

How to Generate version Number using oracle SQL like rownum??

Need Result Like this 0.7,0.8,0.9,1.0,1.1,1.2 upto 4.5

and Connor said...

A little rownum and to_char should do the trick

select to_char((rownum+6)/10,'fm0.0') ver
from dual
connect by level < 40;


Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thank you

A reader, April 03, 2020 - 3:15 am UTC


Chris Saxon
April 03, 2020 - 10:11 am UTC

You're welcome.

The model rocks!

Rajeshwaran, Jeyabal, April 03, 2020 - 3:49 pm UTC

demo@PDB1> select to_char(y,'fm0.0') as final_values
  2  from dual
  3  model
  4     return updated rows
  5     dimension by (0 as x)
  6     measures( 0 y )
  7     rules(
  8             y[ for x from 0.7 to 4.5 increment 0.1 ] = cv(x))
  9  /

FINA
----
0.7
0.8
0.9
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3.0
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4.0
4.1
4.2
4.3
4.4
4.5

39 rows selected.

demo@PDB1>

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library