There is a code snippet in the query that I don't understand, but i write them down. ^^;

SELECT TO_CHAR(TO_DATE(ROWNUM+2454832, 'J'), 'YYYYMMDD') AAA
FROM (
    SELECT LEVEL M FROM DUAL
    CONNECT BY LEVEL <= 2556
)
ORDER BY AAA

Result :

 

DateFormat 'J' Option is

Julian day; the number of days since January 1, 4712 BC. Number specified with J must be integers.

https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924

 

Format Models

The total length of a datetime format model cannot exceed 22 characters. The default datetime formats are specified either explicitly with the initialization parameter NLS_DATE_FORMAT or implicitly with the initialization parameter NLS_TERRITORY. You can c

docs.oracle.com

 

What is the principle of this snippet?

SELECT LEVEL M FROM DUAL
CONNECT BY LEVEL <= 2556


I can guess why, but I don't understand the principle.

Is there anyone who can teach me? ^^;

 

There is a saying in Korea.

If you don't understand, calm down and read(memorize) it.

^^;

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

반응형

+ Recent posts