My Oracle 10g Tips
Friday, December 20, 2019

Time Interval

›
Simple example of converting time-time to hrs/minutes. Change the times or date in the subquery to see what happens. SELECT start_tm ...
Friday, August 24, 2018

Fetch!

›
In 12c, Oracle released the Fetch/Offset clauses of the Select statement. It can replace "WHERE ROWNUM <" . Besides having mor...
Tuesday, August 14, 2018

In the Ballpark

›
When 'close enough' is 'good enough', try the 12c statement APPROX_COUNT_DISTINCT. (It was actually available in 11g, but n...
Tuesday, June 26, 2018

Who's on First?

›
It's important to know which SQL statements happen before others. Hopefully, this list will make it obvious why you can't use an ali...
Thursday, August 18, 2016

First or Last of a Set

›
If you need the 1st or last of a set, try this code: SELECT year_code AS "Yea...
Wednesday, August 26, 2015

Cumulative Count

›
This is similar to the post on cumulative sum using the windowing function. This was needed because we had an old application that would on...
1 comment:
Wednesday, August 19, 2015

1000 = 1k

›
I found this bit of code when I was trying to write a report for work. I like it and wanted to save it as sometimes links seem to go away....
Monday, August 10, 2015

Making a Connection

›
If you want to change your login in your code, use the following statement. It can be either 'CONN' or 'CONNECT'. I find t...
Saturday, August 1, 2015

Count a Field in Varying Tables with Subtotals

›
This code was written like this because the table names were not constant in which I need a count of a certain field. This sets variables ...
Tuesday, July 28, 2015

Outer Join with Where

›
I may be the last one to figure this out, but a WHERE statement causes grief with an outer JOIN. Here I’m trying to join on a code table to ...
Tuesday, July 14, 2015

Where Case

›
I wish I could think of a good reason to have a CASE statement in a WHERE statement -- but I can't so I'll just show something that ...

Order By Case

›
This is a simple example of using CASE to get a specific order in your output. SELECT ename , job FROM scott.emp ORDER BY CASE job...
Friday, July 10, 2015

Backup Tables in a Sandbox

›
This script is to backup a set of common tables. The owner and table_name are converted to a shorter version so there is room to add a date ...
Tuesday, July 7, 2015

Really Null Columns

›
I was asked to find a column on a table that was null that we could use for another purpose. Since on the requested table, there is close ...
Thursday, June 25, 2015

Generate Basic Select Except for All-Null Columns

›
I’m building your standard Select statement, but I hate looking at null fields so I’m tossing those out. It does take a little while to ge...
Sunday, June 7, 2015

Partitioned Tables Report for a Schema

›
This query -- once you adjust it for the schemas you’re interested in (and tables you’re not) -- will show pertinent information on the tab...
Saturday, June 6, 2015

Finding a Word in any Table that Stores Code

›
This might come in handy if you have to find all the places in your code that a word is used. The following code generates a SQL query with ...
Tuesday, June 2, 2015

Roll-up without Subtotals

›
Rollup usually will show subtotals on every difference in the group. To show only a grand total, add 'grouping sets' and a '1...
Monday, June 1, 2015

UAT vs PRD

›
If you’re tired of switching your schemas in code from UAT to PRD, you can use ‘USER’, which will return the schema. -- create amper varia...

Cumulative Sum

›
To get a cumulative sum, you need to use a window function ‘Rows Between Unbounded Preceding and Current Row’, which tells Oracle that the ...
Sunday, August 14, 2011

Connecting to SQL Developer

›
A while ago, the disk on my laptop crashed, and so now I'm trying to download and set up some of the tools I used before. I got SQL Deve...
Thursday, August 11, 2011

Wanna' Date?

›
Just a picture of 99% of the date variations listed in the book, although I'm saving timestamps for another post. The Easy Way   Sele...
Sunday, July 24, 2011

My Ah-ha! Moment with Self-Joins

›
I was recently taking an online class in SQL from Oracle. I will admit that sometimes self-joins still baffle my mind. So I decided to try w...
Saturday, July 23, 2011

HR Hierarchy

›
A friend asked me to explain the hierarchical query, and when I went back to look at what I had on the blog, there was little explanation, a...
Friday, July 22, 2011

SQL*Plus Output -> HTML

›
*I saw this on Uwe Hesse 's blog, and it was too cool not to keep a copy where I knew I could find it again.  The only thing I added to ...
›
Home
View web version

About Me

Lynn Tobias
Washington, DC
I've been in IT almost since birth. I've done many things with many languages and operating systems, but finally found a home when I started learning Oracle.

SQL is just plain fun when you're trying to resolve a puzzle. Always searching in the books for that new function or statement, I was able to get certified in 9i SQL.

I took a hiatus from it all for personal reasons, but I'm back in college and am currently studying Database Administration with plans of getting certified.

Want to drive me crazy? Tell me you can't do that in SQL. Anyway, hope you enjoy the blog.
View my complete profile
Powered by Blogger.