Home >Database >Mysql Tutorial >ORALCE 查询当前月的所有日期sql语句

ORALCE 查询当前月的所有日期sql语句

WBOY
WBOYOriginal
2016-06-07 17:46:181186browse

本文章介绍了一篇关于ORALCE 查询当前月的所有日期sql语句,有需要的同学可以查看一下。

本文章介绍了一篇关于ORALCE 查询当前月的所有日期sql语句,有需要的同学可以查看一下。

1. 查询将来 6 个月的月份:

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1"  style="background:#FB7">
	  <tr>
		<td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td>
		<td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onClick="doCopy('copy8666')">复制代码</td>
	  </tr>
	  <tr>
		<td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy8666><pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">SELECT to_char(add_months(SYSDATE, ROWNUM), 'yyyy-mm')
  FROM dual
CONNECT BY ROWNUM <= 6
1

2. 查询当前月的所有日期

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1"  style="background:#FB7">
	  <tr>
		<td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td>
		<td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onClick="doCopy('copy3936')">复制代码</td>
	  </tr>
	  <tr>
		<td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy3936><pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">SELECT TRUNC(SYSDATE, 'MM') + ROWNUM - 1
  FROM DUAL
CONNECT BY ROWNUM <= TO_NUMBER(TO_CHAR(LAST_DAY(SYSDATE), 'dd'))
2
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn