PL/SQL Question and Answer

Question  :  Introduce Your self  ?

Ans            : Normally first question starts with point  "Introduce Your self "  either guy is fresher or experience  , so if you are experience  then it is always good start telling from your career then academy  -- then personal achievement  and if it is necessary then family background .
if you are fresher , start with academy ,and then some personnel achievement , and try to correlate how you personal achievement with  your current job  interview .

Q  :  What is PL/SQL .  ?
Ans   : PL/SQL  stands for procedure  programming language for structured query language .

Q : Why PL/SQL is needed  ?
 Ans  : Normal sql is having some limitation  to work with database , you can not do much more in       in single line query  .. , in this case p/sql is always beneficial  in terms of  you can multi line query  as method or function , you can create a package  , triggers ,cursors , overall in one word ,you can manage your code easily , you can reduce network traffic , you can implement security  , changes can be easily possible and overall can achieve better  performance .


Q : What are table Space in Oracle  ?
Ans : Logical storage unit in Oracle database is called  TableSpace  , which contains all database objects like Table , index  .In Oracle v$tablespace contains all detail of tablespaces .

Q : what are data files ?
Ans  : physically storage of data . a table space can contain one or more data file , so oracle data base can have one or more tablespace  and a tablespace can have one or more  data files .



Q : what are cursors  ?
Ans  : Cursor are way to hold the value of Select Statement and then manipulate accordingly as per use  or can say Cursor are temporary work area used after execution of select statement , or can say if you want to play with the result of select statement you can use cursor in procedure .
There are two types of Cursor  : 1 = Implicit Cursor , 2 : Explicit Cursor .
Implicit Cursor  :  Implicit Cursor is created by default  ,when ever select ,insert ,update ,delete , command is executed . in this case select command affects only one row .
Explicit Cursor  :  Explicit Cursor is used when you multiple rows are returning by your select statement then it is good to create a temporary work area  by declaring explicit cursor for using those rows . 
Cursor   Can be create  as mentioned :
 step 1 :  Declare a Cursor 
 Step 2:  Open a statement .
 Step 3  : Fetch Statement 
Step 4  :  Close Cursor  .
Example  :  Suppose you want to print name from from table emp using Cursor .
                   cursor c IS select name from emp ;
                    Begin 
                   open c ;
                  fetch c into  c_firstname ;
                dbms_output.putline(c_firstname);
               close c ;

      

Comments

Popular posts from this blog

Install Mysql from ZIP without MySQL Installer or Exe

Logging in Python .

Dictionary in Python