|
|
|
|
Re: variable prompt - default selection - SQL results [message #678467 is a reply to message #678465] |
Fri, 06 December 2019 07:23 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Solomon Yakobson
Messages: 3280 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Or:
WITH T AS (
SELECT LEVEL MONTH
FROM DUAL
CONNECT BY LEVEL <= 12
)
SELECT MONTH,
MOD(MONTH + 10,12) + 1 PREVIOUS_MONTH
FROM T
/
MONTH PREVIOUS_MONTH
---------- --------------
1 12
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
MONTH PREVIOUS_MONTH
---------- --------------
12 11
12 rows selected.
SQL>
SY.
|
|
|
|
|
|
|