PL SQL Interview Qns
PL SQL Interview Qns
PL SQL Interview Qns
Method 1:
Will give you a zero if it is a number or greater than zero if not numeric (actually gives
the count of non numeric characters)
Method 2:
select instr(translate('wwww',
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX'),'X')
FROM dual;
Here N = 10
The following query has a Problem of performance in the execution of the following
query where the table ter.ter_master have 22231 records. So the results are obtained after
hours.
What are steps required tuning this query to improve its performance?
?̩Be sure to get familiar with EXPLAIN PLAN. This can help you determine the
execution path that Oracle takes. If you are using Cost Based Optimizer mode, then be
sure that your statistics on TER_MASTER are up-to-date.
?̩Also, you can change your SQL to:
PADMAPRIYA N Page 1
PL_SQL_Interview_Qns
SELECT a.*
FROM ter.ter_master a
WHERE NOT EXISTS (SELECT b.repno FROM ermast b
WHERE a.repno=b.repno) AND
(a.brepno = 'ALL' or a.repno > a.brepno)
ORDER BY a.repno;
3. What is the difference between Truncate and Delete interms of Referential Integrity?
TRUNCATE removes ALL records in a table. It does not execute any triggers.
Also, it only checks for the existence (and status) of another foreign key
Pointing to the table. If one exists and is enabled, then you will get
The following error. This is true even if you do the child tables first.
You should disable the foreign key constraints in the child tables before
issuing the TRUNCATE command, then re-enable them afterwards.
CLIENT/SERVER
Preemptive refers to the fact that each task is alloted fixed time slots and at the end of that
time slot the next task is started.
In a client server environment, what would be the major work that the client deals with ?
The client deals with the user interface part of the system.
To reduce the network traffic and for application sharing and implementing business
PADMAPRIYA N Page 2
PL_SQL_Interview_Qns
rules.
Applications that have outgrown their environment are re-engineered to run in a larger
environment. This is upsizing.
With rightsizing, one would move applications to the most appropriate server platforms.
An event trigger, a segment of code which is associated with each event and is fired when
the event occurs.
When a stored procedure is called, only the procedure call is sent to the server and not the
statements that the procedure contains.
An integrity constraint allows the definition of certain restrictions, at the table level, on
the data that is entered into a table.
Database triggers can be used to enforce business rules, to maintain derived values and
perform value-based auditing.
What is a transaction ?
PADMAPRIYA N Page 3
PL_SQL_Interview_Qns
A transaction is a set of operations that begin when the first DML is issued and end when
a commit or rollback is issued. BEGIN COMMIT/ROLLBACK are the boundries of a
transaction.
Why is it better to use an integrity constraint to validate data in a table than to use a
stored procedure ?
Because an integrity constraint is automatically checked while data is inserted into a table.
A stored has to be specifically invoked.
A Client,
A Server and
A Network/Communication software.
Flexibility of the system, scalability, cost saving, centralised control and implementation
of business rules, increase of developers productivity, portability, improved network and
resource utilization.
Heterogeneity of the system results in reduced reliablity. May not be suitable for all
applications. Managing and tuning networks becomes difficult.
Star,
Bus,
Ring.
PADMAPRIYA N Page 4
PL_SQL_Interview_Qns
The application can be connected to any back end server that is supported by the API.
The application cannot use any special features of the backend server.
Because an event driven program is always waiting for something to happen before
processing.
1. System Events.
2. Control Events
3. User Events
4. Other Events.
A file server just transfers all the data requested by all its client and the client processes
the data while a database server runs the query and sends only the query output.
What is inheritance ?
PADMAPRIYA N Page 5
PL_SQL_Interview_Qns
The ODBC Manager manages all the data sources that exists in the system.
The ODBC Driver allows the developer to talk to the back end database.
The name of the DBMS, the location of the source and the database dependent
information.
ODBC uses the description of the datasource available in the ODBC.INI file to load the
required drivers to access that particular back end database.
RDBMS FUNDAMENTALS
I. INTRODUCING DATABASES :
Concept of a Database :
Traditional Approach : In this approach, independent application programs access their
own independent data files. This results in many problems in data storage and retrieval.
Database Approach : In this approach, all application access a common database, which
is a centralized data storage system. This approach has the following advantages :
Redundancy of data storage is reduced, Inconsistency in data is eliminated & Data
sharing between applications is possible.
Interacting with a Database :
Database Management System (DBMS) : DBMS is a software that interfaces between
applications and a database for all data processing activities.
Users of a DBMS : End Users, Application Programmers and Database Administrators
use a DBMS, either directly or indirectly.
How users interact with a Database :
1. End users send queries to the DBMS through applications.
2. The DBMS translates the queries.
3. The DBMS retrieves data from the database.
4. The DBMS sends data to the application, which present the data to the end users.
Functions of a DBMS :
Function of DBMS Description Provided by using
Defining the data structure Defining structure of data to be stored in database Data
Definition Language (DDL)
Manipulating Data Retrieving, adding, modifying, deleting data. Data Manipulation
Language (DML)
PADMAPRIYA N Page 6
PL_SQL_Interview_Qns
PADMAPRIYA N Page 7
PL_SQL_Interview_Qns
PADMAPRIYA N Page 8
PL_SQL_Interview_Qns
belong to a single entity or relationship and depend on its unique identifier. To simplify
data to 2NF, you ensure that all nonkey attributes in a relation are functionally dependent
on the whole key and not part of the key.
Conversion from 1NF to 2NF : To convert a relation in 1NF to 2NF, move all nonkey
attributes that are not wholly dependent on the primary key, to a new relation. Then,
choose an appropriate primary key for the new relation. E.g. Separating Sup. table and
Item table.
Simplifying Data to 3NF (Eliminate Columns not Dependent on the Key) :
Columns in each table should be a group of columns in which the data in each column
contributes to the description of each row in the table.
Transitively Dependent Attributes : Transitively Dependent Attributes in a relation are
those that are dependent on a nonkey attribute and not the primary key. To simplify data
to 3NF, you ensure that there are no attributes in a relation that are transitively dependent
on other attributes.
Conversion from 2NF to 3NF : To convert a relation in 2NF to 3NF, move all transitively
dependent attributes to a new relation. Then, choose an appropriate primary key for the
new relation. E.g. Status is dependent on City in Sup. table, so move those two to
separate table.
Simplifying Data to 4NF (Isolate Independent Multiple Relationships) :
V. STORING & RETRIEVING DATA :
Language Support for an RDBMS :
SQL :SQL is the language that provides command to interact with the data in the
database. SQL consists of three components - DDL, DML & DCL.
DDL : DDL comprises commands you can use to create and modify the database
structure.
DML : DML comprises commands you can use to add, modify, delete and query data in
the database.
DCL : DCL comprises commands you can use to control the user access to the database.
Organizing the Database :
Base Tables : A database comprises base tables, which have the following features :
They physically exist on the disk, Each of them has a unique name & they contain data
that is crucial to an organization.
Their attributes have data types such as character, integer, decimal, date and time.
CREATE TABLE : This is a DDL command in SQL that creates a new table in a
database.
Syntax : CREATE TABLE table-name (column-name data-type [[size]]
NOT NULL/DEFAULT default-value]]
CHECK (column-name > 0)
UNIQUE (column-name)
PRIMARY KEY (column-name)
FOREIGN KEY (column-name) REFERENCES table-name)
ALTER TABLE : This is a DDL command in SQL that modifies the structure of an
existing table.
Syntax : ALTER TABLE table-name
ADD (column-name data-type [[size]] [[NOT NULL DEFAULT]]...)
primary key definition / foreign key definition
PADMAPRIYA N Page 9
PL_SQL_Interview_Qns
PADMAPRIYA N Page 10
PL_SQL_Interview_Qns
PADMAPRIYA N Page 11
PL_SQL_Interview_Qns
PADMAPRIYA N Page 12
PL_SQL_Interview_Qns
requesters of services and Servers are provider of services. Typically, clients handle user
interface function & server handle data management function.
Client/Server Architecture requires Processing to be distributed over more than one
computing system. Client-initiated client/server interactions. Server control over the
services that can be requested by the client. Servers to arbitrate between conflicting client
requests. A communication system that enables clients & servers to communicate.
Multitasking can be defines as the capability of an OS to run multiple applications
concurrently. A Multitasking OS allocates a certain amount of CPU time to each task. In
Preemptive multitasking, the OS controls the amount of CPU time allocated to a task. In
non-preemptive multitasking, the application controls the CPU time and the CPU is
released only after the task is completed.
Multithreading is an extension of multitasking. It allows multitasking within an
application. Programs and subroutines within a program can execute concurrently in a
multithreaded environment. Several user process for a single server process.
Database Server should have preemptive multitasking & multithreading capability.
Support a standard RDBMS. Support a standard Network Operating System.
Tools such as RDBMS, Application Software, Application Program Interfaces, Stored
Procedures, Remote Procedure Call (RPC) & Application Development Tools are an
important part of client/server systems. Such tools improve productivity and also play a
role in making client/server systems more open. An API is a set of functions that
translates client requests into a format that the server can understand. RPC is essentially a
messaging system which allows stored procedures to be invoked. Many RPCs allows
procedures to be invoked across heterogeneous platforms and also provide the required
data translation services.
There are several application designs possible in the client/server model depending on
how application processing is distributed.
In Distributed Presentation, the presentation function is divided between the client & the
server. Useful in situations where PC or workstations are connected to mainframes. Used
to enhance the user interface of mainframe based applications.
In Remote Presentation, the entire presentation part of the application resides on a
different computer than the one that has the logic function. Used in applications where
user interaction is completely static and predetermined.
In Distributed Logic, the logic function is placed on more than one platform thus,
improving response time by allowing the logic to execute simultaneously on several
processors.
In Remote Data Management, the application logic resides on different computer than the
one that has the data and the DBMS. Easy to implement and often provide end-users with
totally transparent access to data.
In Distributed Data Management, the data and DBMS is distributed among multiple
nodes and distribution of application logic.
Goals of Client/Server Paradigm is the end-user. Client/Server seeks to provide end-user
transparent access to the computing resources of the organization. The goal is referred to
as single system image. There are four attributes of single system image :
Location Transparency : Users must be able to access data without knowing the location
of the data. Users should not have to learn & use different commands for accessing data
from different locations.
PADMAPRIYA N Page 13
PL_SQL_Interview_Qns
Interoperability requires that applications and processing tasks be freely portable across
heterogeneous computing resources.
Consistent User Interfaces require that applications retain the same user interface across
heterogeneous computing platforms. Common computing tasks are represented
consistently across applications.
Enterprise-wide Resource Sharing is the common thread that links all of an enterprise's
computing resource
II. Concepts for Client/Server :
Introduction : RDBMS's standardize data storage and access and are therefore ideal for
implementing client/server systems. The physical structure of a network is called
Network Topology i.e. refers to the way the cabling of a network is physically structured.
The rules that govern the process of data transmission in a network are collectively
referred to as Network Protocol. Graphical User Interfaces improve productivity because
they reduce learning time
and are easier to use.
Distributed Database Support : The capability of an RDBMS to manage databases lying
at more than one location. To provide distributed database support, an RDBMS must be
able to provide transparent access to data, Join tables on different platforms, Handle and
manage distributed queries and Ensure that transactions are successfully completed on all
relevant databases.
Network : Network has six basic functions, Naming, Segmentation, Segmenting, Flow
Control, Synchronization, Priority & Error Control. There are three types of network
topologies, Bus, Star & Ring. There are three types of transmission media, Twisted Pair,
Coaxial Cable & Optic Fibre. There are three types of data transmission methods,
Centralized, Distributed & Random.
GUIs : GUI must support mouse events, keyboard events, menu events, resizing events,
activation/deactivation events and initialize/terminate events. GUI should be portable,
should support wide variety of development tools & be an industry standard.
III. Client/Server Software :
Back-end Software : It is made up of Database Servers & Network Operating Systems.
The database server manages data on the system & maintains data integrity. Database
server requires some special features. Compatibility i.e. must be able to work on different
operating systems. SQL Implementation i.e. must support standard ANSI SQL since it
can communicate with different SQL dialects. Stored Procedures i.e. must be able to use
SP as they are analyzed, compiled and optimized. Referential Integrity i.e. allows the
server to synchronize change to columns that are part of multiple tables. Declarative RI
establishes precise rules for use of columns that are common across tables. Built into db
software and enforced by default. In Procedural RI, each db command is associated with
a trigger. When command is issued, the trigger sets of a series of commands that make
the necessary changes. Disadvantage is programmers must write triggers leading to errors.
Multithreading i.e. support execution of multiple tasks simultaneously. Distributed
Database Support i.e. able to divide database tasks among multiple CPUs. Also, able to
join tables located on different servers, & manage SQL queries sent to different servers.
Concurrency Control i.e. support automatic escalation, the server locks a record, if a
single record is being modified. A page, if several records are being modified. A table, if
several pages are being modified. Transaction Control i.e. protect transactions from
PADMAPRIYA N Page 14
PL_SQL_Interview_Qns
system failures. In two phase commit, all workstations are notified of database changes,
and if system fails, all sites rollback.
NOS controls the transmission of data across the network and manages the sharing of
hardware and software resource on the network. Four important features are Operating
Environment Support, Workstation Support, Security & Protocol Support.
Development Tools are made up of SQL/3GL programming tools & Front-end
development tools.
End User Tools are made up of Decision Support Tools and PC-based add-ons.
IV. Migrating to Client/Server :
Evaluating the Client/Server Option : To evaluate the following before deciding on
client/server. Application requirements, Geographical requirements & Productivity Gains.
Client/Server is most suitable for applications are decision support or on-line transaction
processing (OLTP). The distances are site or city & both developer & end-user
productivity are expected to increase.
Planning for Migration : Planning is needed to reduce problems with network load,
training & systems maintenance. Migration plan must include analysis, selection,
prototyping & implementation as activities. Planning must include end-users, developers
and system administrators as resources. To specify system requirements for end-users,
developers, system managers and the business as a whole. To evaluate business priorities
to eliminate stagnation & disruption.
Implementing Client/Server : The Systems Integration Life Cycle (SILC) is made up of
preparation, detailing and execution. Managing SILC projects involves planning,
controlling & completing. System maintenance involves ensures reliability, ensuring
serviceability and monitoring performance. The training must cover end-users,
developers & system administrators.
ORACLE
I. SQL*PLUS :
SQL is an English like language consisting of commands to store, retrieve, maintain &
regulate access to your database.
SQL*PLUS is an application that recognizes & executes SQL commands & specialized
SQL*Plus commands that can customize reports, provide help & edit facility & maintain
system variables.
NVL : Null value function converts a null value to a non-null value for the purpose of
evaluating an expression.
Numeric Functions accept numeric I/P & return numeric values. They are MOD, SQRT,
ROUND, TRUNC & POWER.
Date Functions are ADD_MONTHS, LAST_DAY, NEXT_DAY,
MONTHS_BETWEEN & SYSDATE.
Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional
functions are GREATEST & LEAST.
Group Functions returns results based upon groups of rows rather than one result per row,
use group functions. They are AVG, COUNT, MAX, MIN & SUM.
TTITLE & BTITLE are commands to control report headings & footers.
COLUMN command define column headings & format data values.
BREAK command clarify reports by suppressing repeated values, skipping lines &
PADMAPRIYA N Page 15
PL_SQL_Interview_Qns
PADMAPRIYA N Page 16
PL_SQL_Interview_Qns
PADMAPRIYA N Page 17
PL_SQL_Interview_Qns
describes the data to be loaded. It describes the Names and format of the data files,
Specifications for loading data and the Data to be loaded (optional). Invoking the loader
sqlload username/password controlfilename <options>
PL/SQL :
Data types are NUMBER, CHAR/VARCHAR2, DATE & BOOLEAN.
Arrays are not allowed & only one identifier per line is allowed.
Attributes of PL/SQL objects are %TYPE, %ROWTYPE.
PL/SQL Block is a standard PL/SQL code segment. Block consists of three parts.
Declarative Section for variables, constants & exceptions. This section is optional.
Executable Section which is mandatory.
Exception Handlers which is optional.
PL/SQL supports only DML i.e. INSERT, UPDATE, DELETE & SELECT...INTO.
SQL Functions can be referenced within a SQL statement i.e. Numeric
(SQRT,ROUND,POWER),
Character (LENGTH,UPPER), DATE (ADD_MONTHS,MONTHS_BETWEEN) &
Group (AVG,MAX,COUNT). Most SQL functions are available outside SQL statement
except for group functions.
Code Simple Loops repeats a sequence of statements multiple times.
Syntax : LOOP
<Sequence of Statements>
END LOOP;
Code Numeric FOR Loops repeat a sequence of statements a fixed number of times.
Syntax : FOR <index> IN [[ REVERSE ]] <integer>..<integer> LOOP
<sequence of statements>
END LOOP;
<index> is implicitly of type number. Defined only within the loop & Value can be
referenced in an expression, but a new value cannot be assigned to the index within the
loop.
Code While Loops repeats a sequence of statements until a specific condition is no longer
TRUE.
Syntax : WHILE <condition> LOOP
<sequence of statements>
END LOOP;
<condition> can be any legal PL/SQL condition & statements will be repeated as long as
condition evaluates to TRUE.
Code GOTO Statements jumps to a different place in the PL/SQL block.
Syntax : GOTO label_name;
Legally use a GOTO a statement that is in the same sequence of statements as the GOTO.
In the sequence of statements that encloses the GOTO statement (outer block).
Labels can label any statement. Used as targets for GOTO statements, use labels for
blocks and loops, Label a block to allow referencing of DECLAREd objects that would
otherwise not be visible because of scoping rules, Label a block to allow a variable to be
referenced that might be hidden by a column name, Label a loop to allow an object to be
reference that would otherwise not be visible because of scoping rules & Label an EXIT
as a convenient way to specify exits from outer loops.
PADMAPRIYA N Page 18
PL_SQL_Interview_Qns
Cursors are associated with every SQL DML statement processed by PL/SQL. Two types
are Explicit i.e. Multiple row SELECT statements & Implicit i.e. INSERT, UPDATE,
DELETE & SELECT...INTO statements. Implicit cursor is called the SQL cursor-it
stores info concerning the processing of the last SQL statement not associated with an
explicit cursor. OPEN, FETCH & CLOSE do not apply. All cursor attributes apply.
Cursor has to be explicitly defined when a query returns multiple rows to process beyond
the first row returned by the query & to keep track of which row is currently being
processed.
Declare the cursor to associate its name with a SELECT statement.
Syntax : DECLARE
CURSOR <cursor_name>
IS <regular_select_statement>;
Open the cursor to process the SELECT statement and store the returned rows in the
cursor.
Syntax : OPEN <cursor_name>;
Fetch data from the cursor and store it in specified variables.
Syntax : FETCH <cursor_name> INTO <var1, var2...>;
Close the cursor to free up resources. Cursors must be closed before they can be reopened.
Syntax : CLOSE <cursor_name>
Explicit Cursor Attributes are %NOTFOUND, %FOUND, %ROWCOUNT & %ISOPEN.
Reference the current cursor row with the WHERE CURRENT OF statement. The cursor
must be declared with a FOR UPDATE OF clause.
Syntax : WHERE CURRENT OF <cursor_name>
Reference Cursors FOR Loops to specify a sequence of statements to be repeated once
for each row that is returned by the cursor with the Cursor FOR Loop.
Syntax : FOR <record_name> IN <cursor_name> LOOP
--statements to be repeated go here
END LOOP;
Cursor FOR loops (CFL) are similar to Numeric For Loops(NFL). CFL specify a set of
rows from a table using the cursor's name. NFL specify an integer range. CFL record
takes on vales of each row. NFL index takes on each value in the range. Record_name is
implicitly declared as
record_name cursor_name%ROWTYPE
When a CFL is initiated, an implicit OPEN cursor_name is initiated.
For each row that satisfies the query associated with the cursor, an implicit FETCH is
executed into the components of record_name.
When there are no more rows left to FETCH, an implicit CLOSE cursor_name is
executed and the loop is exited.
Declare cursors to use parameters
Syntax : DECLARE
CURSOR <cursor_name> [[(param_name param_type)]]
IS <regular select statement>;
Exception Handlers : In PL/SQL, errors are called exceptions. When an exception is
raised, processing jumps to the exception handlers. An exception handler is a sequence of
statements to be processed when a certain exception occurs. When an exception handler
is complete, processing of the block terminates. Two types are Predefined Internal
PADMAPRIYA N Page 19
PL_SQL_Interview_Qns
SQL*FORMS :
Form is a tool for developing and executing forms based interactive applications that can
access info from ORACLE database.
Blocks describes each section or subsection of the form and serves as the basis of default
database interaction.
Fields represents columns or data entry areas and describes how data should be displayed
and validated and how an operator should interact with the data while it is entered.
Pages is a collection of display info such as constant texts and graphics. All fields have to
be displayed on some page.
Pop-Up Pages Non-Pop-Up Pages
Appear in windows Overlay the entire screen
Created by selecting pop-up page attribute Default type of page
Can be larger or smaller than the screen Can only be the size of the screen
Can appear anywhere on the screen Must be positioned at the upper left hand corner of
the screen
Can be a section (view) of a page Must fill the entire text region
Many pages can appear on the screen at one time Only one non-pop-up page can appear
on the screen
PADMAPRIYA N Page 20
PL_SQL_Interview_Qns
View Page specifies the initial location of the view on the page, i.e. the part of the pop-up
page that is shown; the X & Y coordinates of the page define the upper left corner of the
view.
Screen Painter is used to edit screen images, add constant text and graphic elements.
Zoom In : Displays the form or spread table for the objects that are owned by the current
object.
Zoom Out : Displays the form or spread table for the object that owns the current object.
Validation Unit is a characteristic which determines the max. amount to data to be
entered before form initiates validation. It corresponds to a unit of data which can be field,
record, block or form.
Navigation is performed to move the cursor from one location to another.
Cursor is an instance of field, outside the form or undefined.
Row Id is a column created by ORACLE when a table is created. It contains a value for
each row which uniquely identifies that row. When a block is created, forms add a non-
displayable, non-up dateable field named row id. Forms uses row id to determine what
rows to fetch from db or reserve in db and what rows to update or delete during posting.
It helps forms to manage transactions and is used to update a table that is not associated
with a block in the form.
Trigger is a piece of PL/SQL code that is executed or triggered by an event while the
form is running. It validates data entry, performs calculations, control the flow of
application & replace or enhance default processing.
Trigger Point is a temporal space in an event with which a specific trigger type is
associated.
Types of Triggers : Most key triggers are function key triggers; they have a one-to-one
relationship with specific keys.
Function Key Triggers : Fires when a particular Forms function key is pressed.
Replace or supplement default function key functionality, Perform multiple or complex
functions & Disable function keys.
Key Startup : Fires at the end of the entering the form event. Considered as key trigger
because its action is similar to an operator pressing a startup function key.
Set up form default, Send a message to the operator as soon as the form comes up on the
screen & Perform an automatic query upon entering the form.
Key Others : Associate a key-others trigger with all keys that can have key triggers
associated with them but are not currently defined by a function key triggers.
Key Fn : Attach key-Fn triggers to any one of ten key sequences that normally do not
perform any SQL*Form operations. Before attaching key triggers to these keys, run
Oracle*Terminal to map the keys to the appropriate functions.
Navigational Triggers : Fires when entering or leaving a form, block, record or field.
Restrict access to a form, Print messages, Derive a complex default value, Keep a
running total & Perform calculations.
Validation Triggers : Validation is an internal process by which Forms determines
whether the data in an object is correct. Validation triggers fire when validation is
performed. Validation occurs when the operator has entered or changed data in an object
and then tries to leave the object. Validation does not occur when the operator is in Enter
Query mode. Validation or Navigation triggers cannot contain Restricted Packaged
Procedures.
PADMAPRIYA N Page 21
PL_SQL_Interview_Qns
Fires as last part of field validation, Changes, Calculates & Validates a field value.
Query Triggers : Fires when entering & executing a query, and when counting query hits.
Defined only at the block or form level. Pre-Query fires once before block is queried.
Post-Query fires once for every record fetched by the query.
Error & Message Handling Triggers : Write these triggers to replace the default
SQL*Forms error or informative messages. On-Error & On-Message trigger fires when
Forms displays an error or an informative message respectively.
Trap & recover from an error, Replace a standard message with a custom message.
Transactional Triggers : Fires during commit processing - an event that makes the data in
the database identical to the data in the form.
Sets up special locking requirements, Update an audit trial, Prevent Insert/Update/Delete
actions & Modify Insert/Update/Delete actions.
Packaged Procedure is a predefined piece of PL/SQL procedure that executes a
SQL*Forms function.
Restricted Packaged Procedure is any packaged procedure that affects the basic functions
of SQL forms. It is used only in Key triggers, user named triggers that are invoked by key
triggers & On-New-Field-Instance trigger.
Do_Key packaged procedure executes the key trigger that corresponds to the specified
packaged procedure. If no such trigger executes, then the specified packaged procedure
executes. This behavior is analogous to the user pressing the corresponding function key.
Syntax : DO-KEY (package procedure name)
Packaged Function is a predefined piece of PL/SQL function that evaluates some aspect
of the current SQL*Forms session and returns a value.
Name_In packaged function returns the contents of the variable to which you apply it.
Returned value is in the form of character string. Also use Name_In to return number and
dates as character strings and then convert those strings to the appropriate data types.
Call packaged procedure runs an indicated form while keeping the parent form active.
SQL form runs the called form with the same options as the parent form. When called
form is exited thro' the EXIT function or as a result of navigational failure, processing
resumes in parent form at the point where the call occurred.
Call_Form runs an indicated form while keeping the parent form active.
Open_Form opens an indicated form to create multiple form application called form is
modal.
New_Form exits the current form and enters the indicated form.
Key-Duprec trigger copies the values of each field in the record with the next lower
sequence number to the corresponding fields in the current record. The current record
must not correspond already to a row in the database. If it does, an error occurs and calls
the Duplicate_Record packaged procedure.
Primary Key Field Attributes indicates that the field is a unique characteristics for a
record or part of unique key. To ensure that an inserted record or updated record does not
duplicate an existing record, give the critical field the primary key characteristics and
give the block the primary key characteristics.
Anonymous Block is a PL/SQL block without a name and this block can be executed
from the trigger in which it is defined. It does not require BEGIN & END keywords. It
has to be included if it has Declaration section.
Form Level Procedure are callable PL/SQL blocks. The full PL/SQL syntax, including
PADMAPRIYA N Page 22
PL_SQL_Interview_Qns
declarations and keywords BEGIN & END are required. They cannot contain anonymous
block. These procedures can use any command that a trigger can use. They can also take
arguments and return values, just as subroutines do in 3GL. It can be called from other
procedures & triggers. Advantages are
Reduce the amount of logic the designer needs to write for any task, Leads to more
efficient & consistent applications, Can be called by another procedure or trigger & Can
pass parameters.
User Exits is a subroutine which is written and linked into SQL forms executable files. It
is a link to pass data from forms to host language programs and receives the result. It
performs complex data manipulation, pass data to forms from OS files, manipulate long
raw data, support PL/SQL blocks and control real time devices such as printer or robot. It
returns a integer value which indicates Success, Failure or Fatal Error.
Types :
Oracle PreCompiler User Exits : Incorporates Oracle Precompiler interface. Allow to
write a subroutine using one of the following host language & embedded SQL commands.
Host language are ADA, C, COBOL, FORTRAN, PASCAL & PL/1. With embedded
SQL commands, an Oracle Precompiler user exit can access oracle databases. Also
access SQL*Forms variables & fields. Because of this feature, most of user exits is
Oracle Precompiler user exits.
Oracle Call Interface User Exits : Incorporates Oracle Call Interface. Allows to write a
subroutine that contains call to Oracle database but cannot access SQL*Forms variable &
fields.
Non-Oracle User Exits : Does not incorporate either precompiler interface or OCI. Non-
Oracle user exit might be entirely written using C. Cannot access Oracle database &
SQL*Forms variable & fields.
PL/SQL Variable is a local variable that is active only within the anonymous block or
form level procedure in which it has been declared.
Global Variable is a forms variable that is active in any trigger within a form and is active
through out the session. Stores a character string of upto 255 characters long. Before a
variable is active, it should be initialized thro' a trigger or it will be initialized first time
you assign a value to it. Delete any variable with ERASE package procedure. Global
variable declared in one form can be used in called form. Used to store data values that
should not be stored inside a block or you want to share between forms during form
session.
Syntax : GLOBAL.variable_name Oracle Naming Conventions.
System Variable is a SQL*Forms variable to keep track of some internal SQL*Forms
state. Able to reference the value of system variable in order to control the way an
application behaves. Value of system variable corresponds to the current form. They are
Block_Status,Record_Status,Form_Status,
Current_Block,Current_Field,Current_Form,Current_Value,Cursor_Block,Cursor_Field,
Cursor_Record,Cursor_Value,Last_Record,Last_Query,Message_Level,Record_Status,T
rigger_Block,Trigger_Field & Trigger_Record.
Features of Oracle 7 :
Stored Procedures is commonly used procedures can be written once in PL/SQL and
stored in the database for repeated use by applications. This ensures consistent behavior
among applications and reduce development & testing time. Centralizing the application
PADMAPRIYA N Page 23
PL_SQL_Interview_Qns
PADMAPRIYA N Page 24
PL_SQL_Interview_Qns
Do not define triggers to duplicate the functionality & do not create Recursive triggers.
Triggers will be compiled when it is fired. So, limit the size of triggers. Compilation of
triggers smaller in size will have insignificant effect on system performance. If the trigger
has to be execute many lines of code, include the code in the Stored Procedure.
Mutating Error in DB triggers is when a select statement within the scope of the trigger
selects rows corresponding to the trigger table itself. It can be solved by placing the select
statement in a stored procedure and calling the stored procedure from the scope of the
trigger.
Differences between Oracle 6.0 & 7.0 :
Only not null was implemented in 6 where as in 7 all the integrity constraints are
implemented i.e. Not Null, Primary, Foreign, Check, Default & Unique constraints.
Database Triggers, Stored Procedures, Functions & Packages are available in 7.
Roles : ORACLE provides for easy & controlled privilege management thro?? the use of
Roles. Roles are named groups of related privileges that are granted to users or other
roles. The properties are Reduced granting of privileges, Dynamic privilege management,
Selective availability of privileges & Application awareness.
Schemas is a collection of objects i.e. tables, views etc. and schema exists for each oracle
user.
Profiles is assigned to each user that specifies limitations on several system resources
available to the user i.e. the number of concurrent sessions the user can establish, the
CPU processing time, the amount of logical I/O, the allowed amount of idle time for the
user??s session & the allowed amount of connect time for the user??s session.
Cost Based Optimizer is available. It uses statistics about tables, along with info about the
available indexes to select an execution plan for SQL statements. This allows even
inexperienced users to submit complex queries without having to worry about the
performance. If we know the better execution path, provide hints to it to allow it to select
the proper execution path.
Table Replication is a snapshot of a table.
Multi threaded architecture several user process for a single server process and the user
process can be configured.
Declarative Referential Integrity establishes precise rules for use of columns that are
common across tables. Built into db software and enforced by default.
SQL*REPORTWriter :
Features :
Application development tool for designing & executing reports. ANSI standard SQL
used to retrieve records in the report. Menu-driven, simple spreadsheet-style screens.
Default values for report format. Ability to customize report format, date & number
formats. Complex data relationships. Calculations & summaries. Text processing and
highlighting features. Reports can be viewed immediately on-line for corrections.
Generate reports interactively or in a production environment. Parameters provide run-
time flexibility. Report management facility for easy report maintenance & Integration
with Oracle application tools.
Components :
Query - retrieves data from the database. Group - used to cluster columns returned from
the query. Fields - containers for data values. Summary - calculated summary function on
PADMAPRIYA N Page 25
PL_SQL_Interview_Qns
a field. Text - physical areas of report. Report - dimensions, security and history of the
report. Parameters - entered at run-time to control production, data values.
Queries : Every report must contain atleast one query. Query retrieves data for the report
from database tables or views. Queries can be unrelated i.e Master/Master report. Related
queries form a hierarchy, in which child query is executed once for each record returned
by the parent. Can create relationships between queries. No limit to the number of queries
in a report. No limit to the level of relationships (nesting) in queries. i.e. Master/Detail
(parent/child) queries. Matrix queries i.e. Two parents/One child queries.
On-line report can be viewed either in Browse i.e. Page by page or Window i.e. scrolls
horizontally and vertically through a page.
Groups : A group is a set of one or more columns. Every report must contain at least one
group. Each query automatically generates one group consisting of all columns in the
query.
Break Groups : A break is a set of groups generated from one query. Can create new
groups (break groups) that group records by the distinct values of a column or set of
columns. Group settings provide format control.
Field : A field is a container for values derived from columns or calculated column values
in the SELECT statement. Computed fields created by user. System variables (page
number, number of pages, date etc.). User exits & DML statements.
Summaries : Summaries calculate subtotals, grand totals, running totals & other standard
functions on field values. All summaries are manually created. Multiple summaries may
be computed on any field, including fields derived from user exits & system variables.
Summary settings provide format control. Summaries may be referenced in queries.
Text Objects : Text objects represent the physical layout of the report. Text objects are
used to manipulate positions of fields & summaries. Customize text. Add page
numbering. Changes made on field, group & summary setting screens are reflected on all
associated text objects that have not been edited. Text object changes are not dynamically
reflected in field, group & summary settings.
Parameters : Parameters contain default values that can be modified for each report or
with each interactive run. Parameters may be placed in queries, user exits & text. The
default parameter value, width & data type applying to a report may be changed on the
parameter screen. Parameters may be selected for appearance or may be changed at run-
time on the run-time parameter form. Parameters may be entered from the command line
with the sqlrep or runrep command.
System Parameters provide production control. They are DESTYPE-Device type i.e.
Screen, File, Printer, Sysout & Mail. DESNAME-Destination of report i.e. File name,
Printer name & Oracle*Mail user id or user list. DESFORMAT-Printer format (used
when sending the report to a file, printer, stream, or Oracle*Mail). COPIES-Number of
copies to print (used when sending the report to the printer). CURRENCY-Symbols to
use for the dollar sign. THOUSANDS-Symbol to use for the comma. DECIMAL-Symbol
to use for the period.
Query Parameters can be created to specify data for the report at run-time.
Bind Parameter binds in a specific value when the query is run. To create a bind
parameter Include the parameter in the SELECT statement; precede the name with a
colon. Specify a default value on the parameter screen, or enter the value at run-time.
Lexical Parameter : Insert a SQL clause when the query is run. May be used to replace
PADMAPRIYA N Page 26
PL_SQL_Interview_Qns
WHERE, GROUP BY, ORDER BY, HAVING, CONNECT WITH, START WITH
clauses. To create a lexical parameter Create a new record on the parameter screen. Enter
the parameter name, data type & width. Enter the default value (SQL clause) on the
Parameter screen. Include the parameter in the SELECT statement; precede the parameter
name with &. Use the default value, or specify the value at run-time.
SQL*ReportWriter Utilities : SQLREP - Program used to design reports. GENREP -
Generates a runfile for a report that has not been executed via the Action menu. RUNREP
- Runs the reports (stored as runfiles) & creates final output. May be loaded on systems
without SQLREP to produce reports. DUMPREP - Creates an ASCII file containing
report definitions. LOADREP - Loads report definitions into an ORACLE database.
PRINTDEF - Creates printer definitions. TERMDEF - Created terminal definitions.
MOVEREP - SQL*ReportWriter V1.0 to V1.1 conversion program.
Matrix Reports : A matrix report has the following characteristics :
Matrix report is a grid containing three sets of data. Matrix Report require exactly three
queries: two parents & one child. Each query has only one group. Each group must be
identified as a matrix group. Print direction is Down for one group, Across for one group,
and Cross tab for the third (the group of the child query). Summaries are placed by
default in the group subfoots of the print group.
PRO*C :
Oracle Precompiler is a programming tool that allows to embed SQL statements in a high
level source program. Precompiler accepts the source program as input, translates the
embedded SQL statements into standard Oracle runtime library calls & generates a
modified source program that can be compiled, linked & executed in the normal way.
Why use Precompiler : It allows to pack the power & flexibility of SQL into application
programs. A convenient, easy to use interface lets your application access Oracle directly.
Help to fine tune the application & saves time because the precompiler & not the user
translates each embedded SQL statement into several native language Oracle calls.
Oracle Precompilers are full featured tools that support professional approach to
embedded SQL programming. FIPS flagger helps to develop portable applications & to
identify nonconforming SQL elements.
Embedded SQL Statements are divided into
Executable Declarative
Call to runtime library SQLLIB To declare Oracle objects, communication areas & SQL
variables.
Connect to Oracle, to define query & manipulate data, to control access to data & to
process transactions. Placed wherever host language host language executable statements
can be placed. Placed wherever host language declarations can be placed.
For SQL statements, begin with keywords EXEC SQL & end with SQL statement
terminator. For PL/SQL block, begin with EXEC SQL EXECUTE & END EXEC.
Host Variables are key to communication between Oracle and the program. Host variable
is a scalar or array variable declared in the host language & shared with Oracle. Program
uses i/p host variable to pass data to Oracle. Oracle uses o/p host variable to pass data &
status info to the program. In SQL statements, the variable are prefixed with a colon.
Indicator Variables is an integer variable that indicates the value or condition of its host
variable. Use indicator variable to assign nulls to i/p host variable & to detect nulls or
PADMAPRIYA N Page 27
PL_SQL_Interview_Qns
SQL*DBA :
Auditing : To aid in the investigation of suspicious db use. Statement Auditing is the
auditing of specific SQL statements. Privilege Auditing is the auditing of the use of
powerful system privileges. Object Auditing is the auditing of access to specific schema
objects.
Audit Trial : Results of audited operations are stored in a table in data dictionary.
Physical DB Structure : ORACLE db consists of atleast one or more data files, two or
more redo log files & one or more control files. The files of a db provide the actual
physical storage for db info.
Logical DB Structure : ORACLE db consists of one or more tablespaces, the db
schema??s objects (i.e. tables, views, indexes, clusters, sequences, sp). Tablespaces,
Segments, Extents dictate how physical space of a db is used.
Tablespaces : A db is divided into logical storage units called TS. TS is used to group
related logical structures together. Each db is logically divided into one or more TS. One
or more data files are explicitly created for each TS to physically store the data of all
logical structures in a TS. Combined size of the data file is the total storage capacity of
TS. Combined storage capacity of the TS??s is the total storage capacity of the db.
Online & Offline TS : A TS can be online (accessible) or offline (not accessible). A TS
can be offline to make portion of the db unavailable while allowing normal access for the
remainder of the db to make administrative tasks easier.
PADMAPRIYA N Page 28
PL_SQL_Interview_Qns
Schema is a collection of objects. Schema Objects are the logical structures that directly
refer to the db??s data. Schema objects includes tables, views, sequences, synonyms,
stored procedures, indexes, clusters & db links. No relation between ts & schema.
Objects in same schema can be in diff. ts & vice versa.
Index Clusters are group of one or more tables physically stored together because they
share common columns & are often used together. The related columns of the tables in a
cluster is called cluster key. The data in a cluster key of an index cluster is store only
once for multiple tables, so disk access time improves.
Hash Clusters : Also cluster table data in a manner similar to normal cluster. A row is
stored in a hash cluster based on the result of applying a hash function to the row??s
cluster key value. All rows with the same hash key value are stored together on disk.
Hash clusters are better than using indexed table or indexed clusters when a table is
queried with equality queries. For such queries, the specified cluster key is hashed. The
resulting hash key value points directly to the area on disk that stores the specified rows.
Database Links is a name object that describes a path from one db to another. DB links
are implicitly used when a reference is made to a global object name in a distributed db.
Data Blocks : At the finest level of granularity, an ORACLE db??s data is stored in data
blocks. One data block corresponds to a specific number of bytes of physical db space on
a disk. A data block size is specified when the db is created. A db uses & allocates free
db space in ORACLE data blocks.
Extents is the next level of logical db space. An extent is a specific number of contiguous
data blocks, obtained in a single allocation, used to store a specific type of info.
Segments is the next level of logical db storage above extent. A segment is a set of
extents allocated for a certain logical structure. Different types are
Data Segment : Each non clustered table has a data segment. All the table??s data is
stored in the extents of its data segment. Each cluster has a data segment.
Index Segment : Each index has a index segment that stores all of its data.
Rollback Segment : One or more rollback segments are created by the db administrator
for a db to temporarily store undo info.
Temporary Segments are created by ORACLE when a SQL statement needs a temporary
work area to complete execution. When the statement finishes execution, the temp.
segments extents are returned to the system for future use. ORACLE allocates space for
all types of segments in extents. Therefore, when the existing extents of a segment are
full, ORACLE allocates another extent for that segment as needed. Because extents are
allocated as needed, the extents of a segment may or may not be contiguous on disk.
Data Files : ORACLE db should have atleast one or more physical data files. It contains
all db data. A data file can be associated with only one db. Once created, a data file
cannot change in size. One or more data files form a logical unit of db storage called a
tablespace.
Redo Log Files : ORACLE db should have atleast two or more redo log files. The set of
redo log files for a db is collectively known as the db??s redo log. The primary function
is to record all changes made to data. Should a failure prevent modified data from being
permanently written to the data files, the changes can be obtained from redo log & work
is never lost. Redo Log files are critical in protecting a db against failures. To protect
against a failure involving the redo log itself, ORACLE allows a mirrored redo log so that
two or more copies of the redo log can be maintained in diff. disks.
PADMAPRIYA N Page 29
PL_SQL_Interview_Qns
The use of Redo Log Files : The info in redo log file is used only to recovered the db
from a system or media failure that prevents db data from being written to a db??s data
files.
Rolling Forward is the process of applying the redo log during a recovery operation.
Control Files : ORACLE db should have atleast one control file. A control file records
the physical structure of the db. It contains db name, names & locations of db??s data &
redo log files & time stamp of db creation. Control files can be mirrored for protection of
control files.
The use of Control Files : Every time an instance of an ORACLE db is started, its control
file is used to identify the db & the redo log files that must be opened for db operation to
proceed. DB??s control file is also used if db recovery is necessary.
Data Dictionary : ORACLE db should have a data dictionary. The data dictionary of a
ORACLE DB is a set of tables & views that are used as a read only reference about the
db. It stores info about physical & logical structure of db. It also stored the info about
valid users of an ORACLE db, info about integrity constraints defined for tables in the db
& how much space is allocated for a schema object and how much of it is being used. DD
is created when a db is created. The dd is critical to the operation of the db, which relies
on the dd to record, verify and conduct ongoing work.
ORACLE has three basic memory structures to function - System Global Area (SGA),
Program or Process Global Area (PGA) & Context Areas.
SGA is a shared memory region allocated by ORACLE that contain data & control info
for one Oracle db instance. It is written to only by RDBMS processes. SGA & Oracle
Background processes make up an Instance. SGA is allocated when an instance starts and
deallocated when the instance is shut down. Data in SGA is shared among all users
currently connected to the database. For optimal performance, the entire SGA should be
as large as possible, to store as much data in memory as possible & minimize disk I/O.
Most Oracle servers support only one Instance per Server. SGA contains Database
Buffers, Redo Log Buffers & Shared Pool. These areas have fixed sizes are created at the
instance startup.
DB Buffers Cache of the SGA store the most recently used blocks of db data; the set of
db buffers in an instance is the db buffer cache. These buffers can contain modified data
that has not been permanently written to the disk. Because the most recently used is kept
in memory, less disk I/O is necessary and performance is increased. It consists of two
blocks Data Segment Block & Rollback Segment Block.
During the course of transaction, changes to data are not written to the database file but
these steps take place (a) Each statement executed in the transaction modifies the
appropriate data segment block in the DB pool buffer. (b) Info that can be used to undo
the transaction is stored in a Rollback block in the db buffer pool. (c) A record of each
change made to Data & Rollback block is entered in a Redo Log Buffer. When
transaction is committed, info in the redo log buffer is written to Redo Log File which are
used in Recovery operations.
Redo Log Buffer of the SGA stores redo entries - a lot of changes made to the db. The
redo entries stored in the redo log buffers are written to an online redo log file, which is
used if db recovery is necessary. It size is static.
Shared Pool is a portion of the SGA that contains shared memory constructs such as
Shared SQL areas. A shared SQL area is required to process every unique SQL statement
PADMAPRIYA N Page 30
PL_SQL_Interview_Qns
submitted to a db. It contains info such as the parse tree and execution plan for the
corresponding statement. A single shared SQL areas is used by multiple applns. that issue
the same statement, leaving more shared memory for other uses.
PGA is a memory buffer that contains data & control info for a single client process.
PGA is allocated on the server for each client that connects to the server. It contains info
about connection & maintains info so that user can communicate with oracle. PGA
includes Context Areas. PGA is a writeable, non-shared memory area. It is exclusive to
the user processes & is read & written only by Oracle processes acting on behalf of the
user.
Context Areas is a memory buffer of the Server that contains the current status of one
SQL statement.
Virtual Memory is an OS feature that offers more apparent memory than is provided by
real memory. Simulates memory by swapping RAM & Secondary storage.
Processes is a mechanism in an OS that can execute a series of steps. Some OS uses the
terms job or tasks. A process normally has its own memory area in which it runs. It has
two general type of processes
User (Client) Processes is created and maintained to execute the software code of an
appln. program (Pro*C) or an ORACLE tool (SQL*DBA). It also manages the
communication with the server process thro?? program interface.
ORACLE Processes are called by other processes to perform functions on behalf of the
invoking process. Diff. types of Oracle processes are
Server Processes : ORACLE creates server processes to handle requests from connected
user processes. A server process is in charge of communicating with the user process and
interacting with ORACLE to carry out requests of the associated user process. Can be
configured to vary the number of user processes per server process
In a dedicated server config, a server process handles requests for a single user process. A
multi threaded config. allows many user process to share a small number of server
processes, minimizing the number of server processes and maximizing the utilization of
available system resources & the user and server processes should be separate.
Background Process : ORACLE creates a set of background processes for each instance.
They consolidate functions that would otherwise handled by multiple ORACLE programs
running for each user process. They asynchronously perform I/O & monitor other
ORACLE processes to provide increased parallelism for better performance & reliability.
BG processes are given below.
Database Writer (DBWR) processes writes modified blocks from the database buffer
cache to the database files. Blocks are written in proper order to maintain database
integrity. DBWR is optimized to minimize disk writes. DBWR writes only when more
data needs to be read into the SGA and too few db buffers free. The least recently used
data is written to the data files first.
Log Writer (LGWR) processes writes redo log entries to disk when transaction is
committed & the log buffer fills. Redo Log data is generated in the redo log buffer of the
SGA.
Checkpoint (CKPT) : At specific times, all modified db buffers in the SGA are written to
the data files by DBWR; this event is called a checkpoint. The checkpoint process is
responsible for signaling DBWR at checkpoints and updating all data & control files of
the db to indicate the most recent checkpoint. CKPT is optional; LGWR assumes the
PADMAPRIYA N Page 31
PL_SQL_Interview_Qns
PADMAPRIYA N Page 32
PL_SQL_Interview_Qns
3. The server is running proper SQL*Net driver & the server detects the connection
request from the appln. and creates a (dedicated) server process on behalf of the user
process.
4. The user creates a SQL statement and commits the transaction. E.g. changes a name in
a row of a table.
5. The server process receives the statement and checks the shared pool for any shared
SQL area that contains an identical SQL statement. If a shared SQL area is found, the
server process checks the user??s access privileges to the requested data and the
previously existing shared SQL is used to process the statement; if not, a new shared SQL
area is allocated for the statement so that it can be parsed and processed.
6. The server process retrieves any necessary data values from the actual data file or those
stored in SGA.
7. The server process modifies data in the SGA. The DBWR process writes modified
blocks permanently to disk when doing so is efficient. Because the transaction committed,
the LGWR process immediately records the transaction in the online redo log file.
8. If the transaction is successful, the server process send a message across the network to
the appln. If it is not successful, an appropriate error message is transmitted.
9. Throughout this entire procedure, the other background processes run, watching for
conditions that require intervention. In addition, the db server manages other users
transactions and prevents contention between transaction that request the same data.
Trusted ORACLE : is ORACLE corp. multilevel secure DBMS product. It is designed to
provide high level of secure data management capabilities required by organizations
processing sensitive or classified info. It enforces Mandatory Access Control (MAC)
which is mean of restricting access to info based on labels.
Distributed Processing uses more than one processor to divide the processing for a set of
related jobs. Reduces the processing load on a single processor by allowing different
processors to concentrate on a subset of related tasks, thus improving the performance.
An ORACLE db system can easily take advantage of the distributed processing by using
its client server architecture.
Distributed Databases is a network of db??s managed by multiple db servers that appears
to a user as a single logical db. The data of all db??s in the distributed db can be
simultaneously accessed and modified. Benefit is data of physically separate db??s can be
logically combined & potentially made accessible to all users on a nw. The db to which a
user is directly connected is known as local db. Any additional db??s accessed are called
remote db. Distributed db allows increased access to a large amount of data across a nw,
it must also provide the ability to hide the location of the data (Location Transparency) &
hide the complexity of accessing it across the nw. Site Autonomy i.e. each db
participating in a distributed db is administered separately & independently from the
other db??s, as though each db was a non-networked db.
Distributed Data Manipulation : To query a table named emp in the remote db SALES
select * from emp@sales.
Two Phase Commit mechanism guarantees that all db servers participating in a
distributed transaction either all commit or all roll back the statements in the transaction.
Consists of two phases
Prepare Phase : The global coordinator (initiating node) asks participants to prepare (to
promise to commit or rollback the transaction, even if there is a failure).
PADMAPRIYA N Page 33
PL_SQL_Interview_Qns
Commit Phase : If all participants respond to the coordinator that they are prepared, the
coordinator asks all nodes to commit the transaction; if all participants cannot prepare,
the coordinator asks all nodes to roll back the transaction.
Table Replication : Distributed db systems often locally replicate remote tables that are
frequently queried by local users. By having read-only copies of heavily accessed data on
several nodes, the distd. db does not need to send info across a nw repeatedly, thus
helping to maximize the performance of the db appln. ORACLE provides automatic
method for table replication & update called Snapshots.
Snapshots are read-only copies of a master table located on a remote node. Can be
queried but not updated.
Optimization is to choose the most efficient way to execute a SQL statement.
Execution Plan : To execute a DML statement, ORACLE may have to physically
retrieves rows of data from the db or prepares them in some way for the user issuing the
statement.. The combination of the steps the optimizer chooses to execute a statement is
called an execution plan.
Explain Plan : Examine the execution plan chosen by the optimizer for a SQL statement
by using this command. This command causes the optimizer to choose the execution plan
and then inserts data describing the plan into a db table.
Rule based approach : The optimizer chooses an execution plan based on the access paths
available and the ranks of these access paths in table. If there is more than one way to
execute an SQL statement, this approach uses the operation with the lower rank.
Operation of lower rank executes faster than those associated with constructs with higher
rank.
Cost based approach : The optimizer generates a set of potential execution plan for the
statement based on its available access paths and hints.
The optimizer estimates the cost of each execution plan based on data distribution and
storage characteristics statistics for the tables, clusters and indexes in the data dictionary.
The cost is an estimated value proportional to the expected elapsed time needed to
execute the statement using the execution plan. The optimizer calculates the cost based
on the estimated computer resources including but not limited to I/O, CPU time and
memory required to execute the statement using the plan. Execution plans with greater
costs take more time to execute than those with smaller costs.
The optimizer compares the cost of the execution plans and chooses one with the smaller
cost.
Goal of the Cost based Approach is the best throughput or minimal elapsed time
necessary to process all rows accessed by the statement.
Statistics used for the Cost based approach : This approach uses statistics to estimate the
cost of each execution plan. These statistics quantify the data distribution and storage
characteristics of tables, columns and indexes. These statistics are generated using the
ANALYZE command. Using these statistics, the optimizer estimates how much I/O,
CPU time, and memory are required to execute a SQL statement using a particular
execution plan.
The statistics are visible through these tables in the data dictionary.
USER_TABLES, ALL_TABLES & DBA_TABLES.
USER_TAB_COLUMNS, ALL_TAB_COLUMNS & DBA_TAB_COLUMNS.
USER_INDEXES, ALL_ INDEXES & DBA_ INDEXES.
PADMAPRIYA N Page 34
PL_SQL_Interview_Qns
Oracle :
1) What are the Back ground processes in Oracle and what are they.
This is one of the most frequently asked question.There are basically 9 Processes but in a
general system we need to mention the first five background processes.They do the house
keeping activities for the Oracle and are common in any system.
The various background processes in oracle are
a) Data Base Writer(DBWR) : Data Base Writer Writes Modified blocks from Database
buffer cache to Data Files.This is required since the data is not written whenever a
transaction is commited.
b) LogWriter(LGWR) : LogWriter writes the redo log entries to disk. Redo Log data is
generated in redo log buffer of SGA. As transaction commits and log buffer fills, LGWR
writes log entries into a online redo log file.
c) System Monitor(SMON) : The System Monitor performs instance recovery at instance
startup.This is useful for recovery from system failure
d) Process Monitor(PMON) : The Process Monitor peforms process recovery when user
Process fails. Pmon Clears and Frees resources that process was using.
e) CheckPoint(CKPT) : At Specified times, all modified database buffers in SGA are
written to data files by DBWR at Checkpoints and Updating all data files and control
files of database to indicate the most recent checkpoint
f) Archieves(ARCH) : The Archiver copies online redo log files to archival storal when
they are busy.
g) Recoveror(RECO) : The Recoveror is used to resolve the distributed transaction in
network
h) Dispatcher (Dnnn) : The Dispatcher is useful in Multi Threaded Architecture
PADMAPRIYA N Page 35
PL_SQL_Interview_Qns
i) Lckn : We can have upto 10 lock processes for inter instance locking in parallel sql.
PADMAPRIYA N Page 36
PL_SQL_Interview_Qns
7) How many Integrity Rules are there and what are they
There are Three Integrity Rules. They are as follows ::
a) Entity Integrity Rule : The Entity Integrity Rule enforces that the Primary key cannot
be Null
b) Foreign Key Integrity Rule : The FKIR denotes that the relationship between the
foreign key and the primary key has to be enforced.When there is data in Child Tables
the Master tables cannot be deleted.
c) Business Integrity Rules : The Third Intigrity rule is about the complex business
processes which cannot be implemented by the above 2 rules.
PADMAPRIYA N Page 37
PL_SQL_Interview_Qns
15) How many minimum groups are required for a matrix report
The minimum number of groups in matrix report are 4
PADMAPRIYA N Page 38
PL_SQL_Interview_Qns
Snapshots are mirror or replicas of tables. Views are built using the columns from one or
more tables. The Single Table View can be updated but the view with multi table cannot
be updated
19) What is the difference between candidate key, unique key and primary key
Candidate keys are the columns in the table that could be the primary keys and the
primary key is the key that has been selected to identify the rows. Unique key is also
useful for identifying the distinct rows in the table.
PADMAPRIYA N Page 39
PL_SQL_Interview_Qns
PADMAPRIYA N Page 40
PL_SQL_Interview_Qns
rules and Oracle Satisfies 11 of the 12 rules and is the only Rdbms to satisfy the
maximum number of rules.
31) What is the Difference between a post query and a pre query
A post query will fire for every row that is fetched but the pre query will fire only once.
PADMAPRIYA N Page 41
PL_SQL_Interview_Qns
* ISOLATED
a) on clear details
b) on populate details
* CASCADE
a) per-delete
b) on clear details
c) on populate details
PADMAPRIYA N Page 42
PL_SQL_Interview_Qns
automatically inherits any changes that have been made to the source object when you
open or regenerate the module that contains the reference object.
Restrictions:
The statement you pass to FORMS_DDL may not contain bind variable references in the
string, but the values of bind variables can be concatenated into the string before passing
the result to FORMS_DDL.
9 ) What are the types of triggers and how the sequence of firing in text item
Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers.
Key Triggers : Key Triggers are fired as a result of Key action.e.g : Key-next-field, Key-
up,Key-Down Mouse Triggers : Mouse Triggers are fired as a result of the mouse
navigation.e.g. When-mouse-button-presed,when-mouse-doubleclicked,etc
Navigational Triggers : These Triggers are fired as a result of Navigation. E.g : Post-
Text-item,Pre-text-item. We also have event triggers like when -new-form-instance and
when-new-block-instance.
We cannot call restricted procedures like go_to(??my_block.first_item??) in the
Navigational triggers . But can use them in the Key-next-item. The Difference between
Key-next and Post-Text is an very important question. The key-next is fired as a result of
the key action while the post text is fired as a result of the mouse movement. Key next
will not fire unless there is a key event.
The sequence of firing in a text item are as follows ::
a) pre - text
b) when new item
PADMAPRIYA N Page 43
PL_SQL_Interview_Qns
c) key-next
d) when validate
e) post text
11) What are property classes ? Can property classes have trigger?
Property class inheritance is a powerful feature that allows you to quickly define objects
that conform to your own interface and functionality standards. Property classes also
allow you to make global changes to applications quickly. By simply changing the
definition of a property class, you can change the definition of all objects that inherit
properties from that class. Yes . All type of triggers .
12) If you have property class attached to an item and you have same trigger written for
the
item . Which will fire first?
Item level trigger fires , If item level trigger fires, property level trigger won't fire.
Triggers at the lowest level are always given the first preference. The item level trigger
fires first and then the block and then the Form level trigger.
13) What are record groups ? Can record groups created at run-time?
A record group is an internal Oracle Forms data structure that has a column/row
framework similar to a database table. However, unlike database tables, record groups are
separate objects that belong to the form module in which they are defined. A record
group can have an unlimited number of columns of type CHAR, LONG, NUMBER, or
DATE provided that the total number of columns does not exceed 64K.Record group
column names cannot exceed 30 characters. Programmatically, record groups can be used
whenever the functionality offered by a two-dimensional array of multiple data types is
desirable.
TYPES OF RECORD GROUP:
Query Record Group A query record group is a record group that has an associated
SELECT statement.
The columns in a query record group derive their default names, data types, and lengths
from the database columns referenced in the SELECT statement. The records in a query
record group are the rows retrieved by the query associated with that record group.
Non-query Record Group A non-query record group is a group that does not have an
associated query, but whose structure and values can be modified programmatically at
runtime.
Static Record Group A static record group is not associated with a query; rather, you
define its structure and row values at design time, and they remain fixed at runtime.
PADMAPRIYA N Page 44
PL_SQL_Interview_Qns
15) Can a button have icon and lable at the same time ?
-NO
PADMAPRIYA N Page 45
PL_SQL_Interview_Qns
8) what is precompiler?
It is similar to C precompiler directives.
11) What are savepoint mode and cursor mode properties ? level?
Specifies whether Oracle Forms should issue savepoints during a session. This property
is included primarily for applications that will run against non-ORACLE data sources.
For applications that will run against ORACLE, use the default setting.
Cursor mode - define cursur state across transaction
Open/close.
PADMAPRIYA N Page 46
PL_SQL_Interview_Qns
provides a way for an OLE container application to use the features of an OLE server
application to manipulate an OLE object from the OLE container environment.
(FORMS_OLE)
GUI
PADMAPRIYA N Page 47
PL_SQL_Interview_Qns
PADMAPRIYA N Page 48
PL_SQL_Interview_Qns
Reports 2.5
1) How many types of columns are there and what are they
Formula columns : For doing mathematical calculations and returning one value
Summary Columns : For doing summary calculations such as summations etc.
Place holder Columns : These columns are useful for storing the value in a variable
5) What is Flex
Flex is the property of moving the related fields together by setting the flex property on
6) What are the minimum number of groups required for a matrix report
The minimum of groups required for a matrix report are 4
Oracle
1) What are the Back ground processes in Oracle and what are they.
1) This is one of the most frequently asked question.There are basically 9 Processes but
in a
general system we need to mention the first five background processes.They do the house
keeping
activities for the Oracle and are common in any system.
The various background processes in oracle are
a) Data Base Writer(DBWR) :: Data Base Writer Writes Modified blocks from Database
buffer cache to Data Files.This is required since the data is not written whenever a
transaction is commited.
b)LogWriter(LGWR) :: LogWriter writes the redo log entries to disk. Redo Log data is
PADMAPRIYA N Page 49
PL_SQL_Interview_Qns
generated in redo log buffer of SGA. As transaction commits and log buffer fills, LGWR
writes log entries into a online redo log file.
c) System Monitor(SMON) :: The System Monitor performs instance recovery at
instance startup.This is useful for recovery from system failure
d)Process Monitor(PMON) :: The Process Monitor peforms process recovery when user
Process fails. Pmon Clears and Frees resources that process was using.
e) CheckPoint(CKPT) :: At Specified times, all modified database buffers in SGA are
written to data files by DBWR at Checkpoints and Updating all data files and control
files of database to indicate the
most recent checkpoint
f)Archieves(ARCH) :: The Archiver copies online redo log files to archival storal when
they are busy.
g) Recoveror(RECO) :: The Recoveror is used to resolve the distributed transaction in
network
h) Dispatcher (Dnnn) :: The Dispatcher is useful in Multi Threaded Architecture
i) Lckn :: We can have upto 10 lock processes for inter instance locking in parallel sql.
PADMAPRIYA N Page 50
PL_SQL_Interview_Qns
specific stament. A cursor is basically an area allocated by Oracle for executing the Sql
Statement. Oracle uses an implicit cursor statement for Single row query and Uses
Explcit cursor for a multi row query.
f) System Global Area(SGA) :: The SGA is a shared memory region allocated by the
Oracle that contains Data and control information for one Oracle Instance.It consists of
Database Buffer Cache and Redo log Buffer.
g) Program Global Area (PGA) :: The PGA is a memory buffer that contains data and
control information for server process.
g) Database Buffer Cache :: Databese Buffer of SGA stores the most recently used blocks
of datatbase data.The set of database buffers in an instance is called Database Buffer
Cache.
h) Redo log Buffer :: Redo log Buffer of SGA stores all the redo log entries.
i) Redo Log Files :: Redo log files are set of files that protect altered database data in
memory that has not been written to Data Files. They are basically used for backup when
a database crashes.
j) Process :: A Process is a 'thread of control' or mechansim in Operating System that
executes series of steps.
7) How many Integrity Rules are there and what are they
7) There are Three Integrity Rules. They are as follows ::
a) Entity Integrity Rule :: The Entity Integrity Rule enforces that the Primary key cannot
PADMAPRIYA N Page 51
PL_SQL_Interview_Qns
be Null
b) Foreign Key Integrity Rule :: The FKIR denotes that the relationship between the
foreign key and the primary key has to be enforced.When there is data in Child Tables
the Master tables cannot be deleted.
c) Business Integrity Rules :: The Third Intigrity rule is about the complex business
processes which cannot be implemented by the above 2 rules.
PADMAPRIYA N Page 52
PL_SQL_Interview_Qns
15) How many minimum groups are required for a matrix report
15) The minimum number of groups in matrix report are 4
19) What is the difference between candidate key, unique key and primary key
19) Candidate keys are the columns in the table that could be the primary keys and the
primary key
is the key that has been selected to identify the rows. Unique key is also useful for
identifying the distinct rows in the table.
20)What is concurrency
20) Cuncurrency is allowing simultaneous access of same data by different users. Locks
useful for accesing the database are
a) Exclusive
The exclusive lock is useful for locking the row when an insert,update or delete is being
PADMAPRIYA N Page 53
PL_SQL_Interview_Qns
done.This lock should not be applied when we do only select from the row.
b) Share lock
We can do the table as Share_Lock as many share_locks can be put on the same resource.
PADMAPRIYA N Page 54
PL_SQL_Interview_Qns
31) What is the Difference between a post query and a pre query
31) A post query will fire for every row that is fetched but the pre query will fire only
once.
PADMAPRIYA N Page 55
PL_SQL_Interview_Qns
32) We can delete the duplicate rows in the table by using the Rowid
In extents .
* NON-ISOLATED (default)
PADMAPRIYA N Page 56
PL_SQL_Interview_Qns
b) on clear details
c) on populate details
* ISOLATED
a) on clear details
b) on populate details
* CASCADE
a) per-delete
b) on clear details
c) on populate details
PADMAPRIYA N Page 57
PL_SQL_Interview_Qns
reference object.
Restrictions:
The statement you pass to FORMS_DDL may not contain bind variable references in the
string, but the
values of bind variables can be concatenated into the string before passing the result to
FORMS_DDL.
9 ) What are the types of triggers and how the sequence of firing in text item
9)
Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers.
Key Triggers :: Key Triggers are fired as a result of Key action.e.g :: Key-next-field,
Key-up,Key-Down
Mouse Triggers :: Mouse Triggers are fired as a result of the mouse navigation.e.g.
When-mouse-button-presed,when-mouse-doubleclicked,etc
Navigational Triggers :: These Triggers are fired as a result of Navigation. E.g : Post-
Text-item,Pre-text-item.
We also have event triggers like when ?Vnew-form-instance and when-new-block-
PADMAPRIYA N Page 58
PL_SQL_Interview_Qns
instance.
We cannot call restricted procedures like go_to(??my_block.first_item??) in the
Navigational triggers
But can use them in the Key-next-item.
The Difference between Key-next and Post-Text is an very important question. The key-
next is fired as a result of the key action while the post text is fired as a result of the
mouse movement. Key next will not fire unless there is a key event.
The sequence of firing in a text item are as follows ::
a) pre - text
b) when new item
c) key-next
d) when validate
e) post text
11) What are property classes ? Can property classes have trigger?
11) Property class inheritance is a powerful feature that allows you to quickly define
objects that conform to
your own interface and functionality standards. Property classes also allow you to make
global changes to
applications quickly. By simply changing the definition of a property class, you can
change the definition
of all objects that inherit properties from that class.
Yes . All type of triggers .
* 12 a) If you have property class attached to an item and you have same trigger written
for the item .
Which will fire first?
12)Item level trigger fires , If item level trigger fires, property level trigger won't fire.
Triggers at the lowest level are always given the first preference. The item level trigger
fires first and then the block and then the Form level trigger.
13) What are record groups ? * Can record groups created at run-time?
13)A record group is an internal Oracle Forms data structure that has a column/row
framework similar to a
database table. However, unlike database tables, record groups are separate objects that
belong to the
form module in which they are defined. A record group can have an unlimited number of
columns of type
CHAR, LONG, NUMBER, or DATE provided that the total number of columns does not
exceed 64K.
Record group column names cannot exceed 30 characters.
Programmatically, record groups can be used whenever the functionality offered by a
two-dimensional
PADMAPRIYA N Page 59
PL_SQL_Interview_Qns
15) Can a button have icon and label at the same time ?
15) -NO
When Mouse Navigate is set to False, Oracle Forms does not perform navigation (and the
resulting validation) to move to the item when an operator activates the item with the
mouse.
PADMAPRIYA N Page 60
PL_SQL_Interview_Qns
which we add items and stacked canvas is used for giving 3 dimensional effect.
The following questions might not be asked in an Average Interview and could be asked
when the Interviewer wants to trouble u and go deeppppppppppppp?K?KHe cannot go
further?K..
8) what is precompiler?
PADMAPRIYA N Page 61
PL_SQL_Interview_Qns
Locking mode :
Specifies when Oracle Forms should attempt to obtain database locks on rows that
correspond to queried records in the form.
a) immediate b) delayed
11) What are savepoint mode and cursor mode properties ? level?
11) Specifies whether Oracle Forms should issue savepoints during a session. This
property is included primarily for applications that will run against non-ORACLE data
sources. For applications that will run against ORACLE, use the default setting.
Cursor mode - define cursur state across transaction
Open/close.
PADMAPRIYA N Page 62
PL_SQL_Interview_Qns
Parameters:
object Is an OLE2 Automation Object.
method Is a method (procedure) of the OLE2 object.
list Is the name of an argument list assigned to the OLE2.CREATE_ARGLIST function.
GUI
PADMAPRIYA N Page 63
PL_SQL_Interview_Qns
PADMAPRIYA N Page 64
PL_SQL_Interview_Qns
Reports 2.5
1) How many types of columns are there and what are they
1) Formula columns :: For doing mathematical calculations and returning one value
Summary Columns :: For doing summary calculations such as summations etc.
Place holder Columns :: These columns are useful for storing the value in a variable
5) What is Flex
5) Flex is the property of moving the related fields together by setting the flex property
on
6) What are the minimum number of groups required for a matrix report
6) The minimum of groups required for a matrix report are 4
A database instance (server) is a set of memory structures and background processes that
access a set of database files.
The memory structures that are used to store most queried data from database. This helps
us to improve database performance by decreasing the amount of I/O performed against
data file.
PADMAPRIYA N Page 65
PL_SQL_Interview_Qns
3. What is Schema ?
An index is a database structure used by the server to have direct access of a row in a
table.
An index is automatically created when a unique or primary key constraint clause is
specified in create table command (Ver 7.0)
5. What is clustres ?
Group of tables physically stored together because they share common columns and are
often used together is called Clusters.
The related columns of the tables are called the cluster key. The cluster key is indexed
using a cluster index and its value is stores only once for multiple tables in the cluster.
It consists of
one or more data files
one or more control files
two or more redo log files
PADMAPRIYA N Page 66
PL_SQL_Interview_Qns
ARCH
CKPT
RECO
Dispatcher
User process with associated PGA
Two processes waiting to update the rows of a table which are locked by the other
process then deadlock arises.
In a database environment this will often happen because of not issuing proper row lock
commands. Poor design of front-end application may cause this situation and the
performance of server will reduce drastically.
The System Global Area in a Oracle database is the area in memory to facilitates the
transfer of information between users. It holds the most recently requested structural
information about the database.
The structure is Database buffers, Dictionary Cache, Redo Log Buffer and Shared SQL
pool (Ver 7) area.
The data dictionary cache is stored in an area in SGA called the Shared SQL Pool. This
will allow sharing of parsed SQL statements among concurrent users.
Data segment are the physical areas within a database block in which the data associated
with tables and clusters are stored.
13. What are the factors causing the reparsing of SQL statements in SGA ?
PADMAPRIYA N Page 67
PL_SQL_Interview_Qns
Monitor the ratio of the reloads takes place while executing SQL statements. If the ratio
is greater that 1 then increase the SHARED_POOL_SIZE.
Database buffers are cache in the SGA used to hold the data blocks that are read from the
data segments in the database such as tables, indexes and clusters.
DB_BLOCK_BUFFERS parameter in INIT.ORA decides the size.
Dictionary cache is information about the database objects stored in a data dictionary
table.
Number of times processes repeatedly query the dictionary table is called recursive hits.
It is due to the data dictionary cache is too small. By increasing the
SHARED_POOL_SIZE parameter we can optimize the size of Data Dictionary Cache.
Changes made to entries are written to the on-line redo log files so that they can be used
in roll forward operation during database recoveries. Before writing them into the redo
log files, they will first brought to redo log buffers in SGA and LGWR will write into
files frequently. LOG_BUFFER parameter will decide the size.
18. How will you swap objects into a different table space for an existing database ?
PADMAPRIYA N Page 68
PL_SQL_Interview_Qns
20. How will you force database to use particular rollback segment ?
23. Which parameter in Storage clause will reduce no of rows per block ?
PCTFREE parameter
Row size also reduces no of rows per block.
We can plan the storage for a table as how much initial extents are required, how much
can be extended next, how much % should leave free for managing row updations etc.
This is used to reserve certain amount of space in a block for expansion of rows.
PADMAPRIYA N Page 69
PL_SQL_Interview_Qns
To manage the database level of transactions such as modifications of the data dictionary
table that record information about the free space usage.
30. How the space utilisation takes place within rollback segments ?
It will try to fit the transaction in a cyclic fashion to all existing extents. Once it found an
extent is in use then it forced to acquire a new extent. (No of extents is based on the
OPTIMAL size).
PADMAPRIYA N Page 70
PL_SQL_Interview_Qns
34. List the sequence of events when a large transaction that exceeds beyond its optimal
value when an entry wraps and causes the rollback segment to expand into another extend.
Transaction Begins
An entry is made in the RBS header for new transactions entry
Transaction acquired blocks in an extent of RBS
The entry attempts to wrap into second extent. None is available. So that the RBS must
extent.
The RBS checks to see if it is oldest inactive segment
Oldest inactive segment is eliminated
RBS extends
The Data dictionary table for space management are updated
Transaction Completes.
36. How will you estimate the space required by non-clustered tables ?
37. Is it possible to use raw devices as data file and what is the advantages over file
system files ?
Yes.
The advantages over file system files :
I/O will be improved because Oracle is bye-passing the kernal while writing into disk.
Disk Corruption will be very less.
Database's overall physical architecture is maintained in a file called control file. It will
PADMAPRIYA N Page 71
PL_SQL_Interview_Qns
be used to maintain internal consistency and guide recovery operations. Multiple copies
of control files are advisable.
39. How to implement the multiple control files for an existing database ?
40. What is meant by Redo Log file mirroring ? How it can be achieved ?
Shadow set of disks save as a backup in the event of disk failure. In most Operating
System if any disk failure occurs it automatically switchover to place of failed disk.
Improved performance because of most OS support volume shadowing can direct file I/O
request to use the shadow set of files instead of the main set of files. This reduces I/O
load on the main set of disks.
They allow the database to maintain read consistency between multiple transactions.
It is the set of before image data blocks that contain rows that are modified by a
transaction.
Each Rollback Segment entry must be completed within one rollback segment.
A single rollback segment can have multiple rollback segment entries.
It is a measure of well the data cache buffer is handling requests for data.
Hit Ratio = (Logical Reads - Physical reads - Hit Misses) / Logical reads.
PADMAPRIYA N Page 72
PL_SQL_Interview_Qns
47. List the factors that can affect the accuracy of the estimations ?
The space used transaction entries and deleted records does not become free immediately
after completion due to delayed cleanout.
Trailing nulls and length bytes are not stored.
Inserts of, updates to, and deletes of rows as well as columns larger than a single data
block, can cause fragmentation and chained row pieces.
50. What are the dictionary tables used to monitor a database spaces ?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES
PADMAPRIYA N Page 73
PL_SQL_Interview_Qns
52. What are requirements one should fulfill to connect to ORACLE as internal?
Operating system account has the operating system privileges that allow you to connect
One should be authorised to connect as internal
Database has a password for internal connections, and you know the password must use a
dedicated server
53. What are the roles and user accounts created automatically with the database ?
SYS user account - The DBA role will be assigned to this account. All of the base tables
and views for the database's dictionary are store in this schema and are manipulated only
by ORACLE.
SYSTEM user account - It has all the system privileges for the database and additional
tables and views that display administrative information and internal tables and views
used by oracle tools are created using the username.
SQL*Loader - It loads data from standard operating system files (Flat files) into
ORACLE database tables.
EXPORT(exp) and IMPOER (imp) utilities allow you to move existing data in ORACLE
format to and from ORACLE database.
55. What are the minimum parameters should exist in the parameter file (init.ora) ?
DB_NAME - Must set to a text string of not more that 8 characters and it will be stored
inside the datafiles, redo log files and control file while database creation.
DB_DOMAIN - It is string that specifies the network domain where the database is
created. The global database name is identified by setting these parameters (DB_NAME
& DB_DOMAIN)
PADMAPRIYA N Page 74
PL_SQL_Interview_Qns
DB_BLOCK_SIZE - The default data block size and is operating system dependent. It
cannot be changed after database creation except by re-creating the database.
Each server and background process can write an associated trace file. When an internal
error is detected by a process or user process, it dumps information about the error to its
trace. This can be used for tuning the database.
Roles are easiest way to grant and manage common privileges needed by different groups
of database users.
Creating roles and assigning privies to roles.
Assign each role to group of users. This will simplify the job of assigning privileges to
individual users.
58. What are the steps to switch a database's archiving mode between
NOARCHIEVELOG and ARCHIVELOG mode ?
60. How can we specify the Archived log file name format and destination ?
PADMAPRIYA N Page 75
PL_SQL_Interview_Qns
A simple snapshot is based on a query that does not contains GROUP BY clauses,
CONNECT by clauses, JOINs, Subquery or a set of operations.
A complex snapshots contain at least any one of the above.
Updating or inserting records in remote database through database triggers. It may fail if
remote database is having any problem.
PADMAPRIYA N Page 76
PL_SQL_Interview_Qns
Time the references to occur when master tables are not in use.
Perform the references manually immediately after locking the master tables.
We can join tables in snapshots by creating a complex snapshot that will be based on the
master tables.
COMPLETE - Tables are completely regenerated using the snapshot's query and the
master tables every time the snapshot referenced.
FAST - If simple snapshot used then a snapshot log can be used to send only the changes
to the snapshot tables.
FORCE - The default value. If possible it performs a FAST refresh; Otherwise it will
perform a COMPLETE refresh.
The data in the snapshot log is used during fast references of the table's snapshots.
We must be able to create a after row trigger on table (i.e. it should not be already
available)
After giving table previleges.
We cannot specify snapshot log name because oracle uses the name of the master table in
the name of the database objects that support its snapshot log.
The master table name should be less than or equal to 23 characters.
(The table name created will be MLOG$_tablename, and trigger name will be
TLOG$_tablename)
Database on other servers can be updated and those transactions can be grouped together
with others in a logical unit.
Database uses a two phase commit
Database on other servers can be updated and those transactions can be grouped together
with others in a logical unit is called two-phase commit. They are
PADMAPRIYA N Page 77
PL_SQL_Interview_Qns
The Preparation Phase : An initiating node called the global coordinator notifies all sites
involved in the transaction to be ready either commit or rollback the transaction.
The Commit Phase : If there is no problem with prepare phase, then all sites commit their
transactions. If a network or node failure occurs, then all sites rollback their transactions.
Logical Backups
Cold Backups
Hot Backups (Archive log)
Logical backup involves reading a set of database records and writing them into a file.
Export utility is used for taking backup and Import utility is used to recover from backup.
Cold backup is taking backup of all physical files after normal shutdown of database. We
need to take
All Data files
All Control files
All on-line redo log files
Then init.ora file (optional)
Taking backup of archive log files when database is open. For this the ARCHIVELOG
mode should be enabled. The following files need to be backed up :
All data files
All archive log, redo log files
On control file.
PADMAPRIYA N Page 78
PL_SQL_Interview_Qns
Flag to indicate whether export should compress fragmented segments into single extents.
A flag to indicate whether grants on database objects will be exported or not. Values is
'Y' or 'N'.
Flag to indicate whether table rows should be exported. If 'N' only DDL statements for
the database objects will be created.
For incremental exports, the flag indicates whether a record will be stored in data
dictionary tables recording the export.
PADMAPRIYA N Page 79
PL_SQL_Interview_Qns
A flag to indicate whether statistical information about the exported objects should be
written to export dump file.
A flag to indicate whether a read consistent version of all the exported objects should be
maintained.
A flag to indicate whether import should ignore errors encounter when issuing CREATE
command.
A flag to indicate whether rows should be imported. I f this is set to 'N' then only DDL
for the database objects will be executed ?
PADMAPRIYA N Page 80
PL_SQL_Interview_Qns
A list of database accounts whose objects should be read from the export dump file.
A list of database accounts into which objects in the export dump file will be imported
A flag to indicate whether import should commit after each array. If 'N' then commit will
take place at table level
If filename is given then all the DDL will be created in the given file.
A flag to indicate whether the create tablespace command found in dump files from full
exports will be executed.
Name of the file to which the log of the import will be written.
112. Consider a case below : User is taking the backup in the following fashion :
PADMAPRIYA N Page 81
PL_SQL_Interview_Qns
Type F I I I I C I I I I C I I
Date 1 2 3 4 5 6 7 8 9 10 11 12 13
F - Full Backup
I - Incremental Backup
C - Cumulative Backup
Suppose database crash on 14th morning. How can we retrieve the database ?
113. List the steps to restore the database if data file lost. (Assume we are taking hot
backups)
Copy the lost file from the backup to the original location
Start the instance
Mount the database
Recover the database using recover database command
Open the database
114. What are the points to be taken care when we are using SQL*Loader for importing
data from flat files ?
115. What are the advantages of using direct path option in SQL*Loader ?
It bypasses the normal processing of insert statements and instead writes directly to tables
data blocks.
When direct option is used index become invalid and once the load complete the new key
is merged with all old one and bring the status to valid.
Data should be presorted otherwise it needs the double the size in tablespace.
116. What are areas a DBA can monitor the database using SQLDBA command?
DBA can monitor the following areas to do fine tuning of the database :
Processes
Sessions
Tables(Locks etc)
PADMAPRIYA N Page 82
PL_SQL_Interview_Qns
SQL Area
Library Cache
Latch
Locks
File I/O
System I/O
Rollback Segments
Statistics (System, Sessions)
Apart from this all DBA activities can be performed through SQLDBA command.
DDE ?V OLE
What is DDE ?
DDE uses shared memory to exchange data and a protocol to synchronize passing of data.
A DLL allocates a global memory block to an application and uses this to exchange data
with application.
Message based DDE applications and Dynamic Data Exchange Management Library
application.
PADMAPRIYA N Page 83
PL_SQL_Interview_Qns
A monitor application can only intercept messages but cannot act on it.
An embedded object is stored in the document itself while the document just stores a
reference to the linked object.
If a link object is changed independently of the document, wht happens the linked object
in the document ?
1. The reference object is automatically refreshed
2. The reference object is not refreshed
3. The user decides whether the object is to refreshed or if the older version is retained.
Answer is 2
A trigger is automatically executed when the firing event occurs while stored procedure
has to be invoked.
Oracle Forms:
PADMAPRIYA N Page 84
PL_SQL_Interview_Qns
20. which are the triggers will fire in the following situation
2. Text-item2
1. Pre-text-item
2. When-validate-item
3. When-new-item-instance
4. Key-next-item
5. Post-text-item
6. Post-change
3. Text-item3
1. Pre-text-item
2. When-validate-item
PADMAPRIYA N Page 85
PL_SQL_Interview_Qns
3. When-new-item-instance
4. Key-next-item
5. Post-text-item
6. Post-change
If I press tab or enter key at text-item1 what are the triggers will fire and order of firing
during the entire navigation.
Go_item (??text_item2??);
: Text_item2: = ??Nagendra??;
Go_item (??text_item3??);
Then what are the triggers will fire and order of firing
PADMAPRIYA N Page 86
PL_SQL_Interview_Qns
46. In a non-isolated relation what is the order of firing the following triggers
1. on-populate-details
2. on-clear-details
3. pre-query
4. pre-select
47. How to find out the previous form id in multi form application(it??s system variable)
48. How to use single LOV for multiple items
Oracle reports:
PADMAPRIYA N Page 87
PL_SQL_Interview_Qns
12. Query to display no of employees in the department 10, 20,30 in a single row
Output
Dept10 dept20 dept30
256
13. Query to find the no of subordinate levels for given manager
14. Query to find the no of employees who is drawing less than 1500 and greater than
2000
Server concepts
PADMAPRIYA N Page 88
PL_SQL_Interview_Qns
ii) Query to get the employees who are getting salaries more than their managers
select a.emp_no from emp_self a,emp_self b where a.mgr =b.emp_no and a.sal > b.sal;
EMP_NO
-------
101
100
110
300
iii) Query to find the nth highest salary
select a.empn_name,a.sal from emp_self a where &n = (select count(*) from emp_self b
where a.sal < b.sal);
When n=1 , sal =20000 ->second highest salary ; n=4 , sal =10000 ->fifth highest salary ;
iv) Query to find the second highest salary in different departments.
select a.deptid,min(a. sal) from emp_self a where 1 in (select count(*) from emp_self b
where a.sal < b.sal group by b.deptid) group by a.deptid;
DEPTID MIN(A.SAL)
------- ----------
10 9000
PADMAPRIYA N Page 89
PL_SQL_Interview_Qns
20 20000
50 8000
v) Query to find departments with total salary >25000
DEPTID
------
20
50
4) study the fallowing pl/sql block and find the type of error ->syntax,semantic(logical)
or precedence
begin
for i in 1..5 loop
update emp
set sal = 1000 where empno =100 ;
end loop;
end;
MAX(SAL) MIN(SAL)
---------- ----------
10000 8000
GREATEST(SAL) LEAST(SAL)
------------- ----------
9000 9000
10000 10000
8000 8000
6)Different kinds of constraints .
PADMAPRIYA N Page 90
PL_SQL_Interview_Qns
As a 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.
PADMAPRIYA N Page 91
PL_SQL_Interview_Qns
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.
PROCEDURE CALL_FORM
(formmodule_name VARCHAR2);
New_form( ) :-
Exits the current form and enters the indicated form. The calling form is terminated as the
parent form. If the calling form had been called by a higher form, Form Builder keeps the
higher call active and treats it as a call to the new form. Form Builder releases memory
(such as database cursors) that the terminated form was using.
Form Builder runs the new form with the same Runform options as the parent form. If the
parent form was a called form, Form Builder runs the new form with the same options as
the parent form.
PROCEDURE NEW_FORM
(formmodule_name VARCHAR2);
4) system.mode->
SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch
Processing mode. The value is always a character string.
Usage Notes
When using SYSTEM.MODE to check whether the current block is in Enter Query mode,
be aware that if testing from a When-Button-Pressed trigger in a control block, Enter
Query mode will never be entered, because the control block is not the current block.
PADMAPRIYA N Page 92
PL_SQL_Interview_Qns
PADMAPRIYA N Page 93
PL_SQL_Interview_Qns
9.3 Windows
15. Can you have more than one content canvas view attached
with a window?
Yes. Each window you create must have at least one content canvas-view assigned to it.
PADMAPRIYA N Page 94
PL_SQL_Interview_Qns
You can also create a window that has multiple content canvas-views. At runtime, only
one of the content canvas-views assigned to a window is displayed at a time.
9.4 Modules
18. What are the default extensions of the files created by Forms
Module ?
.FMB Form Module Binary
.FMX Form Module Executable
19. What are the default extensions of the files created by Menu
Module ?
.MMB Menu Module Binary
.MMX Menu Module Executable
PADMAPRIYA N Page 95
PL_SQL_Interview_Qns
coordination-causing event.
26. What are the different default triggers created when Master
Deletes Property is set to Non-isolated?
Master Deletes Property Resulting Triggers
Non-Isolated (the default) On-Check-Delete-Master
On-Clear-Details
On-Populate-Details
27. What are the different default triggers created when Master
Deletes Property is set to Cascade?
Master Deletes Property Resulting Triggers
Cascading On-Clear-Details
On-Populate-Details
Pre-Delete
28. What are the different default triggers created when Master
Deletes Property is set to Isolated?
Master Deletes Property Resulting Triggers
Isolated On-Clear-Details
On-Populate-Details
PADMAPRIYA N Page 96
PL_SQL_Interview_Qns
Auto-Query
These properties determine when the population phase of block coordination should
occur.
Example
PADMAPRIYA N Page 97
PL_SQL_Interview_Qns
Editors
LOV(List Of Values)
45. What is the basic data structure that is required for creating
an LOV?
Record Group
PADMAPRIYA N Page 98
PL_SQL_Interview_Qns
When LOV for validation is set to true, Oracle Forms compares the current value of the
text item to the values in the first column displayed in the LOV whenever the validation
event occurs.
If the value in the text item matches one of the values in the first column of the LOV,
Validation succeeds ,The LOV is not displayed, the processing continues normally.
If the value in the text item doesn??t match one of the values in the first column of the
LOV,Oracle Forms displays the LOV and uses the text item value as the search criteria to
automatically reduce the list.
47. What are the built-ins that are used to attach an LOV
programatically to an item?
Set_item_property
Get_item_property
(by setting the LOV_NAMEproperty)
48. What are the built-ins that are used for setting the LOV
properties at runtime?
get_lov_property
set_lov_property
Record Groups
PADMAPRIYA N Page 99
PL_SQL_Interview_Qns
57. What are the built-ins used for modifying a group structure?
ADD_GROUP_COLUMN(function)
ADD_GROUP_ROW(Procedure)
DELETE_GROUP_ROW(Procedure)
POPULATE_GROUP(function)
POPULATE_GROUP_WITH_QUERY(function)
SET_GROUP_CHAR_CELL(Procedure)
SET_GROUP_DATE_CELL(Procedure)
SET_GROUP_NUMBER_CELL(Procedure)
60. What are the built-ins used for finding Object ID functions?
FIND_GROUP(function)
FIND_COLUMN(function)
PARAMETERS
value.
Example:
Name_In(??PARAMETER.my_param??)
Copy(??SURESH??,??PARAMETER>my_param??)
Images
items.
76. How do you create a new session while opening a new form?
Using OPEN_FORM built-in setting the SESSION option.
Ex: OPEN_FORM(??STOCKS??,ACTIVE,SESSION);
When you invoke multiple forms with OPEN_FORM and CALL_FORM in the
Same application,state whether the following are TRUE or FALSE
80. What are the various subevents a mouse double click event
invokes?
Double_clicking the mouse consists of the mouse down,mouse up,mouse click,mouse
down and mouse up events.
OLE
containers. Examples of OLE servers are MS Word and MS Excel. OLE containers
provide a place to store,display and manipulate objects that are created by OLE server
applications.
Forms Built-ins
Triggers
System Variables
Example: System.Cooordination_Operation=
Miscelleneous
96. What are the differences between LOV and List item?
LOV is a Property whereas List item is an item.
A List item can have only one column whereas an LOV can have one or more columns.
98 . What is a Poplist?
The poplist style list item appears initially as a single field(similar to a text item field.
When The operator selects the list icon, a list of available choices appears.
application only when needed. This can significantly reduce the runtime memory
requirements of an application.
named visual attribute settings take precedence, and any visual attribute properties in the
class are ignored.
Variant property : defined separetely in the property window.
Inherit property : inherits from property class.
Copy object option : automatically copies objects owned by the item being copied. gives
dialog options for associated objects.
copying a reference object results in referencing only
In referencing when the source object name changes, it has to be updated for all
referencing objects in the reference source information property.
Object groups :
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 reference 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.
Object groups cannot contain other object groups. Members of object groups should be
defined in the same form.
Events : Interface events, Internal processing events
When-Event Triggers : A When-event signals a point at which you can augment Oracle
Forms default processing with additional tasks or operations.
On-Event Triggers : An On-event signals a point at which you can replace Oracle Forms
default processing.
Pre-Event Triggers : A Pre-event signals a point just prior to the occurrence of either a
When-event or an On-event.
Post-Event Triggers : A Post-event signals a point just following the occurrence of either
a When-event or an On-event.
Key Triggers : Key triggers have a one-to-one relationship with specific keys. That is, the
trigger fires when the operator presses a specific key or key-sequence.
Master-Detail Relationships :
Block Coordination
To maintain the master-detail relationship at runtime, Oracle Forms coordinates the
master and detail blocks to ensure that the records displayed in the detail block are
associated with the current record in the master block.
Any event that makes a different record in the master block the current record is a
coordination-causing event. Deleting a record or pressing [[Up]] or [[Down]] to move to
a different record are both examples of coordination-causing events. When such an event
occurs, Oracle Forms automatically does the processing necessary to coordinate the
master and detail blocks.
There are two phases of block coordination: the clear phase and the population phase.
During the clear phase, Oracle Forms navigates internally to the detail block and flushes
the obsolete detail records. During the population phase, Oracle Forms issues a SELECT
statement to repopulate the detail block with the detail records associated with the new
master record. These operations are accomplished through the execution of triggers.
The Copy Value from Item Property
The mechanism that Oracle Forms used to coordinate the population of the detail block
with the current record in the master block is the Copy Value from Item property on the
foreign key item in the detail block. The Copy Value from Item property specifies the
primary key item in the master block whose value gets copied to the foreign key item in
the detail block whenever a detail record is created or queried.
Because the value of the primary key item in the master record gets copied to the foreign
key item in the detail block, it is automatically incorporated in the WHERE clause of the
SELECT statement that Oracle Forms issues to populate the detail block.
When blocks are related through a compound join, the Copy Value from Item property is
set on two or more foreign key items in the detail block.
The Relation Object
When you create a relation, Oracle Forms generates the triggers and PL/SQL procedures
required to enforce coordination between the master and detail blocks. The actual code
that Oracle Forms generates depends on how the properties of the relation are set.
The properties that affect the functionality of a relation include Master Deletes,
Coordination, and Prevent Masterless Operation.
Master Deletes Property: The Master Deletes property allows you to specify how the
deletion of a record in the master block should affect records in the detail block. It can be
set to Non-Isolated, Isolated, or Cascading.
Non-Isolated : The default setting. Prevents the deletion of a master record if associated
detail records exist in the database.
Isolated : Allows the master record to be deleted and does not affect the associated detail
records in the database.
Cascading: Allows the master record to be deleted and automatically deletes any
associated detail records from the base table at commit time. When relations are nested to
several levels, only records in the immediate detail block are deleted. That is, deletions
do not automatically cascade to multiple levels of a relation chain.
Note: If your database is using the ORACLE7 Server cascading deletes feature, do not
use the Cascading deletes option in Oracle Forms.
Coordination Properties :
The Coordination properties Deferred and Auto-Query determine when the population
phase of block coordination should occur. Coordination of the detail block with its master
can be Immediate, Deferred with Auto-query, or Deferred with No Auto-query.
Immediate (Deferred False, Auto-Query False) The default setting. When a coordination-
causing event occurs, the detail records are fetched immediately.
Deferred with Auto-Query (Deferred True, Auto-Query True)When a coordination-
causing event occurs, Oracle Forms defers fetching the associated detail records until the
operator navigates to the detail block.
Deferred with No Auto-query (Deferred True, Auto-Query False) When a coordination-
causing event occurs, Oracle Forms does not automatically fetch the detail records. To
fetch the detail records, the operator must navigate to the detail block and explicitly
execute a query.
Choosing the Appropriate Coordination
Deferred coordination can more accurately be thought of as "deferred population." That is,
when a coordination-causing event occurs in the master block, the population phase of
coordination is postponed, but the records in the detail block are cleared immediately.
This functionality prevents a detail block from displaying records that are inconsistent
with the current record in the master block.
As a general rule, choose immediate coordination (Deferred False, Auto-Query False)
when the detail block is visible to the operator, and when it is assumed that the operator
will always want to see the detail records associated with the current master record.
Deferred coordination with Auto-query is preferable when the detail block is not
immediately visible; for example, when the operator must navigate to the detail block in a
different window to be able to view detail records.
Deferred coordination is also useful in situations where the operator may not need to
view the detail records at all. In this case, deferring coordination can prevent an
unnecessary database query.
Deferred coordination with No Auto-query is useful when you want operators to be able
to go into Enter Query mode and specify additional query criteria in the detail block
before population occurs. Also, Deferred coordination with No Auto-query allows
operators to navigate through detail records without forcing coordination, and its
attendant processing, to occur until it is actually required.
Setting the Properties of Foreign Key Items in the Detail Block
When you create a relation, Oracle Forms sets the Copy Value from Item property on the
foreign key items in the detail block automatically. The Copy Value from Item property
specifies the name of the corresponding primary key item in the format
master_block.item_name. At runtime, the value stored in the primary key item in the
master block is copied to the foreign key item in the detail block whenever a detail record
is created or queried.
When you create the relation in the New Block window, Oracle Forms also alters the
properties of the foreign key item(s) in the detail block by doing the following:
o setting the Canvas property to NULL to make the item a NULL-canvas item.
o setting the following properties to False:
o Displayed
o Enabled
o Navigable
o Query Allowed
o Update Allowed
o sequencing items in the Navigator such that the foreign key items are last in the block's
navigation sequence
Also, if the relation was created in the New Block window, Oracle Forms does not create
a boilerplate text label for the foreign key items.
When you create a relation in the Object Navigator, rather than in the New Block window,
you might want to set these same properties yourself.
The purpose of these settings is to hide the foreign key item(s) from the operator, since
the same information is likely to be displayed in the primary key item(s) in the detail
block. These settings are most appropriate when operators can view both the master and
detail blocks at the same time. If operators cannot see the master block when viewing
detail records, you may want to undo these settings so that foreign key item(s) are visible
to the operator. If you do so, make sure that the item Update Allowed property is set to
False, so that operators cannot edit the foreign key value and thus disrupt master-detail
coordination.
Deleting a Relation
You can delete a relation by selecting it in the Object Navigator and choosing Navigator-
>Delete. The following table shows what happens when you delete a relation or an object
that is part of a relation:
If you delete... This is the result...
------------------------------------------------------------------------------------------------------
A relation. Oracle Forms deletes all of the master-detail
triggers that were attached to the relation's
master block and clears the Copy Value from
Item property of the foreign key item(s) in the
detail block.
The master or detail block Oracle Forms deletes the relation and all of the
in a relation.master-detail triggers. Oracle Forms does not
delete the master-detail procedures.
Any master-detail trigger Oracle Forms does not prevent you from
or procedure. (Not deleting a master-detail trigger or procedure.
recommended). Doing so, however, disrupts master-detail
block coordination.
You can set the Prevent Masterless Operation property to True to prevent operators from
performing masterless operations in the detail block of the relation. Setting this property
to True has the following effects:
Oracle Forms does not allow records to be inserted in the detail block when there is no
master record in the master block. Any attempt to insert a record generates error FRM-
41105: Cannot create records without a parent record.
Oracle Forms does not allow querying in the detail block when there is no master record
that came from the database in the master block. Any attempt to query generates error
FRM-41106: Cannot query records without a parent record.
It is usually appropriate to prevent masterless inserts when operators are likely to
encounter an error if they attempt to commit detail records that have been created
independently of a master record. Such an error occurs when the detail block derives the
value of its foreign-key items from the primary key items in the master record (by way of
the Copy Value from Item property).
Similarly, you might want to prevent masterless queries in a detail block because
operators cannot perform effective queries from the detail block. Operators can query the
existence of specific detail records, but they cannot determine which master records own
them. (This assumes that the foreign key item(s) in the detail block are not displayed.)
Preventing Navigation to the Detail Block Setting the Prevent Masterless Operation
property to True prevents operators from querying and inserting in a detail block for
which there is no corresponding master record, but it does not prevent them from
navigating to the detail block and attempting these operations.
In some applications, it may be desirable to disallow any attempt to navigate to a detail
block when there is no master record.
The following example shows one way to prevent operators from navigating to a detail
block for which there is no master. It is based on the detail block warehouse and the
master block region.
When-New-Block-Instance trigger on detail block warehouse:
DECLARE
alert_dummy NUMBER;
BEGIN
/*
** See if there is a master record by checking the status
** of the current record in the master block
*/
IF Get_Record_Property(Get_Block_Property('region',
current_record),'region', STATUS) = 'NEW'
OR :region.region_id IS NULL THEN
/*
** There isn't a master record; display an alert that tells the ** operator to query or enter
a region record before moving to
** the warehouse block
*/
alert_dummy := SHOW_ALERT('my_alert');
/*
** Put the input focus in the master block
*/
GO_BLOCK('region');
END IF;
END;
The When-New-Block-Instance trigger fires whenever the operator navigates to the detail
block.
The built-in function GET_RECORD_PROPERTY is used to determine the status of the
current record in the master block. (The function GET_BLOCK_PROPERTY is nested as
the first argument to GET_RECORD_PROPERTY to return the record number of the
current record in the region block.)
If the status of the current record is NEW, indicating that the record is not an existing
master record, Oracle Forms displays an alert window with the message "Query or enter a
master record before moving to the detail block." The trigger then navigates to the master
block to allow the operator to do just that.
Creating Complex Master-Detail Relationships
Many applications require complex master-detail relationships that involve more than
two blocks. To create such relationships, simply define as many individual relations as
needed.
There is no practical limit to the number of relations that can be defined in a form.
Further, any block can be the master or detail in more than one relation, and a block that
is the master in one relation can be the detail in another.
When you create complex master-detail relationships, Oracle Forms automatically adjusts
the existing triggers to manage the relations you define.
This topic describes three of the most common types of complex master-detail
relationships:
o master with dependent details o master with independent details
o detail with two masters
Complex Relations and Cascading Deletes
When you set the Master Deletes property of a relation to Cascading, be aware that
deletes are enforced only for the immediate detail block in the relation. Thus, in a
complex master-detail relationship involving relations between blocks A and B (A_B),
and B and C (B_C), if relation A_B is cascading, the detail records in Block C are not
automatically deleted unless Relation B_C is also cascading.
Master with Dependent Details
A master with dependent details relationship includes a master block and n levels of
detail blocks, such that the first detail block is itself a master for its own detail block.
To create a master with dependent details relationship, define the individual relations
A_B and B_C separately. The relations can be created in any order.
When you create this type of relationship, consider the effect of the Master Deletes and
Coordination properties on the detail blocks. For example, if one relation in a chain of
related blocks is set to deferred coordination, all subsequent blocks will also be deferred.
Thus, when relation A_B is deferred and relation B_C is immediate, Oracle Forms does
not coordinate Block C with Block B until Block B is coordinated with Block A.
Master with Independent Details
A master with independent details relationship involves two or more detail blocks, each
of which has the same master block. This structure is useful when you want to display
more than one set of detail records for a single master record. A coordination-causing
event in the master block results in both detail blocks being populated with the
appropriate detail records.
In the sample application, the master block region could be displayed along with the
detail blocks warehouse and customer. The operator could then see all of the warehouses
and customers within the currently selected region.
To create this type of relationship, define the individual relations A_B and A_C
separately. The relations can be created in any order.
Detail with Two Masters
A detail with two masters relationship involves a single detail block that has two master
blocks. Oracle Forms displays the appropriate detail records for whichever master block
is the current block in the form. For example, in the sample application referred to earlier,
the ord block could be a detail block having two master blocks, customer and emp. The
operator could then see all of the orders for a particular customer, or for a particular sales
representative (employee).
Usually, when you create a detail with two masters relationship, you will be joining on
different foreign key items in the detail block. In such cases, the Copy Value from Item
property is set for each foreign key item in the detail block to point to the primary key
item in the appropriate master block. To create this type of relationship, you need only
define the two relations, and Oracle Forms will automatically support coordination.
In other cases, however, you might want to create a master with two details with each
relationship joining on the same foreign key item in the detail block. However, because
the Copy Value from Item property can only point to one master block item, you will
need to write additional code to coordinate querying and updating for the second relation
if you are joining on the same item in the detail block.
Depending on the desired functionality, this might include writing a Pre-Query trigger for
the detail block to ensure that the correct primary key item value is copied to the foreign
key item in the detail block. For example,
Copy(name_in(:System.Master_Block||'.primary_key_item'),
'detail_block.item');
You might also want to create a When-New-Block-Instance trigger that checks the
coordination status of the detail block whenever the operator navigates to a different
master block, and, if necessary, populates the detail block. For more information on
triggers and built-ins available for customizing master-detail functionality, refer to
"Modifying the Default Master-Detail Functionality."
About Master-Detail Triggers and Procedures
When you create a relation, Oracle Forms generates different triggers depending on how
the Master Deletes and Coordination properties are set. The following table shows how
the Master Deletes property determines which triggers Oracle Forms creates. When you
change the setting of the Master Deletes property for an existing relation, Oracle Forms
adds or removes triggers as needed. The actual code in these triggers depends on how the
Coordination properties are set, and on whether the relation is part of a complex relation
chain.
Master Deletes Property Resulting Triggers
-----------------------------------------------------------------------------------------------------
Non-Isolated (the default) On-Check-Delete-Master
On-Clear-Details
On-Populate-Details
Cascading On-Clear-Details
On-Populate-Details
Pre-Delete
Isolated On-Clear-Details
On-Populate-Details
Master-Detail Triggers
This section describes the triggers that Oracle Forms creates when you define a master-
detail relationship. The example trigger text shown with each trigger description shows
the basic structure of the trigger. The actual trigger text that you will see in your own
forms will be application-specific, and may look somewhat different.
Oracle Forms also creates user-named procedures that are called by master-detail triggers.
Oracle Forms generates comments in the default trigger and procedure code. Comments
are denoted by the standard PL/SQL double-hyphen ('- -').
On-Clear-Details Trigger The On-Clear-Details trigger is required for all master-detail
relations. It fires during the clear phase of coordination, and clears all of the detail
records in the detail block. This trigger calls the CLEAR_ALL_MASTER_DETAILS
procedure, as shown in the following example trigger text:
-- Begin default relation program section
--
Clear_All_Master_Details;
--
-- End default relation program section
--
On-Check-Delete-Master Trigger Oracle Forms creates the On-Check-Delete-Master
trigger when the Master Deletes property is set to Non-Isolated. It fires when there is an
attempt to delete a master record. The trigger queries the database to see if detail records
exist for the master record. If no details exist, the trigger deletes the master record. If
detail records are found, the trigger displays the message "Cannot delete master record
when matching detail records exist." as shown in the following example trigger text:
-- Begin default relation declare section
--
Declare
Dummy_Define char(1);
--
-- Begin B detail declare section
--
cursor B_cur is
select null from MASDET
where PARENT = :A.ID;
--
-- End B detail declare section
--
--
--
-- Begin B detail program section
--
if ((:A.ID is not null)) then
relation_id := find_relation('A.AB');
Query_Master_Details(relation_id, 'B');
end if;
--
-- End B detail program section
----
End;
Pre-Delete Trigger Oracle Forms creates the Pre-Delete trigger when the Master Deletes
property is set to Cascading. It deletes the records in the detail block's base table that
correspond to the master record that is being deleted.
-- Begin default relation program section
--
BEGIN
--
-- Begin detail_block detail program section
--
DELETE FROM detail_block_base_table
WHERE foreign_key_column = :master_block.primary_key_item;
--
-- End detail_block detail program section
--
END;
--
-- End default relation program section
Master-Detail Procedures
This section shows the text of the master-detail procedures that Oracle Forms creates
automatically when you define a relation. These procedures are called from the master-
detail triggers or from other procedures.
CLEAR_ALL_MASTER_DETAILS Procedure This procedure is called by the On-
Clear-Details trigger. It navigates to the detail block and clears the detail records.
PROCEDURE Clear_All_Master_Details IS
mastblk CHAR(30); /* Initial Master Block Causing Coord */
coordop CHAR(30); /* Operation Causing the Coord */
trigblk CHAR(30); /* Cur Block On-Clear-Details Fires On*/
startitm CHAR(61); /* Item in which cursor started */
frmstat CHAR(15); /* Form Status */
curblk CHAR(30); /* Current Block */
currel CHAR(30); /* Current Relation */
curdtl CHAR(30); /* Current Detail Block */
FUNCTION First_Changed_Block_Below( Master CHAR ) RETURN CHAR
IS
curblk CHAR(30); /* Current Block */
BEGIN
/*
** Init Local Vars
*/
mastblk := :System.Master_Block;
coordop := :System.Coordination_Operation;
trigblk := :System.Trigger_Block;
startitm := :System.Trigger_Item;
frmstat := :System.Form_Status;
/*
** If the coord op is anything but CLEAR_RECORD, then
** continue checking.
*/
IF coordop <> 'CLEAR_RECORD' THEN
/*
** If we're processing the driving master block...
*/
IF mastblk = trigblk THEN
/*
** If something in the form is changed, find the
** first changed block below the master
*/
IF frmstat = 'CHANGED' THEN
curblk := First_Changed_Block_Below(mastblk);
/*
** If we find a changed block below, go there
** and Ask to commit the changes.
*/
IF curblk IS NOT NULL THEN
Go_Block(curblk);
Check_Package_Failure;
Clear_Block(ASK_COMMIT);
/*
** If user cancels commit dialog, raise error
*/
IF NOT( :System.Form_Status = 'QUERY' /* Yes */ OR
:System.Block_Status = 'NEW' /* No */ ) THEN
RAISE Form_Trigger_Failure;
END IF;
END IF;
END IF;
END IF;
END IF;
/*
** Clear all the detail blocks for this master without
** any further asking to commit.
*/
currel := Get_Block_Property(trigblk,FIRST_MASTER_RELATION);
WHILE currel IS NOT NULL LOOP
curdtl := Get_Relation_Property(currel,DETAIL_NAME);
IF ( Get_Block_Property(curdtl, STATUS) <> 'NEW' ) THEN
Go_Block(curdtl);
Check_Package_Failure;
Clear_Block(NO_VALIDATE);
IF ( :System.Block_Status <> 'NEW' ) THEN
RAISE Form_Trigger_Failure;
END IF;
END IF;
currel := Get_Relation_Property(currel,NEXT_MASTER_RELATION);
END LOOP;
/*
** Put cursor back where it started
*/
IF ( :System.Cursor_Item <> startitm ) THEN
Go_Item(startitm);
END IF;
EXCEPTION
WHEN Form_Trigger_Failure THEN
IF :System.Cursor_Item <> startitm THEN
Go_Item(startitm);
END IF;
RAISE;
END Clear_All_Master_Details;
Go_Block(detail);
Check_Package_Failure;
:System.Message_Level := '5';
Execute_Query;
:System.Message_Level := oldmsg;
/*
** If Deferred, Mark the detail block as un-coordinated
*/
ELSE
Set_Block_Property(detail, coordination_status,
NON_COORDINATED);
END IF;
EXCEPTION
WHEN Form_Trigger_Failure THEN
:System.Message_Level := oldmsg;
RAISE;
END Query_Master_Details;
PROCEDURE Check_Package_Failure IS
BEGIN
IF (NOT Form_Success) THEN
RAISE Form_Trigger_Failure;
END IF;
END;
Triggers for Complex Master-Detail Relations
When you create a complex master-detail relationship, Oracle Forms adds or edits the
existing master-detail triggers to support the relationship you have defined. The following
examples illustrate how Oracle Forms adds or edits triggers as required.
Example 1: Master with Independent Details Consider a single relation A_B, with Master
Deletes set to Non-Isolated and Coordination set to Immediate (default settings). Oracle
Forms creates the following triggers on the master block to manage the relation:
o On-Clear-Details o On-Check-Delete-Master
o On-Populate-Details
If you then create a second relation A_C (having the same master block but a different
detail block), you have created a master-with-independent-details relationship; that is,
one master block with two detail blocks.
To manage this relationship, Oracle Forms does not create any additional triggers. Instead,
Oracle Forms adds a section to each existing trigger to facilitate clearing and populating
the second detail block. The generated comments in these triggers delimit the sections
that manage each detail block. For example, the comments in the On-Populate-Details
trigger clearly show where each detail block section begins and ends:
Example 2: Master with Dependent Details In this example, the simple relation A_B is
extended by adding a second relation B_C to create a master with dependent details
relationship.
To manage the second relation B_C, Oracle Forms removes the form-level On-Clear-
Details trigger, and creates two additional triggers that enforce coordination with the new
detail block. The additional triggers are attached to Block B, the master for the second
relation (B_C).
Remember, however, that if you later change the properties of the relation, Oracle Forms
may need to delete or edit the default triggers. For example, changing a relation's Master
Deletes property from Cascading to Isolated causes Oracle Forms to remove the now
unnecessary Pre-Delete trigger.
o Do not alter or delete the comments that Oracle Forms generates. These comments tell
Oracle Forms where to insert or delete trigger text when changes are necessary.
o If you add code to a trigger, insert it before the "Begin default relation program section"
comment or after the "End default relation program section" comment.
o Oracle Forms does not delete a master-detail trigger that you have modified, provided
that you place your code outside the default relation program section. (Oracle Forms
removes the relation program section, but does not delete the trigger.)
Oracle Forms provides a number of triggers and built-in subprograms that are useful for
such tasks, some of which are listed here. For complete information on these triggers and
routines, refer to the Oracle Forms Reference Manual, Vol. 1.
Triggers:
o On-Clear-Details o On-Populate-Details
o On-Check-Delete-Master o When-New-Record-Instance
o When-New-Block-Instance
Built-in subprograms:
o GET_BLOCK_PROPERTY o SET_BLOCK_PROPERTY
o GET_FORM_PROPERTY o GET_RELATION_PROPERTY
o SET_RELATION_PROPERTY
o Use GET_FORM_PROPERTY to get the name of the first and last block in the form
(FIRST_BLOCK, LAST_BLOCK).
DECLARE
master_block VARCHAR2;
BEGIN
master_block := Get_Relation_Property('my_relation',
MASTER_BLOCK);
END;
Set_Relation_Property('my_relation', MASTER_DELETES,
DEFERRED_COORDINATION);
Canvas-Views
Canvas-views are the background objects on which you place the interface items (text
items, check boxes, radio groups, etc.) and boilerplate objects (boxes, lines, images, etc.)
that operators interact with as they run your form. Each canvas-view is displayed in a
window.
Content Canvas-Views Most canvas-views are content canvas-views. A content canvas-
view is the "base" view that occupies the entire content pane of the window in which it is
displayed. You must define at least one content canvas-view for each window you create.
More than one content canvas-view can be assigned to the same window at design time,
but at runtime, only one of them at a time is displayed in the window.
Stacked Canvas-Views A stacked canvas-view is displayed in a window on top of, or
"stacked" on the content canvas-view assigned to that same window. Stacked canvas-
views obscure some part of the underlying content canvas-view, and are often shown and
hidden programmatically. More than one stacked canvas-view can be displayed in a
window at the same time.
Horizontal/Vertical Toolbar Canvas-Views Toolbar canvas-views are used to create
toolbars for individual windows. Horizontal toolbars are displayed at the top of a window,
just under its menu bar. Vertical toolbars are displayed along the left side of a window.
Windows
MDI applications display a default parent window, called the application window. All
other windows in the application are either document windows or dialog windows.
Document windows are always displayed within the MDI application window frame. If
the operator resizes the application window so that it is smaller than a document window,
the document window is clipped. Operators can maximize a document window so that it
occupies the entire content area of the application window.
Dialog windows are free-floating, and the operator can move them outside the application
window if they are defined as Movable. If the operator resizes the application window to
make it smaller than a dialog window, the dialog window is not clipped.
A window can be either modeless or modal.
Modeless windows can remain displayed until they are dismissed by the operator or
hidden programmatically. You can set the Remove on Exit property for a modeless
window to specify whether it should remain displayed when the operator navigates to
another window.
Modal windows are usually used as dialogs, are often displayed with a platform-specific
border unique to modal windows. On some platforms, modal windows are "always-on-
top" windows that cannot be layered behind modeless windows.
In addition to platform-specific restrictions, modal windows have the following
characteristics:
The Remove on Exit property does not apply to modal windows. By default, Oracle
Forms prevents operators from navigating out of modal windows with the mouse, but
does allow them to navigate to another window with keyboard commands. When such
navigation occurs, Oracle Forms always closes the modal window, unless the target
window is itself a modal window.
Modal windows cannot have scroll bars, and setting the Scroll Bar properties for a modal
window has no effect.
Show_lov : the lov need not be attached to the text item.
List_values : the lov should be attached to the text item.
lovs are based on record groups.
Changing a column in the record group does not update lov columns automatically
Record Groups :
The following built-in subprograms are available for creating and manipulating record
groups programmatically:
Creating and deleting groups:
o CREATE_GROUP (function) o CREATE_GROUP_FROM_QUERY (function)
o DELETE_GROUP (procedure)
Modifying a group's structure:
o ADD_GROUP_COLUMN (function) o ADD_GROUP_ROW (procedure)
o DELETE_GROUP_ROW (procedure)
Populating groups:
o POPULATE_GROUP (function)
o POPULATE_GROUP_WITH_QUERY (function)
o SET_GROUP_CHAR_CELL (procedure)
o SET_GROUP_DATE_CELL (procedure)
o SET_GROUP_NUMBER_CELL (procedure)
Getting cell values:
o GET_GROUP_CHAR_CELL (function)
o GET_GROUP_DATE_CELL (function)
o GET_GROUP_NUMBER_CELL (function)
Processing rows:
o GET_GROUP_ROW_COUNT (function)
o GET_GROUP_SELECTION_COUNT (function)
o GET_GROUP_SELECTION (function)
o RESET_GROUP_SELECTION (procedure)
o SET_GROUP_SELECTION (procedure)
o UNSET_GROUP_SELECTION (procedure)
Object ID functions:
o FIND_GROUP (function)
o FIND_COLUMN (function)
Populate Group with query : can be used to modify record group at run time but columns
cannot be altered ( created during design time).
To populate a list item during run time using record group, the record group must contain
two columns of char type
Oracle Forms Datatypes
The following table shows the FIND_ function and return type for each object:
Object Function Return Type
Alert FIND_ALERT ALERT
Block FIND_BLOCK BLOCK
Canvas FIND_CANVAS CANVAS
Record Group Column FIND_COLUMN GROUPCOLUMN
Editor FIND_EDITOR EDITOR
Form FIND_FORM FORMMODULE
Record Group FIND_GROUP RECORDGROUP
Item FIND_ITEM ITEM
List of Values FIND_LOV LOV
Menu Item FIND_MENU_ITEM MENUITEM
Parameter List GET_PARAMETER_LIST PARAMLIST
Relation FIND_RELATION RELATION
Timer FIND_TIMER TIMER
View FIND_VIEW VIEWPORT
Using object id improves performance, makes code generic and easier to maintain.
Each time you reference an object by name in a PL/SQL statement, Oracle Forms does
the necessary processing to look up the object's ID internally.
Default_value built in procedure assigns the value to the indicated variable only if it is
null.
Consider the following factors when deciding whether to use a global or NULL-canvas
item as a variable:
o Items can be defined as CHAR, NUMBER, or DATE data types; global variables store
only character strings, and using conversion functions like TO_DATE and
TO_NUMBER requires additional processing.
o Items can be dimensioned by setting their Maximum Length property; global variables
are always 255 bytes.
o Global variables are visible across multiple modules during a runtime session; NULL-
canvas items are not.
o The CLEAR_FORM operation sets the value of a NULL-canvas item in the current
form to NULL; the value of a global variable is not affected by CLEAR_FORM.
o Both items and global variables can be referenced in the default WHERE clause for a
base table block and record group SQL statements.
Subprograms and functions :
Defined in a form module can be called only in that module
Open_Form('stocks',ACTIVATE,SESSION);
When COMMIT is initiated, processing is done for those forms that share the same
session.
Opening multiple instances of the same form :
To navigate use form id.
Post Vs Commit :
Posting consists of writing updates, deletions, and insertions in the form to the database,
but not committing these transactions to the database. Oracle Forms does all of the
default validation and commit processing, but does not issue the COMMIT statement to
finalize these transactions. If posted the status of the records need not be maintained in
the form.
Commit finalizes these transactions
Post only mode :
When a calling form has pending updates or deletes that have not been explicitly posted,
Oracle Forms runs the called form in post-only mode.
Commiting from child form :
update records in form A, post , call form B, make changes and commit.
Commiting from parent form :
update records in form A, call form B, post return to A in no-rollback mode and commit.
Calling Other Products from Oracle Forms
You can invoke other products from Oracle Forms with the RUN_PRODUCT built-in
procedure. The syntax for RUN_PRODUCT is shown here:
RUN_PRODUCT(product, document, commmode, execmode, location,
list, display);
For example, to invoke Oracle Reports, you could make the following call:
Run_Product(REPORTS,'stats',ASYNCHRONOUS,BATCH,FILESYSTEM);
By default, when you invoke Oracle Reports or Oracle Graphics with RUN_PRODUCT,
the called product logs on to ORACLE using the current form operator's USERID.
Oracle Forms uses the parameters you pass to RUN_PRODUCT to construct a valid
command line invocation of the called product. RUN_PRODUCT takes the following
parameters:
Product A numeric constant that specifies the Oracle tool to be invoked: FORMS,
REPORTS, GRAPHICS, or BOOK.
Commmode Specifies the communication mode to be used when running the called
product. Valid numeric constants for this parameter are SYNCHRONOUS and
ASYNCHRONOUS.
o SYNCHRONOUS specifies that control returns to Oracle Forms only after the called
product has been exited. The operator cannot work in the form while the called product is
running. Synchronous is required when passing a record group to a called product as a
DATA_PARAMETER; for example, when invoking Oracle Graphics to return an Oracle
Graphics display that will appear in a form chart item.
o ASYNCHRONOUS specifies that control returns to the calling application immediately,
even if the called application has not completed its display. Do not use
ASYNCHRONOUS when passing a record group to a called product as a
DATA_PARAMETER; for example, when invoking Oracle Graphics to return an Oracle
Graphics display that will appear in a form chart item.
Execmode Specifies the execution mode to be used when running the called product,
either BATCH or RUNTIME. When you run Oracle Reports and Oracle Graphics,
execmode can be either BATCH or RUNTIME. When you run Oracle Forms, always set
execmode to RUNTIME.
Location Specifies the location of the document or module you want the called product to
execute, either the file system or the database.
List Specifies the name or ID of a parameter list to be passed to the called product.
Display Specifies the name of the Oracle Forms chart item that will contain the display
generated by Oracle Graphics.
Chart item : Does not store database values. contains objects generated by oracle graphics
OLE :Object Linking and Embedding (OLE) provides you with the capability to integrate
objects from many MS Windows applications into a single compound document. In
Oracle Forms, embedded objects become part of the form module, and linked objects are
references from a form module to a linked source file. Embedded objects are activated by
In-place/ External activations. Linked objects - External activation
An OLE server application creates objects that are embedded or linked in OLE containers;
OLE containers store and display OLE objects. Oracle Forms is an OLE container
application, and MS Word is an example of an OLE server application.OLE server
applications can create many object classes. During the installation of an OLE server
application, the object classes that an OLE server can create are installed in a registration
database. When you install MS Windows applications that support OLE, a registration
database is created on your computer, if it does not already exist. The registration
database contains the object classes that are valid for embedding and linking into a form
module. For instance, MS Word classes include MS Word 6.0 Document, MS Word 6.0
Picture, and MS WordArt 2.0.
OLE objects are documents created from OLE server applications such as MS Word.
Another example of an OLE object is a spreadsheet created in MS Excel. OLE objects are
linked or embedded into compound documents created by OLE container applications
such as Oracle Forms.
Embedded Objects
An embedded object, such as a spreadsheet or chart, is created by an MS Windows OLE
server application and is embedded in an Oracle Forms form module. An embedded
object is stored as part of a form module or as an item in the database.
You can modify the content of an embedded object within Oracle Forms if the OLE
server application that created the OLE object is accessible by your computer. Editing an
embedded object is performed with in-place activation or external activation.
1. What built-in can you use to open a second form but keep the first form in control?
A*. OPEN_FORM
B . SYSTEM.MOUSE_FORM
C . SYSTEM.CURRENT_FORM
D . CALL_FORM
E . FIND_FORM
Explanation:
OPEN_FORM
The OPEN_FORM built-in includes a NO_ACTIVATE option stipulating that the form
being opened should not receive control.
2. Which system variable can tell you the record on which the user has placed focus?
A . CURSOR_ITEM
B . CURRENT_RECORD
C*. CURSOR_RECORD
D . CURRENT_ITEM
Explanation:
CURSOR_RECORD
This is a record-level requirement, so the ITEM variables will not help you. There is no
CURRENT_RECORD system variable.
3. You are modifying a Customer form so that it has the ability to place the contents of
the customer's ZIP code into a separate form named Dealer. What built-in will you use?
A . ADD_PARAMETER
B . SET_APPLICATION_PROPERTY
C . WRITE_VALUE
D*. COPY
E . NAME_IN
Explanation:
COPY
This question requires the use of form bind variables, which cannot be referenced directly
across modules. The built-ins NAME_IN and COPY are used to read and write values
across modules with form bind variables. In this case, COPY is the right choice, because
you wish to place values in another field, rather than read them from the field.
4. You have added an LOV to a form and now want to add code to determine whether the
user has made a choice from the LOV or dismissed it. What built-in will help you?
A . WHEN-LIST-CHANGED
B . GET_LOV_PROPERTY
C . WHEN-LIST-ACTIVATED
D . POST-TEXT-ITEM
E*. SHOW_LOV
Explanation:
SHOW_LOV
The SHOW_LOV built-in has the ability to display an object (an LOV), and also return a
Boolean value to the calling program indicating whether or not the user selected a value
from the LOV. If you selected one of the WHEN- or POST- choices, be sure to reread the
chapter before the exam...those are triggers, not built-ins.
5. Which of the following allows you to collect objects and easily reuse them in other
forms?
B . Trigger library
C . PL/SQL Library
D . Object package
E . Property class
Explanation:
Object group
Review the section "Grouping Related Items for Reuse" if you need a refresher on this
topic.
6. You have created a client-lookup canvas, complete with code and all the necessary
objects, that has proven popular enough that others want to use it in their applications.
How can you make it available to the other applications from one central source point?
C*. Copy the canvas, code, and objects into an object library.
E . Place the canvas, code, and objects into an object group that the other developers will
reference.
Explanation:
Copy the canvas, code, and objects into an object library.
Review the section "Reusing Objects from an Object Library" if you need a refresher on
this topic.
7. You have inherited an application from a developer who left to pursue a career in
music. While looking through the SALARY item's Property Palette, you notice that to the
left of its Data Type property is an arrow with an "X" at its point. What does this symbol
indicate?
A . The setting has been derived from a Visual Attributes group, but has been overridden.
E*. The setting has been derived from a property class, but has been overridden.
Explanation:
The setting has been derived from a property class, but has
been overridden.
A Data Type property can only be derived from a property class. The arrow indicates that
this has been done. The "X" at its point indicates that the setting inherited from the
property class has been manually overridden for this item.
8. You want to read the value in an item on another form and use it in your current form.
What built-in will you use?
A . FIND_ITEM
B . NAME_IN
C . SET_ITEM_PROPERTY
D . GET_ITEM_VALUE
E*. COPY
Explanation:
NAME_IN
Some of the built-in names offered as choices don't exist. Of the ones that do, NAME_IN
and COPY are used to read and write values from/to items in other form modules. In this
case, NAME_IN is the right choice, because you wish to read a value in another field.
9. You create a module with two forms: Employee and Product. The application allows
users to have the forms open simultaneously. The users notice that when they save an
Employee record, any unsaved Product records are also committed; the reverse is also
true. This is not the behavior they want. What can you do to change it?
A . Open the first form using the OPEN_FORM built-in with the ACTIVATE option.
B . Open the first form using the OPEN_FORM built-in with the SESSION option.
C*. Open the second form using the OPEN_FORM built-in with the SESSION option.
D . Open the second form using the GO_FORM built-in with the ACTIVATE option.
E . Open the second form using the GO_FORM built-in with the NO_ACTIVATE option.
Explanation:
Open the second form using the OPEN_FORM built-in with the SESSION option.
Review the section "Calling One Form from Another" if you need a refresher on this
topic.
10. You need a built-in that will copy a value into a global variable and create the
variable if it is undefined. What built-in has this ability?
A*. DEFAULT_VALUE
B . SET_VAR
C . COPY
D . CREATE_VAR
Explanation:
DEFAULT_VALUE
Review the section "Built-In Subprograms that Assist Flexible Coding" if you need a
refresher on this topic.
11. You are writing versatile code that checks whether your Employee form's Salary field
is visible; if it is, the code hides it; if it isn't, the code shows it. What built-in can you use
to determine which route the code will take?
A*. GET_ITEM_PROPERTY
B . GET_BLOCK_PROPERTY
C . GET_FORM_PROPERTY
D . GET_WINDOW_PROPERTY
E . GET_RECORD_PROPERTY
Explanation:
GET_ITEM_PROPERTY
12. You want to use a single multipage tab canvas for different purposes. Which built-in
lets you set the labels for the pages dynamically when the application is running?
A . SET_PAGE_PROPERTY
B . SET_CANVAS_PROPERTY
C . SET_TAB_PROPERTY
D*. SET_TAB_PAGE_PROPERTY
Explanation:
SET_TAB_PAGE_PROPERTY
Review the section titled "Built-In Subprograms that Assist Flexible Coding" if you need
a refresher on this topic.
13. Which built-in enables you to change window properties dynamically while the
application is running?
A*. SET_WINDOW_PROPERTY
B . SET_VIEW_PROPERTY
C . GET_CANVAS_PROPERTY
D . GET_WINDOW_PROPERTY
E . SET_CANVAS_PROPERTY
Explanation:
SET_WINDOW_PROPERTY
A*. Form
B . Canvas
C . Block
D . Window
Explanation:
Form
Windows do not have the capability to hold triggers, so you need to define a WHEN-
WINDOWS- trigger one level higher in the object hierarchy: the form level.
15. What happens to a function key's default functionality when you define a key trigger
for the function key?
A . The default functionality overrides whatever code is contained in the key trigger.
C*. The default functionality is replaced by whatever code is contained in the key trigger.
D . Forms determines each time the function key is pressed whether it should execute the
default functionality or the key trigger.
Explanation:
The default functionality is replaced by whatever code is contained in the key trigger.
16. Which property and setting will prohibit the user from deleting a master record if
related detail records exist?
Explanation:
Relation property Delete Record Behavior set to Non Isolated
17. What trigger can institute a default functionality, or no functionality, for every
function key that does not have an explicit trigger?
A . KEY-ELSE
B . KEY-FUNCTION
C . KEY-Fn
D*. KEY-OTHERS
E . KEY-NONE
Explanation:
KEY-OTHERS
The purpose of the KEY-OTHERS command is to replace the functionality of any key
that can have a trigger assigned to it but does not.
18. What built-in gives you the ability to change the cursor's appearance dynamically?
A*. SET_APPLICATION_PROPERTY
B . SET_CANVAS_PROPERTY
C . SET_CONTEXT
D . SET_ITEM_PROPERTY
E . SET_FORM_PROPERTY
Explanation:
SET_APPLICATION_PROPERTY
19. What built-in enables you to dynamically control when a detail block is populated?
A . SET_BLOCK_PROPERTY
B*. SET_RELATION_PROPERTY
C . SET_ITEM_PROPERTY
D . SET_WINDOW_PROPERTY
Explanation:
SET_RELATION_PROPERTY
A . PRE-CASCADE
B . PRE-POST
C*. PRE-DELETE
D . PRE-UPDATE
E . POST-CASCADE
Explanation:
PRE-DELETE
The PRE-DELETE trigger is the only one that has the capability to intercept a master-
record deletion, check to determine if related detail records exist, and delete those detail
records before proceeding to delete the master record. A PRE-CASCADE, POST-
CASCADE, or PRE-POST trigger do not exist.
21. You need to add a display item to a form. The item will display a calculated total
summarizing data from several different tables. You do not want to create any new
objects in the database. What is the best course of action to take?
A . Using the Data Block Wizard, create a block with a stored procedure as its data
source type.
B . Using the Data Block Wizard, create a block with a view as its data source type.
C . After creating a data block manually, set its Query Data Source Columns property to
the desired columns and write the appropriate select command in its Query Data Source
Arguments property.
D*. After creating a data block manually, set its Query Data Source Type to FROM
clause query, and write the appropriate select command in its Query Data Source Name
property.
Explanation:
After creating a data block manually, set its Query Data Source Type to FROM clause
query and write the appropriate select command in its Query Data Source Name property.
You cannot use a stored procedure or a view because both of these require adding a new
item to the database. The correct approach is using a FROM clause query.
22. What built-in enables you to replace the query associated with a record group?
A*. POPULATE_GROUP_WITH_QUERY
B . CREATE_GROUP
C . ADD_GROUP_ROW
D . SET_GROUP_QUERY
Explanation:
POPULATE_GROUP_WITH_QUERY
23. What built-in can you use to open a second form modally?
A . OPEN_FORM
B*. CALL_FORM
C . NEW_FORM
D . RUN_PRODUCT
Explanation:
CALL_FORM
24. What built-in can provide the name of the current form?
A*. GET_APPLICATION_PROPERTY
B . GET_BLOCK_PROPERTY
C . GET_WINDOW_PROPERTY
D . GET_FORM_PROPERTY
Explanation:
GET_APPLICATION_PROPERTY
25. What built-in can populate a dynamic list item on a form with values from a record
group?
A*. POPULATE_LIST
B . POPULATE_LIST_WITH_QUERY
C . SET_LIST_VALUES
D . RETRIEVE_LIST
Explanation:
POPULATE_LIST
26. What built-in enables you to change a nonquery record group into a query record
group?
A . POPULATE_GROUP
B . CREATE_GROUP_FROM_QUERY
C*. POPULATE_GROUP_WITH_QUERY
D . POPULATE_LIST_WITH_QUERY
Explanation:
POPULATE_GROUP_WITH_QUERY
27. How can you base a data block on a stored procedure that uses a ref cursor?
A . Using the Data Block Wizard, specify a data source type of table.
B*. Using the Data Block Wizard, specify a data source type of stored procedure.
C . After creating a data block manually, set the Query Data Source Name property to the
appropriate stored procedure.
D . After creating a data block manually, set the Query Data Source Columns property to
the appropriate stored procedure.
Explanation:
Using the Data Block Wizard, specify a data source type of stored procedure.
The options detailing the creation of a data block manually specify using the name of the
stored procedure in properties not designed to hold a procedure name. Using the Data
Block Wizard, you do not have to specify a data source type of table when you also have
the option for stored procedure.
28. Name a benefit of using a FROM clause query as the basis for a data block.
A . Can perform server joins, calculations, and lookups without needing specific access
rights to tables
C*. Can perform server joins, calculations, and lookups without needing to create a view
Explanation:
Can perform server joins, calculations, and lookups without needing to create a view
The essence of the FROM clause query is its capability to nest SQL select statements in
subqueries that perform lookups, table joins, and calculations without relying on a
database view.
29. What built-in enables you to populate a record group with data that can be filtered
dynamically at runtime?
A . CREATE_GROUP_FROM_PARAMETER
B . POPULATE_LIST
C*. POPULATE_GROUP
D . SET_GROUP_FILTER
Explanation:
POPULATE_GROUP
30. You have created a sales application that uses one form for the sales ticket and a
second form to list the items being purchased. When the second form is called, the sales
ticket is still open and has pending changes. What mode will the second form be opened
in?
B . Commit mode
C . Enter-query mode
D . Open-transaction mode
Explanation:
Post-only mode
31. What built-in enables you to change the contents of a static record group at runtime?
A . POPULATE_GROUP_FROM_QUERY
B . POPULATE_GROUP
C . ADD_GROUP_ROW
D*. You cannot change the contents of a static record group at runtime.
Explanation:
You cannot change the contents of a static record group at runtime.
The definition of a static group is one whose contents cannot be changed at runtime.
32. What built-in enables you to pass data from a record group to a separate Oracle graph?
A . PASS_GROUP_DATA
B*. RUN_PRODUCT
C . OPEN_REPORT_WITH_GROUP
D . PASS_GROUP
Explanation:
RUN_PRODUCT
33. When you need to design a pair of forms in which one passes values to the other,
when and where should you define the parameters that will accept the values?
Explanation:
In the called form, at design time
A parameter that is to be received must be defined at design time, and of course, it must
be defined in the called form. See the section titled "Passing Data Between Forms Using
Parameter Lists" for a refresher on this topic.
34. What reusable component enables you to lead your users through complicated
processes?
A . Navigator class
B . ActiveX controls
D . Picklist class
Explanation:
Wizard class
The Wizard class enables you to create your own custom wizards, which can lead users
through complicated processes.
35. What reusable component enables you to create an Object Navigator-like interface for
your own applications?
A . Picklist class
B . ActiveX controls
C . Calendar class
Explanation:
Navigator class
The Navigator class contains objects that make it easy to implement a Navigator interface
in your own applications.
A*. FIND_TIMER
B . WHEN-TIMER-EXPIRED
C . SET_TIMER
D . CREATE_TIMER
E . SET_TIMER_PROPERTY
Explanation:
FIND_TIMER
The FIND_TIMER built-in returns the internal ID of whatever timer's name is provided
as an argument.
A . Picklist class
B . ActiveX controls
C . Calendar class
D . Navigator class
Explanation:
Standard Object library
A*. DELETE_TIMER
B . REMOVE_TIMER
C . FIND_TIMER
D . SET_TIMER
E . SET_TIMER_PROPERTY
Explanation:
DELETE_TIMER
39. You moved a number of your application's program units over to the server and
started experiencing DBMS errors. What built-in can you use to capture these errors and
the information they return?
A . DBMS_ERROR
B . DBMS_ERROR_NUM
C . DBMS_ERROR_STRING
D*. DBMS_ERROR_TEXT
Explanation:
DBMS_ERROR_TEXT
40. What trigger is used to respond to timers, and at what level is it most commonly
defined?
Explanation:
WHEN-TIMER-EXPIRED at the form level
41. What trigger should you use to activate a calendar when the user presses the List of
Values function key while in a date field?
A . WHEN-LOV-OPEN
B . ON-LIST-OPEN
C . KEY-LIST-OPEN
D . ON-LISTVAL
E*. KEY-LISTVAL
Explanation:
KEY-LISTVAL
The KEY-LISTVAL trigger fires whenever the user presses the LOV function key.
42. What are the steps for embedding an existing chart on a form that is open in the
Layout Editor?
A . Execute the File | Import menu command, identify the chart file, and move the
resulting chart to the correct position on the canvas.
B . Invoke the Chart Wizard, identify the chart file, and move the resulting chart to the
correct position on the canvas.
C*. Create a chart item manually using the Chart Item button, identify the chart file in the
item's Property Palette, and move the resulting chart to the correct position on the canvas.
Explanation:
Create a chart item manually using the Chart Item button, identify the chart file in the
item's Property Palette, and move the resulting chart to the correct position on the canvas.
The Chart Wizard is only useful for creating new charts, so it is not a correct answer
because the question specifies that you are dealing with an existing chart. The command
File | Import does not exist in Form Builder. When dealing with an existing chart file, you
bypass the Chart Wizard, create a new chart item manually, and alter the new item's
properties to use the existing chart file.
A . DDL_RUNTIME
B*. FORMS_DDL
C . RUNTIME_DDL
D . DDL_FORMS
E . FORMS_RUNTIME
Explanation:
FORMS_DDL
The FORMS_DDL built-in gives you the ability to execute SQL commands during
runtime. All other potential answers to this question were made up (FORMS_RUNTIME
is a program, not a built-in).
44. What built-in enables you to determine which timer fired a WHEN-TIMER-
EXPIRED trigger?
A*. GET_APPLICATION_PROPERTY
B . GET_TIMER_PROPERTY
C . SYSTEM.TIMER
D . FIND_TIMER
Explanation:
GET_APPLICATION_PROPERTY
45. What file format must a third-party external procedure be in for Forms 6i to use it?
A . PL/SQL8
B*. DLL
C . C++
Explanation:
DLL
Explanation:
Returns a Boolean value
47. What is the order of firing the following triggers((Both are in form-level))
1. when-new-form-instance
2. pre-text-item
A. *Pre-Text , when-new-form-instance
B. When-new-form-instance, pre-text-item
Explanation:
Pre-Text , when-new-form-instance
B. When Post Query fires, Pre Query returns more than one row.
C. *Post Query fires once for each record fetched from the query Pre Query fires only
once.
Explanation:
Post Query fires once for each record fetched from the query Pre Query fires only once.
Explanation:
Pre-form, pre-block, pre-record , pre-text-item, When-new-form-instance, post-form.
B. Data_Scope, Trigger_Scope
C. Static_Scope, Dynamic_Scope
1. You open a single property sheet to display properties for your DEPARTMENT data
block and DEPARTMENT canvas simultaneously. Which Property Palette display mode
is likely to show more properties?
A . Intersection
B*. Union
Explanation:
Union
The Intersection display mode shows only the properties that multiple selected objects
have in common, while the Union display mode shows all properties for all selected
objects, whether the objects share the properties in common or not.
2. What does it mean when the Property Palette displays ***** as a property's value?
A*. Two or more objects are selected, and their values for that property are not the same.
C . You cannot update that property for the object you have selected.
D . The property is not applicable for the object you have selected.
Explanation:
Two or more objects are selected, and their values for that property are not the same
Because the Property Palette cannot display more than one value per property, the only
way it can deal with multiple objects is to display something special when those objects'
values are different. The special display is *****.
3. What happens if you select multiple objects, open the Property Palette, and change a
property's value?
B . The Property Palette shows each object's old and new values for that property.
Explanation:
The change is applied to all selected objects
4. Which data block property would you consider changing if your records include
LONG items that are not likely to be edited?
B . Update Allowed
C . Query Allowed
Explanation:
Update Changed Columns Only
If your records include LONG items that are not likely to be edited, this data block
property can improve application performance by keeping the application from sending
the voluminous LONG data back to the server during an update command.
5. What does the Property Palette toolbar field labeled Find do?
A . Locates other objects containing the same property as the one you currently have
selected
D*. Forces the Palette to place its focus on the first property matching the characters you
type
Explanation:
Forces the Palette to place its focus on the first property matching the characters you type
The Property Palette toolbar field labeled Find makes the Property Palette quickly jump
to specific properties. If the group containing the matching property is closed, the Find
field will even open it up for you.
6. What would be the result of completely deleting a data block from the Object
Navigator?
A . The data blocks and components are deleted but can be retrieved using the Edit |
Undo command.
B . The data blocks and components are irreversibly deleted, and all components from the
data block are removed from any canvas that contained them, including the data block's
frame and boilerplate title text.
C*. The data blocks and components are irreversibly deleted, and all components from
the data block are removed from any canvas that contained them, but the data block's
frame and boilerplate title text will stay on the canvas.
D . The data blocks and components are irreversibly deleted, and all components from the
data block stay on the canvas and must be deleted manually.
Explanation:
The data blocks and components are irreversibly deleted, all components from the data
block are removed from any canvas that contained them, but the data block's frame and
boilerplate title text will stay on the canvas.
A . Nothing
B*. Identifies which object's properties are currently being displayed by the Property
Palette
C . Identifies which program you are in when you open the Property Palette
Explanation:
Identifies which object's properties are currently being displayed by the Property Palette.
8. Which of the following occur if you copy multiple properties from one object and
paste them into another?
B . Properties not relevant to the destination object will be added to that object.
E . If the destination is a different type of object than the source, the destination object
will be changed to the same type of object as the source.
Explanation:
No Answer is Correct
The Property Palette can copy and paste individual or multiple properties. When copying
multiple properties, the Palette pastes only the properties for which an actual value is
shown, and only the properties that are relevant to the object receiving the pasted
properties.
9. You created an LOV for stock items and included a Quantity Currently In Stock
column in the LOV. How can you ensure that the user sees accurate "in stock" numbers
each time the LOV is invoked?
B . Programmatically requery all tables in the application when the user opens that
canvas.
Explanation:
Enable the LOV's Automatic Refresh property
The Automatic Refresh property determines whether the LOV's underlying query
executes every time the LOV is invoked, or only the first time it is invoked. Setting the
property to Yes configures it to requery every time.
10. You have created a SALES_TICKET form for a point-of-sale application. You now
want to modify the Transaction_Date_Time item in the form so it is automatically
populated with the current date and time each time a new record is created. How can you
accomplish this?
Explanation:
Set the Initial Value property to $$DATETIME$$.
The is no Item property called Default Value, and while SYSDATE is a valid parameter
in a SQL query, it will not work in the Initial Value property; you must use
$$DATETIME$$.
B . When multiple objects are selected, shows only those properties that all selected
objects share in common
C*. Forces the Palette to continue displaying properties for the currently selected
object(s), regardless of what object(s) you select from that point on
Explanation:
Forces the Palette to continue displaying properties for the currently selected object(s),
regardless of what object(s) you select from that point on
12. What is the best way to ensure that an item cannot accept query criteria?
Explanation:
Set the item's Query Allowed property to No
There are no properties named Disable Query or Queryable. Setting the Query Length
property to 0 simply tells Oracle Forms 6i to use the item's length as the maximum query
length.
13. How many characters would you need to type in an LOV to select the WHEN-KEY-
UP item from a list containing WHEN-BUTTON-PRESSED, WHEN-KEY-DOWN, and
WHEN-KEY-UP, assuming they are the only items in the list and the LOV's properties
are set to automatically display the LOV and automatically enter the value once a row is
selected?
A . 3 characters
B . 1 character
C*. 2 characters
D . 10 characters
Explanation:
2 characters
Because all three choices begin with "WHEN-," the LOV only cares about the first
differentiating character, which is the "K" that identifies the KEY group. The next
character needed is the "D" to select DOWN, after which the row's key value will
automatically be entered into the text item.
A . Any control on your form that allows the user to view and edit text, numbers, or dates
B . Any control on your form that allows the user to view and edit text
C . Any control on your form that allows the user to view and edit text or numbers
E*. Any control on your form that allows the user to view and edit text, numbers, dates,
or long data
Explanation:
Any control on your form that allows the user to view and edit text, numbers, dates, or
long data
15. You have created an LOV for a text item on your canvas, and you would like the
LOV to appear automatically each time the user enters that text item. What is required to
make that happen?
A . Set the Automatic Select property in the LOV Property Palette to Yes.
B*. Set the Automatic Display property in the LOV Property Palette to Yes.
C . Set the Automatic Refresh property in the text item Property Palette to Yes.
D . Set the Automatic Refresh property in the LOV Property Palette to Yes.
E . Set the Automatic Display property in the text item Property Palette to Yes.
Explanation:
Set the Automatic Display property in the LOV Property Palette to Yes.
No text item property would effect this change. Of the LOV properties listed, Automatic
Refresh determines whether the LOV's contents are requeried each time it is opened, and
Automatic Select specifies whether the selected LOV row is placed into the specified text
item without the user having to double-click on the row or click the OK button.
16. Which of the following actions can a user do with a display item?
Explanation:
View existing database values
A display item shows data but does not allow the user to change it. In essence, it is a
read-only field.
17. To which of the following items does a control block directly correspond?
B . Database
D . Table
E . Column
Explanation:
No answer is correct
A control block is not associated with a database object. Instead, it contains either
controls (such as buttons), or a group of items with single values (such as calculated
subtotals).
C*. None. You must manually create any items that will go into a control block.
Explanation:
None. You must manually create any items that will go into a control block.
By definition, a control block is not related to a database table. And you can put items
into a control block-that is what it's for. But you must do it manually after the block is
created.
B . A dialog box
D*. A form object through which the user can enter and change data
E . A form object through which the program can enter and change data
Explanation:
A form object through which the user can enter and change data
Input items are the basis of forms-they enable a user to add or edit data. A dialog box
may contain input items, but the dialog itself is a window, not an input item.
20. Users of your application have requested that they be able to see STOCK and
CUSTOMER canvases on the screen simultaneously. You add a second window to the
application. How can you make the CUSTOMER canvas use the second window?
Explanation:
Change the canvas's Window property
A canvas's Window property determines which window the canvas is visible in. The
Visual Attributes Group has no window selection properties, and a window's Primary
Canvas property specifies the primary canvas for a window that displays multiple
canvases.
21. Which check box property controls the text that displays next to the check box?
A*. Label
B . Text
C . Name
Explanation:
Label
Remember that both Prompt and Label can place text next to a radio button.
22. Which type of canvas is best suited for displaying tutorial text on the same canvas as
the form about which the user is being taught?
A . Tab
B . Viewport
C*. Stacked
D . Toolbar
E . Content
Explanation:
Stacked
The requirement that the tutorial text be visible on the same form limits the choices to
either stacked or tab. A tab canvas might be useful for a multipage tutorial, but the
requirements did not state the need for multiple pages, so a simple stacked canvas will
fulfill the requirement.
23. You are working with an existing radio group in the Layout Editor and try to add a
radio button to the group. The Layout Editor responds by:
A . Displaying a warning message, and then returning you to the Layout Editor
B . Offering to create a check box instead, since a radio button group already exists
C*. Presenting a dialog box giving you the chance to select a radio group for the new
radio button, or create a new radio group for it
Explanation:
Presenting a dialog box giving you the chance to select a radio group for the new radio
button, or create a new radio group for it
The Layout Editor is willing to add buttons to an existing radio group. It just needs to
know which group will get the new button, or if a completely new group is what you
desire.
24. Your Employee form includes a SALARY text item. You want to ensure that
standard users cannot input or change a salary value, but you want the value to look
exactly like a regular field. What is the best way to do this?
A . Set the item's Enabled property to No, and its Update Allowed property to No.
B*. Set the item's Insert Allowed property to No, and its Update Allowed property to No.
Explanation:
Set the item's Insert Allowed property to No, and its Update Allowed property to No
Changing an item's Enabled property to No causes its contents to display with light gray
25. What type of canvas can easily eliminate the need for a menu in your application?
A*. Toolbar
B . Content
C . Tab
D . Stacked
Explanation:
Toolbar
A toolbar canvas's sole purpose is holding buttons that initiate actions. The buttons can
replace every menu action your users would need to take.
26. The DEPARTMENT table in your database has been augmented with a BUDGET
column. You want to add BUDGET as an item on your Department form, but the item
should be a read-only text box so users cannot change it. The best way to do this is:
A . In the Layout Editor, create a display item and set its Insert Allowed property to No,
its Update Allowed property to No, and its Database Item property to No.
B . In the Data Block Wizard, move the BUDGET column into the Available Items area.
Change the new data block item's Insert Allowed and Update Allowed properties to No.
Proceed to the Layout Editor and add BUDGET as a text item.
C . In the Data Block Wizard, move the BUDGET column into the Available Items are C:
Proceed to the Layout Editor and add BUDGET as a text item, and change the item's
Insert Allowed and Update Allowed properties to No.
D*. In the Layout Editor, create a display item and set its Column Name property to
BUDGET.
Explanation:
In the Layout Editor, create a display item and set its Column Name property to
BUDGET.
Setting an item's Database Item property to No keeps it from retrieving database data,
eliminates two answers, but it creates a normal-looking text box that actually allows the
user to type in data; it isn't until the user tries to save their work that the data block's
Insert Allowed and Update Allowed properties halt the action. This is not optimal design.
The third incorrect answer creates an application in which the field's data cannot be
changed, but the user can still place focus on the field, which is also not optimal.
27. You have created a form that contains two canvases, ten database items, and four
buttons. The items have all been placed into a group, and the buttons have been placed
into a separate group. What happens when you click one of the buttons in the Layout
Editor?
B . Nothing is selected.
Explanation:
The group of buttons is selected.
The primary reason for groups is to ensure that when any item in the group is selected, all
items are selected with it.
A . Content
B . Stacked
C . Tab
D*. Toolbar
Explanation:
Toolbar
Content, stacked, and tab canvases are all intended to display database data. The toolbar
canvas type is not; it is intended to display buttons that work in concert with the items on
the other three canvas types.
29. What is the primary difference between tab and stacked canvases?
Explanation:
A tab canvas can contain multiple pages.
The essence of a tab canvas is the fact that it consists of multiple pages of data, each page
overlaying the others when it is selected by the user or developer. It is not possible to get
this functionality from a single stacked canvas.
30. What trigger would you use to execute code each time a user modifies the value of a
check box?
A . ON-NEW-CHECKBOX-INSTANCE
B . WHEN-CHECKBOX-UNCHECKED
C . WHEN-CHECKBOX-CLICKED
D . WHEN-CHECKBOX-CHECKED
E*. WHEN-CHECKBOX-CHANGED
Explanation:
WHEN-CHECKBOX-CHANGED
31. You would like to create a trigger that fires each time a window is closed by the user.
You will most likely place the trigger at which of the following levels:
A . Canvas level
B . Window level
D . Item level
Explanation:
Form level
32. What trigger would fire each time a new record is created?
A . ON-NEW-RECORD
B*. WHEN-NEW-RECORD-INSTANCE
C . WHEN-VALIDATE-RECORD
D . WHEN-DATABASE-RECORD
Explanation:
WHEN-NEW-RECORD-INSTANCE
33. What do you need to do to within Form Builder to run a form module in debug mode?
A . Enable Debug Messages and then run your form. The Debugger will appear
automatically.
B*. Enable the Debug Mode button, run the form, and the Debugger displays
automatically.
C . Run the form, and in the Forms Runtime program execute the Help | Debug menu
command.
D . Enable the Debug Mode button, run your form, and in the Forms Runtime program
execute the Help | Debug menu command.
Explanation:
Enable the Debug Mode button, run the form, and the Debugger displays automatically.
See the section "Running a Form Module in Debug Mode" for a refresher on this topic.
A*. After the user enters query criteria, but before the query executes
C . After the form enters Enter-Query mode, but before the user enters query criteria
D . After the query executes, but before records are shown to the user
Explanation:
After the user enters query criteria, but before the query executes
The PRE-QUERY trigger fires after Enter-Query mode but before a query's select
statement has been finalized, and therefore before the query is executed.
A . WHEN-NEW-ITEM-INSTANCE
B . SHOW-EDITOR
C*. SHOW_EDITOR
Explanation:
SHOW_EDITOR
36. You want to write a trigger that screens a query condition. At what level will you
place the trigger?
A . Block
B*. Form
C . Item
D . Record
Explanation:
Form
37. You wish to have certain values in a form initialized when the form is first opened.
What trigger will you use?
A . WHEN-NEW-CANVAS-INSTANCE
B*. WHEN-NEW-FORM-INSTANCE
C . WHEN-NEW-FORM
D . WHEN-FORM-OPENED
E . WHEN-NEW-CANVAS
Explanation:
WHEN-NEW-FORM-INSTANCE
A . Type
B . Name
C*. Code
D . Scope
Explanation:
Code
39. Which built-in causes an LOV to display for a text item that has one defined?
A . WHEN-NEW-ITEM-INSTANCE
B . WHEN-NEW-LOV
C . GO_ITEM
D*. SHOW_LOV
Explanation:
SHOW_LOV
40. What trigger can you use to ensure that a query entered by the user includes at least
one item that is indexed, and keep the query from occurring if not?
A*. PRE-QUERY
B . WHEN-CLEAR-BLOCK
C . ON-SELECT
D . POST-SELECT
E . ON-FETCH
Explanation:
PRE-QUERY
While the other triggers listed are query triggers, only the PRE-QUERY trigger fires
before the select statement is executed.
B*. Provides code to execute if user presses a key that has no trigger attached
D . Provides code that accesses another key's trigger and executes the code it contains
Explanation:
Provides code to execute if user presses a key that has no trigger attached.
See the section "Form Trigger Categories" for a refresher on this topic.
42. Your data analysis application is slowing the network to a crawl. You analyze the
queries users are performing and discover that the majority of their queries are too broad,
returning many more records than necessary. You decide to require that any query have
at least three fields containing criteria. What type of trigger can you use to enforce that
requirement?
A . POST-QUERY
B . ON-NEW-QUERY-INSTANCE
C . PRE-UPDATE
D*. PRE-QUERY
E . POST-UPDATE
Explanation:
PRE-QUERY
The PRE-QUERY trigger fires before a query's select statement has been finalized, and is
therefore ideal for screening query criteria before the query is executed.
43. You have created an alert with three buttons. What value will be returned if the user
selects the second button?
A . BUTTON2
B . DIALOG_BUTTON2
C*. ALERT_BUTTON2
Explanation:
ALERT_BUTTON2
44. What is the default level at which validation occurs in the Forms Runtime program?
A*. Item
B . Form
C . Block
D . Record
Explanation:
Item
By default, the Forms Runtime program validates an item immediately when the user
tries to leave the item.
45. How does the Forms Runtime program respond when a user enters text into a text
item that has an LOV attached and the VALIDATE_FROM_LIST property set to Yes?
A . The Forms Runtime program ignores the LOV if the user types a value directly into
the field.
B . The Forms Runtime program populates the item automatically with the first value in
the LOV that matches the user's entry.
C*. The Forms Runtime program opens the LOV and shows only items that match what
the user has typed so far.
Explanation:
The Forms Runtime program opens the LOV and shows only items that match what the
user has typed so far.
See the section "Introduction to Form Builder Validation Properties" for a refresher on
this topic.
46. How can you cause a block to use a database sequence to get unique IDs?
Explanation:
This action is not possible.
Data blocks cannot read sequences, and in fact cannot store values at all. Items, on the
other hand, can.
Give yourself half a point if you answered:
Set the Initial Value property to
:sequence.sequence-name.nextval.
which would have been the right answer if the question had referred to an item instead of
a block, and remember to pay closer attention to the wording of questions. In some
Oracle exam questions, a single word defines why one choice is right and another choice
wrong.
47. You have written a contact-tracking application that includes a field for the last date a
client was contacted. You want to use a trigger to guarantee that whenever the date in that
field is changed, the date entered is later than the date that was there before. What is the
best trigger to use?
A . PRE-UPDATE
B . ON-COMMIT
C . ON-UPDATE
D*. PRE-COMMIT
E . POST-UPDATE
Explanation:
PRE-COMMIT
48. Your form module's Validation Unit property is set to Form. The module includes a
data block that has a PRE-TEXT-ITEM trigger. At what point will the trigger fire?
A*. Never
Explanation:
Never
The trigger will not fire because the object level defined in the trigger name item is
smaller than the module's validation unit.
49. You want to add a delete-confirmation dialog to your application. You can do so by
creating which type of object?
A*. Alert
B . Message
C . Editor
D . Message box
Explanation:
Alert
50. You would like to keep the user from seeing the Forms Runtime program's "nn
records applied and saved" messages. What would you put in the form's WHEN-NEW-
FORM-INSTANCE trigger?
A . :system.message_level := 0;
B . :system.suppress_working := 'TRUE';
C . :system.suppress_working := 'FALSE';
D*. :system.message_level := 5;
Explanation:
:system.message_level := 5;
See the section "Controlling System Messages" for a refresher on this topic.
51. What is the last DML statement processed during a commit transaction?
A*. INSERT
B . UPDATE
C . DELETE
D . POST
Explanation:
INSERT
The post command does not perform a commit. Of the three remaining choices, their
processing order is delete, update, and then insert.
A . DOWN
B . COMMIT_FORM
E . GO_ITEM
Explanation:
No Answer is Correct.
Each built-in listed is a navigational built-in, which cannot be used within the
navigational trigger PRE-UPDATE.
53. Which navigational built-in will move the focus to a subsequent record and place it
on the same item it was on in the original record?
A . NEXT_BLOCK
B . NEXT_ITEM
C*. DOWN
Explanation:
DOWN
54. You would like to modify your form so it uses array processing to send DML
statements to the server in batches of 50. How would you do this?
B*. Set the data block's DML Array Size property to 50.
Explanation:
Set the data block's DML Array Size property to 50.
Oracle Questions
?h What is SQL*Plus and where does it come from?
?h How does one use the SQL*Plus utility?
?h What commands can be executed from SQL*Plus?
?h What are the basic SQL*Plus commands?
?h What is AFIEDT.BUF?
?h How does one restore session state in SQL*Plus?
?h What is the difference between @ and @@?
?h What is the difference between & and &&?
?h What is the difference between ! and HOST?
?h What is the difference between ? and HELP?
?h How does one enable the SQL*Plus HELP facility?
?h How can one disable SQL*Plus prompting?
?h How can one trap errors in SQL*Plus?
?h How does one trace SQL statement execution?
?h How can one prevent SQL*Plus connection warning messages?
?h How can uses be prevented from executing devious commands?
?h How can one disable SQL*Plus formatting?
3. PL/SQL blocks - for more information see the Oracle PLSQL FAQ. Eg:
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World!');
END;
/
What are the basic SQL*Plus commands?
The following SQL*Plus commands are available:
ACCEPT Get input from the user
DEFINE Declare a variable (short: DEF)
DESCRIBE Lists the attributes of tables and other objects (short: DESC)
EDIT Places you in an editor so you can edit a SQL command (short: ED)
EXIT or QUIT Disconnect from the database and terminate SQL*Plus
GET Retrieves a SQL file and places it into the SQL buffer
HOST Issue an operating system command (short: !)
LIST Displays the last command executed/ command in the SQL buffer (short: L)
PROMPT Display a text string on the screen. Eg prompt Hello World!!!
RUN List and Run the command stored in the SQL buffer (short: /)
SAVE Saves command in the SQL buffer to a file. Eg "save x" will create a script file
called x.sql
SET Modify the SQL*Plus environment eg. SET PAGESIZE 23
SHOW Show environment settings (short: SHO). Eg SHOW ALL, SHO PAGESIZE etc.
SPOOL Send output to a file. Eg "spool x" will save STDOUT to a file called x.lst
START Run a SQL script file (short: @)
How does one restore session state in SQL*Plus?
Look at the following example (Oracle8):
SQL> STORE SET filename REPLACE
SQL> (do whatever you like)
SQL> @filename
What is AFIEDT.BUF?
AFIEDT.BUF is the SQL*Plus default edit save file. When you issue the command "ed"
or "edit" without arguments, the last SQL or PL/SQL command will be saved to a file
called AFIEDT.BUF and opened in the default editor.
In the prehistoric days when SQL*Plus was called UFI, the file name was "ufiedt.buf",
short for UFI editing buffer. When new features were added to UFI, it was the initially
named Advanced UFI and the filename was changed to "aufiedt.buf" and then to
"afiedt.buf". They presumably needed to keep the name short for compatibility with some
of the odd operating systems that Oracle supported in those days.
The name "Advanced UFI" was never used officially, as the name was changed to
SQL*Plus before this version was released.
You can overwrite the default edit save file name like this:
SET EDITFILE "afiedt.buf"
What is the difference between @ and @@?
The @ (at symbol) is equivalent to the START command and is used to run SQL*Plus
command scripts.
A single @ symbol runs the script in your current directory, or one specified with a full
or relative path, or one that is found in you SQLPATH or ORACLE_PATH.
@@ will start a sqlplus script that is in the same directory as the script that called it
(relative to the directory of the current script). This is normally used for nested command
files.
Both "!" and "HOST" will execute operating system commands as child processes of
SQL*Plus. The difference is that "HOST" will perform variable substitution (& and &&
symbols), whereas "!" will not. (Note: use "$" under MVS, VMS, and Windows
environments, not "!")
What is the difference between ? and HELP?
There is no difference. Both "?" and HELP will read the SYSTEM.HELP table (if
available) and shows help text on the screen.
To use the help facility, type HELP followed by the command you need to learn more
about. For example, to get help on the SELECT statement, type:
HELP SELECT
How does one enable the SQL*Plus HELP facility?
To enable HELP for SQl*Plus, run the supplied SQL and Loader scritps to create the
Help table and to populate it. Look at this Unix example:
cd $ORACLE_HOME/sqlplus/admin/help
sqlplus system/manager @helptbl
sqlplus system/manager @helpindx
sqlldr system/manager control=plushelp.ctl
sqlldr system/manager control=sqlhelp.ctl
sqlldr system/manager control=plshelp.ctl
If the HELP command is not supported on your operating system, you can access the help
table with a simple script like this:
HELP.SQL:
select info
from system.help
where upper(topic)=upper('&1')
/
How can one disable SQL*Plus prompting?
If you run a script that contains "&" symbols SQL*Plus thinks that you want to prompt
the user for a value. To turn this off:
SET ESCAPE ON
SET ESCAPE ""
SELECT 'You & me' FROM DUAL;
or
SET DEFINE ?
SELECT 'You & me' FROM DUAL;
Note: You can disable substitution variable prompting altogether by issuing the SET
DEFINE OFF commmand.
in $ORACLE_HOME/sqlplus/admin.
2. Create a PLAN_TABLE using the UTLXPLAN.SQL script. This script is in
$ORACLE_HOME/rdbms/admin.
3. Use the "SET AUTOTRACE ON" command to trace SQL execution. This will print
the result of your query, an explain plan and high level trace information. Look at this
example:
SQL> set autotrace on
SQL> select * from dual;
D
-
X
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (FULL) OF 'DUAL'
Statistics
----------------------------------------------------------
0 recursive calls
2 db block gets
1 consistent gets
0 physical reads
0 redo size
181 bytes sent via SQL*Net to client
256 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
How can one prevent SQL*Plus connection warning messages?
When I go to SQl*Plus, I get the following errors:
Eg. to disable all users whose names starts with OPS$ from executing the CONNECT
command:
SQL> INSERT INTO SYSTEM.PRODUCT_USER_PROFILE VALUES ('SQL*Plus',
'OPS$%', 'CONNECT', NULL, NULL, 'DISABLED', NULL, NULL);
Can one copy tables with LONG columns from one database to another?
About the fastest way of copying data between databases and schemas are by using the
SQL*Plus COPY statement. Look at this example:
COPY FROM SCOTT/TIGER@LOCAL_DB TO SCOTT/TIGER@REMOTE_DB -
CREATE IMAGE_TABLE USING -
SELECT IMAGE_NO, IMAGE -
FROM IMAGES;
Interview questions:
1.query for self join.
2.deletion of duplicate rows.
3.post query trigger
4.pre query trigger
5.mastere ?Vdetail relation
6.report triggers
7.report parameters.