Oracle interview Questions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Qus. 9. Display the number value in
Words
Ans: SQL> select sal, (to_char(to_date(sal,'j'), 'jsp'))
from emp;
the output like,
SAL (TO_CHAR(TO_DATE(SAL,'J'),'JSP'))
--------- -----------------------------------------------------
800 eight hundred
1600 one thousand six hundred
1250 one thousand two hundred fifty
If you want to add some text like,
Rs. Three Thousand only.
SQL> select sal "Salary ",
(' Rs. '|| (to_char(to_date(sal,'j'), 'Jsp'))|| ' only.'))
"Sal in Words" from emp
/
Salary Sal in Words
------- ------------------------------------------------------
800 Rs. Eight Hundred only.
1600 Rs. One Thousand Six Hundred only.
1250 Rs. One Thousand Two Hundred Fifty only.
Qus. 0. Display Odd/ Even number of records
Ans: Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
2
4
6
Qus. 1. Which date function returns number value?
Ans: months_between
Qus. 2. Any three PL/SQL Exceptions?
Ans: Too_many_rows, No_Data_Found, Value_Error, Zero_Error, Others
Qus. 3. What are PL/SQL Cursor Exceptions?
Ans: Cursor_Already_Open, Invalid_Cursor
Qus. 4. Other way to replace query result null value with a text
Ans: SQL> Set NULL ‘N/A’
to reset SQL> Set NULL ‘’
Qus. 5. What are the more common pseudo-columns?
Ans: SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM
Qus. 6. What is the output of SIGN function?
Ans: 1 for positive value,
0 for Zero,
-1 for Negative value.
Qus. 7. What is the maximum number of triggers, can apply to a single table?
Ans: 12 triggers.
.1 2 3 4 5 6 7 8 9 10 11 12 13
14 15