Professional Documents
Culture Documents
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, and processing continues
normally.
If the value in the text item does not 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.
18 What is the difference between LIST_VALUES and SHOW_LOV?
LIST_VALUES:
LIST_VALUES displays the list of values for the current item, as long as the
input focus is in a text item
That has an attached LOV. The list of values remains displayed until the
operator dismisses the LOV or
Selects a value.
By default, LIST_VALUES uses the NO_RESTRICT parameter. This parameter causes
Oracle Forms
Not to use the automatic search and complete feature. If you use the RESTRICT
parameter, Oracle
Forms use the automatic search and complete feature.
SHOW_LOV:
Displays a list of values (LOV) window at the given coordinates, and returns
TRUE if the operator selects a value from the list, and FALSE if the operator
Cancels and dismisses the list.
Note: You must attach a LIST_VALUES built-in to the text item. But it is not
necessary to attach SHOW_LOV to the text item.
19 What is a RECORD GROUP ? Different types of record groups? How to create
QUERY RECORD GROUP Dynamically?
A RECORD GROUP is an Internal Oracle Forms data structure that has a column/row
frame work similar to a database table. TYPES: QUERY, NON-QUERY AND STATIC
RECORD GROUP.
For creating QUERY RECORD GROUP dynamically use CREATE_GROUP_FROM_QUERY
(recordgroup_name, query);
20 How many no. of columns that a RECORD GROUP can have?
The total no. of columns should not exceed 64K.
21 What does POPULATE_GROUP return when query succeeds?
NUMBER i.e 0 When it succeeds.
22 How to change an LOV from one record group to another record group?
Use SET_LOV_PROPERTY.
Syntax:
SET_LOV_PROPERTY (lov_id, property, value);
SET_LOV_PROPERTY (lov_name, property, value);
SET_LOV_PROPERTY(lov_id, property, x, y);
SET_LOV_PROPERTY(lov_name, property, x, y);
Ex : Set_LOV_Property(lov_id,GROUP_NAME,'NEW_GROUP_NAME');
23 What are different types of CANVASES?
1] CONTENT, 2] STACKED, 3] HORIZONTAL TOOL BAR and 4] VERTICAL TOOL BAR.
*** 24 Explain RAISE ON ENTRY PROPERTY?
The Raise on Entry property of canvas-views determines how stacking order is
affected by navigation to items on those views:
When Raise on Entry is False, Oracle Forms raises the canvas-view only if the
target item is hidden behind another canvas-view in that same window.
When Raise on Entry is True, Oracle Forms raises the canvas-view to the front
of the window whenever the operator or the application navigates to an item on
that view. Be careful about
setting Raise on Entry to True for a content canvas-view; Because a content view
occupies the
entire content area of its window, it will always obscure any stacked canvasviews when it is
raised to the front of the view stack.
25 What is a CONTENT VIEW ?
A CONTENT CANVAS VIEW is the BASE view that occupies the entire CONTENT pane
of the window on which it is placed.
26
What is the difference between SHOW_VIEW and REPLACE_CONTENT_VIEW ?
Use SHOW_VIEW and REPLACE_CONTENT_VIEW.
Syntax:
SHOW_VIEW(view_id); SHOW_VIEW(view_name);
Syntax:
REPLACE_CONTENT_VIEW(window_id, view_id);
REPLACE_CONTENT_VIEW(window_name, view_id);
REPLACE_CONTENT_VIEW(window_id, view_name);
REPLACE_CONTENT_VIEW(window_name, view_name);
SHOW_VIEW displays the view at the specified display co-ordinates, whereas
REPLACE_CONTENT_VIEW displays the view at the location of the previously
displayed content view. The advantage is REPLACE_CONTENT_VIEW will not obscure
any stacked view displayed before calling REPLACE_CONTENT_VIEW.
27 What are the different types of WINDOWS ?
1] DOCUMENT WINDOW, 2] DIALOG WINDOW
28 How to display a WINDOW programmatically ?
Use SHOW_WINDOW, SET_WINDOW_PROPERTY to display window programmatically.
Syntax:
SHOW_WINDOW(window_id);
SHOW_WINDOW(window_id, x, y);
SHOW_WINDOW(window_name);
SHOW_WINDOW(window_name, x, y);
Syntax:
SET_WINDOW_PROPERTY(window_id, property, value);
SET_WINDOW_PROPERTY(window_id, property, x);
SET_WINDOW_PROPERTY(window_id, property, x, y);
SET_WINDOW_PROPERTY(window_name, property, value);
SET_WINDOW_PROPERTY(window_name, property, x);
SET_WINDOW_PROPERTY(window_name, property, x, y);
29 To which type of window REMOVE ON EXIT property is meaningful ?
DOCUMENT WINDOW ( Modeless Window)
30 To which type of window SCROLL BAR doesnt apply ?
DIALOG WINDOW ( Modal Window )
31 How to SCROLL a window dynamically ?
Use SCROLL_VIEW, SET_VIEW_PROPERTY built-ins.
Syntax:
SCROLL_VIEW(view_id, x, y);
SCROLL_VIEW(view_name, x, y);
Syntax:
SET_VIEW_PROPERTY(view_id, property, value);
SET_VIEW_PROPERTY(view_id, property, x, y);
SET_VIEW_PROPERTY(view_name, property, value);
SET_VIEW_PROPERTY(view_name, property, x, y);
starting_menu, group_name);
REPLACE_MENU(menu_module_name, menu_type,
starting_menu, group_name, use_file);
45 What are all the different types of MENU ITEMS ?
PLAIN, CHECK, RADIO,SEPERATOR and MAGIC ITEMS.
46 In which platform BACKROUND MENU is supported ?
CHARACTER MODE.
47 What are the different types of codes that we write in MENUS ?
NULL, MENU, PL/SQL, PLUS, CURRENT FORM and MACRO.
48 What are the way of referencing you will be using while writing the codes in
menus ?
Use NAME_IN and COPY for referencing objects in menu commands.
49 What is an ALERT ? How to change an alert message dynamically ? What type of
an window is an alert ? What are the maximum no. of characters that an alert
have ?
An ALERT is a MODAL WINDOW that displays a message notifying the operator of
some application condition.
Use SET_ALERT_PROPERTY to change the alert message.
Syntax: SET_ALERT_PROPERTY(alert_id/name,ALERT_MESSAGE_TEXT,Good choice).
ALERT is a MODAL WINDOW. Maximum no. of characters allowed in alert is 200.
50 What is FREEZE / UNFREEZE ?
Toggles properties window synchronization On and Off. When FREEZE is Off ( the
Default ), the property list is updated to display the properties of objects you
select in the Navigator and Windows. When FREEZE is On, the property list is
pinned and does not get update, allowing you to compare it to other property
lists.
51 What do you mean by COPYING and REFERENCING ?
COPYING creates a new and separate instance of the object in the target module.
REFERENCING creates a new object that maintains a link to the source object
52 When you COPY a REFERENCED object what will be the resultant object ?
COPYING a REFERENCED object creates a new and separate instance of the
referenced OBJECT.
The resultant is a REFERNCED object.
53 How to reuse the PL/SQL codes ?
For reusing PL/SQL codes we have to either REFERENCE or COPY the PL/SQL codes
defined in the SOURCE object.
Go for Program Units ( Procedures & Functions ) - Right Answer. ( Libraries )
54 How to use DDL statements in the FORMS 4.5 ?
Use FORMS_DDL( Statemnt)
Statement Any string expression up to 32K:
a literal
an expression or a variable representing the text of a block of dynamically
created
PL/SQL code.
a DML statement or
a DDL statement
55 How many SYSTEM VARIABLES are there in FORMS 4.5 ?
42 System Variables.
56 What does the SYSTEM_MOUSE_BUTTON_PRESSED variable do ?
SYSTEM.MOUSE_BUTTON_PRESSED indicates the number of the button that was clicked.
Mouse
button support is limited to buttons 1 and 2 (left or middle) on a three button
mouse. The value is always a character string.
57 What is the SYSTEM VARIABLE that is used to determine the CURRENT MODE ?
SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch
Processing mode. The value is always a character string.
10
11
12
11. How to write a SQL statement that should have a best RESPONSE TIME ?
Use the ___________________ in the optimizer hint inorder to obtain a best
response time. Use FIRST_ROW - Cost based Optimizer Hint.
12. What are OPTIMIZER HINTS ?
Specifies a hint string that Oracle Forms passes on to the RDBMS optimizer when
constructing queries. Using the optimizer can improve the performance of
database transactions.
13. What is the difference between %TYPE and %rowtype ?
%TYPE provides the datatype of a varible,constant or column. It is useful when
you declare a variable that refers to a database column in the table.
%ROWTYPE attribute is based on a record variable that has the same structure as
a row in a table or view or as a row fetched from a cursor.
14. Can we define structure like objects in PL/SQL ?
[ If the structure is what we define in C then we can create objects of type
structure using RECORD variable available in PL/SQL. ]
Yes, Using the PL/SQL tables. PL/SQL tables are temporary array like objects
used in a PL/SQL block. PL/SQL tables can have one column and a primary key. The
column data type can belong to any scalar data type, but the primary key must
only belong to the type binary_integer.
Size - UNLIMITED.
15. Can we use a funtion inside an INSERT statement ?
Yes. Eg: INSERT INTO EMP(COMM ) VALUES ( SAL*0.05 ) WHERE DEPTNO = 20;
16. What is TRUNCATE table ?
TRUNCATE table is a DDL command used to remove all the rows from the specified
table or cluster instantly. Eg: TRUNCATE TABLE table_name;
Advantage over DELETING:
a] It is a DDL statement and generates NO ROLLBACK information.
b] Doesnt fire the tables DELETE TRIGGER.
c] Truncating the master table of a snapshot doesnt record any changes in the
tables snapshot log.
d] Its more convinient than dropping and recreating the table.
e] D/R invalidates the tables dependent objects than truncating the object.
f] D/R requires you to REGRANT the privileges on the table while truncating
doesnt.
g] D/R requires you to RECREATE the INDEXES, INTEGRITY CONSTRAINTS, TRIGGERS and
STORAGE PARAMETER while truncating doesnt.
17. What is ROWID ? What are its components ?
ROWID is the logical address of a row, and it is unique within the database.The
ROWID is broken into three sections: left,middle,, and right (corresponding to
00001F20,000C, AND 0001, just shown). The numbering is in hexadecimal notation.
The left section is the block in the file, the middle is the row sequence number
within the block(numbering starts with 0, not 1), and the right is the file
number within the database. Note that the file numbers are uniquewithin the
whole database. The tablespace they are in is not relevant to the ROWID.
13
14
15
16
40. What are RESTRICTED PACKAGED PROCEDURES ? Why are they restricted from using
?
Any PACKAGED PROCEDURE that affects the basic functions of SQL*FORMS is a
RESRICTED PACKAGED PROCEDURE. You should use restricted packaged procedure only
in KEY-TRIGGERS, USER-NAMED TRIGGERS that are invoked by KEY-TRIGGERS, and
ON_NEW_FIELD_INSTANCE triggers. You should not use restricted packaged
procedures in any of the following types of triggers.
On-error,On-Database-Record,On-delete,On-insert,On-Lock,
On-Message,On-New-Record,On-Remove-record,On-Update,
On-Validate-Field, and On-validate-Record triggers.
Post-Change triggers.
Pre- and Post- Field, Pre- and Post- Record, Pre- and Post-Block, Pre- and
Post-Form triggers.
Pre- and Post-Query triggers.
Pre- and Post-Insert, Pre- and Post-Update, Pre- and Post-Delete, Pre- and
Post-Commit triggers.
User-Named triggers that are invoked by any of the above triggers.
41. What is the DIFFERENCE between EXPLICIT CURSOR & IMPLICIT CURSOR ?
IMPLICIT CURSORS are automatically opened by issuing a SELECT statement. But the
EXPLICIT cursors are to be opened using OPEN, fetching is done using FETCH and
closing using CLOSE.
42. What is the difference between ROWID and ROWNUM ?
ROWID is the logical address of the row, whereas ROWNUM returns the sequence no.
in which the row was retrieved when first fetched from a table.
43. What is the RESULT of the statement ?
SELECT EMPNO, NAME,SAL FROM EMP WHERE ROWNUM >2;
Result : 0, No rows will be selected.
44. How do you evaluate performance ?
Using SQL TRACE. It is an utility that can monitor and report on database
performance when one or more queries are run against the database.
It is used to gather statistics when running the query (i.e) reports on CPU time
spent on the query, the total no. of rows processed and statistics related to
parsing and cache performance.
45. What will EXPLAIN PLAN give?
It is an utility that shows how Oracle will access data for a given query. Use
EXPLAIN PLAN to determine the effective way to write queries and decide whether
to INDEX CERTAIN COLUMNS or TO USE CLUSTERS.
It shows :
1] The type of query processed; SELECT, INSERT,UPDATE or DELETE.
2] The cost assigned by the COST BASED OPTIMIZER if it is in use.
3] The steps that are necessary to return the data.
4] The internal operations that were performed for each step.
5] The object accessed for each step.
46. How do you analyse TKPROF ?
TKPROF filename.tra O/P file EXPLAIN = USR/PWD0
47. what parameter variables to be set to use TKPROF ?
SQL PROF
48. How many types of lockings are there ?
5 types of locks.
17
18
UNIQUE INDEX, COMPRESSED INDEX, CONCATENATED INDEX. An Index has an entry for
each value found in the tables Indexed field(s) ( except those with a NULL
value ) and pointer(s) to the rows having that value.
59. What is an UNIQUE INDEX ?
An UNIQUE INDEX ia an index that imposes uniqueness on each value in indexes.
The index may be one column or concatenated columns.
60 What is an COMPRESSED INDEX ?
A COMPRESSED INDEX is an index for which only enough index information is stored
to identify unique enrties; information that an index stores with the previous
or following key is compressed (truncated) and not stored to reduce the
storage overhead required by an index.
61. What is an CONCATENATED INDEX ?
A CONCATENATED INDEX is one that is created on more than one column of a table.
It can be used to guarentee that those columns are unique for every row in the
table and to speed access to rows via those columns
62. What is a UNION, UNION ALL,INTERSECTION and MINUS operator ?
The UNION operator returns ALL DISTINCT ROWS selected by either query.
The UNION ALL operator returns ALL ROWS selected by either query including
duplicates.
The INTERSECTION operator returns ONLY ROWS that are COMMON to both the queries.
The MINUS operator returns ALL DISTINCT ROWS selected only by the first query
and not by the second.
63. What does GROUP BY statement do ?
GROUP BY statement causes a SELECT statement to produce ONE SUMMARY ROW for all
selected rows that have identical values in one or more specified column or
expressions. Each expe\ressionin the SELECT clause must be one of the
following :
1] A CONSANT
2] A Function without parameters
3] A GROUP function like SUM , AVG.
4] Matched IDENTICALLY to a expression in the GROUP BY clause.
64. In 2 SELECT statements SELECT A FROM DUAL; and SELECT B FROM DUAL; What will
be the difference in using UNION and UNION ALL ?
UNION returns all distinct rows selected by either of the query, whereas UNION
ALL returns ALL ROWS selected by either query including duplicates.
64. Give one example where you will use DATABASE TRIGGERS ?
For AUDITING purposes we use database triggers.
65. Do you have any idea about ROW-CHAINING ? How will you resolve the issue if
there is rowchaining in a table ?
When a row NO LONGER FITS WITHIN THE DATABLOCK, it is stored in more than one
database block, and that therefore have several row pieces.
Resolving: Use ANALYZE to identify chained rows and also provides statistics on
the chained rows. Eg: ANALYZE ledger LIST CHAINED ROWS INTO CHAINED_ROWS:
(CHAINED_ROWS is a user defined table)
For creating chained_rows run the UTLCHAIN.SQL script.
66. What is an OPTIIMIZER ?
19
INDEX IN ORACLE
dministering Oracle Indexes
Tables can get quite big. Ive had databases with tables that were hundreds of gigabytes
in size, which is very big indeed! Big tables typically have a large number of rows in
them. Imagine how long it might take to search through 500 million rows of a 200
gigabyte table for one employee record. It could take a very long time.
One way we make accessing table faster is to create an index on that table. You are
probably very familiar with indexes and there is an index at the end of this book. If you
want to find out about Oracle tables, you go to the end of the book, look in the index,
and it tells you which page to read for information on Oracle indexes. Without this
20
index, finding a topic would be more difficult. Now imagine if we asked you to find
every instance of the word the in the book. How long would it take you?
By default Oracle uses indexes called B*Tree indexes. These indexes work very much
the same way as the index in the back of this book. You build an index based on one or
more columns in the table. Those column values are stored in the index. Say we create
an index on the EMPLOYEE_ID column. Our index would have 500 million
EMPLOYEE_ID values. Also in that index, with each EMPLOYEE_ID, is an address
that tells Oracle exactly where that EMPLOYEE_ID is located in the table. This address
is called the ROWID. The ROWID is like your address at home, it identifies one and
only one row in a table. Hence, armed with the column value, and the ROWID, Oracle
can quickly find the rows that have the value we are interested in.
For example, say we wanted EMPLOYEE_ID 5555. Part of our index might look like
this:
Column Value
ROWID
5551
AAAL+ZAAEAAAAMOAGa
5552
AAAL+ZAAEAAAAMOAGb
5553
AAAL+ZAAEAAAAMOAGc
5554
AAAL+ZAAEAAAAMOAGd
5555
AAAL+ZAAEAAAAMOAGe
5556
AAAL+ZAAEAAAAMOAGf
5556
AAAL+ZAAEAAAAMOAG
Oracle indexes are built so Oracle can very quickly find the column value entries you
are looking for. In our case, Oracle will then very quickly find the index entry for 5555,
and read the associated ROWID. Based on the ROWID, it knows exactly where the row
is in the table, and it will go read it.
Did you notice that the column values are sorted in the index? This is good because it
makes looking for specific values or a range of values very fast. For example, if we want
to find all column values between 5553 and 5556, we know that we start reading the
index at 5553, and that we dont need to read any more of the index after Ive read 5556.
That makes for very quick lookups of a range of values. Queries like this can take
advantage of these types of range scans:
SELECT empid, sal FROM emp WHERE empid BETWEEN 5553 AND 5556;
21
Also, since the column values are sorted, Oracle may not need to perform a sort
operation. For example a query like this:
SELECT empid, sal FROM emp WHERE empid BETWEEN 5553 AND 5556 ORDER BY empid;
Will require a sort if there is no index, but since we have an index on the EMPID
column, in many cases Oracle will not need to do a sort as long as it uses that index to
get the data we need. Oracle sometimes creates indexes for you. When you define a
primary key constraint (discussed earlier in this chapter) Oracle will create an index for
you. When you define a unique constraint, Oracle will also create an index for you.
Recall that Oracle uses B*Tree indexes by default. A picture of the index makes it look
like an upside down tree. At this point, its not important that you know how a B*Tree
index really works. All you need to know is that they are very fast and efficient for
many kinds of queries. If your queries are going to look at only a certain amount of table
data, indexes can improve the speed of your queries several fold. Here is a graphic of a
BTREE Index.
In the graphic of the B*Tree index Oracle starts from the top box called the root node,
and works its past the intermediate branch nodes down to the bottom boxes, called the
leaf nodes, to find your data. The root node points to the correct branch node to go to
based on the data value you are looking at. Each branch node points to the correct leaf
node based on the data value you are looking for.
For example in the B*Tree graphic, we are looking for a value of 65. The root node
points us to the left branch node, because it contains all values up to 122. This branch
node then points us to the left most leaf node, because the left most lead node contains
all values up to 65.
We find the record for 65, along with the ROWID in the left most leaf node. Oracle will
then take that ROWID and read the correct row in the table. Usually this is a very fast
and efficient way to get to your data, however as you can see this can be a very
expensive process, it took us 4 IOs to get just one record out of the table (3 index IOs
and 1 table IO). Hence, indexes are not always the best way to get at table data. You will
really need to make a study of Oracle Performance Tuning to understand when indexes
are good and when they are bad. Since this book is about being a DBA and managing
your database, we will leave that discussion for another day.
Oracle can use other kinds of indexes, such as index organized tables, function based
indexes and indexed clusters. These are slightly more advanced topics and best saved for
another book. In this book, we will stick with B*Tree indexes. Also, Oracle offers
advanced functionality with indexes such as partitioning and key compression. In this
22
book, we are just trying to get you through the basics first. Once you are through the
basics and comfortable with them, then you can move onto these index options later.
c1
c2
c3
c4
heading
heading
heading
heading
'Table|Name'
'Table|Freelists'
'Index|Name'
'Index|Freelists'
format
format
format
format
a20
99
a20
99
select distinct
t.table_name c1,
t.freelists
c2,
index_name
c3,
i.freelists
c4
from
dba_tables
t,
dba_indexes
i
where
t.table_name = i.table_name
and
i.index_name = 'IDX_EVENTCASE_STATUS_OVERAGE'
23