SlideShare a Scribd company logo
1 of 17
ORACLE
-----------------------------------------------------------------------------------------------------------
-

    1) What is Data or Information?

         The matter what we feed into the computer is called Data or Information.

    2) What is database?

         The collection of interrelated data is called Database.

    3) What is Oracle?

         Oracle is RDBMS package.

    4) Communication channel between backend and front end?

         SQL*NET

    5) Difference between Truncate and Delete?

             6) Truncate commits after deleting entire table. i.e.; it can not be rolled back.
                Database triggers do not fire on truncate.
             7) Delete allows the filtered deletion. Deleted records can be rolled back or
                committed. Data base triggers fire on delete.

    8) What is difference between Alias and Synonym?

             9) Alias is temporary and used with one query. Synonym is permanent and
                not used as alias.

    10) What is difference between Rename and Alias?

             11) Rename is permanent name given to a table or column where as
             12) Alias is a temporary name given to a table or column which does not exist
                 once the sol statement is executed.

    13) What are the Special operators?

             14) In (Picks required values from list of values).
             15) Like (Character comparition).
             16) Between (Provide range specification).
             17) Is (Reffer Null values).
18) What are Pseudo columns?

       19) Pseudo columns are system defined columns behaves like a table columns.
           We can not insert, update or delete their values.
           Ex: currval, nextval, level, rowid, rownum, new, old, sysdate.

20) What is Rownum?

   Represents the records number for displayed data, which is temporary.

21) What is Rowid?

       22) Represents uniqueness of records given by system, which are permanent.
       23) Rowid holds the information in hexadecimal which consists of file id,
           block id, field id, record id.

24) What is the fastest way of accessing a row in a table?

       25) Rowid and Constraints.

26) Difference between Translate and Replace?

       27) This function used to translate the string character by character. Need to
           pass equal no of characters. Translate(S, C1, C2).
       28) This function used to replace the string by string comparition. C1, C2
           lengeths may or may not equal. Replace(S, C1, C2).

29) Difference between Substr ( ) and Instr( )?

       30) Substr ( ) will return the specific part of a string, where as Instr( ) returns
           the position of the specific part of the string

31) Which is an effective command – Truncate or Delete?

       32) Delete is the effective command. Because using this command we can
           delete only these records that are not really required.

33) Difference between Count ( ) and count(*) ?

       34) Count ( ) is count with column ignore null values.
       35) But Count (*) is not ignore null values.

36) What is NVL ( ) function?

       37) It is a general function.
38) It represents null values with specified value.

39) Difference between Min ( ) and Least ( )?

        40) Min ( ) is an aggregate function which takes only one column of a table as
            parameter where as
        41) Least ( ) is a general function which can take any no of values and column
            names from dual and table respectively.

42) Difference between Update and Alter?

        43) Alter command is used to modify the database objects where as
        44) The Update command is used to modify the values of a database object.

45) What is the last clause and first clause in select statement?

        46) Last clause: Order by
        47) First clause: Where clause

48) Difference between Group functions and Single row functions?

        49) Group function operates on many rows returns one and returns single
            result. A group function will not allow in PL/SQL procedural. Ex. Sum ( ),
            Avg ( ).
        50) Single row function result for one row. Allowed in PL/SQL procedural
            statements. Ex. Upper ( ), Lower ( ).

51) Where clause: Used to provide required conditions on records while
    manipulating
    or retrieving records.

52) Group by clause: Used to group data based on columns given in group by clause.

53) Having clause: Used to provide group functions in conditions.

54) Order by clause: Used to arrange data either in ascending or descending order.

JOINS

55) What is a join? Explain the different types of joins?

   Join is a query which retrieves related columns or rows from multiple tables.
   Equi join:: Joing two tables by equating two common columns.
   Non equi join:: Join two tables without common columns.
   Self join:: Joining the table with itself.
   Outer join::
56) What are the minimum requirements for an Equi join?

   There should be atleast one common column between the joining data.



57) Which is most faster – IN or EXISTS ?

   EXISTS is more faster than IN. Because EXISTS returns a boolean value where
   as IN returns a value.

58) Difference between Union and Join ?

   Union is used to combine the o/p of select statements in one table. And must and
   should have same no of columns and similer datatypes in given select statements.
   Join is used to combine the more than one table. There is no required of same no
   of columns.

59) What is Defficient table?

   In outer join which table has ‘+’ symbol that is defficient table.

60) Difference between Left outer join and Right outer join?

   In Left outer join retrieves the all records of left side table. But only matching
   recors from right side table. Where as right outer join is opp to left outer join.

61) How do you implement the IF statement in select statement ?

   By using the Decode statement.

62) What is a Transaction?

    A Transaction is a set of SQL statements between commit and rollback.

SUB QUERIES

63) What is a Query?

   Query is a single line request for the information from the database.

64) What are the Set operators?

   Set operators are combine the results of 2 queries into one result.
   ( Union, Intersect, Minus, Union all ).
65) What we need, when we are using Set operators?

   Queries should contain the same no of columns along with data type matching.

66) What is Subquery?

   Subquery is a query whose return values are used in filtering conditions of the
   main query.

67) What is Correlated sub-query?

   Correlated sub-query is a sub-query which has reference to the main query.

68) Difference between Simple sub-query and Correlated sub-query?

   In Simple sub-query first the inner query executed and its value is given as
   condition to outer query , which gets executed later.
   Correlated sub-query is opp to Simple sub-query.

69) What are the Special operators in Sub Queries?

   Any / Some – Picks lowest value.
   All        – Picks highest value.
   Exists     – Returns True or False.

CONSTRAINTS

70) What are the Integrity Constraints?

   An Integrity constraint is a declarative way to define a business rule for a column
   of a table.

71) What is Self-referential integrity constraint?

   If a foreign key reference a parent key of the same table is called Self_reference
   integrity constraint.

72) What is a Composite primary key?

   A primary key created on combination of columns is called a Composite primary
   key. ( Max 32 columns are candidate keys can be allowed in composite primary
   key.

73) What is a Candidate column?
It is a part of Composite primary key.

74) What is Null? Is it constraint or default value?

   Default value.

75) What is default value for every column of a table ?

   Null.

76) What are limitations of CHECK constraint?

   In this we can not specify the pseudo columns like sysdate, rownum etc.

77) What is ‘On delete cascade’?

   If this key word is included in the definition of a child table, whenever the
   records from the parent table is deleted then automatically deleted the respective
   values in the child table.

78) How to drop parent table when it have child tables?

   Using with ‘cascade constraints’.
   Ex: Drop table <table name> cascade constraints;

50. How can you cut the relation ship between parent and child table (or)
    How can you drop the primary key from parent table?

   Alter table <table name> drop constraint <const-name> cascade;

79) In which order constraints are fired?

   Not null, Check, Primary key, Unique, Foreign key.

80) Can Check constraint be used for self referential integrity? How?

   Yes. In Check condition for a column of a table, we can reference some other
   column of the same table and thus enforce self referential integrity.

81) Difference between Unique and Primary key?

   Unique key can accept null values but Primary key can not accept null values.

82) Difference between Foreign key and Reference key?

   Foreign key is the key. i.e; attribute which refers to another table primary key.
Reference key is the primary key of table reffered by another table.

  83) How to add a primary key constraint to an existed table?

      Alter table <parent table> add constraint <constraint name>;
  84) How to add a Foreign key to an existed table?

     Alter table <parent table> add constraint foreign key <constraint name>
     references <

  VIEWS

  57. What is a View?

     View is virtual table. View exists logically but contains no physical data and
     manipulates the base table. Every view has a query attached to it.

 58. Advantages of Views?

     View provides high security to base table while sharing. Using views we can write
     complicated queries into simple queries.
     To protect some of the columns of a table from other user.

59. Which database objects are called 'Stored Queries'? --- Views.

60. Do view contain data? --- No.

61. Can a trigger written for a view? --- No.

62. Can you alter Synonym of view or view? --- No.

63. Can you create Index on View? --- No.

64. Difference between Simple view and Complex view?

    Simple view can be created on a table where as Complex view can be created on
    more than one table.
    Simple view can be modified where as Complex view can not be modified.

65.What is an Inline view?

   An Inline view is just a subquery in place of a table in an insert, update, delete or
   select.

66. How to update a Complex view? -- Using with 'Instead of Triggers'.
67. Difference between View and Force view?

   View created on existing table where as Force view created on without an exitsting
   table.

68. Difference between View and Materialized view?

                   View                                    Materialized view
   1.Data will store logically.                   1.Data will be stored physically.
   2.It occupies less memory.                     2.Occupies huge space.
   3.With user interaction it can refresh at      3.It can refresh without user
     the time of calling.                           interaction based on time interval.
   4.It reduce performance at the time of         4.It improves the performance at the
     reports.                                        time of reprots.
   5.There is a possibility for duplicate rows.   5.We can avoid duplicate rows by
                                                     assigning primary key at the time
                                                     of creation.

69. Non-key preserved column --- The common column used in a complex view
    having primary key is called as Non-key preserved column.

70. Minimum requirements for creating Materialized view?-- Primary key on
    column of a table.

SYNONYMS

71. What is Synonym?

   A Synonym is an alias name for a table, view, sequence or program units.

72. Difference between Private sysnonym and Public sysnonym?

   Private sysnonym can be accessed only by the owner where as Public synonym can
   be accessed by any user on the database.

73. Advantages of Synonym-- Mask the real name and owner of an object. Provide
    public access to an object.
    Provide location transparency for tables, views or program units of a remote
    database.

 74. Difference between View and Synonym?

    Synonym is just a second name of a table used for multiple link of database.
    View can be created with many tables and with virtual columns and with
    conditions.
SEQUENCE

75. What is a Sequence?

    A Sequence generates a serial list of unique numbers for numarical columns of a
   database table.

76. In Oracle database which object is operated with Pseudo columns?

   Sequence. ( Nextval, Currval ).
   Initially Sequence has to be operated with Nextval.
   In Sequence start value should be greater than Min value.

77. Consider a Sequence whose currval is 1 and gets incremented by 1 by using the
    nextval the nextval reference we get the nextvalue 2.
    Suppose at this point we issue an rollback and again issue a nextval. What will
    the output be? --- 3.

INDEX

78. What is an Index?

    Index is a pointer locates the physical address of column.It provide quick access to
    rows in a table.
    These gets activated only when the indexed columns are used in where clause
    condition.
    It increases the performance of server

79. How can u find out what columns have what indexs of a perticular Table?

    Select * from user_ind_columns where table_name='EMP';

80. How to bypass(fire) the index in select statement for number datatype column
    and char datatype column?

    select * from fana where empno+0 = 7876; (number column)

    select * from fana where job||’’ = ’CLERK’; (character column)

80. Types of Indexes?

    1.Normal Index : Applied on single column.
    2.Composite Index : Applied on more than one column
      Ex : Create index ind3 on emp(deptno, comm);
    3.Functional Index : Applied on columns which are having functions.
    4.Partitioning Index :These are 2 types a) Local Index b) Global Index
a : Applied on individual parts.
      b : Applied on all parts at a time.

81. What is Cluster ?

    It is group of one or more tables physically stores together to share common
    columns & are often used together.

82. What is Cluster Key?

   The related column of the tables in a cluster is called Cluster Key.
   Cluster Index applied on more than one table.

   Advantages of Clusters : 1) access time reduced for joins.
   Disadvantages : 1) The time for insert increases.

LOCKS :

83. What r the locks?

    Locks r used to avoid disturbances among different users how r sharing the data.

84. Types of locks ?

   1. Row level lock : Lock perticular columns & Records.
      EX : select * from emp where deptno= 10 for update;
           select * from emp for update of sal;
   2.Table level lock : Lock entaire table.
     Syntax : Lock table tablename in (mode);
     Ex : lock table emp in exclusive mode;

   There r 3 types of table level locks :

   85) Share mode:: If a user applies a lock, other user cannot be perform transactions.
       But he also can apply this lock.
   2) Share update mode::If a user applies a lock, other user can perform transactions
       on other rows which r not used by first user. Other user can also apply this lock.
   3) Exclusive mode::If a user applies a lock, other user cannot perform transactions
       and also cannot apply any lock.

85. What is Snapshot ?

    These r read only copies of a master table located on a remote node which is
    periodically refreshed to reflect changes made to the master table.

86. Difference b/t Round & Trunc ?
Round : Gives nearest whole number
      Trunc : It gives only whole number.

  87. Explain Connect by prior? Sol : Retrives rows in hirerchal order.

  88. What is Dead lock ?

     Two processes waiting to update the rows of a table which r locked by the other
     process then dead lock arises.

     In a database environment this will often happen because of not issuing proper row
     lock commands. poor design of front end application may cause
     this situation and the perfomance of server will reduce drastically.

     These locks will be realesed automatically when a commit/rollback operation
     performed or any one of this processes being killed externally.


                                          PL/SQL



   1. What is PL/SQL?

      PL/SQL is a procedural language that has both interactive and procedural
      programing language constructs such as iteration, conditional branching.

   2. What is PLSQL block?

     A set of related declarations and procedural statements is called block.

   3. How many types of PLSQL blocks?

     Anonymous block and Named block.

   4. Difference between Anonymous and Named blocks?

     Anonymous blocks are no reusability and stored in Operating system where as
     Named blocks are stored in database. Reusability is possible.

5. What is DBMS_OUTPUT.PUT_LINE( ) ?

     It is a built in packaged procedure. Here DBMS_OUTPUT is a package and
PUT_LINE is a procedure. This is used to display required messages on screen.
6. What is 'SET SERVEROUTPUT ON'?

   Used to active the DBMS_OUTPUT.PUT_LINE( ).

7. What are Stored procedures?

   Named blocks are also called Stored procedures.There are 4 types. 1.Procedures 2.
Functions 3. Packages 4. Triggers.

8. What are Sub programs? --- 1.Procedures 2. Functions.

9. Datatypes in PLSQL --- Scalar datatypes          &    Composite datatypes.
   Scalar datatypes :      All SQL datatypes.
   Composite datatypes : %type, %rowtype, Record type, Table type, Objects, Varrays,
Nested tables..
   Record type, Table type are user defined temporary datatypes.
   Objects, varrays, nested tables are user defined permanent datatypes.

10. What are %Type and %Rowtype?

      %Type is a column type declaration supports to declare a variable according to
column structure.
    Ex: variablename tablename.columnname%type;

    %Rowtype is a table type declaration supports to declare a variable according to table
structure.
    Ex: variablename tablename%rowtype;

11. Advantages of %Rowtype?

  When, we need variables for all columns of a table, no need to declare those many
%Type variables what can be done by using a variable of %Rowtype.

12. Difference between %Rowtype and Record type?

    %Rowtype is used whenever query returns a entire row of a table or view. where as
Record type is used whenever query returns columns of different tables or
   views and variables.

13. What is default value for a numaric PL/SQL variables? --- NULL.

14. Smallest PLSQL programe in Oracle?

   BEGIN
     NULL;
   END;
15. What is a PLSQL Engine?

    This PLSQL Engine accepts any valid PLSQL block as input, executes the procedural
part of the statements and sends the SQL statements to the SQL
    statement executor in the Oracle server.

16. Difference between Simple loop and For loop?

    Simple loop requires declaration of variables used in it and exit condition. But For
loop does not require this.

CURSORS

17. What is Cursor? why cursor is required?

    Cursor is a named private SQL area in PLSQL. It is a pointer pointing to data , which
can be used to manipulate more than 1 row at a time.

18. How many types of Cursors are supported by Oracle? --- Implicit cursor,
Explicit cursor.

19. What are the PLSQL statements used in cursor processing?

    Declare cursor, Open cursor, Fetch cursor, Exit cursor, Close cursor.

20. Difference between Implicit cursor, Explicit cursor?

     Explicit cursors are user defined cursors.where as Implicit cursors are created by
system and no need of cursor operations.(declare cursor, open cursor....).

21. What is a Cursor For loop?

     Cursor for loop is shortcut process for explicit cursors, because the cursor is open,
rows are fetched and cursor is closed automatically when all the rows have
   been processed.

22. What are Cursor attributes?

     %Found, %Not found, %Is open, %Rowcount.

23. Is TCL commands are allowed in loops?

    No. Because rollback, commit are used when the transaction is completed.

24. What is the use of cursor with "FOR UPDATE OF" clause?
This clause stop accessing of other users on the particular columns used by the cursor
untill the commit is issued.

25. What is the use of " WHERE CURRENT OF " clause ?

WHERE CURRENT OF clause is used with FOR UPDATE clause to point the cursor
& do changes in that location only.

26 . What should be the return type for a cursor variable?

 The return type for a cursor must be a record type. it can be declared explicitly as a user
defined or %rowtype can be used

27 . Can cursor variables are stored in pl/sql tables. if yes how?

  No. A cursor variable points a row which cannot be stored in a two_diamentional pl/sql
table.

28. Cursor parameter

    Cursor can accept arguments dynamically while opening it . Max 32 parameters can
be passed to a cursor.

EXCEPTIONS

29 . What is an Exceptions? How it is differ from error?

Exceptions are used to handled errors at run time. whenever an error occurs exception
raises.

Error is a bug where as the exception is a warning or error condition

30 . Types of errors?

 2types of errors 1)errors at compile time(errors) Ex : Syntax error
                   2) errors at run time (exceptions) Ex : logical error(due to improper i/
p by end user)

31 . Types of exceptions?

   1) user defined exceptions 2) predefined exceptions

32. Difference b/t user defined & predefined exceptions?

 predefined exceptions gets activated automatically whenever logical error occurs
User defined exceptions have to be raised explicitly when ever required by programmer.

33. Name some built in exceptions ?

    Two_many_rows, No_data_found, Zero_divide, not_logged_on, storage_error,
value_error, etc--

34. Predefined SQL code range:--        -1 to -20000

35 . Non predefind exception ?

   Used to handle constraint validation errors in pl/sql block by using PRAGMA
EXCEPTION_ INIT( ).

PRAGMA EXCEPTION_ INIT( ) : takes 2 parameters as user exception name & sql
code.

For Non null constraint ---> -1400

For Check Constraint ---> -2290

For foreign key Constraint ---> -2291

For Pk Constraint ---> 0001

Child record found --> -2292

36. What is OTHERS exception?

It is used to along with 1 or more exceptions handlers. This will handle all the errors not
already handled in the block.




1. What is bulk collect?
Bulk collect is part of PLSQL collection where data is stored/ poped up into a variable.
Example:
declare
Type sal_rec is table of number;
v_sal sal_rec;
Begin
Select sal bulk collect into v_sal from EMP;
For r in 1.. v_sal.count loop
dbms_output.put_line (v_sal(r));
End loop;
End;

What is PRAGMA EXECPTION_INIT?
Ans: The PRAGMA EXECPTION_INIT tells the complier to associate an exception
with an oracle error. To get an error message of a specific oracle error.
E.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)

What is raise application error?
Raise_application_error is a procedure of package DBMS_STANDARD which allows
issuing a user defined error messages from stored sub-program or database trigger.

What is stored procedure?
Stored procedures are subprogram’s stored in the database and can be called &execute
multiple times wherein an application procedure is the one being used for a particular
application same is the way for function.

Both can be executed any number of times. Only difference is that stored procedures/
functions are stored in database in complied format while the application
procedures/functions are not in precompiled format and at run time has to be compiled.

What is WHERE CURRENT OF clause?
WHERE CURRENT OF clause in an UPDATE, DELETE statement refers to the latest
row fetched from a cursor. Database Triggers

What is pl/sql table?

Objects of type TABLE are called "PL/SQL tables", which are modeled as (but not the
same as) database tables, PL/SQL tables use a primary PL/SQL tables can have one
column and a primary key.
Cursors
Ora faq

More Related Content

What's hot (19)

computer notes - Linked list inside computer memory
computer notes - Linked list inside computer memorycomputer notes - Linked list inside computer memory
computer notes - Linked list inside computer memory
 
Lesson 5 link list
Lesson 5  link listLesson 5  link list
Lesson 5 link list
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
 
358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8
 
Lesson 3 simple sorting
Lesson 3   simple sortingLesson 3   simple sorting
Lesson 3 simple sorting
 
LectureNotes-06-DSA
LectureNotes-06-DSALectureNotes-06-DSA
LectureNotes-06-DSA
 
Advanced data structures slide 2 2+
Advanced data structures slide 2 2+Advanced data structures slide 2 2+
Advanced data structures slide 2 2+
 
Lesson 2.1 array
Lesson 2.1   arrayLesson 2.1   array
Lesson 2.1 array
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Lesson 4 stacks and queues
Lesson 4  stacks and queuesLesson 4  stacks and queues
Lesson 4 stacks and queues
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
Recursion Lecture in Java
Recursion Lecture in JavaRecursion Lecture in Java
Recursion Lecture in Java
 
Unit 4 tree
Unit 4   treeUnit 4   tree
Unit 4 tree
 
06 linked list
06 linked list06 linked list
06 linked list
 
Top 50 oracle interview questions and answers
Top 50 oracle interview questions and answersTop 50 oracle interview questions and answers
Top 50 oracle interview questions and answers
 
Arrays
ArraysArrays
Arrays
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked list
 
Xxxx
XxxxXxxx
Xxxx
 
LectureNotes-05-DSA
LectureNotes-05-DSALectureNotes-05-DSA
LectureNotes-05-DSA
 

Viewers also liked

Microbiomes corsi final3_2012
Microbiomes corsi final3_2012Microbiomes corsi final3_2012
Microbiomes corsi final3_2012UT1994
 
Flysafe airlines company
Flysafe airlines companyFlysafe airlines company
Flysafe airlines company10137_vishal
 
Jaguars yhteispalaveri 7.7.2012
Jaguars yhteispalaveri 7.7.2012Jaguars yhteispalaveri 7.7.2012
Jaguars yhteispalaveri 7.7.2012NinaJussila
 
Concurso Técnico de Tecnologia da Informação 2014 - IFSP
Concurso Técnico de Tecnologia da Informação 2014 - IFSPConcurso Técnico de Tecnologia da Informação 2014 - IFSP
Concurso Técnico de Tecnologia da Informação 2014 - IFSPWendel Marcos dos Santos
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecturesaqlain11
 

Viewers also liked (7)

Microbiomes corsi final3_2012
Microbiomes corsi final3_2012Microbiomes corsi final3_2012
Microbiomes corsi final3_2012
 
College new
College newCollege new
College new
 
Flysafe airlines company
Flysafe airlines companyFlysafe airlines company
Flysafe airlines company
 
Jaguars yhteispalaveri 7.7.2012
Jaguars yhteispalaveri 7.7.2012Jaguars yhteispalaveri 7.7.2012
Jaguars yhteispalaveri 7.7.2012
 
Ora faq
Ora faqOra faq
Ora faq
 
Concurso Técnico de Tecnologia da Informação 2014 - IFSP
Concurso Técnico de Tecnologia da Informação 2014 - IFSPConcurso Técnico de Tecnologia da Informação 2014 - IFSP
Concurso Técnico de Tecnologia da Informação 2014 - IFSP
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecture
 

Similar to Ora faq

Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&aSyed Shah
 
Informatica interview questions
Informatica interview questionsInformatica interview questions
Informatica interview questionsmarukonda
 
C language 100 questions answers
C language 100 questions answersC language 100 questions answers
C language 100 questions answerssakshitiwari631430
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Trainingbixxman
 
Difference between all topics in oracle
Difference between all topics in oracleDifference between all topics in oracle
Difference between all topics in oraclePraveenRaj280263
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfDraguClaudiu
 
C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013srikanthreddy004
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-bookVipul Wankar
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-bookVipul Wankar
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questionsambika93
 
Top 20 SQL interview questions.pdf
Top 20 SQL interview questions.pdfTop 20 SQL interview questions.pdf
Top 20 SQL interview questions.pdfAnanthReddy38
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008paulguerin
 
SQL Interview Questions For Experienced
SQL Interview Questions For ExperiencedSQL Interview Questions For Experienced
SQL Interview Questions For Experiencedzynofustechnology
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorialMohd Tousif
 

Similar to Ora faq (20)

Interview Questions.pdf
Interview Questions.pdfInterview Questions.pdf
Interview Questions.pdf
 
Viva voce
Viva voceViva voce
Viva voce
 
Adbms
AdbmsAdbms
Adbms
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
 
Informatica interview questions
Informatica interview questionsInformatica interview questions
Informatica interview questions
 
C
CC
C
 
C language 100 questions answers
C language 100 questions answersC language 100 questions answers
C language 100 questions answers
 
MSSQL_Book.pdf
MSSQL_Book.pdfMSSQL_Book.pdf
MSSQL_Book.pdf
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
 
Difference between all topics in oracle
Difference between all topics in oracleDifference between all topics in oracle
Difference between all topics in oracle
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-book
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-book
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
 
Top 20 SQL interview questions.pdf
Top 20 SQL interview questions.pdfTop 20 SQL interview questions.pdf
Top 20 SQL interview questions.pdf
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008
 
SQL Interview Questions For Experienced
SQL Interview Questions For ExperiencedSQL Interview Questions For Experienced
SQL Interview Questions For Experienced
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 
SQL
SQLSQL
SQL
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 

Ora faq

  • 1. ORACLE ----------------------------------------------------------------------------------------------------------- - 1) What is Data or Information? The matter what we feed into the computer is called Data or Information. 2) What is database? The collection of interrelated data is called Database. 3) What is Oracle? Oracle is RDBMS package. 4) Communication channel between backend and front end? SQL*NET 5) Difference between Truncate and Delete? 6) Truncate commits after deleting entire table. i.e.; it can not be rolled back. Database triggers do not fire on truncate. 7) Delete allows the filtered deletion. Deleted records can be rolled back or committed. Data base triggers fire on delete. 8) What is difference between Alias and Synonym? 9) Alias is temporary and used with one query. Synonym is permanent and not used as alias. 10) What is difference between Rename and Alias? 11) Rename is permanent name given to a table or column where as 12) Alias is a temporary name given to a table or column which does not exist once the sol statement is executed. 13) What are the Special operators? 14) In (Picks required values from list of values). 15) Like (Character comparition). 16) Between (Provide range specification). 17) Is (Reffer Null values).
  • 2. 18) What are Pseudo columns? 19) Pseudo columns are system defined columns behaves like a table columns. We can not insert, update or delete their values. Ex: currval, nextval, level, rowid, rownum, new, old, sysdate. 20) What is Rownum? Represents the records number for displayed data, which is temporary. 21) What is Rowid? 22) Represents uniqueness of records given by system, which are permanent. 23) Rowid holds the information in hexadecimal which consists of file id, block id, field id, record id. 24) What is the fastest way of accessing a row in a table? 25) Rowid and Constraints. 26) Difference between Translate and Replace? 27) This function used to translate the string character by character. Need to pass equal no of characters. Translate(S, C1, C2). 28) This function used to replace the string by string comparition. C1, C2 lengeths may or may not equal. Replace(S, C1, C2). 29) Difference between Substr ( ) and Instr( )? 30) Substr ( ) will return the specific part of a string, where as Instr( ) returns the position of the specific part of the string 31) Which is an effective command – Truncate or Delete? 32) Delete is the effective command. Because using this command we can delete only these records that are not really required. 33) Difference between Count ( ) and count(*) ? 34) Count ( ) is count with column ignore null values. 35) But Count (*) is not ignore null values. 36) What is NVL ( ) function? 37) It is a general function.
  • 3. 38) It represents null values with specified value. 39) Difference between Min ( ) and Least ( )? 40) Min ( ) is an aggregate function which takes only one column of a table as parameter where as 41) Least ( ) is a general function which can take any no of values and column names from dual and table respectively. 42) Difference between Update and Alter? 43) Alter command is used to modify the database objects where as 44) The Update command is used to modify the values of a database object. 45) What is the last clause and first clause in select statement? 46) Last clause: Order by 47) First clause: Where clause 48) Difference between Group functions and Single row functions? 49) Group function operates on many rows returns one and returns single result. A group function will not allow in PL/SQL procedural. Ex. Sum ( ), Avg ( ). 50) Single row function result for one row. Allowed in PL/SQL procedural statements. Ex. Upper ( ), Lower ( ). 51) Where clause: Used to provide required conditions on records while manipulating or retrieving records. 52) Group by clause: Used to group data based on columns given in group by clause. 53) Having clause: Used to provide group functions in conditions. 54) Order by clause: Used to arrange data either in ascending or descending order. JOINS 55) What is a join? Explain the different types of joins? Join is a query which retrieves related columns or rows from multiple tables. Equi join:: Joing two tables by equating two common columns. Non equi join:: Join two tables without common columns. Self join:: Joining the table with itself. Outer join::
  • 4. 56) What are the minimum requirements for an Equi join? There should be atleast one common column between the joining data. 57) Which is most faster – IN or EXISTS ? EXISTS is more faster than IN. Because EXISTS returns a boolean value where as IN returns a value. 58) Difference between Union and Join ? Union is used to combine the o/p of select statements in one table. And must and should have same no of columns and similer datatypes in given select statements. Join is used to combine the more than one table. There is no required of same no of columns. 59) What is Defficient table? In outer join which table has ‘+’ symbol that is defficient table. 60) Difference between Left outer join and Right outer join? In Left outer join retrieves the all records of left side table. But only matching recors from right side table. Where as right outer join is opp to left outer join. 61) How do you implement the IF statement in select statement ? By using the Decode statement. 62) What is a Transaction? A Transaction is a set of SQL statements between commit and rollback. SUB QUERIES 63) What is a Query? Query is a single line request for the information from the database. 64) What are the Set operators? Set operators are combine the results of 2 queries into one result. ( Union, Intersect, Minus, Union all ).
  • 5. 65) What we need, when we are using Set operators? Queries should contain the same no of columns along with data type matching. 66) What is Subquery? Subquery is a query whose return values are used in filtering conditions of the main query. 67) What is Correlated sub-query? Correlated sub-query is a sub-query which has reference to the main query. 68) Difference between Simple sub-query and Correlated sub-query? In Simple sub-query first the inner query executed and its value is given as condition to outer query , which gets executed later. Correlated sub-query is opp to Simple sub-query. 69) What are the Special operators in Sub Queries? Any / Some – Picks lowest value. All – Picks highest value. Exists – Returns True or False. CONSTRAINTS 70) What are the Integrity Constraints? An Integrity constraint is a declarative way to define a business rule for a column of a table. 71) What is Self-referential integrity constraint? If a foreign key reference a parent key of the same table is called Self_reference integrity constraint. 72) What is a Composite primary key? A primary key created on combination of columns is called a Composite primary key. ( Max 32 columns are candidate keys can be allowed in composite primary key. 73) What is a Candidate column?
  • 6. It is a part of Composite primary key. 74) What is Null? Is it constraint or default value? Default value. 75) What is default value for every column of a table ? Null. 76) What are limitations of CHECK constraint? In this we can not specify the pseudo columns like sysdate, rownum etc. 77) What is ‘On delete cascade’? If this key word is included in the definition of a child table, whenever the records from the parent table is deleted then automatically deleted the respective values in the child table. 78) How to drop parent table when it have child tables? Using with ‘cascade constraints’. Ex: Drop table <table name> cascade constraints; 50. How can you cut the relation ship between parent and child table (or) How can you drop the primary key from parent table? Alter table <table name> drop constraint <const-name> cascade; 79) In which order constraints are fired? Not null, Check, Primary key, Unique, Foreign key. 80) Can Check constraint be used for self referential integrity? How? Yes. In Check condition for a column of a table, we can reference some other column of the same table and thus enforce self referential integrity. 81) Difference between Unique and Primary key? Unique key can accept null values but Primary key can not accept null values. 82) Difference between Foreign key and Reference key? Foreign key is the key. i.e; attribute which refers to another table primary key.
  • 7. Reference key is the primary key of table reffered by another table. 83) How to add a primary key constraint to an existed table? Alter table <parent table> add constraint <constraint name>; 84) How to add a Foreign key to an existed table? Alter table <parent table> add constraint foreign key <constraint name> references < VIEWS 57. What is a View? View is virtual table. View exists logically but contains no physical data and manipulates the base table. Every view has a query attached to it. 58. Advantages of Views? View provides high security to base table while sharing. Using views we can write complicated queries into simple queries. To protect some of the columns of a table from other user. 59. Which database objects are called 'Stored Queries'? --- Views. 60. Do view contain data? --- No. 61. Can a trigger written for a view? --- No. 62. Can you alter Synonym of view or view? --- No. 63. Can you create Index on View? --- No. 64. Difference between Simple view and Complex view? Simple view can be created on a table where as Complex view can be created on more than one table. Simple view can be modified where as Complex view can not be modified. 65.What is an Inline view? An Inline view is just a subquery in place of a table in an insert, update, delete or select. 66. How to update a Complex view? -- Using with 'Instead of Triggers'.
  • 8. 67. Difference between View and Force view? View created on existing table where as Force view created on without an exitsting table. 68. Difference between View and Materialized view? View Materialized view 1.Data will store logically. 1.Data will be stored physically. 2.It occupies less memory. 2.Occupies huge space. 3.With user interaction it can refresh at 3.It can refresh without user the time of calling. interaction based on time interval. 4.It reduce performance at the time of 4.It improves the performance at the reports. time of reprots. 5.There is a possibility for duplicate rows. 5.We can avoid duplicate rows by assigning primary key at the time of creation. 69. Non-key preserved column --- The common column used in a complex view having primary key is called as Non-key preserved column. 70. Minimum requirements for creating Materialized view?-- Primary key on column of a table. SYNONYMS 71. What is Synonym? A Synonym is an alias name for a table, view, sequence or program units. 72. Difference between Private sysnonym and Public sysnonym? Private sysnonym can be accessed only by the owner where as Public synonym can be accessed by any user on the database. 73. Advantages of Synonym-- Mask the real name and owner of an object. Provide public access to an object. Provide location transparency for tables, views or program units of a remote database. 74. Difference between View and Synonym? Synonym is just a second name of a table used for multiple link of database. View can be created with many tables and with virtual columns and with conditions.
  • 9. SEQUENCE 75. What is a Sequence? A Sequence generates a serial list of unique numbers for numarical columns of a database table. 76. In Oracle database which object is operated with Pseudo columns? Sequence. ( Nextval, Currval ). Initially Sequence has to be operated with Nextval. In Sequence start value should be greater than Min value. 77. Consider a Sequence whose currval is 1 and gets incremented by 1 by using the nextval the nextval reference we get the nextvalue 2. Suppose at this point we issue an rollback and again issue a nextval. What will the output be? --- 3. INDEX 78. What is an Index? Index is a pointer locates the physical address of column.It provide quick access to rows in a table. These gets activated only when the indexed columns are used in where clause condition. It increases the performance of server 79. How can u find out what columns have what indexs of a perticular Table? Select * from user_ind_columns where table_name='EMP'; 80. How to bypass(fire) the index in select statement for number datatype column and char datatype column? select * from fana where empno+0 = 7876; (number column) select * from fana where job||’’ = ’CLERK’; (character column) 80. Types of Indexes? 1.Normal Index : Applied on single column. 2.Composite Index : Applied on more than one column Ex : Create index ind3 on emp(deptno, comm); 3.Functional Index : Applied on columns which are having functions. 4.Partitioning Index :These are 2 types a) Local Index b) Global Index
  • 10. a : Applied on individual parts. b : Applied on all parts at a time. 81. What is Cluster ? It is group of one or more tables physically stores together to share common columns & are often used together. 82. What is Cluster Key? The related column of the tables in a cluster is called Cluster Key. Cluster Index applied on more than one table. Advantages of Clusters : 1) access time reduced for joins. Disadvantages : 1) The time for insert increases. LOCKS : 83. What r the locks? Locks r used to avoid disturbances among different users how r sharing the data. 84. Types of locks ? 1. Row level lock : Lock perticular columns & Records. EX : select * from emp where deptno= 10 for update; select * from emp for update of sal; 2.Table level lock : Lock entaire table. Syntax : Lock table tablename in (mode); Ex : lock table emp in exclusive mode; There r 3 types of table level locks : 85) Share mode:: If a user applies a lock, other user cannot be perform transactions. But he also can apply this lock. 2) Share update mode::If a user applies a lock, other user can perform transactions on other rows which r not used by first user. Other user can also apply this lock. 3) Exclusive mode::If a user applies a lock, other user cannot perform transactions and also cannot apply any lock. 85. What is Snapshot ? These r read only copies of a master table located on a remote node which is periodically refreshed to reflect changes made to the master table. 86. Difference b/t Round & Trunc ?
  • 11. Round : Gives nearest whole number Trunc : It gives only whole number. 87. Explain Connect by prior? Sol : Retrives rows in hirerchal order. 88. What is Dead lock ? Two processes waiting to update the rows of a table which r locked by the other process then dead lock arises. In a database environment this will often happen because of not issuing proper row lock commands. poor design of front end application may cause this situation and the perfomance of server will reduce drastically. These locks will be realesed automatically when a commit/rollback operation performed or any one of this processes being killed externally. PL/SQL 1. What is PL/SQL? PL/SQL is a procedural language that has both interactive and procedural programing language constructs such as iteration, conditional branching. 2. What is PLSQL block? A set of related declarations and procedural statements is called block. 3. How many types of PLSQL blocks? Anonymous block and Named block. 4. Difference between Anonymous and Named blocks? Anonymous blocks are no reusability and stored in Operating system where as Named blocks are stored in database. Reusability is possible. 5. What is DBMS_OUTPUT.PUT_LINE( ) ? It is a built in packaged procedure. Here DBMS_OUTPUT is a package and PUT_LINE is a procedure. This is used to display required messages on screen.
  • 12. 6. What is 'SET SERVEROUTPUT ON'? Used to active the DBMS_OUTPUT.PUT_LINE( ). 7. What are Stored procedures? Named blocks are also called Stored procedures.There are 4 types. 1.Procedures 2. Functions 3. Packages 4. Triggers. 8. What are Sub programs? --- 1.Procedures 2. Functions. 9. Datatypes in PLSQL --- Scalar datatypes & Composite datatypes. Scalar datatypes : All SQL datatypes. Composite datatypes : %type, %rowtype, Record type, Table type, Objects, Varrays, Nested tables.. Record type, Table type are user defined temporary datatypes. Objects, varrays, nested tables are user defined permanent datatypes. 10. What are %Type and %Rowtype? %Type is a column type declaration supports to declare a variable according to column structure. Ex: variablename tablename.columnname%type; %Rowtype is a table type declaration supports to declare a variable according to table structure. Ex: variablename tablename%rowtype; 11. Advantages of %Rowtype? When, we need variables for all columns of a table, no need to declare those many %Type variables what can be done by using a variable of %Rowtype. 12. Difference between %Rowtype and Record type? %Rowtype is used whenever query returns a entire row of a table or view. where as Record type is used whenever query returns columns of different tables or views and variables. 13. What is default value for a numaric PL/SQL variables? --- NULL. 14. Smallest PLSQL programe in Oracle? BEGIN NULL; END;
  • 13. 15. What is a PLSQL Engine? This PLSQL Engine accepts any valid PLSQL block as input, executes the procedural part of the statements and sends the SQL statements to the SQL statement executor in the Oracle server. 16. Difference between Simple loop and For loop? Simple loop requires declaration of variables used in it and exit condition. But For loop does not require this. CURSORS 17. What is Cursor? why cursor is required? Cursor is a named private SQL area in PLSQL. It is a pointer pointing to data , which can be used to manipulate more than 1 row at a time. 18. How many types of Cursors are supported by Oracle? --- Implicit cursor, Explicit cursor. 19. What are the PLSQL statements used in cursor processing? Declare cursor, Open cursor, Fetch cursor, Exit cursor, Close cursor. 20. Difference between Implicit cursor, Explicit cursor? Explicit cursors are user defined cursors.where as Implicit cursors are created by system and no need of cursor operations.(declare cursor, open cursor....). 21. What is a Cursor For loop? Cursor for loop is shortcut process for explicit cursors, because the cursor is open, rows are fetched and cursor is closed automatically when all the rows have been processed. 22. What are Cursor attributes? %Found, %Not found, %Is open, %Rowcount. 23. Is TCL commands are allowed in loops? No. Because rollback, commit are used when the transaction is completed. 24. What is the use of cursor with "FOR UPDATE OF" clause?
  • 14. This clause stop accessing of other users on the particular columns used by the cursor untill the commit is issued. 25. What is the use of " WHERE CURRENT OF " clause ? WHERE CURRENT OF clause is used with FOR UPDATE clause to point the cursor & do changes in that location only. 26 . What should be the return type for a cursor variable? The return type for a cursor must be a record type. it can be declared explicitly as a user defined or %rowtype can be used 27 . Can cursor variables are stored in pl/sql tables. if yes how? No. A cursor variable points a row which cannot be stored in a two_diamentional pl/sql table. 28. Cursor parameter Cursor can accept arguments dynamically while opening it . Max 32 parameters can be passed to a cursor. EXCEPTIONS 29 . What is an Exceptions? How it is differ from error? Exceptions are used to handled errors at run time. whenever an error occurs exception raises. Error is a bug where as the exception is a warning or error condition 30 . Types of errors? 2types of errors 1)errors at compile time(errors) Ex : Syntax error 2) errors at run time (exceptions) Ex : logical error(due to improper i/ p by end user) 31 . Types of exceptions? 1) user defined exceptions 2) predefined exceptions 32. Difference b/t user defined & predefined exceptions? predefined exceptions gets activated automatically whenever logical error occurs
  • 15. User defined exceptions have to be raised explicitly when ever required by programmer. 33. Name some built in exceptions ? Two_many_rows, No_data_found, Zero_divide, not_logged_on, storage_error, value_error, etc-- 34. Predefined SQL code range:-- -1 to -20000 35 . Non predefind exception ? Used to handle constraint validation errors in pl/sql block by using PRAGMA EXCEPTION_ INIT( ). PRAGMA EXCEPTION_ INIT( ) : takes 2 parameters as user exception name & sql code. For Non null constraint ---> -1400 For Check Constraint ---> -2290 For foreign key Constraint ---> -2291 For Pk Constraint ---> 0001 Child record found --> -2292 36. What is OTHERS exception? It is used to along with 1 or more exceptions handlers. This will handle all the errors not already handled in the block. 1. What is bulk collect? Bulk collect is part of PLSQL collection where data is stored/ poped up into a variable. Example: declare Type sal_rec is table of number;
  • 16. v_sal sal_rec; Begin Select sal bulk collect into v_sal from EMP; For r in 1.. v_sal.count loop dbms_output.put_line (v_sal(r)); End loop; End; What is PRAGMA EXECPTION_INIT? Ans: The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error. E.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number) What is raise application error? Raise_application_error is a procedure of package DBMS_STANDARD which allows issuing a user defined error messages from stored sub-program or database trigger. What is stored procedure? Stored procedures are subprogram’s stored in the database and can be called &execute multiple times wherein an application procedure is the one being used for a particular application same is the way for function. Both can be executed any number of times. Only difference is that stored procedures/ functions are stored in database in complied format while the application procedures/functions are not in precompiled format and at run time has to be compiled. What is WHERE CURRENT OF clause? WHERE CURRENT OF clause in an UPDATE, DELETE statement refers to the latest row fetched from a cursor. Database Triggers What is pl/sql table? Objects of type TABLE are called "PL/SQL tables", which are modeled as (but not the same as) database tables, PL/SQL tables use a primary PL/SQL tables can have one column and a primary key. Cursors