|
|
|
|
Re: variable prompt - default selection - SQL results [message #678467 is a reply to message #678465] |
Fri, 06 December 2019 07:23   |
Solomon Yakobson
Messages: 3303 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.
|
|
|
|
|
|
|