Oracle年曆【By Jackywood】
jackywood原創,lastwinner小做修改:)
原文地址:http://www.itpub.net/469543.html
[@more@]column next_year new_v next_year
set termout off
select to_char(add_months(sysdate,12),'yyyy') next_year from dual;
set termout on
accept year char prompt '請輸入日曆年份,預設為明年:' default &next_year;
set timing off
set autotrace off
set linesize 1000
set term off verify off feedback off pagesize 999
SET TRIMSPOOL ON
spool calendar&year..html
set heading off
select lpad(' ',30)||' Calendar of '||&year||' Year ' title from dual
/
set heading on
set markup html on entmap off spool on preformat off
alter session set nls_language=american;
select case
when (new_yweek = min(new_yweek)
over(partition by mon order by new_yweek)) then
mon_name
else
null
end as month,
new_yweek as yweek,
row_number() over(partition by mon order by new_yweek) as mweek,
sum(decode(wday, '1', mday, null)) as sun,
sum(decode(wday, '2', mday, null)) as mon,
sum(decode(wday, '3', mday, null)) as tue,
sum(decode(wday, '4', mday, null)) as wed,
sum(decode(wday, '5', mday, null)) as thu,
sum(decode(wday, '6', mday, null)) as fri,
sum(decode(wday, '7', mday, null)) as sat
from (select dayofyear as everyday,
to_char(dayofyear, 'mm') as mon,
to_char(dayofyear, 'Month') as mon_name,
to_char(dayofyear, 'w') as mweek,
to_char(dayofyear, 'ww') as yweek,
case
when (to_char(to_date(&year || '0101', 'yyyymmdd'), 'd') > '1') and
(to_char(dayofyear, 'd') < to_char(to_date(&year || '0101', 'yyyymmdd'), 'd'))
then
to_char(to_char(dayofyear, 'ww') + 1, 'fm00')
else
to_char(dayofyear, 'ww')
end as new_yweek,
to_char(dayofyear, 'd') as wday,
to_char(dayofyear, 'dd') as mday
from (select to_date(&year || '0101', 'yyyymmdd') + level - 1 as dayofyear
from dual
connect by level <= to_char(to_date(&year || '1231', 'yyyymmdd'),'ddd')))
group by mon, mon_name, new_yweek
/
SPOOL OFF
set markup html off entmap off preformat on
set term on verify on feedback on pagesize 14
set linesize 80
prompt 日曆已生成
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29867/viewspace-812261/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- java萬年曆Java
- 日曆2021年日曆表|2021年日曆表列印版 Excel版Excel
- Oracle用SQL列印日曆OracleSQL
- C語言列印年曆C語言
- 二、Java之萬年曆Java
- Oracle和JDE日曆轉換Oracle
- 前端 javascript 練習題 -簡易年曆及tab切換簡易年曆【千鋒】前端JavaScript
- 最好用的萬年曆軟體:萬年曆 for Mac v3.0.1中文啟用版Mac
- Java 周曆日曆Java
- PHP獲取農曆、陽曆轉陰曆PHP
- C語言實現萬年曆程式C語言
- TechSmith:線上視訊的5年曆史MIT
- 中國歷史(2)明朝276年曆史
- 中國歷史(5)唐朝289年曆史
- 中國歷史(3)元朝98年曆史
- 中國歷史(6)唐朝289年曆史
- 公曆日期轉農曆日期
- Google:音樂發展的60年曆史Go
- iPhone的5年曆程–資料資訊圖iPhone
- JS編寫日曆控制元件(支援單日曆 雙日曆 甚至多日曆等)JS控制元件
- 根據公曆計算農曆
- “偽萬年曆” Root Exploit惡意應用分析
- Google Research:音樂發展的60年曆史Go
- 平安全息萬年曆1.0.4演算法分析演算法
- 【一句日曆】2024年11月
- 中國歷史(4)宋朝319年曆史
- 陽曆到陰曆的轉換 (轉)
- win10 日曆怎麼顯示農曆_win10日曆不顯示農曆怎麼辦Win10
- Linux核心修正5年曆史的嚴重bugLinux
- asp.net萬年曆,以及表格邊框設定ASP.NET
- 【SQL】日曆SQL
- vue之實現日曆----顯示農曆,滾動日曆監聽年月改變Vue
- 演算法系列之十七:日曆生成演算法-中國公曆(格里曆)(下)演算法
- VC SaaS:紅杉資本中國曆年投資資料分析
- win10電腦日曆怎麼顯示農曆_win10系統日曆顯示農曆的設定方法Win10
- Oracle日曆表維護實踐:建表、準備資料Oracle
- 今天出門你查老黃曆了嗎?包括萬年曆在內的超多免費可用 API 推薦(一)API
- 如何在Mac中使用佛教日曆,波斯日曆等Mac