Get the App
SLTechnology News&Howtos  ›  Database  › 

NLS_DATE_LANGUAGEE and NLS_DATE_FORMAT

Shulou Source: shulou.com Published: 2022-06-01 16:57:15 10月01日 Update

Look at the usage of these two default parameters through a question of 051:

91.View the Exhibit and examine the structure of the PROMOTIONS table. Which two SQL statements would execute successfully?

A.UPDATE promotions SET promo_cost = promo_cost+ 100WHERE TO_CHAR (promo_end_date, 'yyyy') >' 2000'

B.SELECT promo_begin_date FROM promotions WHERE TO_CHAR (promo_begin_date,'mon dd yy') = 'jul 01 98'

C.UPDATE promotions SET promo_cost = promo_cost+ 100WHERE promo_end_date > TO_DATE (SUBSTR ('01MJANMUR 2000))

D.SELECT TO_CHAR (promo_begin_date,'dd/month') FROM promotions WHERE promo_begin_date IN (TO_DATE ('JUN 01 98'), TO_DATE ('JUL 01 98'))

Answer: AB

A: correct

B: correct

C: error

D: error

Both C and D errors are due to the fact that the format of the conversion is not specified, and the default format is through the

Decided by NLS_DATE_LANGUAGEE and NLS_DATE_FORMAT, so they both have problems and can be modified as follows

SQL > select TO_DATE (SUBSTR (01Rajousei 2000) from dual;select TO_DATE (SUBSTR)) from dualORA-01861: text and format strings do not match SQL > alter session set NLS_DATE_FORMAT='yyyy';Session alteredSQL > select TO_DATE (01MJANMui 2000 jewelry 8) from dual TO_DATE (SUBSTR ('01murJANKULY 2000 calendar) 8FLV 2000 JUN 12SQL 1SQL > select TO_DATE (' JUN 098') from dual;select TO_DATE ('JUN 098') from dualORA-01841: (complete) the year value must be between-4713 and + 9999, and not 0SQL > alter session set NLS_DATE_FORMAT='MON DD RR' Session alteredSQL > alter SESSION SET NLS_DATE_LANGUAGE='AMERICAN';Session alteredSQL > select TO_DATE ('JUN0198') from dual;TO_DATE (' JUN0198')-1998-6-1

Tags: Format error one two between parameters characters string year text answers questions questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Huawei MySQL NVidia