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.
'7' day from dualCurrent Time minus JulySelect sysdate, sysdate-interval '7' month from dualCurrent Time minus 7 yearsSelect sysdate, sysdate-interval '7' year from dualTime Interval multiplied by a numberSelect sysdate, sysdate-8 * interval '2' hour from dual2. Date-to-character operationsSelect sysdate, to_char (sysdate, 'yyyy-mm-dd hh24: mi: ss') from dualSelect sysdate, to_char (sysdate, 'yyyy-mm-dd hh: mi: ss') from dualSelect sysdate, to_char (
'), 'day') from dual; // MondaySelect to_char (to_date ('1970-08-26 ', 'yyyy-mm-dd'), 'day ','Nls _ DATE_LANGUAGE = American ') from dual; // Monday// Set the date languageAlter session set NLS_DATE_LANGUAGE = 'American ';// You can alsoTO_DATE ('1970-08-26 ', 'yyyy-mm-dd', 'nls _ DATE_LANGUAGE = American ')
4. Days of the two-day periodCopy codeThe Code is as follows:Select floor (sysdate-to_date ('20140901', 'yyyymmdd') from dual;
5. Use a time of n
Tags: number date type first day get conversion SQL name includes divThis article focuses on the detailed usage examples of to_date in Oracle, including the use of period and character conversion functions, string and time conversions, the day of the week, the number of days between two dates, and the use of months. To_date format (time: 2007-11-02 13:45:25 for
To_date format (in time: 2007-11-02 13:45:25 for example)
1. Date and character conversion function usage (TO_DATE,TO_CHAR)
Copy Code code as follows:
Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') as nowtime from dual; Convert Date to String
Select To_char (sysdate, ' yyyy ') as nowyear from dual; Get the year of time
Select To_char (s
oracle| Solution | data
CREATE TABLE Worklog_a (Man_bar CHAR (8) Not NULL,Man_name VARCHAR2 is not NULL,MAN_DEP VARCHAR2 () not NULL,Log_time Date not NULLStatus VARCHAR2 (40));CREATE Unique INDEX Worklog_a_indexOn Workman (Man_bar,man_name);Comment on table worklog_a is' Log on to the diary list ';
sql:= ' Select Man_bar as "attendance bar code", Man_name as "n
During development, you often need to write an SQL statement to insert information into the table. If the inserted data field is of the date type, you must convert the date type to the string type and insert it into the database using SQL statements. This is the only method of my field. If you have any questions, pleas
Oracle Database SQL single-row functions-date functionsPrefaceThe date functions of the Oracle database are very powerful and relatively large. I will sort it out for future reference.. Convenience for yourself and convenience for others!Common
Oracle Function Synthesis small example date operation premise there is a student table student contains a birthday field (Date Field) let you find a student over 10 years old. Here, we only use the year to judge the difference between the birthday and the current date. Firs
When I was writing a stored procedure, I used the start time and end time to create a view. So I wrote a process like this:
Procedure prc_CreateViewOBookTcert (p_startdate in date, -- start date of statisticsP_enddate in date) -- end date of statisticsIsV_ SQL varchar2 (2000
display style of the date data. The following describes several style parameters:
100mm dd yyyy
101/DD/YYYY
102 YYYY. Mm. dd
103 dd/mm/yyyy
106 DD MM YYYY
108 hh: MI: SS (time)
111 yyyy/mm/dd
112 yyyymmdd
120 yyyy-mm-dd
You can find that it is more convenient to use this method to obtain the date part. Compared with this method, the advantage of the datename () function is to obtain the specific part of th
Three database date conversions comparison:http://blog.csdn.net/zljjava/article/details/17552741SQL type conversion function: Cast (type1 as Type2)Date types in the database SQL SERVERDATE 1970-01-01DATETIME 1970-01-01 00:00:00OracleDATE 2015-08-07 17:34:37TIMESTAMP 1970-01-01 00:00:00.000000 is the extended type of date
Ext.: http://chwshuang.iteye.com/blog/933926In development, it is often necessary to write a SQL statement to insert information into a table, insert the data if the field is a date type, you must convert the date type to a string literal in the SQL statement to insert the database. This is the only method of my field,
, or 25thDatePart (' y ', ' 2005-7-25 22:56:32 ') returns a value of 206 that is the No. 206 Day of the YearDatePart (' yyyy ', ' 2005-7-25 22:56:32 ') returns a value of 2005 that is 2005The SQL Server DATEPART () function returns a portion of the SQL Server datetime field.The syntax for the SQL Server DATEPART () function is:DATEPART (Portion, datetime)where da
1, Oracle date in the internal representation is numeric format, precision from century to seconds.2. The default date representation format is DD-MON-RR (not yy)The difference between YY and RR:3. Date Operation functionExample:The second parameter of Next_day can also be a number that represents a
SQL Server and Oracle acquisition time and date difference1. Get System Current TimeSQL Server 2005:
Select GETDATE ()
The GETDATE () function returns the current time and date from SQL Server.
GrammarGETDATE () instanceExample 1Use the following SELECT statement:
Select
Oracle SQL uses with recursive analysis (for example) and oracle Recursion
The WITH recursion provided by Oracle is not just a repetition of tree-like queries. In fact, recursive WITH statements can provide more flexible tree-like Query functions.
The following describes th
Copy Code code as follows:
-Oracle takes the SQL from Monday to the weekend
This takes the first days of the week, starting with Sunday.
Select To_char (to_date (' 20130906 ', ' yyyymmdd '), ' d ') from dual;
--Result: 6 Note: 2013.09.06 is Friday, the sixth day of the week
Select To_char (sysdate+ (2-to_char (sysdate, ' d '))-7, ' YYYYMMDD ') from dual;---Monday
Select To_char (sysdate+ (2-t
To operate on time in SQL, You need to master four time functions:Dateadd, datediff, datepart, datename.
Dateadd is to add or subtract a time on a specified date.For example, if you add a 3-day select dateadd (day, 3, '2017-05-06 ') on the specified date, the returned result is 2010-05-09.
Datediff is the date and
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.