Monday, 22 April 2013

Oracle Functions



Functions are used to manipulate data items and return a result. Functions follow the format of:
Examples :-
=>AVG : Select AVG(s_price)”Average” from  data;
=>MIN : Select min(s_date)”Minimum Date” from data;
=>COUNT(expr) : Select count(s_order_no)”No of Orders”  from data;
=>COUNT(*) :         Select count(*) “Total ” from data;
=>MAX :         Select max(s_qty)”Maximum” from data;
=>SUM :         Select sum(s_qty)”Total Qty.” from data;
=>ABS :         Select ABS(-20)”Absolute” from dual;
=>POWER :         Select power(3,2)”Raised” from dual;
=>ROUND :         Select round(20.254,2)”Round” from dual;
=>SQRT :         Select sqrt(49) “Square Root” from dual;
=>LOWER :         Select lower(‘ABCD’)”LOWER” from dual;
=>INITCAP :         Select inicap(‘PRADEEP SHARMA’)”Titel Case” from dual;
=>UPPER :         Select uppar(‘rajeev gupta’) from dual;
=>SUBSTR :         Select substr(‘123456789,1,3)”substruig” from dual;
=>LENGTH :         Select length(‘apple’)”Length” from dual;
=>LTRIM :         Select ltrim(‘xxxXxxWorld’,’x’)”Left trim example” from dual;
=>RTRIM :         Select rtrim(‘wordxxXxx’,’x’)”reight trim example” from dual;
=>LPAD :         Select lpad(‘ABC’,10,’*’)”LPAD” from dual;
=>RPAD :         Select rpad(name,10,’x’)”Rpad example”  from data;
=>TO_NUMBER :         Update data set amt=amt+to_number(sybstr(100,1,2);

The above oracle function are just a few selected from the many functions that are in built into oracle.


Ur's
AmarAlam

0 comments:

Post a Comment