Archive for the ‘Databases’ Category

Time calculations and conversions in Oracle and PL/SQL

Wednesday, October 22nd, 2008

This article summarizes the methods for performing simple date/time calculations in Oracle and PL/SQL.

The basics

First of all, there are two data types in Oracle: DATE and TIMESTAMP. The primary difference between two of them is that TIMESTAMP supports higher time precision - up to 10-9 seconds. DATE values can be created by parsing a string [...]

Dynamic runtime evaluation of the PL/SQL expressions

Sunday, August 24th, 2008

Quite frequently the people who have to work with PL/SQL and who have some experience with other programming languages (like me) are looking for familiar mechanisms to solve their problems. One of these mechanism is dynamic evaluation of the language expressions commonly used in Unix shell, Perl and other languages. It actually turns out that [...]

Using OUT parameters in SQL procedures called from Java to return multiple result values

Friday, July 4th, 2008

Using stored procedures and functions when working with the database server has a number of advantages: it allows to abstract and externalize the implementation of certain data-crunching algorithms, may sometimes simplify the transaction processing and may reduce the overhead caused by the complex operation since there is less data to convert/serialize. It may also make [...]

Using custom exceptions in Oracle PL/SQL

Thursday, July 3rd, 2008

Exception handling mechanism is a very important feature of PL/SQL. In most of the cases it is much simpler to just attempt an operation and properly handle the expected failure rather than to check for the conditions before attempting an operation. For example: it is much easier to unconditionally attempt to drop a table and [...]