Monday, May 19, 2008

Exceptions 1: Named System Exceptions

What is a named system exception?
Named system exceptions are exceptions that have been given names by PL/SQL. They are named in the STANDARD package in PL/SQL and do not need to be defined by the programmer.

Oracle has a standard set of exceptions already named as follows:



Oracle/PLSQL: Named System Exceptions

--------------------------------------------------------------------------------




The syntax for the Named System Exception in a procedure is:

CREATE [OR REPLACE] PROCEDURE procedure_name
[ (parameter [,parameter]) ]
IS
[declaration_section]
BEGIN
executable_section

EXCEPTION
WHEN exception_name1 THEN
[statements]

WHEN exception_name2 THEN
[statements]

WHEN exception_name_n THEN
[statements]

WHEN OTHERS THEN
[statements]

END [procedure_name];




The syntax for the Named System Exception in a function is:

CREATE [OR REPLACE] FUNCTION function_name
[ (parameter [,parameter]) ]
RETURN return_datatype
IS | AS
[declaration_section]
BEGIN
executable_section

EXCEPTION
WHEN exception_name1 THEN
[statements]

WHEN exception_name2 THEN
[statements]

WHEN exception_name_n THEN
[statements]

WHEN OTHERS THEN
[statements]

END [function_name];



Here is an example of a procedure that uses a Named System Exception:

CREATE OR REPLACE PROCEDURE add_new_supplier
(supplier_id_in IN NUMBER, supplier_name_in IN VARCHAR2)
IS

BEGIN
INSERT INTO suppliers (supplier_id, supplier_name )
VALUES ( supplier_id_in, supplier_name_in );

EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
raise_application_error (-20001,'You have tried to insert a duplicate supplier_id.');

WHEN OTHERS THEN
raise_application_error (-20002,'An error has occurred inserting a supplier.');

END;

In this example, we are trapping the Named System Exception called DUP_VAL_ON_INDEX. We are also using the WHEN OTHERS clause to trap all remaining exceptions.

Sunday, May 4, 2008

Oracle Interview pattern

Find more oracle material at http://download.35mb.com/kvreddy83

Oracle Questions:

DBMS - General


Oracle DBA



Oracle Development



Interview Questions for Oracle, DBA, Developer Candidates
Score each question on a 1-5 or 1-10 scale.


DBA Sections: SQL/SQLPLUS, PL/SQL, Tuning, Configuration, Trouble shooting
Developer Sections: SQL/SQLPLUS, PL/SQL, Data Modeling
Data Modeler: Data Modeling
All candidates for UNIX shop: UNIX







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.

Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________


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.

Score: ____________ Comment: ________________________________________________________

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.
Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________

7. In what order should a open/fetch/while set of commands in a PL/SQL block be implemented if you use the %NOTFOUND cursor variable? Why?
Level: Intermediate

Expected answer: OPEN then FETCH then WHILE. 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.

Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________

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.

Score: ____________ Comment: ________________________________________________________

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.
Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________



DBA:

1. Give one method for transferring a table from one schema to another:
Level:Intermediate

Expected Answer: There are several possible methods, export-import, CREATE TABLE... AS SELECT, or COPY.

Score: ____________ Comment: ________________________________________________________

2. What is the purpose of the IMPORT option IGNORE? What is it’s default setting?
Level: Low

Expected Answer: The IMPORT IGNORE option tells import to ignore “already exists” errors. If it is not specified the tables that already exist will be skipped. If it is specified, the error is ignored and the tables data will be inserted. The default value is N.

Score: ____________ Comment: ________________________________________________________

3. You have a rollback segment in a version 7.2 database that has expanded beyond optimal, how can it be restored to optimal?
Level: Low

Expected answer: Use the ALTER TABLESPACE ..... SHRINK command.

Score: ____________ Comment: ________________________________________________________

4. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER command what happens? Is this bad or good? Why?
Level: Low

Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary tablespace. This is bad because it causes user objects and temporary segments to be placed into the SYSTEM tablespace resulting in fragmentation and improper table placement (only data dictionary objects and the system rollback segment should be in SYSTEM).

Score: ____________ Comment: ________________________________________________________

5. What are some of the Oracle provided packages that DBAs should be aware of?
Level: Intermediate to High

Expected answer: Oracle provides a number of packages in the form of the DBMS_ packages owned by the SYS user. The packages used by DBAs may include: DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL, DBMS_SESSION, DBMS_OUTPUT and DBMS_SNAPSHOT. They may also try to answer with the UTL*.SQL or CAT*.SQL series of SQL procedures. These can be viewed as extra credit but aren’t part of the answer.

Score: ____________ Comment: ________________________________________________________

6. What happens if the constraint name is left out of a constraint clause?
Level: Low

Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx is a system generated number. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder.

Score: ____________ Comment: ________________________________________________________

7. What happens if a tablespace clause is left off of a primary key constraint clause?
Level: Low

Expected answer: This results in the index that is automatically generated being placed in then users default tablespace. Since this will usually be the same tablespace as the table is being created in, this can cause serious performance problems.

Score: ____________ Comment: ________________________________________________________

8. What is the proper method for disabling and re-enabling a primary key constraint?
Level: Intermediate

Expected answer: You use the ALTER TABLE command for both. However, for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys.

Score: ____________ Comment: ________________________________________________________

9. What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause?
Level: Intermediate

Expected answer: The index is created in the user’s default tablespace and all sizing information is lost. Oracle doesn’t store this information as a part of the constraint definition, but only as part of the index definition, when the constraint was disabled the index was dropped and the information is gone.

Score: ____________ Comment: ________________________________________________________

10. (On UNIX) When should more than one DB writer process be used? How many should be used?
Level: High

Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required, if the system is not capable of asynchronous IO then up to twice the number of disks used by Oracle number of DB writers should be specified by use of the db_writers initialization parameter.

Score: ____________ Comment: ________________________________________________________

11. You are using hot backup without being in archivelog mode, can you recover in the event of a failure? Why or why not?
Level: High

Expected answer: You can’t use hot backup without being in archivelog mode. So no, you couldn’t recover.

Score: ____________ Comment: ________________________________________________________

12. What causes the “snapshot too old” error? How can this be prevented or mitigated?
Level: Intermediate

Expected answer: This is caused by large or long running transactions that have either wrapped onto their own rollback space or have had another transaction write on part of their rollback space. This can be prevented or mitigated by breaking the transaction into a set of smaller transactions or increasing the size of the rollback segments and their extents.

Score: ____________ Comment: ________________________________________________________

13. How can you tell if a database object is invalid?
Level: Low

Expected answer: By checking the status column of the DBA_, ALL_ or USER_OBJECTS views, depending upon whether you own or only have permission on the view or are using a DBA account.

Score: ____________ Comment: ________________________________________________________

14. A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check?
Level: Low

Expected answer: You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that points to the object (create synonym emp for scott.emp;)

Score: ____________ Comment: ________________________________________________________

15. A developer is trying to create a view and the database won’t let him. He has the “DEVELOPER” role which has the “CREATE VIEW” system privilege and SELECT grants on the tables he is using, what is the problem?
Level: Intermediate

Expected answer: You need to verify the developer has direct grants on all tables used in the view. You can’t create a stored object with grants given through views.

Score: ____________ Comment: ________________________________________________________

16. If you have an example table, what is the best way to get sizing data for the production table implementation?
Level: Intermediate

Expected answer: The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows.

Score: ____________ Comment: ________________________________________________________

17. How can you find out how many users are currently logged into the database? How can you find their operating system id?
Level: high

Expected answer: There are several ways. One is to look at the v$session or v$process views. Another way is to check the current_logins parameter in the v$sysstat view. Another if you are on UNIX is to do a “ps -ef|grep oracle|wc -l’ command, but this only works against a single instance installation.

Score: ____________ Comment: ________________________________________________________

18. A user selects from a sequence and gets back two values, his select is:

SELECT pk_seq.nextval FROM dual;

What is the problem?
Level: Intermediate

Expected answer: Somehow two values have been inserted into the dual table. This table is a single row, single column table that should only have one value in it.

Score: ____________ Comment: ________________________________________________________

19. How can you determine if an index needs to be dropped and rebuilt?
Level: Intermediate

Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn’t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio
BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

SQL/ SQLPlus

1. How can variables be passed to a SQL routine?
Level: Low

Expected answer: By use of the & symbol. For passing in variables the numbers 1-8 can be used (&1, &2,...,&8) to pass the values after the command into the SQLPLUS session. To be prompted for a specific variable, place the ampersanded variable in the code itself:
“select * from dba_tables where owner=&owner_name;” . Use of double ampersands tells SQLPLUS to resubstitute the value for each subsequent use of the variable, a single ampersand will cause a reprompt for the value unless an ACCEPT statement is used to get the value from the user.

Score: ____________ Comment: ________________________________________________________

2. You want to include a carriage return/linefeed in your output from a SQL script, how can you do this?
Level: Intermediate to high

Expected answer: The best method is to use the CHR() function (CHR(10) is a return/linefeed) and the concatenation function “||”. Another method, although it is hard to document and isn’t always portable is to use the return/linefeed as a part of a quoted string.

Score: ____________ Comment: ________________________________________________________

3. How can you call a PL/SQL procedure from SQL?
Level: Intermediate

Expected answer: By use of the EXECUTE (short form EXEC) command.

Score: ____________ Comment: ________________________________________________________

4. How do you execute a host operating system command from within SQL?
Level: Low

Expected answer: By use of the exclamation point “!” (in UNIX and some other OS) or the HOST (HO) command.

Score: ____________ Comment: ________________________________________________________

5. You want to use SQL to build SQL, what is this called and give an example
Level: Intermediate to high

Expected answer: This is called dynamic SQL. An example would be:

set lines 90 pages 0 termout off feedback off verify off
spool drop_all.sql
select ‘drop user ‘||username||’ cascade;’ from dba_users
where username not in (“SYS’,’SYSTEM’);
spool off

Essentially you are looking to see that they know to include a command (in this case DROP USER...CASCADE;) and that you need to concatenate using the ‘||’ the values selected from the database.

Score: ____________ Comment: ________________________________________________________

6. What SQLPlus command is used to format output from a select?
Level: low

Expected answer: This is best done with the COLUMN command.

Score: ____________ Comment: ________________________________________________________

7. You want to group the following set of select returns, what can you group on?

Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no
Level: Intermediate

Expected answer: The only column that can be grouped on is the “item_no” column, the rest have aggregate functions associated with them.

Score: ____________ Comment: ________________________________________________________

8. What special Oracle feature allows you to specify how the cost based system treats a SQL statement?
Level: Intermediate to high

Expected answer: The COST based system allows the use of HINTs to control the optimizer path selection. If they can give some example hints such as FIRST ROWS, ALL ROWS, USING INDEX, STAR, even better.

Score: ____________ Comment: ________________________________________________________

9. You want to determine the location of identical rows in a table before attempting to place a unique index on the table, how can this be done?
Level: High

Expected answer: Oracle tables always have one guaranteed unique column, the rowid column. If you use a min/max function against your rowid and then select against the proposed primary key you can squeeze out the rowids of the duplicate rows pretty quick. For example:

select rowid from emp e
where e.rowid > (select min(x.rowid)
from emp x
where x.emp_no = e.emp_no);

In the situation where multiple columns make up the proposed key, they must all be used in the where clause.

Score: ____________ Comment: ________________________________________________________

10. What is a Cartesian product?
Level: Low

Expected answer: A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join.

Score: ____________ Comment: ________________________________________________________

11. You are joining a local and a remote table, the network manager complains about the traffic involved, how can you reduce the network traffic?
Level: High

Expected answer: Push the processing of the remote data to the remote instance by using a view to pre-select the information for the join. This will result in only the data required for the join being sent across.

Score: ____________ Comment: ________________________________________________________

12. What is the default ordering of an ORDER BY clause in a SELECT statement?
Level: Low

Expected answer: Ascending

Score: ____________ Comment: ________________________________________________________

13. What is tkprof and how is it used?
Level: Intermediate to high

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

Score: ____________ Comment: ________________________________________________________

14. What is explain plan and how is it used?
Level: Intermediate to high

Expected answer: The EXPLAIN PLAN command is a tool to tune SQL statements. To use it you must have an explain_table generated in the user you are running the explain plan for. This is created using the utlxplan.sql script. Once the explain plan table exists you run the explain plan command giving as its argument the SQL statement to be explained. The explain_plan table is then queried to see the execution plan of the statement. Explain plans can also be run using tkprof.

Score: ____________ Comment: ________________________________________________________

15. How do you set the number of lines on a page of output? The width?
Level: Low

Expected answer: The SET command in SQLPLUS is used to control the number of lines generated per page and the width of those lines, for example SET PAGESIZE 60 LINESIZE 80 will generate reports that are 60 lines long with a line width of 80 characters. The PAGESIZE and LINESIZE options can be shortened to PAGES and LINES.

Score: ____________ Comment: ________________________________________________________

16. How do you prevent output from coming to the screen?
Level: Low

Expected answer: The SET option TERMOUT controls output to the screen. Setting TERMOUT OFF turns off screen output. This option can be shortened to TERM.

Score: ____________ Comment: ________________________________________________________

17. How do you prevent Oracle from giving you informational messages during and after a SQL statement execution?
Level: Low

Expected answer: The SET options FEEDBACK and VERIFY can be set to OFF.

Score: ____________ Comment: ________________________________________________________

18. How do you generate file output from SQL?
Level: Low

Expected answer: By use of the SPOOL command

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

Tuning Questions:

1. A tablespace has a table with 30 extents in it. Is this bad? Why or why not.
Level: Intermediate

Expected answer: Multiple extents in and of themselves aren’t bad. However if you also have chained rows this can hurt performance.

Score: ____________ Comment: ________________________________________________________

2. How do you set up tablespaces during an Oracle installation?
Level: Low

Expected answer: You should always attempt to use the Oracle Flexible Architecture standard or another partitioning scheme to ensure proper separation of SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments.

Score: ____________ Comment: ________________________________________________________

3. You see multiple fragments in the SYSTEM tablespace, what should you check first?
Level: Low

Expected answer: Ensure that users don’t have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view.

Score: ____________ Comment: ________________________________________________________

4. What are some indications that you need to increase the SHARED_POOL_SIZE parameter?
Level: Intermediate

Expected answer: Poor data dictionary or library cache hit ratios, getting error ORA-04031. Another indication is steadily decreasing performance with all other tuning parameters the same.

Score: ____________ Comment: ________________________________________________________

5. What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans?
Level: High

Expected answer: Oracle always reads in 64k chunks. The two should have a product equal to 64 or a multiple of 64.

Score: ____________ Comment: ________________________________________________________

6. What is the fastest query method for a table?
Level: Intermediate

Expected answer: Fetch by rowid

Score: ____________ Comment: ________________________________________________________

7. Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?
Level: High

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

Score: ____________ Comment: ________________________________________________________

8. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?
Level: Intermediate

Expected answer: If you get excessive disk sorts this is bad. This indicates you need to tune the sort area parameters in the initialization files. The major sort are parameter is the SORT_AREA_SIZe parameter.

Score: ____________ Comment: ________________________________________________________

9. When should you increase copy latches? What parameters control copy latches?
Level: high

Expected answer: When you get excessive contention for the copy latches as shown by the “redo copy” latch hit ratio. You can increase copy latches via the initialization parameter LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system.

Score: ____________ Comment: ________________________________________________________

10. Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed?
Level: Low

Expected answer: You can look in the init.ora file for an indication of manually set parameters. For all parameters, their value and whether or not the current value is the default value, look in the v$parameter view.

Score: ____________ Comment: ________________________________________________________

11. 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?
Level: Intermediate

Expected answer: 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 disks. A value greater than 80-90% is good, less could indicate problems. If you simply take the ratio of existing parameters this will be a cumulative value since the database started. If you do a comparison between pairs of readings based on some arbitrary time span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over.

Score: ____________ Comment: ________________________________________________________

12. Discuss row chaining, how does it happen? How can you reduce it? How do you correct it?
Level: high

Expected answer: Row chaining occurs when a VARCHAR2 value is updated and the length of the new value is longer than the old value and won’t fit in the remaining block space. This results in the row chaining to another block. It can be reduced by setting the storage parameters on the table to appropriate values. It can be corrected by export and import of the effected table.

Score: ____________ Comment: ________________________________________________________

13. When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it?
Level: high

Expected answer: Buffer busy waits could indicate contention in redo, rollback or data blocks. You need to check the v$waitstat view to see what areas are causing the problem. The value of the “count” column tells where the problem is, the “class” column tells you with what. UNDO is rollback segments, DATA is data base buffers.

Score: ____________ Comment: ________________________________________________________

14. If you see contention for library caches how can you fix it?
Level: Intermediate

Expected answer: Increase the size of the shared pool.

Score: ____________ Comment: ________________________________________________________

15. If you see statistics that deal with “undo” what are they really talking about?
Level: Intermediate

Expected answer: Rollback segments and associated structures.

Score: ____________ Comment: ________________________________________________________

16. If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)?
Level: High

Expected answer: The SMON process won’t automatically coalesce its free space fragments.

Score: ____________ Comment: ________________________________________________________

17. If a tablespace shows excessive fragmentation what are some methods to defragment the tablespace? (7.1,7.2 and 7.3 only)
Level: High

Expected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate trace name coalesce level ts#';’ command is the easiest way to defragment contiguous free space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ‘alter tablespace coalesce;’ is best. If the free space isn’t contiguous then export, drop and import of the tablespace contents may be the only way to reclaim non-contiguous free space.

Score: ____________ Comment: ________________________________________________________

18. How can you tell if a tablespace has excessive fragmentation?
Level: Intermediate

If a select against the dba_free_space table shows that the count of a tablespaces extents is greater than the count of its data files, then it is fragmented.

Score: ____________ Comment: ________________________________________________________

19. You see the following on a status report:

redo log space requests 23
redo log space wait time 0

Is this something to worry about? What if redo log space wait time is high? How can you fix this?
Level: Intermediate

Expected answer: Since the wait time is zero, no. If the wait time was high it might indicate a need for more or larger redo logs.

Score: ____________ Comment: ________________________________________________________

20. What can cause a high value for recursive calls? How can this be fixed?
Level: High

Expected answer: A high value for recursive calls is cause by improper cursor usage, excessive dynamic space management actions, and or excessive statement re-parses. You need to determine the cause and correct it By either relinking applications to hold cursors, use proper space management techniques (proper storage and sizing) or ensure repeat queries are placed in packages for proper reuse.

Score: ____________ Comment: ________________________________________________________

21. If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it?
Level: Intermediate

Expected answer: This indicate that the shared pool may be too small. Increase the shared pool size.

Score: ____________ Comment: ________________________________________________________

22. If you see the value for reloads is high in the estat library cache report is this a matter for concern?
Level: Intermediate

Expected answer: Yes, you should strive for zero reloads if possible. If you see excessive reloads then increase the size of the shared pool.

Score: ____________ Comment: ________________________________________________________

23. You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem?
Level: High

Expected answer: A large number of small shrinks indicates a need to increase the size of the rollback segment extents. Ideally you should have no shrinks or a small number of large shrinks. To fix this just increase the size of the extents and adjust optimal accordingly.

Score: ____________ Comment: ________________________________________________________

24. You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem?
Level: High

Expected answer: A large number of wraps indicates that your extent size for your rollback segments are probably too small. Increase the size of your extents to reduce the number of wraps. You can look at the average transaction size in the same view to get the information on transaction size.

Score: ____________ Comment: ________________________________________________________

25. In a system with an average of 40 concurrent users you get the following from a query on rollback extents:

ROLLBACK CUR EXTENTS
---------- -----------
R01 11
R02 8
R03 12
R04 9
SYSTEM 4

You have room for each to grow by 20 more extents each. Is there a problem? Should you take any action?
Level: Intermediate

Expected answer: No there is not a problem. You have 40 extents showing and an average of 40 concurrent users. Since there is plenty of room to grow no action is needed.

Score: ____________ Comment: ________________________________________________________

26. You see multiple extents in the temporary tablespace. Is this a problem?
Level: Intermediate

Expected answer: As long as they are all the same size this isn’t a problem. In fact, it can even improve performance since Oracle won’t have to create a new extent when a user needs one.

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

Installation/Configuration

1. Define OFA.
Level: Low

Expected answer: OFA stands for Optimal Flexible Architecture. It is a method of placing directories and files in an Oracle system so that you get the maximum flexibility for future tuning and file placement.

Score: ____________ Comment: ________________________________________________________

2. How do you set up your tablespace on installation?
Level: Low

Expected answer: The answer here should show an understanding of separation of redo and rollback, data and indexes and isolation os SYSTEM tables from other tables. An example would be to specify that at least 7 disks should be used for an Oracle installation so that you can place SYSTEM tablespace on one, redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another, ROLLBACK tablespace on another and still have two for DATA and INDEXES. They should indicate how they will handle archive logs and exports as well. As long as they have a logical plan for combining or further separation more or less disks can be specified.

Score: ____________ Comment: ________________________________________________________

3. What should be done prior to installing Oracle (for the OS and the disks)?
Level: Low

Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with installation guide. Be sure enough contiguous disk space is available.

Score: ____________ Comment: ________________________________________________________

4. You have installed Oracle and you are now setting up the actual instance. You have been waiting an hour for the initialization script to finish, what should you check first to determine if there is a problem?
Level: Intermediate to high

Expected Answer: Check to make sure that the archiver isn’t stuck. If archive logging is turned on during install a large number of logs will be created. This can fill up your archive log destination causing Oracle to stop to wait for more space.

Score: ____________ Comment: ________________________________________________________

5. When configuring SQLNET on the server what files must be set up?
Level: Intermediate

Expected answer: INITIALIZATION file, TNSNAMES.ORA file, SQLNET.ORA file

Score: ____________ Comment: ________________________________________________________

6. When configuring SQLNET on the client what files need to be set up?
Level: Intermediate

Expected answer: SQLNET.ORA, TNSNAMES.ORA

Score: ____________ Comment: ________________________________________________________

7. What must be installed with ODBC on the client in order for it to work with Oracle?
Level: Intermediate

Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the transport programs.

Score: ____________ Comment: ________________________________________________________

8. You have just started a new instance with a large SGA on a busy existing server. Performance is terrible, what should you check for?
Level: Intermediate

Expected answer: The first thing to check with a large SGA is that it isn’t being swapped out.

Score: ____________ Comment: ________________________________________________________

9. What OS user should be used for the first part of an Oracle installation (on UNIX)?
Level: low

Expected answer: You must use root first.

Score: ____________ Comment: ________________________________________________________

10. When should the default values for Oracle initialization parameters be used as is?
Level: Low

Expected answer: Never

Score: ____________ Comment: ________________________________________________________

11. How many control files should you have? Where should they be located?
Level: Low

Expected answer: At least 2 on separate disk spindles. Be sure they say on separate disks, not just file systems.

Score: ____________ Comment: ________________________________________________________

12. How many redo logs should you have and how should they be configured for maximum recoverability?
Level: Intermediate

Expected answer: You should have at least three groups of two redo logs with the two logs each on a separate disk spindle (mirrored by Oracle). The redo logs should not be on raw devices on UNIX if it can be avoided.

Score: ____________ Comment: ________________________________________________________

13. You have a simple application with no “hot” tables (i.e. uniform IO and access requirements). How many disks should you have assuming standard layout for SYSTEM, USER, TEMP and ROLLBACK tablespaces?

Expected answer: At least 7, see disk configuration answer above.

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

Data Modeler:

1. Describe third normal form?
Level: Low

Expected answer: Something like: In third normal form all attributes in an entity are related to the primary key and only to the primary key

Score: ____________ Comment: ________________________________________________________

2. Is the following statement true or false:

“All relational databases must be in third normal form”

Why or why not?
Level: Intermediate

Expected answer: False. While 3NF is good for logical design most databases, if they have more than just a few tables, will not perform well using full 3NF. Usually some entities will be denormalized in the logical to physical transfer process.

Score: ____________ Comment: ________________________________________________________

3. What is an ERD?
Level: Low

Expected answer: An ERD is an Entity-Relationship-Diagram. It is used to show the entities and relationships for a database logical model.

Score: ____________ Comment: ________________________________________________________

4. Why are recursive relationships bad? How do you resolve them?
Level: Intermediate

A recursive relationship (one where a table relates to itself) is bad when it is a hard relationship (i.e. neither side is a “may” both are “must”) as this can result in it not being possible to put in a top or perhaps a bottom of the table (for example in the EMPLOYEE table you couldn’t put in the PRESIDENT of the company because he has no boss, or the junior janitor because he has no subordinates). These type of relationships are usually resolved by adding a small intersection entity.

Score: ____________ Comment: ________________________________________________________

5. What does a hard one-to-one relationship mean (one where the relationship on both ends is “must”)?
Level: Low to intermediate

Expected answer: This means the two entities should probably be made into one entity.

Score: ____________ Comment: ________________________________________________________

6. How should a many-to-many relationship be handled?
Level: Intermediate

Expected answer: By adding an intersection entity table

Score: ____________ Comment: ________________________________________________________

7. What is an artificial (derived) primary key? When should an artificial (or derived) primary key be used?
Level: Intermediate

Expected answer: A derived key comes from a sequence. Usually it is used when a concatenated key becomes too cumbersome to use as a foreign key.

Score: ____________ Comment: ________________________________________________________

8. When should you consider denormalization?
Level: Intermediate

Expected answer: Whenever performance analysis indicates it would be beneficial to do so without compromising data integrity.

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

UNIX:

1. How can you determine the space left in a file system?
Level: Low

Expected answer: There are several commands to do this: du, df, or bdf

Score: ____________ Comment: ________________________________________________________

2. How can you determine the number of SQLNET users logged in to the UNIX system?
Level: Intermediate

Expected answer: SQLNET users will show up with a process unique name that begins with oracle, if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users.

Score: ____________ Comment: ________________________________________________________

3. What command is used to type files to the screen?
Level: Low

Expected answer: cat, more, pg

Score: ____________ Comment: ________________________________________________________

4. What command is used to remove a file?
Level: Low

Expected answer: rm

Score: ____________ Comment: ________________________________________________________

5. Can you remove an open file under UNIX?
Level: Low

Expected answer: yes

Score: ____________ Comment: ________________________________________________________

6. How do you create a decision tree in a shell script?
Level: intermediate

Expected answer: depending on shell, usually a case-esac or an if-endif or fi structure

Score: ____________ Comment: ________________________________________________________

7. What is the purpose of the grep command?
Level: Low

Expected answer: grep is a string search command that parses the specified string from the specified file or files

Score: ____________ Comment: ________________________________________________________

8. The system has a program that always includes the word nocomp in its name, how can you determine the number of processes that are using this program?
Level: intermediate

Expected answer: ps -ef|grep *nocomp*|wc -l

Score: ____________ Comment: ________________________________________________________

9. What is an inode?
Level: Intermediate

Expected answer: an inode is a file status indicator. It is stored in both disk and memory and tracts file status. There is one inode for each file on the system.

Score: ____________ Comment: ________________________________________________________

10. The system administrator tells you that the system hasn’t been rebooted in 6 months, should he be proud of this?
Level: High

Expected answer: Maybe. Some UNIX systems don’t clean up well after themselves. Inode problems and dead user processes can accumulate causing possible performance and corruption problems. Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out.

Score: ____________ Comment: ________________________________________________________

11. What is redirection and how is it used?
Level: Intermediate

Expected answer: redirection is the process by which input or output to or from a process is redirected to another process. This can be done using the pipe symbol “|”, the greater than symbol “>“ or the “tee” command. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command.

Score: ____________ Comment: ________________________________________________________

12. How can you find dead processes?
Level: Intermediate

Expected answer: ps -ef|grep zombie -- or -- who -d depending on the system.

Score: ____________ Comment: ________________________________________________________

13. How can you find all the processes on your system?
Level: Low

Expected answer: Use the ps command

Score: ____________ Comment: ________________________________________________________

14. How can you find your id on a system?
Level: Low

Expected answer: Use the “who am i” command.

Score: ____________ Comment: ________________________________________________________

15. What is the finger command?
Level: Low

Expected answer: The finger command uses data in the passwd file to give information on system users.

Score: ____________ Comment: ________________________________________________________

16. What is the easiest method to create a file on UNIX?
Level: Low

Expected answer: Use the touch command

Score: ____________ Comment: ________________________________________________________

17. What does >> do?
Level: Intermediate

Expected answer: The “>>“ redirection symbol appends the output from the command specified into the file specified. The file must already have been created.

Score: ____________ Comment: ________________________________________________________


18. If you aren’t sure what command does a particular UNIX function what is the best way to determine the command?

Expected answer: The UNIX man -k command will search the man pages for the value specified. Review the results from the command to find the command of interest.

Score: ____________ Comment: ________________________________________________________

Section average score: __________________________________ Level: __________________________

Oracle Troubleshooting:

1. How can you determine if an Oracle instance is up from the operating system level?
Level: Low

Expected answer: There are several base Oracle processes that will be running on multi-user operating systems, these will be smon, pmon, dbwr and lgwr. Any answer that has them using their operating system process showing feature to check for these is acceptable. For example, on UNIX a ps -ef|grep dbwr will show what instances are up.

Score: ____________ Comment: ________________________________________________________

2. Users from the PC clients are getting messages indicating :
Level: Low

ORA-06114: (Cnct err, can't get err txt. See Servr Msgs & Codes Manual)

What could the problem be?

Expected answer: The instance name is probably incorrect in their connection string.

Score: ____________ Comment: ________________________________________________________

3. Users from the PC clients are getting the following error stack:
Level: Low

ERROR: ORA-01034: ORACLE not available
ORA-07318: smsget: open error when opening sgadef.dbf file.
HP-UX Error: 2: No such file or directory

What is the probable cause?

Expected answer: The Oracle instance is shutdown that they are trying to access, restart the instance.

Score: ____________ Comment: ________________________________________________________

4. How can you determine if the SQLNET process is running for SQLNET V1? How about V2?
Level: Low

Expected answer: For SQLNET V1 check for the existence of the orasrv process. You can use the command “tcpctl status” to get a full status of the V1 TCPIP server, other protocols have similar command formats. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command “lsnrctl status”.

Score: ____________ Comment: ________________________________________________________

5. What file will give you Oracle instance status information? Where is it located?
Level: Low

Expected answer: The alert.ora log. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table.

6. Users aren’t being allowed on the system. The following message is received:
Level: Intermediate

ORA-00257 archiver is stuck. Connect internal only, until freed

What is the problem?

Expected answer: The archive destination is probably full, backup the archive logs and remove them and the archiver will re-start.

Score: ____________ Comment: ________________________________________________________

7. Where would you look to find out if a redo log was corrupted assuming you are using Oracle mirrored redo logs?
Level: Intermediate

Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs during startup in this situation, you must check the alert.log file for this information.

Score: ____________ Comment: ________________________________________________________

8. You attempt to add a datafile and get:
Level: Intermediate

ORA-01118: cannot add anymore datafiles: limit of 40 exceeded

What is the problem and how can you fix it?

Expected answer: When the database was created the db_files parameter in the initialization file was set to 40. You can shutdown and reset this to a higher value, up to the value of MAX_DATAFILES as specified at database creation. If the MAX_DATAFILES is set to low, you will have to rebuild the control file to increase it before proceeding.

Score: ____________ Comment: ________________________________________________________

9. You look at your fragmentation report and see that smon hasn’t coalesced any of you tablespaces, even though you know several have large chunks of contiguous free extents. What is the problem?
Level: High

Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. If pct_increase is zero, smon will not coalesce their free space.


Score: ____________ Comment: ________________________________________________________

10. Your users get the following error:
Level: Intermediate

ORA-00055 maximum number of DML locks exceeded

What is the problem and how do you fix it?

Expected answer: The number of DML Locks is set by the initialization parameter DML_LOCKS. If this value is set to low (which it is by default) you will get this error. Increase the value of DML_LOCKS. If you are sure that this is just a temporary problem, you can have them wait and then try again later and the error should clear.

Score: _________ Comment: ________________________________________________________

11. You get a call from you backup DBA while you are on vacation. He has corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. What do you do?
Level: High
Expected answer: As long as all datafiles are safe and he was successful with the BACKUP controlfile command you can do the following:

CONNECT INTERNAL
STARTUP MOUNT
(Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE .... OFFLINE;)
RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
(bring read-only tablespaces back online)

Shutdown and backup the system, then restart

If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE; command, they can use that to recover as well.

If no backup of the control file is available then the following will be required:

CONNECT INTERNAL
STARTUP NOMOUNT
CREATE CONTROL FILE .....;

However, they will need to know all of the datafiles, logfiles, and settings for MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES for the database to use the command.

Score: __________ Comment: ________________________________________________________

Section average score: ______________________________ Level: __________________________



Interview average score: _____________________________ Level: _________________________


Comments:



Find more oracle material at http://download.35mb.com/kvreddy83

Oracle Developer 2k

Please find good oracle material @ http://download.35mb.com/kvreddy83





Alert : An alert is a modal window that displays a message notifying the operator of some application condition.
There are three styles of alerts: Stop, Caution, and Note

Attach Library: Attached library object

This object is a read-only library module that represents a collection of subprograms, including user-named procedures, functions, and packages, that can be called from other modules in the application.

Object group:

An object group is a container for a group of objects. You define an object group when you want to package related objects so you can copy or subclass them in another module.
Object groups provide a way to bundle objects into higher-level building blocks that can be used in other parts of an application and in subsequent development projects.
For example, you might build an appointment scheduler in a form and then decide to make it available from other forms in your applications. The scheduler would probably be built from several types of objects, including a window and canvas, blocks, and items that display dates and appointments, and triggers that contain the logic for scheduling and other functionality. If you packaged these objects into an object group, you could then copy them to any number of other forms in one simple operation.

You can create object groups in form and menu modules. Once you create an object group, you can add and remove objects to it as desired.

Object Library: n any development environment, you will always have standards to which you want your developers to adhere as well as common objects which can be reused throughout the development effort.
The Object Library provides an easy method of reusing objects and enforcing standards across the entire development organization.
You can use the Object Library to:

n create, store, maintain, and distribute standard and reusable objects.

n rapidly create applications by dragging and dropping predefined objects to your form.

There are several advantages to using object libraries to develop applications:

n Object libraries are automatically re-opened when you startup Form Builder, making your reusable objects immediately accessible.

n You can associate multiple object libraries with an application. For example, you can create an object library specfically for corporate standards, and you can create an object library to satisfy project-specific requirements.

n Object libraries feature SmartClasses-- objects that you define as being the standard. You use SmartClasses to convert objects to standard objects.

A property class is a named object that contains a list of properties and their settings. Once you create a property class you can base other objects on it. An object based on a property class can inherit the setting of any property in the class that makes sense for that object.

Property class inheritance is an instance of subclassing. Conceptually, you can consider a property class as a universal subclassing parent.
There can be any number of properties in a property class, and the properties in a class can apply to different types of objects. For example, a property class might contain some properties that are common to all types of items, some that apply only to text items, and some that apply only to check boxes.


When you base an object on a property class, you have complete control over which properties the object should inherit from the class, and which should be overridden locally.

Property classes are separate objects, and, as such, can be copied between modules as needed. Perhaps more importantly, property classes can be subclassed in any number of modules.


Visual attributes are the font, color, and pattern properties that you set for form and menu objects that appear in your application's interface. Visual attributes can include the following properties:

n Font properties: Font Name, Font Size, Font Style, Font Width, Font Weight

n Color and pattern properties: Foreground Color, Background Color, Fill Pattern, Charmode Logical Attribute, White on Black

Every interface object has a Visual Attribute Group property that determines how the object's individual visual attribute settings (Font Size, Foreground Color, etc.) are derived. The Visual Attribute Group property can be set to Default, NULL, or the name of a named visual attribute defined in the same module.
There are several ways to set the visual attributes of objects:

n In the Property Palette, set the Visual Attribute Group property as desired, then set the individual attributes (Font Name, Foreground Color, etc.) to the desired settings.

n In the Layout Editor, select an item or a canvas and then choose the desired font, color, and pattern attributes from the Font dialog and Fill Color and Text Color palettes.

n Define a named visual attribute object with the appropriate font, color, and pattern settings and then apply it to one or more objects in the same module. You can programmatically change an object's named visual attribute setting to change the font, color, and pattern of the object at runtime.

n Subclass a visual attribute that includes visual attribute properties and then base objects on it that inherit those properties.

n Create a property class that includes visual attribute properties and then base objects on it that inherit those properties.

A ref cursor is a pointer to a server-side cursor variable. It is analogous to a pointer in "C" in that it is an address to a location in memory. The stored procedure returns a reference to a cursor that is open and populated by a SELECT statement to be used as a block datasource.

A stored procedure that uses a reference cursor can only be used as a query block datasource; it cannot be used for DML block datasource. Using a ref cursor is ideal for queries that are dependent only on variations in SQL statements and not PL/SQL.

When deciding whether to use a ref cursor or a table of records, consider that:

n a stored procedure that uses a ref cursor can only be used as a query block datasource

n a stored procedure that uses a table of records can be used as both a query and DML block datasource
PL/SQL Library:
This PL/SQL library contains a function to write out the contents of a block.

TRIGGER:

Form Builder recognizes a predefined set of runtime events, each of which has a corresponding built in trigger. When you add code to an application by writing a trigger, it is important to decide what event should fire the trigger. The event you choose determines the name assigned to the trigger.
Interface Events

When selecting triggers, it is important to understand precisely when events occur, both in relation to other events, and in relation to form processing. Some events are external interface events, and their occurrence is immediately apparent. Examples of such events, and their corresponding triggers, include the following:

Event Trigger Name
Pressing a button When-Button-Pressed
Clicking a check box When-Checkbox-Changed
Pressing the Tab key KEY-FN
Internal Processing Events

Internal events occur as a result of runtime processing. These events occur according to the Form Builder processing model.
Consider a form with two blocks, Block A and Block B, with text items in each block. On GUI platforms, operators can move the input focus from a text item in Block A to a text item in Block B by clicking the target item with a mouse. Although this operation involves only one interface action (the mouse-click in the target item), it actually sets off a series of internal processing events, each of which has one or more corresponding triggers:





Event Trigger Name
Validate the item When -Validate-Item
Leave the item Post -Text-Item
Validate the record - When-Validate-Record
Leave the record Post -Record
Leave the block Post -Block
Enter the block Pre -Block
Enter the record Pre -Record
Enter the Item Pre-Text-Item
Ready block for input When-New-Block-Instance
Ready record for input When-New-Record-Instance
Ready item for input When-New-Item-Instance

It is important to understand that navigational events such as "Leave the Item" and "Enter the Block" occur as a result of internal form processing navigation. These events occur as Form Builder validates data in the form and "navigates" through the object hierarchy to move from one item to another.

In the example, to move the input focus from a source item in one block to a target item in another, Form Builder first validates the value in the source item, then "enters the record" to validate all of the items in the record, then leaves the record and "enters the block," and so on, finally ending up in the target item.

The Form Builder processing model enforces the integrity of data at the item, record, block, and form level. The rich assortment of events to which can be responded with trigger code gives complete control over every aspect of an application.

Processes and Sub-Processes

A process is a series of individual, related events that occurs during a specific Form Builder Runform operation. The previous example described a navigational process. Other processes involve validation and database transactions. For example, the Post and Commit Transaction process includes a complex series of events and sub-processes.

Difference between POST-QUERY/PRE-QUERY:

Query-time triggers fire just before and just after the operator or the application executes a query in a block.

Trigger Typical Usage
Pre-Query Validate the current query criteria or provide additional query criteria programmatically, just before sending the SELECT statement to the database.
Post-Query Perform an action after fetching a record, such as looking up values in other tables based on a value in the current record. Fires once for each record fetched into the block.

Navigational triggers fire in response to navigational events. For instance, when the operator clicks on a text item in another block, navigational events occur as Form Builder moves the input focus from the current item to the target item.
Navigational events occur at different levels of the Form Builder object hierarchy (Form, Block, Record, Item). Navigational triggers can be further sub-divided into two categories: Pre- and Post- triggers, and When-New-Instance triggers.

Pre- and Post- Triggers fire as Form Builder navigates internally through different levels of the object hierarchy. As you might expect, these triggers fire in response to navigation initiated by an operator, such as pressing the [Next Item] key. However, be aware that these triggers also fire in response to internal navigation that Form Builder performs during default processing. To avoid unexpected results, you must consider such internal navigation when you use these triggers.






Trigger Typical Usage
Pre-Form Perform an action just before Form Builder navigates to the form from "outside" the form, such as at form startup.

Pre-Block Perform an action before Form Builder navigates to the block level from the form level.

Pre-Record Perform an action before Form Builder navigates to the record level from the block level.

Pre-Text-Item Perform an action before Form Builder navigates to a text item from the record level.

Post-Text-Item Manipulate an item when Form Builder leaves a text item and navigates to the record level.

Post-Record Manipulate a record when Form Builder leaves a record and navigates to the block level.

Post-Block Manipulate the current record when Form Builder leaves a block and navigates to the form level.

Post-Form Perform an action before Form Builder navigates to "outside" the form, such as when exiting the form.

When-New-Instance-Triggers fire at the end of a navigational sequence that places the input focus on a different item. Specifically, these triggers fire just after Form Builder moves the input focus to a different item, when the form returns to a quiet state to wait for operator input.

Unlike the Pre- and Post- navigational triggers, the When-New-Instance triggers do not fire in response to internal navigational events that occur during default form processing.

Trigger Typical Usage
When-New-Form-Instance Perform an action at form start-up. (Occurs after the Pre-Form trigger fires).

When-New-Block-Instance Perform an action immediately after the input focus moves to an item in a block other than the block that previously had input focus.

When-New-Record-Instance Perform an action immediately after the input focus moves to an item in a different record. If the new record is in a different block, fires after the When-New-Block-Instance trigger, but before the When-New-Item-Instance trigger.

When-New-Item-Instance Perform an action immediately after the input focus moves to a different item. If the new item is in a different block, fires after the When-New-Block-Instance trigger.

Transactional triggers fire in response to a wide variety of events that occur as a form interacts with the data source.

Trigger Typical Usage
On-Delete Replace the default Form Builder processing for handling deleted records during transaction posting.

On-Insert Replace the default Form Builder processing for handling inserted records during transaction posting.

On-Lock Replace the default Form Builder processing for locking rows in the database.

On-Logon Replace the default Form Builder processing for connecting to ORACLE, especially for a form that does not require a database connection or for connecting to a non-ORACLE data source.

On-Logout Replace the default Form Builder processing for logout from ORACLE.

On-Update Replace the default Form Builder processing for handling updated records during transaction posting.

Post-Database-Commit Augment default Form Builder processing following a database commit.

Post-Delete Audit transactions following the deletion of a row from the database.

Post-Forms-Commit Augment the default Form Builder commit statement prior to committing a transaction.

Post-Insert Audit transactions following the insertion of a row in the database.

Post-Update Audit transactions following the updating of a row in the database.

Pre-Commit Perform an action immediately before the Post and Commit Transactions process, when Form Builder determines that there are changes in the form to post or to commit.

Pre-Delete Manipulate a record prior to its being deleted from the database during the default Post and Commit Transactions process; for example, to prevent deletion of the record if certain conditions exist.

Pre-Insert Manipulate a record prior to its being inserted in the database during the default Post and Commit Transactions process.

Pre-Update Validate or modify a record prior to its being updated in the database during the default Post and Commit Transactions process.

Note: This is only a partial list of the transactional triggers available. Many of the triggers not shown here are On-event triggers that exist primarily for applications that will run against a non-ORACLE data source.


Form Builder provides the following predefined packages:

Standard Extensions The STANDARD Extensions package contains Form Builder built-in procedures and functions.


TOOL_ENV The TOOL_ENV package allows you to interact with Oracle environment variables.

ORA_NLS The ORA_NLS package enables you to extract high-level information about your current language environment.

TOOL_RES The TOOL_RES package allows you to extract string resources from a resource file.

ORA_FFI The ORA_FFI package allows you to access foreign (3GL) functions.

ORA_DE The ORA_DE is an internal package. Do not use this package.

STPROC The STPROC is an internal package. Do not use this package.

TEXT_IO The TEXT_IO package allows you to read and write information to a file in the file system.

PECS The PECS package allows you to evaluate form performance.

FORMS_OLE The FORMS_OLE package contains Form Builder OLE functions and procedures.

VBX The VBX package contains Form Builder VBX functions and procedures.

Standard The Standard package contains PL/SQL procedures and functions.

Note: PL/SQL also offers some supplied packages, and those procedures can be called from within PL/SQL code in a Forms application. However, any such procedure with a name beginning DBMS_ is available only on the server (not on the client).


Master-Detail Triggers:
Form Builder generates master/detail triggers automatically when a master/detail relation is defined between blocks. The default master/detail triggers enforce coordination between records in a detail block and the master record in a master block. Unless developing custom block-coordination schemes, you do not need to define these triggers. Instead, simply create a relation object, and let Form Builder generate the triggers required to manage coordination between the master and detail blocks in the relation.

Trigger Typical Usage

On-Check-Delete-Master Fires when Form Builder attempts to delete a record in a block that is a master block in a master/detail relation.

On-Clear-Details Fires when Form Builder needs to clear records in a block that is a detail block in a master/detail relation because those records no longer correspond to the current record in the master block.

On-Populate-Details Fires when Form Builder needs to fetch records into a block that is the detail block in a master/detail relation so that detail records are synchronized with the current record in the master block.

Message -Handling Triggers:
orm Builder automatically issues appropriate error and informational messages in response to runtime events. Message handling triggers fire in response to these default messaging events.

Trigger Typical Usage
On-Error Replace a default error message with a custom error message, or to trap and recover from an error.
On-Message To trap and respond to a message; for example, to replace a default message issued by Form Builder with a custom message.



REPORT



FLEX MODE :

On: child objects cannot be moved outside their enclosing parent objects.
Off: child objects can be moved outside their enclosing parent objects.

A placeholder is a column for which you set the datatype and value in PL/SQL that you define. You can set the value of a placeholder column in the following places:

n the Before Report Trigger, if the placeholder is a report-level column

n a report-level formula column, if the placeholder is a report-level column

n a formula in the placeholder's group or a group below it (the value is set once for each record of the group)

A formula column performs a user-defined computation on another column(s) data, including placeholder columns. Note

A summary column performs a computation on another column's data. Using the Report Wizard or Data Wizard, you can create the following summaries: sum, average, count, minimum, maximum, % total. You can also create a summary column manually in the Data Model view, and use the Property Palette to create the following additional summaries: first, last, standard deviation, variance.
Note: For group reports, the Report Wizard and Data Wizard create n summary fields in the data model for each summary column you define: one at each group level above the column being summarized, and one at the report level. For example, if a report is grouped by division, and further grouped by department, then a summary column defined for a salary total would create fields for the sum of salaries for each division and each department group (group-level summaries), and the sum of all salaries (report-level summary).

SYTEM PARAMETER:

BACKGROUND Is whether the report should run in the foreground or the background.
COPIES Is the number of report copies that should be made when the report is printed.

CURRENCY Is the symbol for the currency indicator (e.g., "$").

DECIMAL Is the symbol for the decimal indicator (e.g., ".").

DESFORMAT Is the definition of the output device's format (e.g., landscape mode for a printer). This parameter is used when running a report in a character-mode environment, and when sending a bitmap report to a file (e.g. to create PDF or HTML output).

DESNAME Is the name of the output device (e.g., the file name, printer's name, mail userid).

DESTYPE Is the type of device to which to send the report output (screen, file, mail, printer, or screen using PostScript format).

MODE Is whether the report should run in character mode or bitmap.

ORIENTATION Is the print direction for the report (landscape, portrait, default).

PRINTJOB Is whether the Print Job dialog box should appear before the report is run.

THOUSANDS Is the symbol for the thousand's indicator (e.g., ",").

DATA LINK:

Data links relate the results of multiple queries. A data link (or parent-child relationship) causes the child query to be executed once for each instance of its parent group. When you create a data link in the Data Model view of your report, Report Builder constructs a clause (as specified in the link's Property Palette) that will be added to the child query's SELECT statement at runtime. You can view the SELECT statements for the individual parent and child queries in the Builder, but can not view the SELECT statement that includes the clause created by the data link you define.

General rule, any processing that will affect the data retrieved by the report should be performed in the Before Parameter Form or After Parameter Form triggers. (These are the two report triggers that fire before anything is parsed or fetched.) Any processing that will not affect the data retrieved by the report can be performed in the other triggers.

Report Builder has five global report triggers. You cannot create new global report triggers. The trigger names indicate at what point the trigger fires:

Before Report Fires before the report is executed but after queries are parsed.

After Report Fires after you exit the Previewer, or after report output is sent to a specified destination, such as a file, a printer, or an Oracle Office userid. This trigger can be used to clean up any initial processing that was done, such as deleting tables. Note, however, that this trigger always fires, whether or not your report completed successfully.

Between Pages Fires before each page of the report is formatted, except the very first page. This trigger can be used for customized page formatting. In the Previewer, this trigger only fires the first time that you go to a page. If you subsequently return to the page, the trigger does not fire again.

Before Parameter Form Fires before the Runtime Parameter Form is displayed. From this trigger, you can access and change the values of parameters, PL/SQL global variables, and report-level columns. If the Runtime Parameter Form is suppressed, this trigger still fires. Consequently, you can use this trigger for validation of command line parameters.

After Parameter Form Fires after the Runtime Parameter Form is displayed. From this trigger, you can access parameters and check their values. This trigger can also be used to change parameter values or, if an error occurs, return to the Runtime Parameter Form. Columns from the data model are not accessible from this trigger. If the Runtime Parameter Form is suppressed, the After Parameter Form trigger still fires. Consequently, you can use this trigger for validation of command line parameters or other data.

Matrix Report:
A matrix (crosstab) report contains one row of labels, one column of labels, and information in a grid format that is related to the row and column labels. A distinguishing feature of matrix reports is that the number of columns is not known until the data is fetched from the database.
To create a matrix report, you need at least four groups: one group must be a cross-product group, two of the groups must be within the cross-product group to furnish the "labels," and at least one group must provide the information to fill the cells. The groups can belong to a single query or to multiple queries.

EF CODD Rules

Codd's 12 Rules

DATA MANAGEMENT STRATEGIES

Dr. E.F. Codd, an IBM researcher, first developed the relational data model in 1970. In 1985, Dr. Codd published a list of 12 rules that concisely define an ideal relational database, which have provided a guideline for the design of all relational database systems ever since. I use the term "guideline" because, to date, no commercial relational database system fully conforms to all 12 rules. They do represent the relational ideal, though. For a few years, scorecards were kept that rated each commercial product's conformity to Codd's rules. Today, the rules are not talked about as much but remain a goal for relational database design. Following is a list of Codd's 12 rules, including his original name for each rule and a simplified description. I also have included a note where certain rules are problematic to implement. Don't worry if some of these items are confusing to you, as we move further through this newsletter series we will fill in the details.

Rule 1: The Information Rule: All data should be presented to the user in table form. Last week's newsletter already discussed the basics of this rule.

Rule 2: Guaranteed Access Rule: All data should be accessible without ambiguity. This can be accomplished through a combination of the table name, primary key, and column name.

Rule 3: Systematic Treatment of Null Values: A field should be allowed to remain empty. This involves the support of a null value, which is distinct from an empty string or a number with a value of zero. Of course, this can't apply to primary keys. In addition, most database implementations support the concept of a nun- null field constraint that prevents null values in a specific table column.

Rule 4: Dynamic On-Line Catalog Based on the Relational Model A relational database must provide access to its structure through the same tools that are used to access the data. This is usually accomplished by storing the structure definition within special system tables.

Rule 5: Comprehensive Data Sublanguage Rule: The database must support at least one clearly defined language that includes functionality for data definition, data manipulation, data integrity, and database transaction control. All commercial relational databases use forms of the standard SQL (Structured Query Language) as their supported comprehensive language.

Rule 6: View Updating Rule: Data can be presented to the user in different logical combinations, called views. Each view should support the same full range of data manipulation that direct-access to a table has available. In practice, providing update and delete access to logical views is difficult and is not fully supported by any current database.

Rule 7: High-level Insert, Update, and Delete: Data can be retrieved from a relational database in sets constructed of data from multiple rows and/or multiple tables. This rule states that insert, update, and delete operations should be supported for any retrievable set rather than just for a single row in a single table.

Rule 8: Physical Data Independence: The user is isolated from the physical method of storing and retrieving information from the database. Changes can be made to the underlying architecture ( hardware, disk storage methods ) without affecting how the user accesses it.

Rule 9: Logical Data Independence: How a user views data should not change when the logical structure (tables structure) of the database changes. This rule is particularly difficult to satisfy. Most databases rely on strong ties between the user view of the data and the actual structure of the underlying tables.

Rule 10: Integrity Independence: The database language (like SQL) should support constraints on user input that maintain database integrity. This rule is not fully implemented by most major vendors. At a minimum, all databases do preserve two constraints through SQL.
• No component of a primary key can have a null value. (see rule 3)
• If a foreign key is defined in one table, any value in it must exist as a primary key in another table.

Rule 11: Distribution Independence: A user should be totally unaware of whether or not the database is distributed (whether parts of the database exist in multiple locations). A variety of reasons make this rule difficult to implement; I will spend time addressing these reasons when we discuss distributed databases.

Rule 12: Nonsubversion Rule: There should be no way to modify the database structure other than through the multiple row database language (like SQL). Most databases today support administrative tools that allow some direct manipulation of the datastructure.


Please find some good oracle documents at

Oracle Interview Questions II

Find more oracle material at http://download.35mb.com/kvreddy83

SQL – 2 Marks each

1. Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
Which three statements insert a row into the table? (Choose three.)

A. INSERT INTO employees VALUES ( NULL, 'John', 'Smith');

B. INSERT INTO employees( first_name, last_name) VALUES( 'John', 'Smith');

C. INSERT INTO employees VALUES ( '1000', 'John', NULL);

D. INSERT INTO employees (first_ name, last_name, employee_id) VALUES ( 1000, 'John', 'Smith');

E. INSERT INTO employees (employee_id) VALUES (1000);

F. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'John', ' ');


2. Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR2(30)
SALARY NUMBER(8,2)

Which statement shows the maximum salary paid in each job category of each department?
A. SELECT dept_id, job_cat, MAX(salary) FROM employees
WHERE salary > MAX(salary);
B. SELECT dept_id, job_cat, MAX(salary) FROM employees
GROUP BY dept_id, job_cat;
C. SELECT dept_id, job_cat, MAX(salary) FROM employees;
D. SELECT dept_id, job_cat, MAX(salary) FROM employees
GROUP BY dept_id;
E. SELECT dept_id, job_cat, MAX(salary) FROM employees
GROUP BY dept_id, job_cat, salary;

3. Which SELECT statement will get the result 'elloworld' from the string 'HelloWorld'?
A. SELECT SUBSTR( 'HelloWorld',1) FROM dual;
B. SELECT INITCAP(TRIM ('HelloWorld', 1,1)) FROM dual;
C. SELECT LOWER(SUBSTR('HelloWorld', 1, 1) FROM dual;
D. SELECT LOWER(SUBSTR('HelloWorld', 2, 1) FROM dual;
E. SELECT LOWER(TRIM ('H' FROM 'HelloWorld')) FROM dual;

4. Management has asked you to calculate the value 12*salary*commission_pct for all the employees in the EMP table. The EMP table contains these columns:
LAST NAME VARCHAR2(35) NOT NULL
SALARY NUMBER(9,2) NOT NULL
COMMISSION_PCT NUMBER(4,2)
Which statement ensures that a value is displayed in the calculated column for all employees?
A. SELECT last_name, 12*salary*commission_pct FROM emp;
B. SELECT last_name, 12*salary* (commission_pct,0) FROM emp;
C. SELECT last_name, 12*salary*(nvl(commission_pct,0)) FROM emp;
D. SELECT last_name, 12*salary*(decode(commission_pct,0)) FROM emp;


5. Examine the description of the STUDENTS table:
STD_ID NUMBER(4)
COURSE_ID VARCHAR2(10)
START_DATE DATE
END_DATE DATE
Which two aggregate functions are valid on the START_DATE column? (Choose two.)
A. SUM(start_date)
B. AVG(start_date)
C. COUNT(start_date)
D. AVG(start_date, end_date)
E. MIN(start_date)
F. MAXIMUM(start_date)


6. Which SQL statement defines a FOREIGN KEY constraint on the DEPTNO column of the EMP table?
A. CREATE TABLE EMP
(empno NUMBER(4),
ename VARCHAR2(35),
deptno NUMBER(7,2) NOT NULL,
CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno);

B. CREATE TABLE EMP
(empno NUMBER(4),
ename VARCHAR2(35),
deptno NUMBER(7,2)
CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));

C. CREATE TABLE EMP
(empno NUMBER(4),
ename VARCHAR2(35),
deptno NUMBER(7,2) NOT NULL,
CONSTRAINT emp_deptno_fk REFERENCES dept (deptno) FOREIGN KEY (deptno));



D. CREATE TABLE EMP (empno NUMBER(4),
ename VARCHAR2(35),
deptno NUMBER(7,2) FOREIGN KEY
CONSTRAINT emp deptno fk REFERENCES dept (deptno));


7. Evaluate the set of SQL statements:
CREATE TABLE dept
(deptno NUMBER(2), dname VARCHAR2(14), loc VARCHAR2(13));
ROLLBACK;
DESCRIBE DEPT
What is true about the set?
A. The DESCRIBE DEPT statement displays the structure of the DEPT table.
B. The ROLLBACK statement frees the storage space occupied by the DEPT table.
C. The DESCRIBE DEPT statement returns an error ORA-04043: object DEPT does not exist.
D. The DESCRIBE DEPT statement displays the structure of the DEPT table only if there is a COMMIT
statement introduced before the ROLLBACK statement.


8. Which SQL statement generates the alias Annual Salary for the calculated column SALARY*12?
A. SELECT ename, salary*12 'Annual Salary' FROM employees;
B. SELECT ename, salary*12 "Annual Salary" FROM employees;
C. SELECT ename, salary*12 AS Annual Salary FROM employees;
D. SELECT ename, salary*12 AS INITCAP("ANNUAL SALARY") FROM employees;


9. You need to display the last names of those employees who have the letter "A" as the second
character in their names.
Which SQL statement displays the required results?
A. SELECT last_name FROM EMP WHERE last_name LIKE '_A%';
B. SELECT last_name FROM EMP WHERE last name ='*A%'
C. SELECT last_name FROM EMP WHERE last name ='_A%';
D. SELECT last_name FROM EMP WHERE last name LIKE '*A%'


10. Which two statements about creating constraints are true? (Choose two.)
A. Constraint names must start with SYS_C.
B. All constraints must be defined at the column level.
C. Constraints can be created after the table is created.
D. Constraints can be created at the same time the table is created.
E. Information about constraints is found in the VIEW_CONSTRAINTS dictionary view


11. Examine the SQL statement that creates ORDERS table:
CREATE TABLE orders
(SER_NO NUMBER UNIQUE,
ORDER_ID NUMBER,
ORDER_DATE DATE NOT NULL,
STATUS VARCHAR2(10)
CHECK (status IN ('CREDIT','CASH')),
PROD_ID NUMBER REFERENCES PRODUCTS(PRODUCT_ID),
ORD_TOTAL NUMBER,
PRIMARY KEY (order_id, order date));

For which columns would an index be automatically created when you execute the above SQL statement? (Choose two.)

A. SER_NO
B. ORDER_ID
C. STATUS
D. PROD_ID
E. ORD_TOTAL
F. composite index on ORDER_ID and ORDER_DATE


12. Which constraint can be defined only at the column level?
A. UNIQUE
B. NOT NULL
C. CHECK
D. PRIMARY KEY
E. FOREIGN KEY


13. What does the TRUNCATE statement do?
A. removes the table
B. removes all rows from a table
C. shortens the table to 10 rows
D. removes all columns from a table
E. removes foreign keys from a table


14. Which SELECT statement should you use to extract the year from the system date and display it in the
format "1998"?
A. SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;
B. SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;
C. SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;
D. SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;
E. SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;




15. Which clause should you use to exclude group results?
A. WHERE
B. HAVING
C. RESTRICT
D. GROUP BY
E. ORDER BY


16. What is true about joining tables through an equijoin?
A. You can join a maximum of two tables through an equijoin.
B. You can join a maximum of two columns through an equijoin.
C. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT statement.
D. To join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns.
E. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.


17. You would like to display the system date in the format "Monday, 01 June, 2001".
Which SELECT statement should you use?
A. SELECT TO_DATE(SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;
B. SELECT TO_CHAR(SYSDATE, 'FMDD, DY Month, 'YYY') FROM dual;
C. SELECT TO_CHAR(SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;
D. SELECT TO_CHAR(SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;
E. SELECT TO_DATE(SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;


18. Which two are character manipulation functions? (Choose two.)
A. TRIM
B. REPLACE
C. TRUNC
D. TO_DATE
E. MOD
F. CASE


19. You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20.
Which SQL statement would you use to create the view EMP_VU?
A. CREATE VIEW emp_vu AS
SELECT * FROM employees
WHERE department_id IN (10,20);

B. CREATE VIEW emp_vu AS
SELECT * FROM employees
WHERE department_id IN (10,20)
WITH READ ONLY;

C. CREATE VIEW emp_vu AS
SELECT * FROM employees
WHERE department_id IN (10,20)
WITH CHECK OPTION;

D. CREATE FORCE VIEW emp_vu AS
SELECT * FROM employees
WHERE department_id IN (10,20);

E. CREATE FORCE VIEW emp_vu AS
SELECT * FROM employees
WHERE department_id IN (10,20)
NO UPDATE;


20. Evaluate these two SQL statements:
SELECT last_name, salary, hire_date
FROM EMPLOYEES
ORDER BY salary DESC;
SELECT last_name, salary, hire_date
FROM EMPLOYEES
ORDER BY 2 DESC;
What is true about them?
A. The two statements produce identical results.
B. The second statement returns a syntax error.
C. There is no need to specify DESC because the results are sorted in descending order by default.
D. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement.


21. You added a PHONE-NUMBER column of NUMBER data type to an existing EMPLOYEES table. The EMPLOYEES table already contains records of 100 employees. Now, you want to enter the phone numbers of each of the 100 employees into the table. Some of the employees may not have a phone number available.
Which data manipulation operation do you perform?
A. MERGE
B. INSERT
C. UPDATE
D. ADD
E. ENTER
F. You cannot enter the phone numbers for the existing employee records.






22. The CUSTOMERS table has these columns:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)

The CUSTOMER_ID column is the primary key for the table.
Which two statements find the number of customers? (Choose two.)

A. SELECT TOTAL(*) FROM customers;
B. SELECT COUNT(*) FROM customers;
C. SELECT TOTAL(customer_id) FROM customers;
D. SELECT COUNT(customer_id) FROM customers;
E. SELECT COUNT(customers) FROM customers;
F. SELECT TOTAL(customer_name) FROM customers;


23. In a SELECT statement that includes a WHERE clause, where is the GROUP BY clause placed in the
SELECT statement?
A. immediately after the SELECT clause
B. before the WHERE clause
C. before the FROM clause
D. after the ORDER BY clause
E. after the WHERE clause


24. For which two constraints does the Oracle Server implicitly create a unique index? (Choose two.)
A. NOT NULL
B. PRIMARY KEY
C. FOREIGN KEY
D. CHECK
E. UNIQUE


PL/SQL

1. Assume a situation whereby we have to maintain a track on all DML operations done on EMP table and store the tracked information along with Userid and Event date time and type of DML operation done. Use suitable PL/SQL object to achieve it. (10 Marks)

2. Difference between Implicit and Explicit Cursors, with cursor attributes explanations. (5 marks).

3. Have a look at the following table structures. (12 Marks)
Customer Table
Acctno Number(8)
CustName Varchar2(25)
Balance Number(7,2)
MinBalance Number(7,2)
Acc_Op_Date date
AccType Varchar2(15) - (SAVINGS or CURRENT or RECCURING)

Transaction Table
Acctno Number(8)
TransType Varchar2(15) - (WITHDRAWAL or DEPOSIT)
Amount number(7,2)
TranDate Date

Whenever a Transaction occurs an entry is made in the transaction table and in the Customer table the Balance is updated to the current balance (i.e. after the last transaction).
Also while making a transaction a check has to be maintained that the balance should not go less than the MINBALANCE value.
Write suitable PL/SQL Object(s) to achieve the following:
• Updating the Customer table on occurrence of any transaction.
• Keeping a check on the Balance not going low than Minbalance.


4. What are Packages and what is its significance? Explain with example. (10 Marks)

5. What are Exceptions? What are the type of Exceptions and its difference? Explain with Examples on each. (7 Marks)

6. Write a suitable PL/SQL block to pick all employees (EMP Table) in a particular department and raise their salary by 10% if they have completed 3 years of service in the organization. (8 Marks)



*********** Best Of Luck ***********

Find more oracle material at http://download.35mb.com/kvreddy83