Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
14Activity
0 of .
Results for:
No results containing your search query
P. 1
Oracle SQL Functions

Oracle SQL Functions

Ratings: (0)|Views: 285|Likes:
Published by ypraju

More info:

Published by: ypraju on Dec 18, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/30/2012

pdf

text

original

 
SQL- FUNCTIONS-1By PenchalaRaju.Yanamala
 
(1).Find out the absolute values of a given number? {ABS (NUM)}
A: - SQL> select ABS (-200) from dual; 
(2).Round the numeric values of a given number? {ROUND (NUM)}
A: - SQL> select ROUND (123.5467, 3) from dual; 
(3).Truncate the numeric values of a given number? {TRUNC (NUM)}
A: - SQL> select TRUNC (123.5678, 2) from dual;
(4).Round the number to the nearest higher integer, if it has got anyDecimal place? {CEIL (NUM)}
A: - SQL> select CEIL (123.000001) from dual;
(5).Truncate the given number up to all decimal places? {FLOOR (NUM)}
A: - SQL> select FLOOR (123.5678) from dual;
(6).Find out the remainder of the given number? {MOD (NUM)}
A: - SQL> select MOD (9, 2) from dual;
(7).Find out the square root of the given number? {SQRT (NUM)}
A: - SQL> select SQRT (9) from dual;
(8).Find out the Nth power of the given number? {POWER (NUM)}
 A: - SQL> select POWER (3, 2) from dual;
(9). Find out the greatest value from the given list of Numbers? {GREATEST(N
)}A: - SQL> select GREATEST (54, 89, 65) from dual;
(10).find out the least value from the given list of numbers? {LEAST (NUM)}
A: - SQL> select LEAST (54, 89, 65) from dual;
(11).find out the status of the given list of numbers? {SIGN (NUM)}
A: - SQL> select SIGN (-200) from dual;
(12).Replace the null values in the specified column with the SpecifiedvalueList of numbers? {NVL (column n)}
 
A: - SQL> select NVL (comm, 0) from EMP;
(13).Find the maximum value of the column in the given set of Rows?{MAX (c n)}
A: - SQL> select MAX (Sal) from EMP;
(14).Find the minimum value of the column in the given set of Rows?{MIN (c n)}
A: - SQL> select MIN (Sal) from EMP;
(15).Find the total no of column values in the given set of Rows?{SUM (c n)}
A: - SQL> select SUM (Sal) from EMP;
(16).Find the Average no of column values in the given set of Rows?{AVG (c n)}
A: - SQL> select AVG (Sal) from EMP;`
(17).Count the no of rows in the given set of Rows? {COUNT (c n)}
A: - SQL> select COUNT (Sal) from EMP;
(18).Convert the upper case? {UPPER (string)}
 A: - SQL> select UPPER (‘oracle’) from Dual;
(19).Convert the lower case? {LOWER (string)}
 A: - SQL> select LOWER (‘ORACLE’) from Dual;
(20).Convert the initial letter of each word of the given stringTo upper case and rest of the chars to lower case? {INITCAP (St)}
A: - SQL> select INITCAP (‘hello hyd’) from Dual;
(21). Find the ASCII code for the given ASCII Character? {ASCII (St)}
A: - SQL> select ASCII (‘A’) from Dual;
(22).Find the equivalent ASCII character for the given ASCII Code?{CHR (num)}
A: - SQL> select CHR (65) from Dual;
(23).find the specified part of the string? {SUBSTR (st)}{SUBSTR (Var2)}
A: - SQL> select SUBSTR (‘MANAGER’, 1, 3) from Dual;
(24).find the position of the specified part of the string? {INSTR (st)}{INSTR (Var2)}
A: - SQL> select INSTR (‘MANAGER’, ‘A’, 1, 2) from Dual;
(25).find the length of the given string? {LENGTH (st)}{LENGTH (Var2)}
A: - SQL> select LENGTH (‘ORCCLE’) from Dual;
 
(26).ADD THE SPECIFIED CHAR(S) TO THE LEFT SIDE OF THE GIVENSTRING UPTO THE SPECIFIED LENGTH? {LPAD (st)}{LPAD (Var2)}
A: - SQL> select LPAD (‘ORCCLE’, 8,’*’) from Dual;
(27).Add the SPECIFIED CHAR(S) TO THE LEFT SIDE OF THE GIVENSTRINGUPTO THE SPECIFIED LENGTH? RPAD (st) RPAD (Var2)
A: - SQL> select LPAD (‘ORCCLE’, 8,’*’) from Dual;
(28).Add the SPECIFIED CHAR(S) TO THE RIGHT SIDE OF THE GIVENSTRING UPTO THE SPECIFIED LENGTH? RPAD (st),RPAD (Var2)
A: - SQL> select RPAD (‘ORCCLE’, 8,’&&’) from Dual;
SQL- FUNCTIONS-3
(29).Remove the specified char(s) from the extreme left side of thegiven string LTRIM (st), LTRIM (Var2)
A: - SQL> select LTRIM (‘SMITH’, ‘S’) from Dual;
(30).Remove the specified char(s) from the extreme right side of the given string RTRIM (st), RTRIM (Var2)
A: - SQL> select RTRIM (‘SMITH’, ‘H’) from Dual;
(31). Join the two strings. CONCAT (st) CONCAT (Var2)
A: - SQL> select CONCAT (‘Mr.’,’JONE’) from Dual;A: - SQL> select (‘Mr.’||’JONE’) from Dual;
(32).Replace each character of one set with the Corresponding character of another set in the given string? TRANSLATE (st) TRANSLATE(Var2)
A: - SQL> select ename, TRANSLATE (ename, ‘ABCDEFGHIJ’,’9876543210’)fromEMP where ename=’ALLEN’;
(33).Replace set1 completely with set2 in the given string? REPLACE (var2)
A: - SQL> select ename, REPLACE (ename, ‘LL’,’Hello’) from EMP whereename=’ALLEN’;
(34).Decode acts as a multiple decision-making statement of anyProcedurallanguage. Like as nested if? DECODE ()
 A: - SQL> select JOB, DECODE (JOB, ‘CLERK’,’C’’MANAGER’,’M’, JOB) FromEMP; 
(35). Match the char, strings, those spell differently but sounds alike.SOUNDEX(),SOUNDEX (var2)

Activity (14)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Harsha Vardhan liked this
prof_kt liked this
brijesh1747 liked this
Syed Sohaib Ali liked this
Syed Sohaib Ali liked this
viru_432 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->