SERPland Oracle, PL/SQL, PHP, Autos, Bungalow-Hotels and more …

7Nov/073

Calculate next (this) friday date with pl/sql – hide out!


Today I needed a PL/SQL funtion to determine next friday's date.
Therefore I had to write a strange PL/SQL function. I'm kind of mixed up - am I complicated?

I'm sure there's a pretty simple Oracle solution out there - hide out!

Hopefully Steven Feuerstein never sees this lines of code. Maybe someon has a better idea than this ....

27Jul/071

Decorator Design Pattern in Oracle PL/SQL: Using Object Type with Constructor

As I did with the Template Method Design Pattern I also tried to implement the "Decorator" Design Pattern in Oracle's PL/SQL language.

English Deutsch/German

The Book "Head First - Design Patterns" perfectly describes the Decorator pattern.
So I wrote some Object Type to implement the Decorator. I'd like to have a DRINK class (Espresso or Tea) with just one attribute called "description" and a method which returns the price.

There are some specific classes to make instances like an Espresso. Other classes are "adding" sugar or cream to my espresso.
I'd like to receive following result:

-- start with a Espresso --
descr= Espresso
price= 1
descr= Espresso, sugar
price= 1,2
descr= Espresso, sugar, Cream
price= 1,95

-- start with a Tea --
descr= Tea
price= 3
descr= Tea, sugar
price= 3,2
descr= Tea, sugar, Cream
price= 3,95