The document discusses several PL/SQL interview questions and expected answers. It covers topics like procedures, functions, anonymous blocks, mutating tables, %ROWTYPE, %TYPE, declare statements, open-fetch-loop commands with %NOTFOUND, SQLCODE, SQLERRM, checking if a cursor is open, generating debugging output, and types of triggers.
The document discusses several PL/SQL interview questions and expected answers. It covers topics like procedures, functions, anonymous blocks, mutating tables, %ROWTYPE, %TYPE, declare statements, open-fetch-loop commands with %NOTFOUND, SQLCODE, SQLERRM, checking if a cursor is open, generating debugging output, and types of triggers.
[ Home | Search | Jobs | Post Jobs | Interview | Directory | Link Us | Index ]
Personal oracle card Our Psychics Will Guide You Ask 1 Question, Absolutely Free CaliforniaPsychics.com Database Encryption Transparent, Centralized Security. Powerful & Simple. Learn How www.vormetric.com/db-en... Internet Explorer 9 Download Internet Explorer 9 and Load Webpages Faster. Official Site Microsoft.com 100% Pass Guarantee OCP each test for $89.00 Pass Oracle OCP 11g DBA www.uCertify.com SQL Training Improve your skills Quickly with our Step- by-Step Training Method www.SQLSteps.com PL/SQL Questions: PL/SQL Interview Questions and Answers (Continued from previous question...) PL/SQL Questions: 1. Describe the difference between a procedure, function and anonymous pl/sql block. Level: Low Expected answer : Candidate should mention use of DECLARE statement, a function must return a value while a procedure doesn?t have to.
2. What is a mutating table error and how can you get around it? Level: Intermediate Expected answer: This happens with triggers. It occurs because the trigger is trying to update a row it is currently using. The usual fix involves either use of views or temporary tables so the database is selecting from one while updating the other.
3. Describe the use of %ROWTYPE and %TYPE in PL/SQL Level: Low Expected answer: %ROWTYPE allows you to associate a variable with an entire table row. The %TYPE associates a variable with a single column type.
4. What packages (if any) has Oracle provided for use by developers? Level: Intermediate to high Expected answer: Oracle provides the DBMS_ series of packages. There are many which developers should be aware of such as DBMS_SQL, DBMS_PIPE, DBMS_TRANSACTION, DBMS_LOCK, DBMS_ALERT, DBMS_OUTPUT, DBMS_JOB, DBMS_UTILITY, DBMS_DDL, UTL_FILE. If they can mention a few of these and describe how they used them, even better. If they include the SQL routines provided by Oracle, great, but not really what was asked.
5. Describe the use of PL/SQL tables Level: Intermediate Expected answer: PL/SQL tables are scalar arrays that can be referenced by a binary integer. They can be used to hold values for use in later queries or calculations. In Oracle 8 they will be able to be of the %ROWTYPE designation, or RECORD.
6. When is a declare statement needed ? Level: Low The DECLARE statement is used in PL/SQL anonymous blocks such as with stand alone, non-stored PL/SQL procedures. It must come first in a PL/SQL stand alone file if it is used.
7. In what order should a open/fetch/loop set of commands in a PL/SQL block be implemented if you use the %NOTFOUND cursor variable in the exit when statement? Why? Level: Intermediate Expected answer: OPEN then FETCH then LOOP followed by the exit when. If not specified in this order will result in the final return being done twice because of the way the %NOTFOUND is handled by PL/SQL.
8. What are SQLCODE and SQLERRM and why are they important for PL/SQL developers? Level: Intermediate Expected answer: SQLCODE returns the value of the error number for the last error encountered. The SQLERRM returns the actual error message for the last error encountered. They can be used in exception handling to report, or, store in an error log table, the error that occurred in the code. These are especially useful for the WHEN OTHERS exception.
Interview Questions
General Basic Interview A&Q XML Interview A&Q Windows Programming A&Q Web Service A&Q Visual Basic Interview A&Q Unix Interview A&Q 64 Tough Interview A&Q Struts A&Q SQL Interview A&Q SIEBEL Interview A&Q Servlet Interview A&Q SAP 1 Interview A&Q SAP 2 Interview A&Q SAP 3 Interview A&Q SAP 4 Interview A&Q SAP 5 Interview A&Q RMI Interview A&Q Python A&Q PHP Interview A&Q Perl A&Q PeopleSoft Interview A&Q ORACLE 1 Interview A&Q ORACLE 2 Interview A&Q ORACLE 3 Interview A&Q ORACLE 4 Interview A&Q ORACLE 5 Interview A&Q Networking Interview A&Q Networking Programming A&Q Microsoft Interview A&Q JSP Interview A&Q JMS Interview A&Q JDBC Interview A&Q Java Interview Tips JavaScript Interview A&Q Java 1 Interview A&Q Java 2 Interview A&Q Java 3 Interview A&Q J2SE Interview A&Q J2ME A&Q J2EE 1 Interview A&Q J2EE 2 Interview A&Q Windows Tutorials/FAQs XHTML XHTML Tutorials/FAQs RSS Tutorials/FAQs PHP Tutorials CSS Tutorials/FAQs ORACLE Tutorials/FAQs MySQL Tutorials/FAQs Bioinformatics A&Q EJB Interview A&Q Electrical Engineering A&Q .NET 1 Interview A&Q .NET 2 Interview A&Q C# Interview A&Q C++ 1 Interview A&Q C++ 2 Interview A&Q Page 1 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html 9. How can you find within a PL/SQL block, if a cursor is open? Level: Low Expected answer: Use the %ISOPEN cursor status variable.
10. How can you generate debugging output from PL/SQL? Level:Intermediate to high Expected answer: Use the DBMS_OUTPUT package. Another possible method is to just use the SHOW ERROR command, but this only shows errors. The DBMS_OUTPUT package can be used to show intermediate results from loops and the status of variables as the procedure is executed. The new package UTL_FILE can also be used.
11. What are the types of triggers? Level:Intermediate to high Expected Answer: There are 12 types of triggers in PL/SQL that consist of combinations of the BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and ALL key words: BEFORE ALL ROW INSERT AFTER ALL ROW INSERT BEFORE INSERT AFTER INSERT etc. (Continued on next question...) Other Interview Questions What's SQL What's SQL*Plus What's NVL What's Date Functions What's Character Functions What's TTITLE & BTITLE What's COLUMN What's BREAK What's COMPUTE What's SET What's SPOOL What's JOIN What's Union What's Intersect What's Minus What's Correlated Subquery What's Multiple columns What's Sequences What's Synonyms What's Indexes What's Data types Order of SQL statement execution What's Transaction What's Commit What's Posting What's Rollback Become An IT Professional PL SQL Certification Programs. Find Schools Today. Get Free Info! Search.Technology-Schools.com C Interview A&Q ASP Interview A&Q XHTML Interview A&Q Swing AWT Interview A&Q Socket programming 1 A&Q Socket programming 2 A&Q Socket programming 3 A&Q Socket programming 4 A&Q Socket programming 5 A&Q Socket programming 6 A&Q Operating System A&Q Web Developers A&Q to Ask HTML Interview A&Q Computer Security 1 A&Q Computer Security 2 A&Q CSS Interview A&Q BEA WebLogic A&Q AJAX A&Q 64 Toughest Interview A&Q Fifty Standard Interview A&Q DB2 Interview A&Q DB2s Dates A&Q DBA Interview A&Q What DBA job like? A&Q Data Warehousing A&Q Java database A&Q Database developer A&Q MS SQL Server A&Q MS SQL DBA A&Q SQL Server DBA FAQs MySQL DBA A&Q Oracle DBA Checklist A&Q Oracle DBA Interview A&Q SQL Server database developer A&Q RDBMS FUNDAMENTALS A&Q SQL Server Enterprise Manager A&Q The Best Jobs In America SQL Server Tutorials MySQL Tutorials Tutorials Oracle Tutorials Tutorials Software QA Testing Interview A&Q Software Localization Testing SilkTest A&Q Load/Stress Testing of Websites LoadRunner Interview A&Q WinRunner 1 Interview A&Q WinRunner 2 Interview A&Q QTP Interview A&Q Rational Robot A&Q QA/Testing Technical A&Q Check List for Software Testing Bugzilla A&Q JUnit Interview A&Q Software Bugs A&Q Test Plan Sample To be a good software tester Writing The Test Plan Page 2 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html What's Savepoint Set Transaction What's Locking What's Consistency What's Integrity What's Deadlock What's Mutating Table What's SQL*Loader The most important DDL statements in SQL are: Operators used in SELECT statements. SELECT statements: The SELECT INTO Statement is most often used to create backup copies of tables or for archiving records. The INSERT INTO Statements: The Update Statement: The Delete Statements: Sort the Rows: The IN operator may be used if you know the exact value you want to return for at least one of the columns. BETWEEN ... AND What is the use of CASCADE CONSTRAINTS? Why does the following command give a compilation error? Which system tables contain information on privileges granted and privileges obtained? Which system table contains information on constraints on all the tables created?obtained? What is the difference between TRUNCATE and DELETE commands? State true or false. !=, <>, ^= all denote the same operation? State true or false. EXISTS, SOME, ANY are operators in SQL? What will be the output of the following query? What does the following query do? What is the advantage of specifying WITH GRANT OPTION in the GRANT command? Which command executes the contents of a specified file? What is the value of comm and sal after executing the following query if the initial value of sal is 10000 UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;? Which command displays the SQL command in the SQL buffer, and then executes it? What command is used to get back the privileges offered by the GRANT command? What will be the output of the following query? Which date function is used to find the difference between two dates? What operator performs pattern matching? What is the use of the DROP option in the ALTER TABLE command? What operator tests column for the absence of data? What are the privileges that can be granted on a table by a user to others? Which function is used to find the largest integer less than or equal to a Test Documents Sample Testing Tools A&Q Bug Tracking Tools A&Q Manual Testing A&Q Database Testing A&Q Knowledge for Testers Rational Coding Software Testing Methodolog Quality On Time Software Development Models The Product Quality Measures Glossary Software Testing Glossary Internet Glossary Windows WinRunner In Simple Steps SilkTest User Guide Rational Suite Tutorial SilkTest Tutorial WinRunner 7.0 Tutorial LoadRunner Controller User Guide LoadRunner Creating Vuser Scripts Tutorial - Checking XML with QuickTest WebLOAD Quick Start Guide Perl Test Tutorial TestDirector Tutorial Rational Test RealTime Users Guide Rational TestManager User Guide Rational Robot Tutorial Rational Robot User`s Guide QTP Tutorial PopUp Windows Coding/Testing Tutorials On-Line Testing Tools Submit your questions
Page 3 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html specific value? Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables? What is the use of DESC in SQL? What command is used to create a table by copying the structure of another table? TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above two commands differ? What is the output of the following query SELECT TRUNC(1234.5678,-2) FROM DUAL;? What are the wildcards used for pattern matching.? What is the parameter substitution symbol used with INSERT INTO command? What's an SQL injection? What is difference between TRUNCATE & DELETE What is a join? Explain the different types of joins? What is the sub-query? What is correlated sub-query? Explain CONNECT BY PRIOR? Difference between SUBSTR and INSTR? Explain UNION, MINUS, UNION ALL and INTERSECT? What is ROWID? What is the fastest way of accessing a row in a table? What is an integrity constraint? What is referential integrity constraint? What is the usage of SAVEPOINTS? What is ON DELETE CASCADE? What are the data types allowed in a table? What is difference between CHAR and VARCHAR2? What is the maximum SIZE allowed for each type? How many LONG columns are allowed in a table? Is it possible to use LONG columns in WHERE clause or ORDER BY? What are the pre-requisites to modify datatype of a column and to add a column with NOT NULL constraint? Where the integrity constraints are stored in data dictionary? How will you activate/deactivate integrity constraints? If unique key constraint on DATE column is created, will it validate the rows that are inserted with SYSDATE? What is a database link? How to access the current value and next value from a sequence? Is it possible to access the current value in a session before accessing next value? What is CYCLE/NO CYCLE in a Sequence? What are the advantages of VIEW? Can a view be updated/inserted/deleted? If Yes - under what conditions? If a view on a single base table is manipulated will the changes be reflected on the base table? Which of the following statements is true about implicit cursors? Which of the following is not a feature of a cursor FOR loop? How would the developer define this variable using referential datatypes? Page 4 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html Which three of the following are implicit cursor attributes? If left out, which of the following would cause an infinite loop to occur in a simple loop? Which line in the following statement will produce an error? The command used to open a CURSOR FOR loop is What happens when rows are found using a FETCH statement Read the following code: Read the following code: What is the maximum number of handlers processed before the PL/SQL block is exited when an exception occurs? 77. For which trigger timing can you reference the NEW and OLD qualifiers? Read the following code 2: When invoking this procedure, you encounter the error Read the following code 3 Which procedure can be used to create a customized error message? The CHECK_THEATER trigger of the THEATER table has been disabled. Which command can you issue to enable this trigger? Examine this database trigger Examine this function: Under which circumstance must you recompile the package body after recompiling the package specification? Procedure and Functions are explicitly executed. This is different from a database trigger. When is a database trigger executed? Which Oracle supplied package can you use to output values and messages from database triggers, stored procedures and functions within SQL*Plus? What occurs if a procedure or function terminates with failure without being handled? Examine this code Which Oracle supplied package will enable this feature? Which Oracle supplied package will enable this feature? How to implement ISNUMERIC function in SQL *Plus ? How to Select last N records from a Table? What is the difference between Truncate and Delete interms of Referential Integrity? CLIENT/SERVER What does the OLTP stands for ? What is the most important requirement for OLTP ? In a client server environment, what would be the major work that the client deals with ? Why is the most of the processing done at the sever ? What does teh term upsizing refer to ? What does one do when one is rightsizing ? What does the term downsizing refer to ? What is event trigger ? Why do stored procedures reduce network traffic ? What are the types of processes that a server runs ? What is a event handler ? What is an integrity constraint ? Page 5 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html
Software QA Resource Center Software Developer Resource Center Database Administrator Resource Center Programming Tutorials Windows Tutorials Interview Q & A BioTechnology Resource Center Link Directory FYI Center Forum
Copyright 2008 FYICenter.com
What are the various uses of database triggers ? What is a transaction ? Why are the integrity constraints preferred to database triggers ? Why is it better to use an integrity constraint to validate data in a table than to use a stored procedure ? What are the three components of a client server model ? What are the advantages of client/server model ? What are the disadvantages of the client/server model ? What are the different topologies available for network ? What is the first work of Client process ? What are the responsibilities of a Server ? In a Client/Server context, what does API (Application Programming Interface) refer to ? Give some examples of standard API??s ? What is the main advantage of developing an application using an API ? What is the main disadvantage of developing an application using an API ? Why is an event driven program referred to a passive program ? What are the four types of events ? What is the difference between file server and a database server ? What is inheritance ? What are the two components of ODBC ? What is the function of a ODBC manager ? What is the function of a ODBC Driver ? What description of a data source is required for ODBC ? How is a connection establised by ODBC ? PL/SQL Questions: SQL/ SQLPlus [ Home | Search | Jobs | Post Jobs | Interview | Directory | Link Us | Index ] Page 6 of 6 PL/SQL Questions: 4/30/2011 http://dev.fyicenter.com/Interview-Questions/SQL/_PL_SQL_Questions_.html