﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-17th</title><link>http://www.blogjava.net/17th/</link><description /><language>zh-cn</language><lastBuildDate>Thu, 07 May 2026 06:28:42 GMT</lastBuildDate><pubDate>Thu, 07 May 2026 06:28:42 GMT</pubDate><ttl>60</ttl><item><title>Several oracle tips</title><link>http://www.blogjava.net/17th/archive/2007/09/12/144595.html</link><dc:creator>17th</dc:creator><author>17th</author><pubDate>Wed, 12 Sep 2007 11:50:00 GMT</pubDate><guid>http://www.blogjava.net/17th/archive/2007/09/12/144595.html</guid><wfw:comment>http://www.blogjava.net/17th/comments/144595.html</wfw:comment><comments>http://www.blogjava.net/17th/archive/2007/09/12/144595.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/17th/comments/commentRss/144595.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/17th/services/trackbacks/144595.html</trackback:ping><description><![CDATA[<h4><span class="bodycopy">This query will return a string in a vertical format. </span></h4>
<pre>SELECT SUBSTR('&amp;&amp;String', ROWNUM, 1)
FROM all_objects
WHERE ROWNUM &lt;= LENGTH(TRIM('&amp;STRING'));
</pre>
<h4><span class="parahead1">Prints a Calendar for the Current Year</span> </h4>
<pre><span class="bodycopy">This tip comes from </span><a href="mailto:rdware@purina.com" target="_blank"><span class="bodylink">Robert Ware</span></a><span class="bodycopy">, a DBA at TekSystems, in St. Louis, Missouri.<br />
</span><span class="bodycopy">This tip prints a calendar for the current year. It can be modified to return other years as well.</span> </pre>
<pre>select lpad( Month, 20-(20-length(month))/2 ) month,
"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"
from (select to_char(dt,'fmMonthfm YYYY') month,
CASE when to_char(dt,'fmMonthfm YYYY') like 'Dec%' AND to_char(dt+1,'iw') = '01' then '53'
when to_char(dt,'fmMonthfm YYYY') like 'Jan%' AND to_char(dt+1,'iw') = '53' then '.5'
else to_char(dt+1,'iw')
END week,
max(decode(to_char(dt,'d'),'1',lpad(to_char(dt,'fmdd'),2))) "Su",
max(decode(to_char(dt,'d'),'2',lpad(to_char(dt,'fmdd'),2))) "Mo",
max(decode(to_char(dt,'d'),'3',lpad(to_char(dt,'fmdd'),2))) "Tu",
max(decode(to_char(dt,'d'),'4',lpad(to_char(dt,'fmdd'),2))) "We",
max(decode(to_char(dt,'d'),'5',lpad(to_char(dt,'fmdd'),2))) "Th",
max(decode(to_char(dt,'d'),'6',lpad(to_char(dt,'fmdd'),2))) "Fr",
max(decode(to_char(dt,'d'),'7',lpad(to_char(dt,'fmdd'),2))) "Sa"
from (select trunc(sysdate,'y')-1+rownum dt
from all_objects
where rownum &lt;= add_months(trunc(sysdate,'y'),12) - trunc(sysdate,'y'))
group by to_char(dt,'fmMonthfm YYYY'), to_char( dt+1, 'iw' )
order by to_char(dt+1,'iw'))
order by to_date( month, 'Month YYYY' ), to_number(week)
/</pre>
<img src ="http://www.blogjava.net/17th/aggbug/144595.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/17th/" target="_blank">17th</a> 2007-09-12 19:50 <a href="http://www.blogjava.net/17th/archive/2007/09/12/144595.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>