interview_plsql_all_comp(1)
interview_plsql_all_comp(1)
What TCL do
Write a pl/sql block for trigger at the time of insertion for inserting old and new
Write an example for left outer join and how output comes
What is package
Difference between cursor for loop and for loop, which is faster?
What is inode?
If we have both user exception and system exception, which will be handled
first?
Ans).prepare phase
Yes
No
What is dns.ora?
How will u connect to the server from ur pc?
Passwd:******
What is view?
Hr
Technical
Define transaction.
What is index?
Based on rowid.
Pseudo columns are those which does not exists physically but they will perform some
expression evaluation
What is a partition
Range
Hash
List
Define view
Yes
Some 3 queries? (nth max sal, query on group by and select dup records)
Hr
Asked about the project and team members and the organization structure
And some other general questions and some funny questions.that’s it all the best.
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.
In pdf format
In text form
At
No
How to find if oracle is there in the resume stored in the data base?
Cat search.
Yes
What is a cursor?
Using the cursors how to increase the salary of employes by 15% whose salary is
Declare
Sal1 emp.sal%type;
Begin
Open c1;
Loop
End loop;
End;
Yes.
Mbt….interview
2). Write query to fetch details of candidates who are not females(including nulls);
21).display details of all employees including who are not in deptno 40 (using outer
join).
24) what is partition, why u go for partitions, and write the syntax?
34) what is the main diff between normal index & organization table index?
35).can foreign key column accepts null values & duplicate values?
44). Can you select the salary by passing the eno as a argument in the procedure?
45). Why you want to shift here?
1st round
9.sqlca structure
Struct sqlca
Char sqlcaid[8];
Long sqlcabc;
Lond sqlcode;
Struct
Short sqlerrml;
}sqlerrm;
Long sqlerrd[6];
Char sqlerrp[8];
Char sqlwarn[8];
Char sqlext[8];
};
12.what is synonym?
2nd round
2.what is exception and tell the error code for data not found?
-01403
5.propagation of exceptions?
6.if there are 3 users if user1 gives permission on select how will u give that to user1 and
5yy
14.precomplication steps
5dd
16.what is dw
It deletes word.
17.grep
18.find command
Pl/sql block
End-exec;
20.grep –v
21.host variables
#!Bin/bash
30.env
31.errd[2]
No of rows effected.
32.what is a pointer
38.what is a in vi editor?
3rd round
Hr
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/~.
Ans:correct use of the macros allow a same oa makes default one purpose to be easily
4.the command to test the files in the current directory e exactly char’s in length(eg.test.cc)?
6.the following command can be used to capture and handle signal in shell script?
Ans:trap.
Ans:”user/local/bin/perk:not found”.
Ans:
Ans:$$.
Ans:0.
Ans:
Ans:% -
Ans: 1 byte.
Ans:0
stmt?
Ans:
10.select s1.currval from dual ,what will be the value when the session opens?
11.begin
Exception
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:
Ans:
Ans:
16.cartesion product?
Ans:
Ans:none.
Ans:error.
Ans:
A)multiple triggers of same type but not multiple row triggers of the same type.
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
I have 10,000 records,. The record length is 70 characters? How will insert at a time 500
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
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?
Some columns having indexes. How to know which columns having indexes in a table
What is find?
*********************************************************************************
Host array.
Indicator variable.
What are the files create when you compile pro*c program
Advantages of package
Disadvantages of package
Sqlca in detail
Optimization steps
Autonomous transaction
Pragma
Init pragma
Have you used system packages?
Instead of trigger
Varchar structure
Native Sql
Native compilation.
Bulk binding.
In a procedure I have written dml statement with in the loop and issued commit with in the
SELECT SAL SECONFD FROM EMP WHERE SAL NOT IN(SELECT MAX(SAL) FIRST
FROM EMP);
DELETE FROM EMP WHERE ROWID <>(SELECT MAX(ROWID) FROM EMP B WHERE
EMPNO=B.EMPNO);
PACKAGE.FUNCTION-NAME
UNIX
Syntax of collection
Disadvantage of triggers.
What is pga?
What is tablespace?
What is datasets?
What is datablocks?
What is blob/bfile?
What is clob?
Can you modify a null column to not null column, if table has some data?
what is er modeling?
what is dbms_utility?
what is pragma_autonomous_tranctions?
which sitivation you have used utl_file packages?
Which cursor are used in u r project,how to idenified which cursor are wrritten in u
A. Emp dept
B. Ename,deptno,sal deptno,dname
A)dname,sum(sal) wise
B)dname,max(sal) wise
When m_views are created mainly?if base table deleted what happen m_views?
What is shell
How will you move the cursor with out using arrow keys in vi editor
What is grep
What {} will do
2. If available rename it
What is egrep
Oracle
What tcl do
Write a pl/sql block for trigger at the time of insertion for inserting old and new values
auditing table.
Write an example for left outer join and how output comes
What is package
Difference between cursor for loop and for loop, which is faster?
If we have both user exception and system exception, which will be handled first?
What is collection?
What is the ref cursor and how to send unlimited data to front end.
Import/export
Db links
Datatypes in sql
Package advantages
Trigeer –types
Nvl function
Pragma
Advantages og 10g
Function,procedure difference
Cursor types
Toad?
Psuedo columns
Decode ()
Sequence, advantages
Inline function()
1. count(1)
2. count(*)
3. count(rowid)
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.
PROCEDURE overloading
lpad(0/rpad()
Stringin() function
case exp
bulk loader
bulk collect
exception concepts
triggers/instead of trigger
use of hint
What is directory?
What is external table?
What is index?
Define view
if I have created view from two tables by taking all the columns in the table now is it possible
then I have to compulsory update that view how to do that(ans: by using instead of triggers).
SELECT * FROM EMP WHERE ROWID NOT IN(SELECT MIN(ROWID) FROM EMP
GROUP BY EMPNO);
B WHERE A.SAL<=B.SAL);
Why PL/SQL
Why package?
What are the options that you use while pre-compiling a Pro*C program and why?
What is the need of Error Handling in PL/SQL and how will you do it
Write queries for deletion of duplicate records and nth max salary
Find syntax
Grep syntax
Copy all the fields from the result of ls –l command into different host variables and insert
Autonomous transaction
Referential Constraint
Date
22-may-2010
26-jun-2010
Id name
101 dinesh
102 suresh
103 prakesh
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(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.
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.
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.
Losses
What are nested tables? How will u delete 5 rows from nested
Tables
Answer
Addresstype;
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.
15 rows selected.
1 row created.
Sql> commit
2 /
Commit complete.
16 rows selected.
Can we use truncate and delete command to disable the referential integrity constraint
How did you export the data from database to excel file
What function you are using to load the data in UTL_FILE package
We have two duplicate rows, how will you delete only one row
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
Do you know TOO_MANY ROWS, when that exception will occur and NO_DATA FOUND
What is view
Do you know global variable, difference between global variable and parameter variable
Trigger is a stored procedure which will fire when ever an event occur.
Pre defined.
User defined.
What is meant by cursor and how many types of cursors are there?
Implicit
Explicit.
Exception handling
Ronum,rowid
Use of hint.
After you work is completed how you produce the documentation for that?
Delete,truncate structure..
Select only those employee information who are earning same salary?
How to find last inserted records from table?
I have table, in column data is 'su@re#sh$', now i want to my output is 'suresh'? How to
retrive?
What is nullif()?
Which will fire default first statement level or row level trigger?
What is substr()&instr()?
What is optimizer?
What is m_view?
What is index?
Define view
If I have created view from two tables by taking all the columns in the table now is it
Then I have to compulsory update that view how to do that(ans: by using instead of
triggers).
Have you ever used dynamic Sql statements in your project (methods in Pro*C)?
SELECT * FROM EMP WHERE ROWID NOT IN(SELECT MIN(ROWID) FROM EMP
GROUP BY EMPNO);
B WHERE A.SAL<=B.SAL);
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
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
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
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
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
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
The sql query becomes faster if you use the actual columns names in select
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.
Instead of:
Select subject, count(subject) From student_details Group by
Sometimes you may have more than one subqueries in your main query. Try to
From employee_details)
Instead of:
Select name From employee
Instead of:
Select * from product p
Where product_id in
Use exists instead of distinct when using joins which involves tables having one-
to-many relationship.
From dept d
Instead of:
Select distinct d.dept_id, d.dept
From dept d,employee e
Union all
Instead of:
Select id, first_name, subject From student_details_class10
Union
Instead of:
Select id, first_name, age from student_details where age != 10;
From student_details
Instead of:
Select id, first_name, age
From student_details
From student_details
From student_details
From product
Instead of:
Select product_id, product_name
From product
From employee
Instead of:
Select id, name, salary
From employee
processed earlier.
From employee
From employee
From student_details
Instead of:
Select id, first_name, age
From student_details
Use decode to avoid the scanning of same rows or joining the same table
clause.
Instead of:
Select decode(location,'bangalore',id,null) id from employee Where
To store large binary objects, first place them in the file system and add the file
To write queries which provide efficient performance follow the general sql
standard rules.
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