Archive for the 'Database' Category

Using aliases in Select

How to use an aliase name in the SELECT clause in Oracle
However, instead of ename and job the column headings should be empname and jobrole. The query that will solve our purpose will be:
SELECT ENAMEĀ  EMPNAME, JOB JOBROLE FROM EMP;
The fun comes, if you want a space in between. Like if you want JOBROLE should [...]

Null Values in Oracle

NULL in Oracle means empty. You need really a special mechanism to handle NULL values in Oracle
Oracle supoorts the NVL function to handle NULL values.
NULL means empty, so it is neither zero nor spaces. NULL value takes place, when the user does not enter any data in the respective columns.
So, if you encounter a null [...]

Multiple Block handling in PL/SQL

This example will demonstrate the performance of different blocks. The golden rule is followed – first inner, then outer
— Block Name
DECLARE
X NUMBER;
BEGIN
X:=1;
WHILE X

Loop in PL/SQL

The example given below shows a While Loop. Here the value of the variable I is checked to ascertain whether it is less than 10 and as long as it is so the body of the loop will be executed.
DECLARE
I NUMBER (4) :=0;
BEGIN
WHILE (I<10)
LOOP
I:= I+1;
DBMS_OUTPUT.PUT_LINE (I);
END LOOP;
END;