Keywords

DECODE and CASE statements in Oracle both provide a conditional construct, of this form:
if A = n1 then A1
else if A = n2 then A2
else X

Databases before Oracle 8.1.6 had only the DECODE function. CASE was introduced in Oracle 8.1.6 as a standard, more meaningful and more powerful function.

Everything DECODE can do, CASE can. There is a lot else CASE can do though, which DECODE cannot. We’ll go through detailed examples in this article.

[click to continue…]

{ 71 comments }

A hierarchical query is one that works on data with a "tree" relationship.

An Example of Hierarchical Data
The employee-manager relationship in SCOTT’s famous EMP table. Each employee record has a manager’s id associated with it. In effect, there is a "tree" of data relationships

At each level, I can get the employee-manager relationship as below:

[click to continue…]

{ 0 comments }

DELETE, TRUNCATE and DROP – all three commands get rid of table data. How exactly are they different? When should you use which?

A bird’s eye view of their differences, a table comparing the three.

[click to continue…]

{ 14 comments }