http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/difference-between-yyyy-and-rrrr-format-519525
Oracle has always stored dates in four digits, regardless of the
NLS_DATE_FORMAT setting in the parameter file (init.ora). Having said that,
it is still essential to understand where problems may arise! It doesn=92t
matter whether you use =91YYYY=92 or =91RRRR=92 for the TO_CHAR function (character
representation of a date), as this function doesn=92t actually convert the
date. You should instead use =91RRRR=92 for the TO_DATE function, which does
convert dates to a Y2K-compliant format.
So what=92s the difference between YY, YYYY, RR, and RRRR? YY
allows you to retrieve just two digits of a year, for example, the 99 in
1999. The other digits (19) are automatically assigned to the current
century. RR converts two-digit years into four-digit years by rounding.
50-99 are stored as 1950-1999, and dates ending in 00-49 are stored as
2000-2049. RRRR accepts a four-digit input (although not required), and
converts two-digit dates as RR does. YYYY accepts 4-digit inputs but doesn=92t
do any date converting
Essentially, the differences between using RR, RRRR, YY, and YYYY come down
to differences in how an Oracle database stores and displays values. As an
example, consider the following scenario. A simple SELECT statement of the
date column is done without the use of the TO_DATE (or TO_CHAR) function.
USING
ENTERED
STORED
SELECT of date column
YY
22-FEB-01
22-FEB-1901
22-FEB-01
YYYY
22-FEB-01
22-FEB-0001
22-FEB-0001
RR
22-FEB-01
22-FEB-2001
22-FEB-01
RRRR
22-FEB-01
22-FEB-2001
22-FEB-2001
If you have dates which need to be made Y2K compliant, use the TO_DATE
function and DD-MM-RRRR:
UPDATE ORDER
SET order_date =3D TO_DATE (order_date, =91DD-MON-RRRR=92);
There are instances, however, in which RR or RRRR won=92t convert dates to the
Year 2000. For example, if the original dates were entered as four digits
then the TO_DATE function with RR (or RRRR) will not change that value to a
Year 2000 date. For solutions to related scenarios, Oracle has provided a
document, "Oracle Products and Year 2000 Compliance", on their web site,
www.oracle.com/year2000.
Subscribe to:
Post Comments (Atom)
Using Handlebar Prompt in Semantic Kernal
> dotnet add package Microsoft.SemanticKernel.PromptTemplates.Handlebars --version 1.30.0 using Microsoft . SemanticKernel ; using Micr...
-
LINK: http://www.techonthenet.com/oracle/functions/nvl.php Oracle/PLSQL: NVL Function In Oracle/PLSQL, the NVL function l...
-
Setting up a MPI cluster on Ubuntu involves the following steps: 1. Install OpenMPI on all machines. $sudo apt-get install libopenmpi-de...
-
Very Useful Link: http://people.cc.ku.edu/~grobe/intro-to-LSL/index.html#particle Using the Linden Script Language This page is a short...
No comments:
Post a Comment