Professional Documents
Culture Documents
Q: What are the advantages of views? Q: What is an Oracle sequence? Q: What is a synonym? Q: What are the types of synonyms? Q: What is a private synonym? Q: What is a public synonym? Q: What is an Oracle inde ? Q: What is a schema? Q: What is difference between !"#$%&!' ( D')'!'? Q: What is a join? ' plain the different types of joins? Q: Difference between *#+*!" and ,$*!"? Q: What is difference between %-&" and .&"%-&"/? What is the ma imum *,0' allowed for each type? Q: -ow to access the current value and ne t value from a sequence? Q: What are the components of physical database structure of Oracle database? Q: What is schema? Q: Query to delete duplicate row from a table Q: What is three types of commands1statemets used in Oracle ? Q: What is a cursor its attribute and types? Q: What are inline views? Q: -ow can we refresh a snapshot? Q: What is a tablespace? Q: What is an Oracle sequence? Q: ,s sequence cyclic? Q: *elect nth highest value from a list of values ? Q: What are triggers and its types? Q: What is the ma imum number of triggers, can apply to a single table? Q: Difference between rowid and rownum? Q: What is the fastest query method for a table? Q: What is the difference of a )'2! 3O,$ and an ,$$'" 3O,$ statement? Q: -ow can , avoid a divide by 4ero error? Q: ,s view updatable? Q: What is Dual ? Q: What is the difference between %-&" and .&"%-&" ? Q: Do we use commit in triggers5 Q: -ow will the fetch the last inserted record in any table ? Q: What are constraints and its types? Q: What is "eferential ,ntegrity and "eferential integrity constraint ? Q: What is groups by and having clause? ' plain with e ample Q: What are )O%6*? What are types of different types of )oc7? Q: Difference between unique 7ey,primary 7ey and foreign 7ey ? Q: What are &dvantages of !"#$%&!' %ommand over D')'!'1D"O8 !&+)' %ommand ? Q: What are steps involved in ' ecution of *Q) statements? Q: What do you mean by 8arsing? Q: What is a -,$! and what are types -,$!? Q: What do u mean by '9%'8!,O$:,$,! 8ragma ? Q: What do u mean by 3*8 query? Q: Describe Oracle database;s physical and logical structure ? Q: What is <%hec7 %onstraints= and <with chec7 options= and <Default *pecification=? Q: What is the ma imum no5 of columns a table can have ? Q: %an a trigger written for a view ?
Q: What is a synonym?
Ans: A synonym is an alias for a table, view, se uence or %rogram unit.
Q: What is a schema?
Ans: The set of objects owned by user account is called the schema.
Q: What is difference between CHAR and VARCHAR2? What is the maximum SIZE allowed for each type?
Ans: #*A- %ads blan( s%aces to the ma+imum length. VA-#*A-3 does not %ad blan(
s%aces. 6or #*A- the ma+imum length is 377 and 3888 for VA-#*A-3
Q: How to access the current value and next value from a sequence?
Ans: "urrent Value : Se uence name.#.--VA" e#t Value se uence name./E9TVA".
Q: What is schema?
Ans: A schema is collection of database objects of a user.
synta+ is S>"@6O./0 @/OT6O./0)) returns T-.E if record is not fetched successfully else 6A"SE synta+ is S>"@/OT6O./0 Attributes Of a E+%licit #ursor @'SOPE/?returns T-.E if cursor is o%en else 6A"SE. Synta+ is cursorname@'SOPE/ @-OA#O./T))) returns number of records %rocessed from cursor synta+ is cursorname @-OA#O./T @6O./0)))) returns T-.E if record is fetched successfully else 6A"SE, synta+ is cursorname @6O./0 @/OT6O./0)) returns T-.E if record is not fetched successfully else 6A"SE synta+ is cursorname @/OT6O./0
Q: What is a tablespace?
Ans: A database is divided into "ogical Storage .nit called tables%aces. A tables%ace is used to grou%ed related logical structures together.
Q: Is sequence cyclic?
Ans: Des
Q: Is view updatable?
Ans: Only if the view is a sim%le hori5ontal slice through a single table.
Q: What is Dual ?
Ans: The 0.A" table is a table with a single row and a single column used where a table is syntactically re uired.
Q: How will the fetch the last inserted record in any table ?
Ans: select column 2, column 3.... from where rowid F !select ma+!rowid$ from table$I
the s%ecified table. #".STE- = The #".STE- hint e+%licitly chooses a cluster scan to access the s%ecified table. *AS* = The *AS* hint e+%licitly chooses a hash scan to access the s%ecified table. '/0E9 = The '/0E9 hint e+%licitly chooses an inde+ scan for the s%ecified table. A/0;E>.A"= The A/0;E>.A" hint e+%licitly chooses an e+ecution %lan that uses an access %ath that merges the scans on several single)column inde+es. !Dou can s%ecify multi%le inde+es through this hint$ '/0E9;AS#= The '/0E9;AS# hint e+%licitly chooses an inde+ scan for the s%ecified table. 'f the statement uses an inde+ range scan, O-A#"E scans the inde+ entries in ascending order of their inde+ed values. '/0E9;0ES#= The '/0E9;0ES# hint e+%licitly chooses an inde+ scan for the s%ecified table. 'f the statement uses an inde+ range scan, O-A#"E scans the inde+ entries in descending order of their inde+ed values. O-0E-E0 = The O-0E-E0 hint causes O-A#"E to join tables in the order in which they a%%ear in the 6-O< clause. .SE;/" = The .SE;/" hint causes O-A#"E to join each s%ecified table to another row source with a nested loo%s join using the s%ecified table as the inner table. .SE;<E-:E = The .SE;<E-:E hint causes O-A#"E to join each s%ecified table with another row source with a sort)merge join.
Q: What is Check Constraints and with check options and Default Specification?
Ans: #*E#L 'ntegrity #onstraints= A #*E#L integrity constraint on a column or a set of columns re uires that a s%ecified condition be true or un(nown !ie. not false$ for every row of the table. 'f a 0<" statement is issued so that the condition of the #*E#L constraint evaluates to false, the statement is rolled bac(. Aith chec( O%tion= Aith #hec( o%tion restricts inserts and u%dates %erformed through the view to %revent them from creating rows that the view cannot itself select .based on where clause of the create view statement. 6or eg= #reate or re%lace view Aomen As select name from Em%loyee Ahere Se+F U6emaleM Aith #hec( O%tionI 0efault S%ecification 't su%%lies a default value if column value is not s%ecified on '/SE-T 't can contain literals !constants$ and S>" functions, .SE-, SDS0ATE, se uence 't cannot include references to any columns.
Q: Consider a sequence whose currval is 1 and gets incremented by 1 by using the nextval reference we get the next number 2. Suppose at this point we issue an rollback and again issue a nextval. What will the output be ?
Ans: J
Q: What is Savepoint ?
Ans: Save%oints are intermediate mar(ers that can be declared in long transactions that contain many S>" statements. 4y using save%oints, you can arbitrarily mar( your wor( at any %oint within a long transaction. This allows you the o%tion of later rolling bac( all wor( %erformed from the current %oint in the transaction to a declared save%oint within the transaction.
Q: What is Deadlocks?
Ans: A deadloc( is a situation that can occur in multi)user systems that causes some number of transactions to be unable to continue wor(. A deadloc( can occur when two or
more users are waiting for data loc(ed by each other. 't ty%ically ha%%ens when each of two or more users are waiting to access a resource that another user has already loc(ed. This creates a deadloc( situation because each user is waiting for resources held by the other user. Eg Transaction 2 Time Point Transaction 3 .P0ATE em% 2 .P0ATE em% SET sal F salB2.2 SET sal F 2JK3 A*E-E em%no F 2888I A*E-E em%no F 3888I .P0ATE em% 3 .P0ATE em% SET sal F salB2.2 SET sal F 2JK3 A*E-E em%no F 3888I A*E-E em%no F 2888I O-A)888O8 J deadloc( detected while waiting for resource
Q: What is Privilege ?
Ans: A %rivilege is a right to e+ecute a %articular ty%e of S>" statement or to access another user,s object. Ty%es of %rivileges = N system %rivileges N object %rivileges System Privileges = System %rivileges allow users to %erform a %articular systemwide action, or to %erform a %articular action on a %articular ty%e of object. E.g. #reate Tables%ace, 0elete the row of any table, etc. Object Privileges = Object %rivileges allow users to %erform a %articular action on a s%ecific object. E.g. delete row of s%ecific table, etc. -oles = -oles are named grou%s of related %rivileges that are granted to users or other roles. Advantages of -oles = 2. reduced granting of %rivileges 3. dynamic %rivilege management !#hanging of %rivileges$ J. selective availability of %rivileges !Enalbling&0isabling roles$ K. a%%lication awareness !Enalbling&0isabling of roles by a%%lication$
a second local view on the remote master table. 't uses this view when it refreshes the sna%shot. N Additionally, if the sna%shot is a sim%le sna%shot, O-A#"E creates an inde+ on the S/APW table. All of these internal objects are created in the schema of the sna%shot. 0o not alter, change data in, or delete these objects manually.
Q: Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning?
Ans: The hit ratio is a measure of how many times the database was able to read a value from the buffers verses how many times it had to re)read a data value from the dis(s. A value greater than H8)V8@ is good, less could indicate %roblems. 'f you sim%ly ta(e the ratio of e+isting %arameters this will be a cumulative value since the database started. 'f you do a com%arison between %airs of readings based on some arbitrary time s%an, this is the instantaneous ratio for that time s%an. An instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over.
Q: What is a mutating table error and how can you get around it?
Ans: This ha%%ens with triggers. 't occurs because the trigger is trying to u%date a row it is currently using. The usual fi+ involves either use of views or tem%orary tables so the database is selecting from one while u%dating the other.
Q: What are SQLCODE and SQLERRM and why are they important for PL/SQL developers?
Ans: S>"#O0E returns the value of the error number for the last error encountered. The S>"E--< returns the actual error message for the last error encountered. They can be used in e+ce%tion handling to re%ort, or, store in an error log table, the error that occurred in the code. These are es%ecially useful for the A*E/ OT*E-S e+ce%tion.
in the database. A %ac(age is an enca%sulated collection of related %rogram objects stored together in the database. Program objects are= %rocedures, functions, variables, constants, cursors, e+ce%tions. Procedure&6unction = A %rocedure or function is a set of S>" and P"&S>" statements grou%ed together as an e+ecutable unit to %erform a s%ecific tas(. The main difference between a %rocedure and function is functions return a single variable by value whereas %rocedures do not return any variable by value. -ather they return multi%le variables by %assing variables by reference through their O.T %arameter.
Q: What are cascading triggers? What is the maximum no of cascading triggers at a time?
Ans: Ahen a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading. <a+ F J3
Q: If all the values from a cursor have been fetched and another fetch is issued, the output will be?
Ans: "ast -ecord
Q: What is RAISE_APPLICATION_ERROR ?
Ans: 04<S;STA/0A-0 %rovides a %rocedure named raise;a%%lication;error, which lets you issue user)defined error messages. That way, you can re%ort errors to an a%%lication and avoid returning unhandled e+ce%tions. The calling synta+ is = raise;a%%lication;error!error;number, error;message$I where error;number is a negative integer in the range )38888...)38VVV and error;message is a character string u% to 38KH bytes in length. An a%%lication can call raise;a%%lication;error only from an e+ecuting stored sub%rogram. Ahen called, raise;a%%lication;error ends the sub%rogram, rolls bac( any database changes it made, and returns a user)defined error number and message to the a%%lication. The error number and message can be tra%%ed li(e any O-A#"E error. The calling a%%lication gets a P"&S>" e+ce%tion, which it can %rocess using the error) re%orting functions S>"#O0E and S>"E--< in an OT*E-S handler. N The statement -aise;A%%lication;Error can be called either from a %rocedure body or from an e+ce%tion handler. N 'rres%ective of whether an error occurred or not, a raise;a%%lication;error command always raises an e+ce%tion in the calling %rogram !eg a forms trigger$. 'f an e+ce%tion handler is not written in that forms trigger, then a forms error occurs.