Interview Questions
Interview Questions
what is output?
to my output is
constraints?
Write a pl/sql block for trigger at the time of insertion for inserting old and
new values auditing table.
What are different types of joins
What self join do
Write an example and explain about self join
Write an example for left outer join and how output comes
What is difference between in and = operator
What is package
Tell some advantages of packages
What are collections in pl/sql
What are pointers in c
How you connect to data base
some more interview questions asked in scope
Difference between cursor for loop and for loop, which is faster?
In proc and PL/SQL, which is faster?
Which is best method to kill the process (unix or oracle)?
Difference between c shell, bourn shell, k shell?
What is inode?
How to search two patterns using grep pattern?
Difference between ls and find?
Difference between view and snapshot?
Difference between function and procedure?
Why we cannot use DDL commands in procedure?
Difference between global variable and static global variable?
How to access variable of nested procedure?
If we have both user exception and system exception, which will be handled
first?
collect?
another procrdure?
What is substr()&instr()?
Difference between case and decode?
Can you use sysdate in check constraints? If no, why?
Difference between column level constraints & table level
What is optimizer?
What is nested_loop join?
What is pivot operater?
Tell me some oracle 10g features?
What is m_view?
constraints?
What is sql tuning, how to reduce the performance of query can u explain.
What is bulk collect and forall, what is the use of bulk collect and forall.
What is data modeling and how to create relation between A and B tables.
successfully completed
Using DENSE_RANK
SELECT *
FROM
( SELECT emp.*,DENSE_RANK() OVER(ORDER BY Sal DESC) Rno FROM EMP
)
WHERE Rno=3;
Using ROWNUM
-------------------------------------------------------------------------SELECT sal
FROM
(SELECT rownum rn,
sal
FROM
( SELECT DISTINCT sal FROM emp ORDER BY sal DESC
)
)
WHERE rn = 3;
---------------------------------------------------------------------------------------SELECT *
FROM emp
WHERE sal =
(SELECT sal
FROM
(SELECT rownum rn,
sal
FROM
( SELECT DISTINCT sal FROM emp ORDER BY sal DESC
)
)
WHERE rn = 3
);
Using SELF JOIN
SELECT *
FROM emp a
WHERE 3 =
(SELECT COUNT(DISTINCT(Sal)) FROM emp b WHERE a.sal<=b.sal
)
ORDER BY sal;
Write a query to find 10 highest salary
Can you write syntax of case statement?
Can we create a table on exiting table?
How to create a synonym, write syntax of synonym
What are partitions, when we go for partitions?
What is cursor?
How to rebuild index, syntax of rebuild index
What is the syntax of the procedure?
How to create a BLOB, syntax of blob
What is UTL_FILE
What is control file, syntax of control file?
What truncate and delete?
How to check the table or view exiting or not
CGI PL/SQL Interview Questions
Explain briefly about your project
How many type of environments r there in your company?
Exception handling
How we will send error msg with no to ui environment.
Ronum,rowid
Use of hint.
In which format u will get requirements?
Select stmt structure..
Can we develop exceptions in cursor environment?
After you work is completed how you produce the documentation for that?
What is the documentation file called?
Delete,truncate structure..
Query for top n records..
Explain plan mechanism..
Structure for the procedure in exception mechanism.
Clover Infotech PL/SQL Interview Questions
Tell me about yourself and what are the responsibilities in your project.
What is the difference between procedure and function
Can we return 2 values through function,i want return empno and sal how to
design a function.
I have a package with 2 procedures and declared one procedure in
specification only second procedure not declared in specification, package
body compiled or not?
What is the use of forward declaration and if you can use in package can we
call procedure outside package.
Difference between primary and unique and i am retrieving unique column,
that time unique column firing or not?
Difference between nvl and nvl2
How many types of exceptions
Explain pragma types, pragma exception_init and pragma serially_reusable
Difference between bulk collect and forall, suppose i am inserting 10000
records due to some issue few records are not inserted, how to find which
records are not inserted, which method you follow to find.
What is index?
How does index form internally?
What are pseudo columns?
What are exceptions? How to handle expections in PL/SQL?
Explain about exception propagation?
What is autonomous transaction?
What is trigger? Have you ever used it?
Define view
Can we update a view?(what are the conditions)?
if I have created view from two tables by taking all the columns in the table
now is it possible to update that view?( ans : NO)
then I have to compulsory update that view how to do that(ans: by using
instead of triggers).
What is instead of triggers?
what is syntax of case?
Difference between procedure and functions?
What is a package and what are its advantages?
another procedure?
What is substr()&instr()?
Difference between case and decode?
Can you use sysdate in check constraints? If no, why?
Difference between column level constraints & table level
What is optimizer?
What is nested_loop join?
What is pivot operater?
Tell me some oracle 10g features?
What is m_view?
What is master & detail tables?
What is sqlcode and sqlerrm?
Diff b/w procedure & packages?
What are the dis_adv of packages?
constraints?
ENAME
-----------
-----------
12345
REDDY
-10
1
8
7
I want to count of positive and negative
select sum(decode(sign(value),1,value)) pos, sum(decode(sign(value),1,value)) neg from pn
select ( select sum(value) from pn where 0<value) as positive, (select
sum(value) from pn where 0>value) as negative from dual
select unique ( select sum(value) from pn where 0<value) as positive, (select
sum(value) from pn where 0>value) as negative from pn
Dun & Bradstreet PL/SQL Interview Questions
listagg
bulk collect
interset
which is the faster left outer join and right outer join
what is awr report
how to delete duplicate records
what is primary and unique constraint
in and exist which is the faster, why exist is faster?
what is the use of declare exception in declaration
what are cursor attributes
what is pragma exception init
what is the use raise application error
can write simple example of cursor
can u write example of forall statement
GE PL/SQL Interview Questions
2. I have a table and created a two indexes on two columns but i want create
3rd index how can u create a index
4. Explain procedure,function,package
8. I wrote a pl/sql block for insert and update on table, one statement was
failed how to know which statement filed, what type of exception you raised
9. Package advantages
User defined.
What is meant by cursor and how many types of cursors are there?
Cursor is a name given to a private sql area.
There are 2 types of cursors.
Implicit
Explicit.
Hexaware PL/SQL Interview Questions
What is cursor? Answer
What is explicit and implicit cursor and examples? Answer
Ref cursor and types Answer
What is exception and exception types Answer
Two types of triggers Answer
What is package? Answer
10g features Answer
Diff b/w primary key unique key Answer
Difference b/w procedure and function Answer
What is bind variable Answer
How to create a table using procedure and how to pass variables for table
Answer
What is the use of execute immediate command Answer
What is materialized view? Answer
Any restriction to create a materialized view Answer
What is fast refresh on commit? Answer
What is integrity constrain Answer
What is index by array Answer
What is difference between group function and analytic function? Answer
What is ls command with different options? Answer
Date
22-may-2010
26-jun-2010
name
101 dinesh
Null jyothi
Null bharathi
102 suresh
Null shilpha
103 prakesh
Null suma
Id
name
101
dinesh
102
suresh
103
prakesh
prakesh
Col1
col2
col3
Name age
John 30
Sharp 35
Select * from test_1 where name is not null and age is not
Null;
Syntex:-
A.oltp
B.dss
C.where clause has functions
D.tables that have only one record
1.yes we can use out parameters in a function.but we have to assign the out
parameter value to the return datatype.
2.but when we use out parameters in function we can't call the function from
a select statement
Src tgt
Select
'Quarter to '||to_char((to_date('01/01/'||substr(src,2),
'Dd/mm/rrrr')),'rrrr') as "target"
From table
Begin
Call p1()
End tri_call;
Oradatabase.standproc(empno=>102,ename=>'ram'); --named
Oradatabase.standproc(ename=>'ram',empno=>102);
The view can be created without base table then the view is
Called force view. The view must be crated with force
Option.
Error at line 1:
Ora-00942: table or view does not exist
a varchar2(10)
4 );
Table created.
No rows selected
However the structure would still be available even after the session is
logged out. Also, the structure is available to other sessions even when one
session is using it, but not the data. I.e multiple sessions could use the same
global temporary table without interfering the data. Each session could
insert/update/delete their own data into the same Global temporary table as
if the table is available to only that session. Any data inserted in one session
is not available to another.
Losses
What are nested tables? How will u delete 5 rows from nested
Tables
Answer
City varchar2(15),
State char(2),
Zip
varchar2(5)
);
Addresstype;
First_name varchar2(10),
Last_name varchar2(10),
Addresses nested_table_addresstype
)
Nested table
Addresses
Store as
Nested_addresses;
);
Can you have multiple sps with the same name on a database?
Answer
Select field1
From table_1 a
Left join table_2 b
On a.field1=b.field2
Ora-12054: cannot set the on commit refresh attribute for
Select field1
From table_1 a, table_2 b
Where a.field1=b.field2
Does anyone have any ideas why this is happening.
3 as
4 select a.deptno
5
from dept a
7 /
From dept a
*
Error at line 5:
Ora-12054: cannot set the on commit refresh attribute for
3 as
4 select a.rowid dept_rowid
5
, b.rowid emp_rowid
, a.deptno
from dept a
9 /
From dept a
*
Error at line 7:
Ora-12054: cannot set the on commit refresh attribute for
3 as
4 select a.rowid dept_rowid
5
, b.rowid emp_rowid
, a.deptno
from dept a
, emp b
Dept_rowid
emp_rowid
deptno
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aab
30
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aac
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aad
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aae
30
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aaf
30
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aag
10
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aah
20
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aai
10
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aaj
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aak
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aal
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aam
20
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aan
10
Aaarhmaaeaaaai/aad
15 rows selected.
1 row created.
Sql> commit
2 /
Commit complete.
40
Dept_rowid
emp_rowid
deptno
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aab
30
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aac
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aad
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aae
30
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aaf
30
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aag
10
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aah
20
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aai
10
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aaj
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aak
20
Aaarhmaaeaaaai/aac aaarhlaaeaaaai3aal
30
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aam
20
Aaarhmaaeaaaai/aaa aaarhlaaeaaaai3aan
10
Aaarhmaaeaaaai/aad
40
Aaarhmaaeaaaai7aaa
50
16 rows selected.
VALUE
---------------------------------------------1
COLUMN_NO
VALUE
---------------------------------------------1
A,B,C
A,B
COL1
COL2
---------------------------------------A
----------------------4
Select * from( select col1,col2 from table_name ) pivot( count(col2) for col1 in
('A','B','C') );
I wrote a trigger (before insert, update, delete) on one table and wrote a logic
to update table in trigger. Trigger compiled or throwing any error?
I have a csv file in outside database, every 10 minutes added new records in
csv file. My requirement is load csv file in database, which method you to
approach to load csv file to database.
If you created primary key which index created and if you created index
which constraint created automatically?
What is nvl and nvl2?
Can you write syntax of decode
Count(*)
status
------------------------1
Using same name with subprograms with different parameters and return
different data types
What are the restrictions in overloading?
Only local or packaged subprograms can be overloaded. You can not overload
stand-alone subprograms
They are giving examples and asking it works or not?
What is exception handling?
Exception is a runtime error for those exceptions the program will abort. In
that situation proper handler we execute the program
What is user and system defined exceptions?
Oracle predefined some errors for those errors oracle server is take care that
when the exception will rise
If I gave a select statement, it contains null data; I gave NO_DATA_FOUND
AND OTHERS in exception block? What exception will handles and that
procedure compiled or not?
It will not compiled why because no choice appear with choice others in
exception handler
What is nested tables, array? Tell me about those/
These are the collections which are similar to the structure array concept
What is materialized view?
I created two table having foreign keys from to side(referencing each other
with different columns)? How can I insert data into?
What is trigger? Write the syntax?
Trigger is a pl/sql block witch is implicitly raise when event occur in the
database
Create or replace trigger trigger_name
[before|after] [insert or update or delete] [of column_name] on table_name
[referencing old as old_value / new as new_value]
[for each row]
What are the types of triggers? What are they?
Dml triggers
Ddl triggers
System triggers
What is instead of trigger?
Triggers which for view only
What is Autonomous transaction?
A transaction is not dependent the other flow transactions are autonomous
transaction, these are execute directly in the server
What is PRAGMA_INIT?
This is preprocess directive which used like autonomous transaction and
exception declarations
Do u know about optimization and performance tuning? Tell me about it?
Optimized based on cost and rule for the performace
PL ROUND
Tell me about your self?
Tell me about your project?
What are the coding standards you used?
Who will review your code?
If u becomes strong in PL/SQL at what area we will provide you the training?
Any critical error you found in your project?
PM ROUND
Tell me about your self?
Tell me about your family background?
Do you know about 24/7 support?
Tell me about your organization?
Do you know about support?
What you will do first, when you got application to fix the bug?(I said
column?
11g features
What are main advantages of 10g then other version(9i)
Syntax of collection
Write a query to display even/odd number from a table.
What is the exception; write syntax on user defined exception.
How many types of sub queries in oracle.
Syntax of correlated sub query.
Write syntax to execute procedure or function in sql.
What are sql functions?
Disadvantage of triggers.
Diff %type and %row type.
What cascade constrains.
What is in line view.
How to retrieve 3rd max sal
Write syntax indian time and time 12 hours and 24 hours.
Index types
MBT PL/SQL Interview Questions
Oracle
Difference between procedure and funtion?
How procedures and functions are called?
What is meant by trigger?
What is two-phase commit?
Ans).prepare phase
Execution phase. I distributed system database.
Can we give commit for procedure and function?
Yes
What is a cursor?
A cursor is handle or pointer to the context area.
Using the cursors how to increase the salary of employes by 15% whose
salary is
Greater than 20,000.
Declare
Cursor c1 is select sal from emp where sal>20000;
Sal1 emp.sal%type;
Begin
Open c1;
Loop
Fetch c1 into sal1;
Update emp set sal=sal+(sal1*20/100);
Exit when c1%notfound;
End loop;
End;
10. Can you put more than one constraint to a column?
Yes.
Mbt.interview
1). How to fetch duplicate rows.?(with out using rowid);
2). Write query to fetch details of candidates who are not females(including
nulls);
3).what is index, types of indexes?
4). What is bitmap index & why is efficient?
5) diff between bitmap & binary index;
6).how to know to which database we connected?
7) what is trigger,types of triggers?
34) what is the main diff between normal index & organization table index?
35).can foreign key column accepts null values & duplicate values?
36). Why we use autonomous trans & write syntax?
37). What is the main diff between function and procedure?
38). How we call a procedure?
39). Is exec a sql statement?
40). Tell me about function overloading?
41). What is the diff between integrity constraints and triggers?
42). Tell me about types of triggers?
43). What is forward declaration?
44). Can you select the salary by passing the eno as a argument in the
procedure?
45). Why you want to shift here?
46). What about your present company?
Questions faced by sreedhar in mbt
1st round
1.what is diff b/w procedure and func?
2.how will u rate ur self in c,proc,sql,pl/sql
3.he asked about init.ora
Here we initialize the data block size.
4.he asked about functions like fprintf,sprintf
5.he asked about precompilation steps
6.which compiler ur using?
7.diff b/w view and materialized view?
8.what is database link?
9.sqlca structure
Struct sqlca
{
Char sqlcaid[8];
Long sqlcabc;
Lond sqlcode;
Struct
{
Unsigned char sqlerrmc[70];
Short sqlerrml;
}sqlerrm;
Long sqlerrd[6];
Char sqlerrp[8];
Char sqlwarn[8];
Char sqlext[8];
};
3rd round
Hr
1.the command [tar xvf myoracle .tar]
Ans: extracts all of the files from the files named myoracle.tax in the
current directory.
2.which of the following unix command will not take the user students to his
personal home directory?
Ans: ed/~.
3.why should we use macros(variables) in a make file?
Ans:correct use of the macros allow a same oa makes default one purpose to
be easily converted for use in the another contex.
4.the command to test the files in the current directory e exactly chars in
length(eg.test.cc)?
Ans :ls *.??.
5.the (ln) command can be used to create?
Ans:both hard links and soft liks.
6.the following command can be used to capture and handle signal in shell
script?
Ans:trap.
7.the script named/tmp/my list contain the following :
Ans:user/local/bin/perk:not found.
8.what would be the out put of the following command:grep^[^a-zaz.*!File?
Ans:
9.the rapid of the current process(shell script) is returned by the user?
Ans:$$.
10.unix domain sockets(choose 2)?
Ans:can be used to communicate process naming on different meachines.
Sql&pl/sql
1.which one is fired first exception when others or when no_data_found?
Ans : no_data_found will raise first.
2.select count(1) from emp where null=null?;
Ans:0.
3.purpose of the substr();
Ans;to pick the desire string from the entire string.
collect?
another procrdure?
What is substr()&instr()?
Difference between case and decode?
Can you use sysdate in check constraints? If no, why?
Difference between column level constraints & table level
What is optimizer?
What is nested_loop join?
What is pivot operater?
Tell me some oracle 10g features?
What is m_view?
What is master & detail tables?
What is sqlcode and sqlerrm?
constraints?
dept
deptno,dname
******************************************************************************
***
We are using UTL_FILES TO export the data from database to excel file
What is Migration?
Data transfer from one data base to entire data base into different formats of
data like as oracle to oracle, oracle to db2, oracle to excel, oracle to text
Export/import
connect to scott
identified by tiger
using 'ora10gdev';
The remote user will need to have at least 'CREATE SESSION' privileges.When
creating an oracle database link, you can decide to create it privately,
you are now ready to select your data from the remote database referenced
by the db link.
select * from dept@ ora10gdev;
Compile-time warnings
Oracle data pump utility (oracle data pump is a newer,faster and more
flexible alternative to the exp and imp utilities used in previous oracle
versions.in addition to basic import and export functionality data pump
provides a pl/sql application and support for external tables.
In the select statement instead of table name, replacing the select statement
is known as inline view.
Ex:
SQL> Select ename, sal, rownum rank from (select *from emp order by sal);
What is autonomous transaction?
What is exception?
Error occur during runtime processing due to application logic error is known
as exception. Exception is nothing but exception handling; it terminates main
body of action means a block always terminates when plsql raises an
exception. We can specify an exception handler to perform final action.
If the exception is raised in the executable section of the block and there is
no corresponding handler the plsql block terminates with failure(go to end )
There is exception block, others is defined that, after the begin statement
insert statement and update statement and during the execution time insert
statement is failed because of some reasons where controller will go
Procure may or not a return value, function should return the value.
We can use the function within queries , procedure wont able to use it in the
queries.
Without return statement i will compile the function . It will compile or not
PS -L