Alibabacloud.com offers a wide variety of articles about oracle sql to date example, easily find your oracle sql to date example information here online.
Oracle|sql Language Oracle Pl/sql Language Foundation
2002-8-23
Oracle Pl/sql Language Basics
Pl/sql is Oracle's extension of the standard database language,
' Nls_date_language=american ')--------------------------------------------------------------------------------------------------------------- -------Republic of 0104-12-04 FridayD: the Weekday (1-7) is represented by numbers. The parameter nls_territory the default configuration when the week is starting from Sunday, so Sunday is 1 and Saturday is 7.Sql> Select To_char (sysdate, ' Yyyy-mm-dd Day d ') from dual;To_char (sysdate, ' Yyyy-mm-dddayd ')--
Label:One, Time function When you use stored procedures, SQL functions, you encounter some processing of time. such as the acquisition of time and the addition and subtraction. In this case, the SQL comes with the time function. Below I list these functions, easy to remember later, use. --getdate Get current time
Select getdate()
--DateAdd Original time add: 2013-02-17 13:20:16 this time plus 12 months
Date field: SQL Server Date field format in the same character field format, that is, a single quotation mark on it, Oracle Date field format is different, it is very wordy, there are only two ways to deal with:
A: Add a single quotation mark to its value. The arrange order
table in Oracle that can be read by any user, often in a SELECT statement block without a target table.1. Date and character conversion function usage (TO_DATE,TO_CHAR)SelectTo_char (Sysdate,'YYYY-MM-DD Hh24:mi:ss') asNowtime fromDual//Date converted to stringSelectTo_char (Sysdate,'yyyy') asNowyear fromDual//get the year of the timeSelectTo_char (Sysdate,'mm')
Tags: 0.00 interval based on different str diff system article arithmetic operationsOne, SQL Server time Date function detailed 1. Current system date, time Select GETDATE () 2. DateAdd returns a new datetime value based on adding a period of time to the specified date Example
Single-record functions in SQL1. ASCIIReturns the decimal number corresponding to the specified character;SQL> select ascii ('A') A, ascii ('A') A, ascii ('0') zero, ascii ('') space from dual;A ZERO SPACE------------------------------------65 97 48 322. CHRReturns the corresponding characters;SQL> select chr (54740) zhao, chr (65) chr65 from dual;ZH C---Zhao3. CONCATConnect two strings;
Interval helps you easily understand my different date calculation examples.
The first day of a month
In the first example, I will show you how to get to the last day of the month from the current date. Note: This example and other examples in this article will only use the datediff and dateadd functions to calc
Tags: oracle date jojo start end time 1 ORACLE mid-week related knowledge description 1.1 Date formatting functions To_char (X [,FORMAT]) : Press X toFORMATThe format is converted into a string. X is a date,FORMATis a format string that specifies the format in which X
The ORACLE tutorial is the basics of Oracle PL/SQL language.
PL/SQL is an extension of ORACLE's standard database language. ORACLE has integrated PL/SQL into ORACLE servers and other to
types:numeric
Table 2 Character data types
Table 3 Date and Boolean
LOB data type
LOB (Large object, Large object) data type is used to store large data objects such as images, sounds, and LOB data objects can be binary or character data with a maximum length of no more than 4G. LOB data types support arbitrary access, and long only supports sequential access. The LOB is stored in a separate location, while a lob locator (LOB locator) is stored i
SQL Server date calculation
SQL Server date calculation
SQL Server date calculation
Generally, you need to obtain the current date and calculate some other dates. For
article will only use the datediff and dateadd functions to calculate the date we want. In each example, the date to be calculated is obtained through calculation but the previous time interval, and then addition or subtraction is performed. This is the SQL script used to calculate the first day of a month:Select d
oracle| Comparison | data | data type
Original Author: James Koopmann
If you want to store date and time information in Oracle, you are actually choosing from two types of field data, let's look at the differences between the two data types and what they provide.
Date data type
This data type is so familiar that w
current date to the last day of the month. Please note: This example and the other examples in this article will only use the DateDiff and DATEADD functions to calculate the date we want. Each example will get the date you want to calculate by calculating the previous time
Tags: style io ar using SP for data on art1.string Contact operatorSQL Server use + or contact (SQL Server 2012)In Oracle, you can also use the contact, but can not used + to the contact string, you should use | |;2.oracle date time is different with SQL Server date.SQL Serv
This article has found many related books and found nearly 30 common Oracle date operations, from basic year, month, and day representation to slightly more complex days from the beginning of the year to the present, the workday calculation method, which is more difficult, involves a comprehensive solution.
I. Common Oracle d
;
Example 4: Query the month and year that each employee has been hired .
Select Trunc (sysdate-hiredate)/30,trunc (sysdate-hiredate)/365 from EMP;
using Angels to achieve year or month calculations must be inaccurate. Oracle provides the following date functions:
No.
Name of function
Meaning
The number/frequency of SQL queries in ORACLE and the number of SQL queries in oracle
In ORACLE Database Application optimization, the execution Frequency/frequency of an SQL statement is also frequently concerned, because the exe
. receivedate, 'yyyy-mm')> = '2017-01' and to_char (t. receivedate, 'yyyy-mm')
-- Query date
Select * from document_main t where to_char (t. receivedate, 'yyyy-mm-dd')> = '2017-01-01 'and to_char (t. receivedate, 'yyyy-mm-dd')
Oracle time comparisonWhen the to_date conversion time of a string without time and minute is compared with the date field with time a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.