<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-1068231502585385072</id><updated>2010-03-15T08:13:08.686-07:00</updated><title type='text'>Jon's Code blog</title><subtitle type='html'></subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.jhbproductions.com/blog/atom.xml'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-6044141867612777926</id><published>2009-04-07T14:25:00.000-07:00</published><updated>2009-05-20T14:47:56.081-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='alerts'/><category scheme='http://www.blogger.com/atom/ns#' term='tablespace'/><category scheme='http://www.blogger.com/atom/ns#' term='autoextend'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Tablespace usage report (w/ autoextend)</title><content type='html'>If you use auto extending tablespaces in your Oracle environment and use Grid Control to monitor them, you will know that it does not take the auto extension into account. The following script will give you a breakout of your TS usage including the auto extension. I found the original script on Metalink and modified it slightly due to a flaw in the logic that would not include a TS if it was not in DBA_FREE_SPACE. This occurs when a TS has no free space left in it's current extent but has not moved into the next one yet.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;select&lt;br /&gt;a.tablespace_name,&lt;br /&gt;SUM(a.bytes)/1024/1024 "CurMb",&lt;br /&gt;SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)) "MaxMb",&lt;br /&gt;(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024)) "TotalUsed",&lt;br /&gt;(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)) - (SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))) "TotalFree",&lt;br /&gt;round(100*(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))/(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)))) "UPercent"&lt;br /&gt;from&lt;br /&gt;dba_data_files a,&lt;br /&gt;sys.filext$ b,&lt;br /&gt;(SELECT d.tablespace_name , sum(nvl(c.bytes,0)) "Free" FROM dba_tablespaces d,DBA_FREE_SPACE c where d.tablespace_name = c.tablespace_name(+) group by d.tablespace_name) c&lt;br /&gt;where a.file_id = b.file#(+)&lt;br /&gt;and a.tablespace_name = c.tablespace_name&lt;br /&gt;GROUP by a.tablespace_name, c."Free"/1024&lt;br /&gt;order by round(100*(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))/(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)))) desc&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-6044141867612777926?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/6044141867612777926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=6044141867612777926' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/6044141867612777926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/6044141867612777926'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2009/04/tablespace-usage-report-w-autoextend.html' title='Tablespace usage report (w/ autoextend)'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-3220063702958218451</id><published>2008-09-15T12:10:00.001-07:00</published><updated>2008-09-15T12:10:40.303-07:00</updated><title type='text'>Get chained rows percentage</title><content type='html'>select owner,table_name,to_char((chain_cnt/num_rows)*100,'99.99') pct_chained&lt;br /&gt;from all_tables&lt;br /&gt;where num_rows &gt; 0&lt;br /&gt;and owner not in ('SYS','SYSTEM','OUTLN')&lt;br /&gt;order by to_char((chain_cnt/num_rows)*100,'99.99') desc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-3220063702958218451?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/3220063702958218451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=3220063702958218451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3220063702958218451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3220063702958218451'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2008/09/get-chained-rows-percentage.html' title='Get chained rows percentage'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-2964971195764265252</id><published>2008-08-12T11:41:00.000-07:00</published><updated>2008-08-12T11:42:14.456-07:00</updated><title type='text'>Select random row examples</title><content type='html'>http://www.petefreitag.com/item/466.cfm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-2964971195764265252?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/2964971195764265252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=2964971195764265252' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/2964971195764265252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/2964971195764265252'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2008/08/select-random-row-examples.html' title='Select random row examples'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-7643325450342631688</id><published>2007-11-27T10:02:00.000-08:00</published><updated>2007-11-27T10:04:47.694-08:00</updated><title type='text'>RMAN commands</title><content type='html'>List current archive logs:&lt;br /&gt;&lt;br /&gt;list archivelog all;&lt;br /&gt;&lt;br /&gt;Delete range by sequence #:&lt;br /&gt;&lt;br /&gt;delete archivelog sequence between N and N;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-7643325450342631688?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/7643325450342631688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=7643325450342631688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/7643325450342631688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/7643325450342631688'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/11/rman-commands.html' title='RMAN commands'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-3108118185563205850</id><published>2007-10-24T11:17:00.000-07:00</published><updated>2007-10-24T11:20:23.016-07:00</updated><title type='text'>Constraint Naming Conventions</title><content type='html'>Doesn't really matter how you feel about this as long as you are consistent.  I picked this up from comments on Dizwell's site and I basically like it.  The only thing I change is the use of table names except in the case of foreign keys.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Each table has a full name (employee) and a short name (emp) of three or four characters.&lt;/li&gt;&lt;li&gt;Each PK is named PM_short_name, so PK_EMP.&lt;/li&gt;&lt;li&gt;Each FK is named FK_parent_short_name_child_short_name and if more than one required, an additional sequence number is added as a suffix. So, FK_EMP_DEPT.&lt;/li&gt;&lt;li&gt;Check constraints are CHK_short_name_column_name - if at all possible. Alternatively, CHK_short_name_reason if it fits. Example, CHK_EMP_NAME or CHK_EMP_NAME_PRESENT.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Unique constraints are UQ_short_name_column where possible or UQ_SHORT_NAME_reason. For example, UQ_EMP_EMAIL.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-3108118185563205850?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/3108118185563205850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=3108118185563205850' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3108118185563205850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3108118185563205850'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/10/constraint-naming-conventions.html' title='Constraint Naming Conventions'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-5626737930436837345</id><published>2007-10-16T13:06:00.000-07:00</published><updated>2007-10-16T13:09:56.904-07:00</updated><title type='text'>Power Architect is the best ERD drawing tool I've found</title><content type='html'>I spent 3 days trying everything out there and Power Architect came out the winner:&lt;br /&gt;&lt;br /&gt;http://www.sqlpower.ca/page/architect&lt;br /&gt;&lt;br /&gt;Free, simple, saves ERD as PDF, reverse engineers, Java based so it will run on anything.  A little buggy here and there but overall a great tool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-5626737930436837345?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/5626737930436837345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=5626737930436837345' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/5626737930436837345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/5626737930436837345'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/10/power-architect-is-best-erd-drawing.html' title='Power Architect is the best ERD drawing tool I&apos;ve found'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-8749497380163401517</id><published>2007-07-24T14:57:00.000-07:00</published><updated>2007-07-24T15:03:57.073-07:00</updated><title type='text'>Replace CRLF with CHR(13) to preserve new lines in Oracle</title><content type='html'>This example uses Perl to look for a CRLF and replace it with the the proper ASCII, it also concatenates it for Oracle:&lt;br /&gt;&lt;br /&gt;$text =~ s/(?:\r\n|[\r\n])/' || chr(13) || '/g;&lt;br /&gt;&lt;br /&gt;So, if you wanted to insert the following and preserve line breaks...&lt;br /&gt;&lt;br /&gt;Line 1&lt;br /&gt;Line 2&lt;br /&gt;&lt;br /&gt;...you can generate the following SQL:&lt;br /&gt;&lt;br /&gt;insert into table values ('Line 1' || chr(13) || 'Line 2');&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-8749497380163401517?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/8749497380163401517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=8749497380163401517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/8749497380163401517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/8749497380163401517'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/07/replace-crlf-with-chr13-to-preserve-new.html' title='Replace CRLF with CHR(13) to preserve new lines in Oracle'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-5464406453070053529</id><published>2007-07-05T09:39:00.000-07:00</published><updated>2007-07-05T09:42:53.488-07:00</updated><title type='text'>Finding Nth row in sql</title><content type='html'>substitute N for the row you want&lt;br /&gt;&lt;br /&gt;select * from YOUR_TABLE t1&lt;br /&gt;where (N-1) = (select count(distinct(t2.YOUR_COLUMN))&lt;br /&gt;              from YOUR_TABLE t2&lt;br /&gt;              and t2.YOUR_COLUMN &gt; t1.YOUR_COLUMN)&lt;br /&gt;&lt;br /&gt;This method is explained in detail here:&lt;br /&gt;&lt;br /&gt;http://www.sqlteam.com/article/find-nth-maximum-value-in-sql-server&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-5464406453070053529?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/5464406453070053529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=5464406453070053529' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/5464406453070053529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/5464406453070053529'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/07/finding-nth-row-in-sql.html' title='Finding Nth row in sql'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-6701499412001306604</id><published>2007-04-24T16:48:00.000-07:00</published><updated>2007-04-24T17:00:49.061-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='command line'/><category scheme='http://www.blogger.com/atom/ns#' term='rename'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>use basename for batch rename</title><content type='html'>NOTE: Be careful with this.  Don't mess with your original files.   Files cannot contain spaces.&lt;br /&gt;&lt;br /&gt;Generic example:&lt;br /&gt;&lt;br /&gt;$ for f in *whatever; do mv $f `basename $f string_to_replace`string; done&lt;br /&gt;&lt;br /&gt;Real example (Rename a bunch of file named blah.M0703.xls to blah.xls):&lt;br /&gt;&lt;br /&gt;$ for f in *xls; do mv $f `basename $f M0703.xls`xls;done&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-6701499412001306604?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/6701499412001306604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=6701499412001306604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/6701499412001306604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/6701499412001306604'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/04/use-basename-for-batch-rename.html' title='use basename for batch rename'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-3521755192336223435</id><published>2007-04-03T15:11:00.000-07:00</published><updated>2007-04-03T15:12:29.357-07:00</updated><title type='text'>Oracle delete duplicates</title><content type='html'>&lt;pre&gt;&lt;code&gt;DELETE FROM our_table&lt;br /&gt;WHERE rowid not in&lt;br /&gt;(SELECT MIN(rowid)&lt;br /&gt;FROM our_table&lt;br /&gt;GROUP BY column1, column2, column3...) ;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-3521755192336223435?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/3521755192336223435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=3521755192336223435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3521755192336223435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/3521755192336223435'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/04/oracle-delete-duplicates.html' title='Oracle delete duplicates'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-1100317092278385543</id><published>2007-03-30T09:44:00.000-07:00</published><updated>2007-03-30T10:27:53.535-07:00</updated><title type='text'>Alternating row color by groups</title><content type='html'>As a DBA, I spend a lot of time looking at lists of rows and grouping them in various ways.  Visually it helps to alternate the color like so:&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;table style="width: 182px; height: 364px;" border="2" cellpadding="0" cellspacing="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 1&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 1&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 1&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor=""&gt;&lt;td&gt;group 2&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor=""&gt;&lt;td&gt;group 2&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 3&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 3&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor="lightblue"&gt;&lt;td&gt;group 3&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr bgcolor=""&gt;&lt;td&gt;group 4&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;p&gt;I can never remember the logic to do this so hear it is (in PHP/Oracle) for future reference:&lt;br /&gt;&lt;/p&gt;while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS)){&lt;br /&gt;    if(!$temp || $temp_zname &lt;&gt; $row[MEMBER_TO_GROUP_BY]){&lt;br /&gt;        $temp = $row[MEMBER_TO_GROUP_BY];&lt;br /&gt;        $bgcolor = ($bgcolor == 'lightblue') ? '' : 'lightblue';&lt;br /&gt;    }&lt;br /&gt;    print "&amp;lt;tr bgcolor=$bgcolor&amp;gt;";&lt;br /&gt;    print "&amp;lt;td&amp;gt;". $row[MEMBER_TO_GROUP_BY] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;    print "&amp;lt;/tr&amp;gt;";&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-1100317092278385543?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/1100317092278385543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=1100317092278385543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/1100317092278385543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/1100317092278385543'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/03/alternating-row-color-by-groups.html' title='Alternating row color by groups'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-470176249381785566</id><published>2007-03-21T09:57:00.000-07:00</published><updated>2007-03-21T09:59:30.368-07:00</updated><title type='text'>Oracle Date Functions</title><content type='html'>Puget Sound Oracle Users Group = Best Oracle Documentation (IMHO)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.psoug.org/reference/date_func.html"&gt;http://www.psoug.org/reference/date_func.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-470176249381785566?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/470176249381785566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=470176249381785566' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/470176249381785566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/470176249381785566'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/03/oracle-date-functions.html' title='Oracle Date Functions'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1068231502585385072.post-4757590805928787050</id><published>2007-01-04T14:35:00.000-08:00</published><updated>2007-01-15T14:21:23.548-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='trigger'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Trigger to mimic MySQL "last modified" datatype in Oracle</title><content type='html'>ALTER TABLE YOUR_TABLE ADD (LAST_MODIFIED DATE);&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE&lt;br /&gt;TRIGGER YOUR_TABLE_BEFORE_INS_UPD BEFORE INSERT OR UPDATE&lt;br /&gt;ON YOUR_TABLE&lt;br /&gt;FOR EACH ROW&lt;br /&gt;DECLARE CURRENT_TIME DATE;&lt;br /&gt;BEGIN&lt;br /&gt;CURRENT_TIME := SYSDATE;&lt;br /&gt;:new.last_modified := CURRENT_TIME;&lt;br /&gt;END;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1068231502585385072-4757590805928787050?l=www.jhbproductions.com%2Fblog%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/4757590805928787050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1068231502585385072&amp;postID=4757590805928787050' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/4757590805928787050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1068231502585385072/posts/default/4757590805928787050'/><link rel='alternate' type='text/html' href='http://www.jhbproductions.com/blog/2007/01/trigger-for-last-modified-column-in.html' title='Trigger to mimic MySQL &quot;last modified&quot; datatype in Oracle'/><author><name>Jon B.</name><uri>http://www.blogger.com/profile/14814850497601472287</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03715404811458662024'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>13</thr:total></entry></feed>