Category Archives: database administration

How to get the next date for a weekday using Oracle

If you ever need to find the next weekday from a given date in Oracle it turns out they have a built in function for doing just that. If you want the next Sunday from yesterday you would do: Valid entries for the day are: SUN, MON, TUE, WED, THU, FRI, and SAT Tags: Oracle, [...]
Posted in database administration | Tagged , | 2 Comments

SQL Beautifier

I pulled a large amount of SQL out of some existing code and wanted to have it formated nicely for me. I figured there had to be some type of pretty printer for SQL available outside of applications like TOAD. I have access to TOAD but it would have required a reboot so I figured [...]
Posted in database administration | Tagged , | 3 Comments

Converting unix or java timestamps (time since the epoch) to real dates with Oracle

A few days ago I made use of a couple Oracle built in functions and it made me happy I didn't have to write a stored proc or some type of mini-app to do it. I needed to parse a timestamp out of a field that was put there by a java program. The timestamp [...]
Posted in database administration | Tagged | Leave a comment

Fun with Oracle Strings

Today I needed to find a way to count the number of unique email domains in a table. I figured there was a way of getting the index of a string in another string and sure enough there is. This did the trick in Oracle: The INSTR function gives you the location in a string [...]
Posted in database administration | Tagged | Leave a comment