Tuesday, June 26, 2012

Large Objects

There are four data types  in this catagory

Clob -->character large objects (cannot store images)
Blob -->binary large objects(can be used to store anything like image,media files etc)
Nclob-->multibyte character set
Bfile -->this also can store any objects like image etc
clob,blob,nclob are stored inside the database.
Bfile is external to the database and the table only contains a pointer to the location of the file.
Eg:
crate table t1(col1 bfile);
insert into t1 values(bfilename('p_dir','a.txt'));
select * form t1;
p_dir/a.txt will be the o/p

The Bfile is read only .
The others large objects are editable.


LONG:

A table can have only one long column.
The datas are stored in the same block .

LOB:

Any number of LOB columns possible.
The datas can be kept anywhere in the tbl space in any other segments also.















Aggregate and Analytic Functions in oracle

Aggregate functions :

1.Aggregate functions return one value within a group if you specify the GROUP BY clause in the query and it returns a single value if group by is not specified in the oracle statements.

eg :

select department_id,sum(salary)
from department
group by department_id;

This would return one row for each department id avalable .

another example is

select sum(salary) from department;

This would return just one row and that is the count .

There are several aggregate functions available in oracle .lets glance at them briefly