Tuesday, 25 November 2008

alternative quoting mechanism

As said in my previous post a teached a course about sql and plsql 10gR2.
One of the topics was the alternative quoting mechanism introduced in Oracle 10g.

The code you had to write in previous versions was sometimes very unreadable.
See the two examples below:

Example 1:

Example 2:

In Oracle 10g you cab define your own delimiter.
The rule is as follows:
start with q' followed by an unique character string end with the same unique character.

Some examples

However there are some (documented) exceptions. The ( and [ !
Here you have to close with respectively ) and ]...
I personally do not like this kind of exceptions.
The alternative quoting mechanism however is something I do like. It makes the code easier to write and makes it more readable which means that is easier to maintain as well.

No comments :