Accenture PL/SQL Interview Questions
What are different types of queries
Write a correlated sub query and explain how it works
What are different type of statements
What TCL do
What is difference between stored procedure and function
How you handle errors
What is %type and %row type
What are different types of cursors
How implicit cursor works
What are different type of triggers
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?
Difference between anonymous block and normal block?
Can we create snapshot for another schema?
How to access table from another database?
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
Can we give commit for the tiggers?
No
What is dns.ora?
How will u connect to the server from ur pc?
Connect: server uid
Passwd:******
Difference between dedicated server and distributed server?
What is view?
What is materialized view?
What is the difference between view and materialized view?
Hr
Tell me about urself?
Tell me about projects?
How will u get the work?
What are ur responsibilities?
Technical
Tell me about your self
Define transaction.
Transaction is a logical unit of work.
What is index?
Index is a database object which is used to fast reterival of data.
How does index form internally?
Based on rowid.
What are pseudo columns?
Pseudo columns are those which does not exists physically but they will perform some
expression evaluation
What is a partition
Large table are divided into small tables depending on condition
Range
Hash
List
Define view
View is a logical representation of data
Can we update a view?
Yes
What is autonomous transaction
Explain about exception propagation
How to find to which database you have connected?
Select * from global_name;
How to connect to different database?
Using database links
What is database link?
It is one way commnincation
Link b/w one db to another db.
What do you know about materialized view?
Have you ever used dynamic sql statements in your project?
Some 3 queries? (nth max sal, query on group by and select dup records)
Do you know about rollup and cube?
Then asked some questions on project for 5 min.
Hr
Asked about the project and team members and the organization structure
To whom do you report? (what is his name)
Tell me some of your team members names?
Tell about your family background
What is your ctc (cost to company)
What is your expected salary
And some other general questions and some funny questions.that’s it all the best.
What is the 3rd normal form
Each non key column must depend on nothing but the key. If a column depends on column
that are not part of the key split those columns into new table.
What’s the difference between the table level constraints and row level constraints.
The table level constraint is part of the table definition. An integrity constraint defined at
table level can impose rules on any columns in the table whereas column level constraint
being a part of the column definition can be imposed only on the column level on which it is
defined.
How to store a resume in the data base.
In pdf format
In text form
At
Is index useful in all cases
No
How to find if oracle is there in the resume stored in the data base?
Cat search.
Can null values be indexed?
Yes
Can a view be indexed?
No, only create index for materialized view.
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?
8) where we use :old and :new ?
9)diff between fns and procds ?
10)diff between pkg spec & pkg body?
11).can we write nested blocks in pl/sql;
12).what is propagation exception?
13).can we create index for view?
14).what do u know abt materialized view?
15).what is the diff between dblink & materialized view?(incase of accessing)
16).what is cursor, types of cursors?
17) how do we process records in cursor?
18) what is autonomous transaction?
19)how do u identify autonomous trans in procedure?
20).what is correlated subquery & give an exml?
21).display details of all employees including who are not in deptno 40 (using outer
join).
22) what is dbms_job ?
23). What is dynamic sql?
24) what is partition, why u go for partitions, and write the syntax?
25).diff between triggers & integrity constraints?
26).what are analytical functions(roll up,rank,cube)?
27).what is sequence & where did u used in ur project?
28).diff between view & materialized view?
29) can we create index on materialized view?
30) what is primary key & unique key?
31).can we create index on primary key column?
32).what is unique index?
33) what is the syntax of organization table index?
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];
};
10.he asked about utl_files
11.how is rate u r self in unix?
12.what is synonym?
13.how u will connect database from pro*c?
14.diff b/w view and synonym?
2nd round
1.she asked about project(current) indepth?
2.what is exception and tell the error code for data not found?
-01403
3.diff b/w implicit cursor and explicit cursor?
4.how u declare a cursor in pro*c?
Exec sql declare c1 cursor for select list from table_name;
5.propagation of exceptions?
6.if there are 3 users if user1 gives permission on select how will u give that to user1 and
how user2 can grant permission to user3?
7.how u will u copy 5 lines in vi editor?
5yy
8.have u done performance tuning?
10. What is diff b/w materialized view and view (atleast 5)
11.how will u reach end of file in vi editor?
12.she asked about linked list?
13.she asked about malloc function and return type of malloc?
14.precomplication steps
15.how u will delete 5 lines
5dd
16.what is dw
It deletes word.
17.grep
18.find command
19.how u will embedded pl/sql in pro*c?
Exec sql execute
Pl/sql block
End-exec;
20.grep –v
Except that lines which contains that pattern
21.host variables
22.she asked about database links
23.diff procedure and trigger
24.have u written any shell scripts
#!Bin/bash
25.what is the o/p of .pc program
***26.diff b/w .pc and .c
27.she asked about utl_file what is its purpose?
28.have u heard about init.ora
29. Have u heard about .profile file
30.env
31.errd[2]
No of rows effected.
32.what is a pointer
33.tell me the syntax for creating dblinks
34.2 phase commit
35.she asked can i give tcl commands in triggers
36.diff b/w truncate and delete
37.how to get a new line b/w two lines
O
38.what is a in vi editor?
End of the line
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 char’s 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-za-z.*!”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.
4.select nvl(100/efficiency,’nvl’) from the colibrations,why it gives error?
Ans:
5.select distinct count(*) from dept;
Ans:6(this is based on given table values);
6.which two char remove escape option?
Ans:% -
7.default length of the char?
Ans: 1 byte.
8.select count(*) from emp where rownum>2;
Ans:0
9. Update emp set comm.=10,sal=sal+(sal*(comm./100)),what is the result of the update
stmt?
Ans:
10.select s1.currval from dual ,what will be the value when the session opens?
Ans:it gives error.
Sequence s1.currval is not yet defined in this session
11.begin
Select ‘x’ into x from test where tname=’test’;
Update test set tname=’test’ where rownum=1;
Exception
When no_data_found then
Null;
End ;
Ans:it will not throw any error and comes out of the block;
12.if there are two after insert triggers on a table for each row,which will be fired first?
Ans:recently written trigger will fire first..
13.select to_char(sysdate,’mm/dd/yy hh 24mi’) from dual;if it is 12:00 in the night on
Jan 1,2000 what is result?
Ans:
14.what is the overloading?
Ans:
15.program define record type?
Ans:
16.cartesion product?
Ans:
17.synonym can not created for
Ans:none.
18.select distinct ename ,se2.nextval from emp?
Ans:error.
19.which is true?that table can have
Ans:
A)multiple triggers of same type but not multiple row triggers of the same type.
B)multiple stmt&row type triggers of the same type.
C)maximum no.of triggers 12.
D)multiple row typr triggers of the same type but not multi stmt triggers of same type.
20.when an attribute of the object is defined ref type ,what data is actually stored in
attributes?
Ans:pointer to data.
GE PL/SQL Interview Questions
Tell me about u r self, educational details and u r projects
Tell me about ur current project.
How will rate yourself in PRO*C, SQl,PL/SQL and UNIX
I have 10,000 records,. The record length is 70 characters? How will insert at a time 500
records into a database
After inserting 500 records, unexpectedly the program was aborted? Again we run the
program. From which position the records are inserted into a database.
How do you know the how many records are processed in PRO*C
Explain sqlca structure
What is the maximum error message length returned by sqlcode.sqlerrm.sqlerrmc?
If I Want to display the error message, which is more than 70 character? How to obtain it?
Until runtime I don’t know the table name, to select a query. Which method u should follow?
I had one varchar variable. I assign a value to that character arrary arr. Is it sufficient?
How handles errors in PRO*C
How to compile u r PRO*C program
How to compile the C program
How to run programs
Do u know the oracle architecture
What is meant by oracle instance
What is inline view? What are the advantages
What is package? What are the advantages
Till now how many packages u r written
Some columns having indexes. How to know which columns having indexes in a table
What is index? Types of index? What is the advantages of bit-map index?
How do u optimize u r query?
How to know the cost of the query?
What is a trigger?
Have u use instead of triggers
How many types of joins u know?
What is meant my outer join? Can write one sample query?
What is full join? Tell me one example?
what is grep? How to find blank lines in a file?
What is find?
What are the other command u know?
what are the major significant you achieve in u r experience?
U r PL gave a compliant on you to your PM? What u do?
Have u prepared any documentation?
KPIT PLSQL Interview Questions
Unix
Chmod (different modes) and umask
Difference between find and grep
All about vi editor like how to reach the end of file or end of screen, how to search and
replace a particular string in the line and in the whole file
What is a filter and explain about different filters
I/o redirection
I was asked to write some search patterns for find and grep commands
How can you find the status of a process? What are the different statuses that a process
can have?
Different shells
What is a shell and for what it can be used
How will you compare two files?
How much do you know about compression?
Sql and pl/sql
What does instr () and substr () returns. Write syntax for both
Write a query to delete duplicate rows from a table
Write query to find the maximum salary w/o using function
Delete vs. Truncate
Procedure vs. Function
Constraint vs. Trigger
View vs. Materialized view
Structure of pl/sql block
How do you handle exceptions in pl/sql?
What is a sequence and what is the need of it
Types of triggers
What happens if a cursor is not closed?
What happens when you try to open a cursor that is already opened?
What is temporary table space? Can you create that?
Can you write triggers for a ddl statement?
What is a package? What is the need of it?
Types of joins and why we need joins
Types of constraints
SONY PL/SQL Interview Questions
Introduce about your self.
Tell me about your project.
For what purpose you are used pro*c in your project.
What is a package, advantages and disadvantages of packages?
What is a procedure and function.
Display the duplicate records in table.
What is meant by overloading.
What is meant by one time procedure.
What is meant by function purity levels.
What is meant by for update clause.
What is meant by dynamic sql.
What are the types of exceptions in pl/sql.
What is meant by raise_application_error.
What is meant by utl_File.
What are the exceptions are there in utl_file.
What is the structure of varchar.
What is the structure of sqlca.
What is meant by whenever statement.
How to embeded the pl/sql block in proc.
How can you declare the cursor in proc.
What is meant by ps command in unix.
How to search the pattern.
How to search a file in particular directory.
What is meant by normalization.
How many types of triggers can be created on a table .
Ans: 12 types of triggers can be created on a table
Before insert/update/delete for each row
After insert/update/delete for each row
Before insert/update/delete for each statement
After insert/update/delete for each statement
*********************************************************************************
Explain your project
File uploading and generation in pro*c in detail with code.
Host array.
Indicator variable.
How do you compile pro*c program.
What are the files create when you compile pro*c program
Unit testing plan
Difference between procedure, function and package
Advantages of package
Disadvantages of package
Methods in pro*c in detail with code
Sqlca in detail
Can we write ddl statements in procedure
Optimization steps
Autonomous transaction
Pragma
Init pragma
Have you used system packages?
Functions in utl file?
Utl file errors
Display the duplicate rows.
Instead of trigger
What is the difference between Sun Solaris and Unix
When do you get core dump errors in pro*c
Varchar structure
Native Sql
Dynamic Sql in pl/Sql
Native compilation.
What is table mutating? When do you get it?
What is the use of cursor? What are different types of cursors?
What is ref cursor? Have used it
Correlated subquery? With example?
How do you declare cursor in pro*c
Bulk binding.
In a procedure I have written dml statement with in the loop and issued commit with in the
loop. What will happen?
Have you talked to your client
Have you prepared any documents
L&T PL/SQL Interview Questions
Written test
1. Which one is used for geographical operations?
A. Integrated server.
B. Distributed server.
C. Common server.
2. How can we able to use group by, order by, having clause in SQL statement?
A. We can use all clauses
B. Only group by and order by we can use
C. Group by ,having clause we will use
3. What is distinct function will give?
A. All the unique rows
B. All the unique columns.
C. Including null values.
D. All the rows
4. They are giving the EMP table as example and ask the simple queries?
UNIX
How to display hidden files?
How to regenerate exiting process with PID?
How to kill the process?
What fork command will do?
How to find the background running process?
Which command is used to display line number of search string?
Which command is used to find the no of line in a file?
HR round
Tell me about your self?
What are your current CTC and ECTC?
Why you’re willing to relocating?
What does u know about L&T?
Tell me about your current project and company briefly?
Technical Round
Rate your self in sql and pl/sql out of 5?
Tell me about your self and your current project?
What is dml, ddl, dcl, tcl commands?
What is joins? What is outer joins available, tell me about briefly?
What is view?
What is inline view?
What is sequence? Tell me the syntax?
What is no cycle and cycle, if we can not give no cycle what happened/
What is index? What type of indexes available?
What is cluster and bitmap index?
What is synonym? Tell me the syntax?
Create synonym synonym_name for object;
Synonym is the mask of the object name and owner and we can declare as public as well
as private synonyms
What is use of synonym?
Can we create a synonym on view?
Yes we can create a synonym on view
What is Cursor? What is the use of cursor?
Cursor is private work area to execute queries
What type of cursors available? Explain?
Implicit and explicit
Write the syntax for cursor?
Cursor cursor_name is select query;
What is the procedure and function?
Procedure and functions are the pl/sql objects
Procedure is for perform an action
Function is return a value
What is the difference between procedure and function/
Procedure are can not use in select query
Procedure may or may not return
Procedure can return more than one value as out mode
Function can use in select query
Function should return value
Function return only one value
Tell me about the packages?Package is also as pl/sql object witch is used grouped related
items, types and subprograms
What is the use of packages?
Reduce the traffic between the client and server
What are the disadvantages of packages?
Memory occupation
What is the concept of over loading?
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 understanding of
application and then estimation)
Does u know about SDLC?
Tell me about sdlc?
Are you prepared unit test plan?
How do you analyze the things?
Do you involve in any other stages of sdlc?
What testing u performs?
Why we want to hire you?
Are you involved in design part?
Write your company flow diagram?
Wipro PL/SQL InterviewQuestions
SQL and PL/SQL
Difference between truncate and delete.
write a query to find second max salary.
SELECT SAL SECONFD FROM EMP WHERE SAL NOT IN(SELECT MAX(SAL) FIRST
FROM EMP);
write a query to delete duplicate rows.
DELETE FROM EMP WHERE ROWID <>(SELECT MAX(ROWID) FROM EMP B WHERE
EMPNO=B.EMPNO);
difference between procedure and function.
what is package.how to call the function.
PACKAGE.FUNCTION-NAME
UNIX
In a text file containing orange and apple.i want number of occurrences.
GREP –N ORANGE APPLE FILE NAME
how to delete recently created 10 days files.
FIND . –TYPE F -ATIME +10 –EXEC RM {};\
how du you know which process is running in u r system.
Matrix PL/SQL Interview Questions
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
LOGICA PL/SQL Interview Questions
What is your daily activites in project?
What is sga?
What is pga?
What is tablespace?
What is extent clause in tablespace?
What is datasets?
What is datablocks?
What is temparery table?
Which sitivation are you worked temparery table?
What are the datatypes in sql?
What are the char datatypes?
Diff b/w char & varchar2?
What is timestamp returns?default size of timestamp?
What is defaults timestamp format like 12 or 24?
Do you know any character datatype without char,varchar2?
Do you know any number datatype without number & integer?
Tell me some pl/sql datatypes?
Do you have create table column's with boolean datatype?
Why boolean datatype is not possible to create a table column?
What is data modeling?
What is constraint? What are types of constraints?
Diff b/w primary key & unique key?
What are the master & detail table?
Which will fire first constraint or trigger?
Which format are you used build a sql query?
What is blob/bfile?
What is clob?
What is the use of timestamp in select statements?
Which datatype does not allows 'null' values?
Diff b/w whare,having & group by clause?
What is row fragmentation?
Can you drop all columns in a table used alter command?
Can you modify a null column to not null column, if table has some data?
What are functions there in sql?
What is lower(),upper(),& initcap()?
What are the substr() & instr()?
What are date functions?
what is the conversion functions?
what is diff b/w nvl,nvl2,&nullif()?
diff b/w rank() & dense_rank()?
what is er modeling?
what is join? Types of joins?what is outer join?
what is psudeo columns?
what is in_line view's?
what is window clause?
diff b/w exist & in?
what is sequence? Can you alter startwith clause?
can you create synonym same name of object?
diff b/w view and synonym?
Second round interview questions
can you create synonym on procedure,package,functions?
what is index? Types of indexes?
can you create index on index?
what is raise_statement? How to declate it?
what is dbms_utility?
can you use out parameter in functions?
what is pragma_autonomous_tranctions?
which sitivation you have used utl_file packages?
how to improvee performence?
hot to debugg your code?
what are the majer step's you are consider in explain?
why are used m_views?
do you know utl_smtp?
what is collections & types of collections?
can you use varchar datatye in indexed_by_table?
can you use collection method types in functions?
Scope international PL/SQL Interview
Questions
How to see invalid indexes?
How to rebuild invalid indexes using pl/sql block
Which cursor are used in u r project,how to idenified which cursor are wrritten in u
r requirement?which is better explict or implict?
A. Emp dept
B. Ename,deptno,sal deptno,dname
I want to output bellow
A)dname,sum(sal) wise
B)dname,max(sal) wise
Create small procedure in u r project you are created?
Do u know m_views? Explain wat is disadvantages and advantages?
When m_views are created mainly?if base table deleted what happen m_views?
Why are u creating m_views in u r project?main purpose?
In exceptions you have handle write ora errors?
Ora errors where stored?
More 3 + experience interview questions
Unix
What is shell
What are different type of shells and explain about them?
How will you move the cursor with out using arrow keys in vi editor
What are keys for moving forward and backward screen
What ps will do and explain options
What is grep
What are –i and –v options will do in grep
What find command will do
What is use of –exec in find
What {} will do
What are re directive operators in unix
What are wild card symbols in unix
How you get latest processed record
How you get processed files between some time period
What is default symbol in case
How you write different commands in single statement
Then how shell will allocate for that two commands
What are the symbols to check the numeric values
Write a script for
1.check a file if it is available or not
2. If available rename it
3. Open a new file and 1,2,3,4, values in it
How you will open another file in same vi editor
How you come back
How you get the values of arguments
How you get the all values of arguments
What is egrep
Oracle
What are different types of queries
Write a correlated sub query and explain how it works
What are different type of statements
What tcl do
What is difference between stored procedure and function
How you handle errors
What is %type and %row type
What are different types of cursors
How implicit cursor works
What are different type of triggers
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?
Difference between anonymous block and normal block?
Can we create snapshot for another schema?
How to access table from another database?
Birlasoft PL/SQL Interview Questions
What is the use of package
What is module overloading?
What are composite data types.
What is the use of record. Why we use record.
What is the difference b/w pl/sql record and pl/sql table.
What is collection?
Difference b/w nested tables and varrays.
What is isolation table?
What are dead locks.
What are shared locks and implicit locks.
How many types of cursors we use.
What is the ref cursor and how to send unlimited data to front end.
Syntax of sql *loader.
How to get the data from database to unix environment
How to control module over loading.
Honeywell PL/SQL Interview Questions
IBM ---- Lakshmi
DIFFERENCE between subquries and co-related sub quries..
How u find which process is running in unix environment?
Whether grep() provide no of times of patrren searching?
Difference b/w procedure and function?
Joins-----types –with explanation
Scenario to find quries using outer joins
Highest & lowest salary values
Find the second maximum salary
POLARIS ---- Lakshmi
Import/export
Db links
Datatypes in sql
Package advantages
Trigeer –types
Nvl function
Pragma
Advantages og 10g
Function,procedure difference
Cursor types
How to debug a procedure
Toad?
Difference b/w union and union all?
Without producing a link how u send data to frontend manually?
How to find how many records it fetched?
How u get where error is occurred in code?
What is data dictionary?
Single row,multi row functions/
Difference b/n view and materialized view?
Psuedo columns
Decode ()
Sequence, advantages
Explain set operations?
Inline function()
Difference b/n nullif and nvl2
Difference b/n dbms and rdbms
Diffence b/n count(1),count(*)
1. count(1)
2. count(*)
3. count(rowid)
the answer is 1 and 3.
The function count() executes faster when given a criteria/value which is quicker to resolve
in the sql processing mechanism.Thus, an integer or rowid are faster to resolve than an
'*'which is a wild card symbol for all the colums in a table and hence it is more time
consuming.
HONEYWELL ----- Lakshmi
PROCEDURE overloading
date fuctions?Loops in plsql
lpad(0/rpad()
Stringin() function
case exp
Find 2nd,3 rd max sal
query to find a_bformat names
import and export
what is table space/
difference b/n having and where caluse?
Dis advantages of cursor
bulk loader
bulk collect
exception concepts
triggers/instead of trigger
creation of data base link
use of hint
What is directory?
What is external table?
TCS PL/SQL Interview Questions
What are the environments in your company?
How to know which version is currently runing in your database?
Do you have any experience in data modeling?
How to disable all triggers in a table?
How many triggers are you created?
How many triggers created on one table?
Which will fire default first statement level or row level trigger?
What is bulkcollect? And any restrictions in bulkcollect?
What is the use of limit clause in bulkcollect?
How to debugg your code?
How to trace error handling?
How to find which line error was raised?
What are the methods there in save exceptions?
What is functional based index? Write syntax?
How to update complex view?
Can you alter procedure with in package?
Is it possible to open cursor which is in package in 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 constraints?
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?
CSS PL/SQL Interview Questions
Tell me about your self
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?
What are the Sqlca structure elements?
Then asked on project for 5 to 10 min.
asked two queries
select duplicate records from a emp table?
Select Nth maximum salary from emp table?
SELECT * FROM EMP WHERE ROWID NOT IN(SELECT MIN(ROWID) FROM EMP
GROUP BY EMPNO);
SELECT A.* FROM EMP A WHERE &N=(SELECT COUNT(DISTINCT(SAL)) FROM EMP
B WHERE A.SAL<=B.SAL);
Why PL/SQL
Why package?
Why Triggers while you are having Constraints
Types of Triggers and Mutating Triggers
Examples for statement level and row level triggers
Bulk-fetch and bulk binding
What are the options that you use while pre-compiling a Pro*C program and why?
All about cursors
What is the need of Error Handling in PL/SQL and how will you do it
Explain Method 4 in paper
Write queries for deletion of duplicate records and nth max salary
Search and Replace in UNIX
Find syntax
Grep syntax
Copy all the fields from the result of ls –l command into different host variables and insert
them into a database object
Describe materialized view
I/O redirection
Why Locks and different types of locks
Autonomous transaction
Referential Constraint
HP PL/SQL Interview Questions
1: wt is the diff b/w greast and max ,least and min? Wt is the diff b/w case and decod?
Answer
Greatest/least: we can pass any no. Of exp
Max/min: we can pass one exp that may a column
Case: is a statement function, cannot process null
Decode: is a function, can process null, we can use in
Update statement.
2: how to print * ** *** **** ***** by using sql query?
(may be using script)
Answr
Select lpad('*',rownum,'*') star from person where rownum<6
*
**
***
****
*****
Write a query to filter improper date format following table?
Date
20-apr
22-may-2010
26-jun-2010
Feb-2009
I want the output
Date
22-may-2010
26-jun-2010
Select to date('column_name','dd-mon-yyyy') from table_name;
Write a query to remove null following table are
Id name
101 dinesh
Null jyothi
Null bharathi
102 suresh
Null shilpha
103 prakesh
Null suma
I want the output format like
Id name
101 dinesh
102 suresh
103 prakesh
Select * from table where id is not null;
Wirte a query to remove null? Following table are
Col1 col2 col3
Dinesh null null
Null suresh null
Null null prakesh
I want the output like
Col1 col2 col3
Dinesh suresh prkaesh
Select distinct((select col1 from coll where
Col1<>'null')),(select col2 from coll where col2<>'null'),
(select col3 from coll where col3<>'null')
From coll
Select max(col1) col1,max(col2) col2,max(col3) col3
From table;
Write a query filter the null value data following source?
Name age
John 30
Smith null
Null 24
Sharp 35
I want output
Name age
John 30
Sharp 35
Select * from test_1 where name is not null and age is not
Null;
When do we create bitmap indexes
Answer
If there is very less cardinality (i.e. 1% of total column
Values) or distinct values in column then we have to create
Bitmap index for that column like gender column will always
Have 2 values male or female.
Syntex:-
Create bitmap index index_name on table_name(column_name);
A.oltp
B.dss
C.where clause has functions
D.tables that have only one record
Can we use out parameter in function?
Answer
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
Write a query to genarate target column.please answer me.
Advance thanks.
Src tgt
Q10 quarter to 2010
Q90 quarter to 1990
Q80 quarter to 1980
Q74 quarter to 1974
Select
'Quarter to '||to_char((to_date('01/01/'||substr(src,2),
'Dd/mm/rrrr')),'rrrr') as "target"
From table
How to call the function and procedure in trigger?
Answer
With the help of call statement..without semicolon
Create or replace trigger tri_call
Begin
Call p1()
End tri_call;
What is different between union and minus?
Answer
Unoin:- this operator returns from all the queries(combined
Through union) but not duplicate record will be display.
Ex- a={1,2,3,4}
B={2,3,4,5}
Aub={1,2,3,4,5}............
Minus:- this operator displays records which belongs to only
The first query.
Ex:- a={1,2,3,4}
B= {2,3,5}
A-b={1,4}...................
Can we interchange parameters in procedure while calling
Answer
If you name the parameter then you can interchange
Otherwise you cannot. Like in the following example the
First case is positional and you cannot interchange. In the
Second one its named and you can interchange.
Regular oradatabase.standproc(102,'ram'); -- positional
Oradatabase.standproc(empno=>102,ename=>'ram'); --named
Oradatabase.standproc(ename=>'ram',empno=>102);
Re: what is 'force view'?
Answer
The view can be created without base table then the view is
Called force view. The view must be crated with force
Option.
Sql> create or replace view test_view
2 as
3 select * from non_existent_table;
Select * from non_existent_table
*
Error at line 3:
Ora-00942: table or view does not exist
/* hence, the view does not exists */
Sql> select * from test_view;
Select * from test_view
*
Error at line 1:
Ora-00942: table or view does not exist
/* specifying force creates the view object (albeit with
Errors) */
Sql> create or replace force view test_view
2 as
3 select * from non_existent_table;
Warning: view created with compilation errors.
/* trying to select from the view implies it's been created
*/
Sql> select * from test_view;
Select * from test_view
*
Error at line 1:
Ora-04063: view "orauser.test_view" has errors
/* creating the missing object then allows us to select
From it */
Sql> create table non_existent_table
2 (
3 a varchar2(10)
4 );
Table created.
Sql> select * from test_view;
No rows selected
What are global temporary tables
Answer
Global temporary tables are session dependant tables which Could be used as temporary
storage for calculations, sorting
Etc. What i mean by session dependant is, the data being Stored in the global temporary
table is not written into the Database or stored anywhere. Once the session ends (in which
The global temporary table is used), the data also vanishes.
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.
Now, why do we need global temporary tables? Well, imagine a requirement where you
need to fetch some data from the database, do some kind of calculations, aggregations and
provide the result set (many records) to a front end. Again, in the front end, you need to
fetch the result set may times, for some purpose. Then you could make use of the Global
temporary table. Until the user gets disconnected from that database session, the data is
available for him in the memory.
Global temporary tables belongs to that session only
Create global temporary table test_gbl
( l_number_no number,
L_char_vc varchar2(100)
) [on commit delete rows]
On commit delete rows:- it's a default one
If any commit will issued that total data of a table will
Losses. But table is exit
To overcome this we have option
On commit preserve rows:-
Means, if commit will issue the data of a table willn't loss
Up to end of the session. Is session ends the data will
Losses
What are nested tables? How will u delete 5 rows from nested
Tables
Answer
Create or replace type addresstype as object (
Street varchar2(15),
City varchar2(15),
State char(2),
Zip varchar2(5)
);
Create or replace type nested_table_addresstype as table of
Addresstype;
Create table employee (
Id integer primary key,
First_name varchar2(10),
Last_name varchar2(10),
Addresses nested_table_addresstype
)
Nested table
Addresses
Store as
Nested_addresses;
Insert into employee values (
1, 'steve', 'brown',
Nested_table_addresstype(
Addresstype('2 ave', 'city', 'ma', '12345'),
Addresstype('4 ave', 'city', 'ca', '54321')
)
);
Delete from table (
Select addresses from employee where id = 1
) addr
Where
Value(addr) = addresstype(
'4 ave', 'city', 'ca', '54321'
);
Re: select top 3 sal from each dept?
Answer
Select* from(select ename,deptno,sal,row_number()
Over(partiton by deptno order by sal)num from emp)
Where num<=3
Order by deptno;
Re: what is difference between having and where clause?
Answer
Having clause is used for filtering grouped data and where
Clause is used for filtering rows.
Where clause filter the data before gruop by clause and
Having clause clause filter the data after group by clause
Can you have multiple sps with the same name on a database?
Answer
Both above answers are correct,but situvationd diff
1) we can't create same db obj with same name,
2) we want that go for packages ,with overloading concept
I want to create a materialized view from a left join of 2
Tables. However the following gives me an error:
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
The materialized view
However the following works:
Select field1
From table_1 a, table_2 b
Where a.field1=b.field2
Does anyone have any ideas why this is happening.
Thx for the help
Oracle views join materialized
Share|improve this question
There are two conditions that are not satisfied to make that
Materialized view refresh fast. First one is that you did
Not specify the rowid columns of every table involved. And
The second one is an undocumented restriction: ansi-joins
Are not supported.
Here is an example with dept being table_1, alias a and emp
Being table_2, alias b:
Sql> create materialized view log on emp with rowid
2 /
Materialized view log created.
Sql> create materialized view log on dept with rowid
2 /
Materialized view log created.
Sql> create materialized view empdept_mv
2 refresh fast on commit
3 as
4 select a.deptno
5 from dept a
6 left join emp b on (a.deptno = b.deptno)
7 /
From dept a
*
Error at line 5:
Ora-12054: cannot set the on commit refresh attribute for
The materialized view
That mimics your situation. First add the rowid's:
Sql> create materialized view empdept_mv
2 refresh fast on commit
3 as
4 select a.rowid dept_rowid
5 , b.rowid emp_rowid
6 , a.deptno
7 from dept a
8 left join emp b on (a.deptno = b.deptno)
9 /
From dept a
*
Error at line 7:
Ora-12054: cannot set the on commit refresh attribute for
The materialized view
Still it cannot fast refresh, because of the ansi joins.
Converting to old-style outer join syntax:
Sql> create materialized view empdept_mv
2 refresh fast on commit
3 as
4 select a.rowid dept_rowid
5 , b.rowid emp_rowid
6 , a.deptno
7 from dept a
8 , emp b
9 where a.deptno = b.deptno (+)
10 /
Materialized view created.
And to prove that it works:
Sql> select * from empdept_mv
2 /
Dept_rowid emp_rowid deptno
------------------ ------------------ ----------
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aaa 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
15 rows selected.
Sql> insert into dept values (50,'it','utrecht')
2 /
1 row created.
Sql> commit
2 /
Commit complete.
Sql> select * from empdept_mv
2 /
Dept_rowid emp_rowid deptno
------------------ ------------------ ----------
Aaarhmaaeaaaai/aab aaarhlaaeaaaai3aaa 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.
IBM PL/SQL Interview Questions
Tell me about your project and client
What is difference between procedure and function?
Function can have out parameter
Difference truncate and delete
Can we use where condition with truncate
Can you explain the truncate and delete with trigger
Can we use truncate and delete command to disable the referential integrity constraint
How did you export the data from database to excel file
How many types of functions in UTL_FILE package
What function you are using to load the data in UTL_FILE package
How many types of trigger
How many max triggers you will declare
What is instead of trigger?
We have two duplicate rows, how will you delete only one row
How will you display rownum?
Select column_name from table_name where rownum=10, it will display the result, (tell me
reason)
Select column_name from table_name where rownum<=10, it will diplay the result
What is implicit and explicit cursor?
What is exception?
How many types of exception
Can we have more than one exception?
What are predefined exceptions?
Do you know TOO_MANY ROWS, when that exception will occur and NO_DATA FOUND
How to catch any type of exception
Can we commit in trigger
What is autonomous transaction?
What is view
Can we delete a record in view
Can we delete a record more than one table
Can we write trigger on view
You are working on oracle 10g, 10g features
Do you have use any debugging tool
Do you know global variable, difference between global variable and parameter variable
Do you know about cascading triggers
Capgemini PL/SQL Interview Questions
What is your roles and responsibility?
How to communicate to your pm?
Select count(1) from dual;,what is output?
How to delete duplicate records from table without distinct clause
How to retrieve second height salary from table?
Diff b/w primary key & unique key?
Diff b/w procedure & package?
Which is better procedure or package?
What is cursor?types of cursor? And diff b/w cursors?
What is exception? Types of exceptions?
Tell me some user_defined exceptions with error codes?
What is sqlcode and sqlerr?
What is ref_cursor? Type of ref_cursors and diff b/w?
How give privilege a one procedure in package?
What is %type & %rowtype? What is main use?
How to improvee performence?
What is bulk collect? What is use of limit clause in bulk collect?
What is forall?
What is merge statement? Give me syntax?
What is view? Use of view's?
What is nocopy clause?where it is used?
What are the environments are there in your company?
How to connect your database?
What are the shartcut of compile & execution of programes in sql developer tool?
Are faced any trouble in your project?
What are the module's , you are working?
Which will fire default first statement level or row level trigger?
What is bulkcollect? And any restrictions in bulkcollect?
What is the use of limit clause in bulkcollect?
How to debugg your code?
How to trace error handling?
How to find which line error was raised?
What are the methods there in save exceptions?
What is functional based index? Write syntax?
How to update complex view?
Can you alter procedure with in package?
Is it possible to open cursor which is in package in 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 constraints?
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?
HCL PL/SQL Interview Questions
What is meant by procedures?
It is stored sub program which is used to perform some action.
What is mean by functions?
It is stored sub program which is used to compute an expression
What is the difference between procedures and functions?
What is meant by packages?
Package is an object which Is used to group the sub programs,
variables ,collections ,constants ,cursors
What is meant by triggers?
Trigger is a stored procedure which will fire when ever an event occur.
What is meant by exception and what are the types of exceptions?
Exception is an error handling mechanism in pl/sql .
There are 2 types of exceptions
Pre defined.
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.
CTS PL/SQL Interview Questions
Tell me something yourself?
What are the activities are you doing daily in your project?
Tell me ratios of sql , pl/sql&unix?
Difference between primary key & unique key?
Diff b/w primary key & unique key + not null?
What is the use of views?
If table dropped, then what happen view?
What is index? types of indexes?
Which functions are not supported to index?
What is save point?
What is ora-1555?
What are the data types available in pl/sql, not in sql?
What is the main use of %type,%rowtype?
What is cursor? Types of cursors?
Diff b/w explict cursor & for loop cursor?
What is exception? Types of exceptions?
What is raise_application_error?
What is pragma_exception_init?
Diff b/w triggers&procedures?
Can you call procedure in select statement?
Restrictions in functions?
What is the use of packages?
How to drop package body only?
Can use pragma_autonamous_tranctions in packages?
What is bulk collect?
What is nullif()?
What is mutating error?
What are the module's , you are working
Which will fire default first statement level or row level trigger?
What is bulkcollect? And any restrictions in bulkcollect?
What is the use of limit clause in bulkcollect?
How to debugg your code?
How to trace error handling?
How to find which line error was raised?
What are the methods there in save exceptions?
What is functional based index? Write syntax?
How to update complex view?
Can you alter procedure with in package?
Is it possible to open cursor which is in package in 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 constraints?
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?
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
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.
3i-infotech PL/SQL Interview Questions
Explain about yourself and it experience?
What are the environments are you worked?
You have any experience in production?
You have any experience in unix?
What is dual? It is database object?
How many column's and row's contains dual table?
Select '1'+1 from dual; what is output?
Select * from emp where comm in (null);
Comm=null; what is output?
How to count no of records in table without count?
What is height sal whthout using max()?
Select only those employee information who are earning same salary?
How to find last inserted records from table?
Select 'vik'||null||'ram' from dual? What is output?
I have table, in column data is 'su@re#sh$', now i want to my output is 'suresh'? How to
retrive?
How to retrive top 3 salaries from each departments?
Can you update complex view? If no, why?
How to know oracle use my index or not?
When should rebuild one an index?
Tell me some errors?
Tell me some restrictions on cursor variables?
What is context swithcing?
What is bulk collect?
What is nullif()?
What is mutating error?
What are the module's , you are working?
Which will fire default first statement level or row level trigger?
What is bulkcollect? And any restrictions in bulkcollect?
What is the use of limit clause in bulkcollect?
How to debugg your code?
How to trace error handling?
How to find which line error was raised?
What are the methods there in save exceptions?
What is functional based index? Write syntax?
How to update complex view?
Can you alter procedure with in package?
Is it possible to open cursor which is in package in 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 constraints?
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?
CSC PL/SQL Interview Questions
Tell me about your self
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?
How to call procedure in Pro*C
Have you ever used dynamic Sql statements in your project (methods in Pro*C)?
How to handle exceptions in Pro*C
What are the Sqlca structure elements?
How do you handle/trap errors in Pro*C?
Then asked on project for 5 to 10 min.
Asked two queries
Select duplicate records from a emp table?
Select Nth maximum salary from emp table?
SELECT * FROM EMP WHERE ROWID NOT IN(SELECT MIN(ROWID) FROM EMP
GROUP BY EMPNO);
SELECT A.* FROM EMP A WHERE &N=(SELECT COUNT(DISTINCT(SAL)) FROM EMP
B WHERE A.SAL<=B.SAL);
Vayana PL/SQL Interview Questions
What is method using export the data from database to excel file?
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
What type of migration you are using
Export/import
What is database link, what command used, permissions
A database link is a pointer that defines a one-way communication path from an
Oracle Database server to another database server. The link pointer is actually
defined as an entry in a data dictionary table.
Create database link ora10gdev
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;
What is source control you are using in your current project?
Currently I am using vss(visual source safe) version controlling tool (SVN)
Why it is called a stored procedure
Stored procedure is a compiled data base object it is stored in data base so that
it can be shared by a number of programs so it is called stored procedure
What are the features in oracle 10g
It supports flashback features
It supports retuning with group function
Automatic storage management in multiple disks
It is used to store ejb components directly into database without any transaction
Database tuning improvements
Scheduler utilities
Back trace an exception to its line number
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.
Do you know about inline view? (TOP-N ANALYSIS)
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?
Autonomous transactions allow you to leave the context of the calling
transaction, perform an independent transaction, and return to the calling
transaction without affecting it's state. The autonomous transaction has no link
to the calling transaction, so only committed data can be shared by both
transactions.
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.
What are predefined exceptions?
NO_DATA_FOUND, CURSOR_ALREADY_OPEN, INVALID_CURSOR,
TOO_MANY_ROWS, ZERO_DIVIDE, INVALID_NUMBER, etc
There is a error in a procedure it is not define into exception block where
controller will go, corresponding handler is not there, what is the exception it
will throw
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
Controller goes to exception section and throws the exception
Can we use commit in trigger
Yes, if we can use pragma autonomous transaction in trigger we can commit
What is mutating trigger
If a trigger body is trying to modified by a DML statement and the trigger event
also DML statement. A mutating table error occurs we have to rewrite row level
trigger to statement level trigger
Difference between procedure and function
Procure may or not a return value, function should return the value.
We can use the function within queries , procedure won’t able to use it in the
queries.
We can implicitly executed the stored procedure, function’s can’t
Without return statement i will compile the function . It will compile or not
No, function should return statement
Tech Mahindra PL/SQL Interview Questions
Introduce yourself
Tell me your project
What are the packages, functions, procedures you developed in your project
what are their Functionality?
Difference between loop and bulk collect which is the faster way
What is global table
Can we load the data from table to table through utl_file package
Difference b/w sql *loader and utl_file package
Which is the faster way to load the data
Description about project?
Difference between having and group by
Difference between case and decode
Difference between delete and truncate
How many types of indexes
What is trigger and types
Diff b/w view and materialized view
Can we update the view
I have one table i created view and materialized view on a table if i delete a
table
Can i see the view and materialized view?
Can u call function in same function
Can we use tcl commands in trigger
What is the cursor and ref cursor
In which format u got the project?
How u started with u r project?
What r the steps u followed to create tables in Your project?
How you involved in db design process?
What r the scripts u wrote for inserting and Deleting data from db?
How u export the data from db to excel file
Where u stored the files in db?
How u execute the code in sql prompt?
Tell me some names of functions and Procedures that u created in u r project?
What is the name of requirement Specification?
What are the path names u provided to
Execute u r coded data?
Steps to get the data from oracle to unix Environment?
SQL Tuning or SQL Optimization
Sql statements are used to retrieve data from the database. We can get same
results by writing different sql queries. But use of the best query is important
when performance is considered. So you need to sql query tuning based on the
requirement. Here is the list of queries which we use reqularly and how these
sql queries can be optimized for better performance.
Sql tuning/sql optimization techniques:
The sql query becomes faster if you use the actual columns names in select
statement instead of than '*'.
For example: write the query as
SELECT id, first_name, last_name, age, subject FROM student_details;
Instead of:
Select * from student_details;
Having clause is used to filter the rows after all the rows are selected. It is just
like a filter. Do not use having clause for any other purposes.
For example: write the query as
Select subject, count(subject) From student_details Where subject !
= 'science' And subject != 'maths' Group by subject;
Instead of:
Select subject, count(subject) From student_details Group by
subject Having subject!= 'vancouver' and subject!= 'toronto';
Sometimes you may have more than one subqueries in your main query. Try to
minimize the number of subquery block in your query.
For example: write the query as
Select name From employee
Where (salary, age ) = (select max (salary), max (age)
From employee_details)
And dept = 'electronics';
Instead of:
Select name From employee
Where salary = (select max(salary) from employee_details)
And age = (select max(age) from employee_details)
And emp_dept = 'electronics';
Use operator exists, in and table joins appropriately in your query.
usually in has the slowest performance.
in is efficient when most of the filter criteria is in the sub-query.
exists is efficient when most of the filter criteria is in the main query.
For example: write the query as
Select * from product p
Where exists (select * from order_items o
Where o.product_id = p.product_id)
Instead of:
Select * from product p
Where product_id in
(select product_id from order_items)
Use exists instead of distinct when using joins which involves tables having one-
to-many relationship.
For example: write the query as
Select d.dept_id, d.dept
From dept d
Where exists ( select 'x' from employee e where e.dept = d.dept);
Instead of:
Select distinct d.dept_id, d.dept
From dept d,employee e
Where e.dept = e.dept;
Try to use union all in place of union.
For example: write the query as
Select id, first_name From student_details_class10
Union all
Select id, first_name From sports_team;
Instead of:
Select id, first_name, subject From student_details_class10
Union
Select id, first_name From sports_team;
Be careful while using conditions in where clause.
For example: write the query as
Select id, first_name, age from student_details where age > 10;
Instead of:
Select id, first_name, age from student_details where age != 10;
Write the query as
Select id, first_name, age
From student_details
Where first_name like 'chan%';
Instead of:
Select id, first_name, age
From student_details
Where substr(first_name,1,3) = 'cha';
Write the query as
Select id, first_name, age
From student_details
Where first_name like nvl ( :name, '%');
Instead of:
Select id, first_name, age
From student_details
Where first_name = nvl ( :name, first_name);
Write the query as
Select product_id, product_name
From product
Where unit_price between max(unit_price) and min(unit_price)
Instead of:
Select product_id, product_name
From product
Where unit_price >= max(unit_price)
And unit_price <= min(unit_price)
Write the query as
Select id, name, salary
From employee
Where dept = 'electronics'
And location = 'bangalore';
Instead of:
Select id, name, salary
From employee
Where dept || location= 'electronicsbangalore';
Use non-column expression on one side of the query because it will be
processed earlier.
Write the query as
Select id, name, salary
From employee
Where salary < 25000;
Instead of:
Select id, name, salary
From employee
Where salary + 10000 < 35000;
Write the query as
Select id, first_name, age
From student_details
Where age > 10;
Instead of:
Select id, first_name, age
From student_details
Where age not = 10;
Use decode to avoid the scanning of same rows or joining the same table
repetitively. Decode can also be made used in place of group by or order by
clause.
For example: write the query as
Select id from employee
Where name like 'ramesh%'
And location = 'bangalore';
Instead of:
Select decode(location,'bangalore',id,null) id from employee Where
name like 'ramesh%';
To store large binary objects, first place them in the file system and add the file
path in the database.
To write queries which provide efficient performance follow the general sql
standard rules.
Use single case for all sql verbs
Begin all sql verbs on a new line
Separate all words with a single space
Right or left aligning verbs within the initial sql verb
Capgemini PL/SQL Interview Questions
PL/SQL Interview Questions for 3.8 years’ Experience
Differencebetween Char and Varchar2.
What is Trunc function where we can use it.
What is Round function and Sign function.
What INSTRING AND SUB STRING.
Difference between Translate and Decode.
Difference between Delete and Truncate.
Which is faster Case or Decode.
What are pseudo columns in oracle
What is Implicit and Explicit cursor.
Difference between Primary key and Unique.
Difference between procedure and function.
Can we use Out parameter in Function.
Can we use return statement in procedure.
If we use out parameter in function and also use return statement , function return 2
values or one value.
What is advantages of Packages.
I have a package with 2 procedures and same name with different signature it is
possible.
How many types of trigger, instead of trigger.
What is mutating table, how to resolve the error.
What are pragma exception types.
Tell me how to delete duplicate rows on a table.
I have a table and create a row level trigger on a table, i deleted 10 records,how many
times records are deleted(raised another question now rows deleted what happens)
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
Cegedim PL/SQL Interview Questions
Write a query to find 3rd highest salary
Using DENSE_RANK
SELECT *
FROM
( SELECT emp.*,DENSE_RANK() OVER(ORDER BY Sal DESC) Rno FROM
EMP
)
WHERE Rno=3;
Using ROWNUM
SELECT *
FROM
(SELECT *
FROM
(SELECT * FROM emp ORDER BY sal DESC
)
WHERE rownum <5 data-blogger-escaped-br=""> ORDER BY sal
)
WHERE rownum = 1;
-----------------------------------------------------------------
-----------------------
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