of 139
8/12/2019 Forms Reports- Overview
1/139
Oracle9i Developer Suite
A Tutorial on Oracle9i Forms and Reports
Covering Developer version 9i for Windows NT/!!!/"#
Ric$ard %olowc&a'
Tutorial Version 5.2 - 1:11 PM 8/16/2011
Please feel free to use these tutorials for your own personal use, education, advancement,training, etc. However, I kindly ask that you respect the time and effort I have put into this work bynot distributing copies, either in whole or in part, for your personal gain. You may not under anycircumstances download, cache or host copies of these tutorials on your own servers. Use ofthese tutorials for commercial training requires a special arrangement with the author or authors.
Contents
1. Introduction
2. Prerequisites
3. Developer Tools
o 3.1 Starting Developer tools under Windows
4. The Oracle or!s "uilder #ain Screen
o 4.1 Oracle or!s O$%ect &avigator
o 4.2 'onnecting to the Data$ase
(. or!s Design
). 'reating a or! with a Single "loc*
o ).1 'reating a &ew "loc*o ).2 The +a,out -ditor
o ).3 Displa,ing Properties
o ).4 Saving /enerating and 0unning or!s
).4.1 Saving a or! ).4.2 'o!piling"uilding a or!
).4.3 0unning a or!
).4.4 uer, ", -a!ple
o ).( -ercise 'reating a Single "loc* or!
5. 'reating a #aster6Detail or!
o 5.1 The #aster6Detail 0elationship
o 5.2 Steps to 'reate a #aster6Detail or! 5.2.1 'reate the #aster "loc*
5.2.2 'reate the Detail "loc*
o 5.3 0elation Properties o7 a #aster6Detail or!
o 5.4 Progra! 8nits in a #aster6Detail or!
o 5.( -tending #aster6Detail or!s
o 5.) -ercise 'reating a #asterDetail or!
9. +ist o7 :alues ;+O:s< and &on6"ase Ta$le ields
http://www.holowczak.com/http://www.holowczak.com/oracle/dev9i/#introductionhttp://www.holowczak.com/oracle/dev9i/#prerequisiteshttp://www.holowczak.com/oracle/dev9i/#developer2000toolshttp://www.holowczak.com/oracle/dev9i/#startingwindowshttp://www.holowczak.com/oracle/dev9i/#formsdesignermainhttp://www.holowczak.com/oracle/dev9i/#objectnavigatorhttp://www.holowczak.com/oracle/dev9i/#connectingtodatabasehttp://www.holowczak.com/oracle/dev9i/#formsdesignhttp://www.holowczak.com/oracle/dev9i/#singleblockformhttp://www.holowczak.com/oracle/dev9i/#creatingnewblockhttp://www.holowczak.com/oracle/dev9i/#layouteditorhttp://www.holowczak.com/oracle/dev9i/#displayingpropertieshttp://www.holowczak.com/oracle/dev9i/#savingcompilingrunninghttp://www.holowczak.com/oracle/dev9i/#savingaformhttp://www.holowczak.com/oracle/dev9i/#compilingaformhttp://www.holowczak.com/oracle/dev9i/#runningaformhttp://www.holowczak.com/oracle/dev9i/#querybyexamplehttp://www.holowczak.com/oracle/dev9i/#exercise_simpleformhttp://www.holowczak.com/oracle/dev9i/#creatingmasterdetailhttp://www.holowczak.com/oracle/dev9i/#masterdetailrelationshiphttp://www.holowczak.com/oracle/dev9i/#stepscreatemasterdetailhttp://www.holowczak.com/oracle/dev9i/#createmasterblockhttp://www.holowczak.com/oracle/dev9i/#createdetailblockhttp://www.holowczak.com/oracle/dev9i/#relationpropertieshttp://www.holowczak.com/oracle/dev9i/#programunitshttp://www.holowczak.com/oracle/dev9i/#extendingmasterdetailhttp://www.holowczak.com/oracle/dev9i/#exercise_masterdetailhttp://www.holowczak.com/oracle/dev9i/#listofvalueshttp://www.holowczak.com/http://www.holowczak.com/oracle/dev9i/#introductionhttp://www.holowczak.com/oracle/dev9i/#prerequisiteshttp://www.holowczak.com/oracle/dev9i/#developer2000toolshttp://www.holowczak.com/oracle/dev9i/#startingwindowshttp://www.holowczak.com/oracle/dev9i/#formsdesignermainhttp://www.holowczak.com/oracle/dev9i/#objectnavigatorhttp://www.holowczak.com/oracle/dev9i/#connectingtodatabasehttp://www.holowczak.com/oracle/dev9i/#formsdesignhttp://www.holowczak.com/oracle/dev9i/#singleblockformhttp://www.holowczak.com/oracle/dev9i/#creatingnewblockhttp://www.holowczak.com/oracle/dev9i/#layouteditorhttp://www.holowczak.com/oracle/dev9i/#displayingpropertieshttp://www.holowczak.com/oracle/dev9i/#savingcompilingrunninghttp://www.holowczak.com/oracle/dev9i/#savingaformhttp://www.holowczak.com/oracle/dev9i/#compilingaformhttp://www.holowczak.com/oracle/dev9i/#runningaformhttp://www.holowczak.com/oracle/dev9i/#querybyexamplehttp://www.holowczak.com/oracle/dev9i/#exercise_simpleformhttp://www.holowczak.com/oracle/dev9i/#creatingmasterdetailhttp://www.holowczak.com/oracle/dev9i/#masterdetailrelationshiphttp://www.holowczak.com/oracle/dev9i/#stepscreatemasterdetailhttp://www.holowczak.com/oracle/dev9i/#createmasterblockhttp://www.holowczak.com/oracle/dev9i/#createdetailblockhttp://www.holowczak.com/oracle/dev9i/#relationpropertieshttp://www.holowczak.com/oracle/dev9i/#programunitshttp://www.holowczak.com/oracle/dev9i/#extendingmasterdetailhttp://www.holowczak.com/oracle/dev9i/#exercise_masterdetailhttp://www.holowczak.com/oracle/dev9i/#listofvalues8/12/2019 Forms Reports- Overview
2/139
o 9.1 'reating a +ist o7 :alues
9.1.1 'reate a new +O: O$%ect 9.1.2 Speci7, the +O: uer, Tet
9.1.3 Speci7, the 'olu!n #apping Properties
9.1.4 =ttach the +O: to the ite!
9.1.( Test the +O:o 9.2 &on6"ase Ta$le 7ields
9.2.1 =dding a &ew Ite! to an -isting Data
"loc* 9.2.2 'reating a Trigger
9.2.3 'reate a new +ist o7 :alues
o 9.3 -ercise 'reating an +O: and &on6"ase Ta$le
7ield
>. Oracle or!s Progra! 8nits and Stored Progra! 8nits
o >.1 'reating Procedures in Oracle or!s
>.1.1 =dd a new ite! to the -#P+O?-- "loc*
>.1.2 'reate a Procedure to 'ount OtherDepart!ent #e!$ers
>.1.3 'reate a Trigger to 'all the Procedure >.1.4 Save 'o!pile and 0un the or!
o >.2 'reating Stored Progra! 8nits ;Procedures< in
S+@Plus
o >.3 =dditional Stored Procedures and Triggers
>.3.1 /enerating unique or consecutive
identi7iers using the ta$le >.3.2 /enerating unique or consecutive
identi7iers using an Oracle Sequence
>.3.3 'hec*ing constraints at the client >.3.4 =dding =lerts ;Pop6up #essages.3.( =uto!atic or!s uer,
>.3.) Populate ite!s with de7ault values
>.3.5 =ttaching 7unctionalit, to co!!and$uttons
>.3.9 Passing para!eters $etween 7or!s
o >.4 -ercise Procedures and Triggers
1A. Oracle 0eports "asics
o 1A.1 Starting Developer tools under Windows
o 1A.2 The Oracle 0eports O$%ect &avigator
o 1A.3 'reating 0eports in Oracle 0eportso 1A.4 'reating a Single6Ta$le 0eport
1A.4.1 Speci7, the Data #odel and +a,out 1A.4.2 Saving /enerating and 0unning the
0eport
o 1A.( -ercise 'reating a 0eport
o 1A.) 'reating a #aster6Detail 0eport
1A.).1 Speci7, the #aster6Detail Data #odel
http://www.holowczak.com/oracle/dev9i/#creatinganlovhttp://www.holowczak.com/oracle/dev9i/#newlovobjecthttp://www.holowczak.com/oracle/dev9i/#specifyquerytexthttp://www.holowczak.com/oracle/dev9i/#specifycolumnmappinghttp://www.holowczak.com/oracle/dev9i/#attachlovtoitemhttp://www.holowczak.com/oracle/dev9i/#testlovhttp://www.holowczak.com/oracle/dev9i/#nonbasetablefieldshttp://www.holowczak.com/oracle/dev9i/#addinganewitemhttp://www.holowczak.com/oracle/dev9i/#addinganewitemhttp://www.holowczak.com/oracle/dev9i/#creatingtriggershttp://www.holowczak.com/oracle/dev9i/#changenewlovhttp://www.holowczak.com/oracle/dev9i/#exercise_lovhttp://www.holowczak.com/oracle/dev9i/#exercise_lovhttp://www.holowczak.com/oracle/dev9i/#storedprocedureshttp://www.holowczak.com/oracle/dev9i/#creatingformsprocedureshttp://www.holowczak.com/oracle/dev9i/#addnewitemtoemployeehttp://www.holowczak.com/oracle/dev9i/#createprocedureotherdeptmembershttp://www.holowczak.com/oracle/dev9i/#createprocedureotherdeptmembershttp://www.holowczak.com/oracle/dev9i/#createatriggertocallprocedurehttp://www.holowczak.com/oracle/dev9i/#savecopmileandruntheformhttp://www.holowczak.com/oracle/dev9i/#sqlplustoredprocedureshttp://www.holowczak.com/oracle/dev9i/#sqlplustoredprocedureshttp://www.holowczak.com/oracle/dev9i/#additionalprocedureshttp://www.holowczak.com/oracle/dev9i/#uniqueidtablehttp://www.holowczak.com/oracle/dev9i/#uniqueidtablehttp://www.holowczak.com/oracle/dev9i/#uniqueidsequencehttp://www.holowczak.com/oracle/dev9i/#uniqueidsequencehttp://www.holowczak.com/oracle/dev9i/#checkingconstraintsclienthttp://www.holowczak.com/oracle/dev9i/#addingalertshttp://www.holowczak.com/oracle/dev9i/#autoqueryhttp://www.holowczak.com/oracle/dev9i/#populatewithdefaultshttp://www.holowczak.com/oracle/dev9i/#commandbuttonshttp://www.holowczak.com/oracle/dev9i/#commandbuttonshttp://www.holowczak.com/oracle/dev9i/#passingparametershttp://www.holowczak.com/oracle/dev9i/#proceduretriggerexerciseshttp://www.holowczak.com/oracle/dev9i/#oraclereportsbasicshttp://www.holowczak.com/oracle/dev9i/#repstartingwindowshttp://www.holowczak.com/oracle/dev9i/#repobjectnavigatorhttp://www.holowczak.com/oracle/dev9i/#repcreatingresportshttp://www.holowczak.com/oracle/dev9i/#repcreatingsingletablereportshttp://www.holowczak.com/oracle/dev9i/#repspecifydatamodelhttp://www.holowczak.com/oracle/dev9i/#repsavinggeneratingrunninghttp://www.holowczak.com/oracle/dev9i/#repsavinggeneratingrunninghttp://www.holowczak.com/oracle/dev9i/#exercise_simplereporthttp://www.holowczak.com/oracle/dev9i/#repmasterdetailhttp://www.holowczak.com/oracle/dev9i/#repmddatamodelhttp://www.holowczak.com/oracle/dev9i/#creatinganlovhttp://www.holowczak.com/oracle/dev9i/#newlovobjecthttp://www.holowczak.com/oracle/dev9i/#specifyquerytexthttp://www.holowczak.com/oracle/dev9i/#specifycolumnmappinghttp://www.holowczak.com/oracle/dev9i/#attachlovtoitemhttp://www.holowczak.com/oracle/dev9i/#testlovhttp://www.holowczak.com/oracle/dev9i/#nonbasetablefieldshttp://www.holowczak.com/oracle/dev9i/#addinganewitemhttp://www.holowczak.com/oracle/dev9i/#addinganewitemhttp://www.holowczak.com/oracle/dev9i/#creatingtriggershttp://www.holowczak.com/oracle/dev9i/#changenewlovhttp://www.holowczak.com/oracle/dev9i/#exercise_lovhttp://www.holowczak.com/oracle/dev9i/#exercise_lovhttp://www.holowczak.com/oracle/dev9i/#storedprocedureshttp://www.holowczak.com/oracle/dev9i/#creatingformsprocedureshttp://www.holowczak.com/oracle/dev9i/#addnewitemtoemployeehttp://www.holowczak.com/oracle/dev9i/#createprocedureotherdeptmembershttp://www.holowczak.com/oracle/dev9i/#createprocedureotherdeptmembershttp://www.holowczak.com/oracle/dev9i/#createatriggertocallprocedurehttp://www.holowczak.com/oracle/dev9i/#savecopmileandruntheformhttp://www.holowczak.com/oracle/dev9i/#sqlplustoredprocedureshttp://www.holowczak.com/oracle/dev9i/#sqlplustoredprocedureshttp://www.holowczak.com/oracle/dev9i/#additionalprocedureshttp://www.holowczak.com/oracle/dev9i/#uniqueidtablehttp://www.holowczak.com/oracle/dev9i/#uniqueidtablehttp://www.holowczak.com/oracle/dev9i/#uniqueidsequencehttp://www.holowczak.com/oracle/dev9i/#uniqueidsequencehttp://www.holowczak.com/oracle/dev9i/#checkingconstraintsclienthttp://www.holowczak.com/oracle/dev9i/#addingalertshttp://www.holowczak.com/oracle/dev9i/#autoqueryhttp://www.holowczak.com/oracle/dev9i/#populatewithdefaultshttp://www.holowczak.com/oracle/dev9i/#commandbuttonshttp://www.holowczak.com/oracle/dev9i/#commandbuttonshttp://www.holowczak.com/oracle/dev9i/#passingparametershttp://www.holowczak.com/oracle/dev9i/#proceduretriggerexerciseshttp://www.holowczak.com/oracle/dev9i/#oraclereportsbasicshttp://www.holowczak.com/oracle/dev9i/#repstartingwindowshttp://www.holowczak.com/oracle/dev9i/#repobjectnavigatorhttp://www.holowczak.com/oracle/dev9i/#repcreatingresportshttp://www.holowczak.com/oracle/dev9i/#repcreatingsingletablereportshttp://www.holowczak.com/oracle/dev9i/#repspecifydatamodelhttp://www.holowczak.com/oracle/dev9i/#repsavinggeneratingrunninghttp://www.holowczak.com/oracle/dev9i/#repsavinggeneratingrunninghttp://www.holowczak.com/oracle/dev9i/#exercise_simplereporthttp://www.holowczak.com/oracle/dev9i/#repmasterdetailhttp://www.holowczak.com/oracle/dev9i/#repmddatamodel8/12/2019 Forms Reports- Overview
3/139
and +a,out
1A.).2 Saving and 0unning the #aster6Detail0eport
o 1A.5 -ercise 'reating a #aster6Detail 0eport
o 1A.9 Para!eter 7or!s in Oracle 0eports
1A.9.1 "uilding a 'usto! Para!eter or! 11 'reating #enus in Oracle or!s
o 11.1 The Oracle or!s #enu Bierarch,
o 11.2 'reating a 'usto! #enu
() *ntroduction
This tutorial introduces the Oracle>i Developer Suite 0elease 2 that
includes Oracle or!s >.A and Oracle 0eports >.A. The !ain o$%ectivesare to de!onstrate and provide hands6on instructions on creating and
!odi7,ing data entr, and quer, 7or!s in various con7igurations reports
and graphics.
'aveats Please note that Oracle tends to change things li*e !enuite!s pro!pts and other s!all things $etween each !a%or ;certainl,i
Developer Suite ,ou have ,ou !a, 7ind so!e s!all discrepencies$etween what is shown in this tutorial and what ,ou see on ,our screen.
) #rere+uisites
"e7ore 7ollowing this tutorial a student !ust have a valid user account
in an Oracle server or a local installation o7 an Oracle data$ase. 'ontact,our D"= or s,ste!s ad!inistrator to learn the details o7 how Oracle
server is set up in ,our organiCation.
I7 ,ou have a local instance o7 the Oracle data$ase please do not use
the S?ST-# ;D"=< account to practice develop!ent. There is a goodchance ,ou can corrupt the entire data$ase $, !ista*e. ?ou are !uch
$etter o77 !a*ing use o7 the S'OTTTI/-0 sche!a or ;even $etteri as a three tier
architecture. This !eans that the data$ase ;Oracle>i server< should run
on one server the application Server ;oracle>i =pplication Server orOracle>i=S 'ontainers 7or ava ;O'4< server as used here< runs on a
second server and the client application ;written in Oracle or!s and
0eports 7or ea!ple< runs on a third !achine. One can get all o7 these
http://www.holowczak.com/oracle/dev9i/#repmddatamodelhttp://www.holowczak.com/oracle/dev9i/#repmdsavinggeneratinghttp://www.holowczak.com/oracle/dev9i/#repmdsavinggeneratinghttp://www.holowczak.com/oracle/dev9i/#exercise_masterdetailreporthttp://www.holowczak.com/oracle/dev9i/#parameterforms_reportshttp://www.holowczak.com/oracle/dev9i/#customparamformhttp://www.holowczak.com/oracle/dev9i/#creatingmenusinoracleformshttp://www.holowczak.com/oracle/dev9i/#menuhierarchyhttp://www.holowczak.com/oracle/dev9i/#creatingcusomtmenuhttp://www.holowczak.com/oracle/dev9i/#repmddatamodelhttp://www.holowczak.com/oracle/dev9i/#repmdsavinggeneratinghttp://www.holowczak.com/oracle/dev9i/#repmdsavinggeneratinghttp://www.holowczak.com/oracle/dev9i/#exercise_masterdetailreporthttp://www.holowczak.com/oracle/dev9i/#parameterforms_reportshttp://www.holowczak.com/oracle/dev9i/#customparamformhttp://www.holowczak.com/oracle/dev9i/#creatingmenusinoracleformshttp://www.holowczak.com/oracle/dev9i/#menuhierarchyhttp://www.holowczak.com/oracle/dev9i/#creatingcusomtmenu8/12/2019 Forms Reports- Overview
4/139
co!ponents to run on the sa!e !achine $ut it requires $oth a 7ast
processor and a lot o7 0=#. Bere is one ea!ple
Service/ApplicationRA, consumed w$ile
runningOracel>i Data$ase ;!ini!al instance< 14A #"
Oracle>i or!s "uilder 42 #"
Oracle>i 0eports "uilder 9A #"
Oracle>i or!s 0unti!e we$launcher
12 #"
O'4 Service ;ava< 3) #"
&etscape 4.5 running a 7or! 3( #"
Oracle>i S+@Plus 9 #"
Total -.- ,
There7ore having at least (12 #" o7 real 0=# ;not swap space< is a
necessit,. 1 /" o7 0=# will ,ield signi7icantl, $etter per7or!ance. I7
,ou have less than (12 #" o7 0=# ,ou should create a swap 7ile;:irtual !e!or,< o7 at least 1 /".
The student should also $e 7a!iliar with OracleEs S+@Plus tools and
should $e co!7orta$le connecting to a data$ase sche!a creatingta$les inserting and !anipulating data ;with S+ I&S-0T 8PD=T-
and D-+-T- state!ents< and with quer,ing ta$le data ;with S+
S-+-'T state!ents>4.
http://www.holowczak.com/oracle/sqlplus/http://www.holowczak.com/oracle/sqlplus/http://www.holowczak.com/oracle/sqlplus/http://www.holowczak.com/oracle/sqlplus/http://www.holowczak.com/oracle/sqlplus/8/12/2019 Forms Reports- Overview
5/139
D4#ART,4NTTa$le
Attri5ute Data T0pe
D&=#- :=0'B=0;1(9&T2AAAGP< will $e given.
-)( Starting Developer tools under Windows
= t,pical installation o7 Oracle>i Developer Suite ;>iDS< creates several 7olders underthe Start Progra!s !enu. The two !ain 7olders are $oth na!ed a7ter the Oracle Bo!e
,ou chose to install >iDS under.= $rie7 guide to installing >iDS can $e 7ound
herett%://Bisnet.aruB.Bun&.e7u/oloCBa3/oraBle/install/i=S'ontainers 7or ava ;O'4< service runs and on how to install the Init plugin 7or ,our
we$ $rowser.
The !ain >iDS progra!s represented in this tutorial are 7ound under the Oracle>i
Developer Suite ho!e and include the 7ollowing ite!s
http://cisnet.baruch.cuny.edu/holowczak/oracle/install/9ids/http://cisnet.baruch.cuny.edu/holowczak/oracle/install/9ids/http://cisnet.baruch.cuny.edu/holowczak/oracle/install/9ids/http://cisnet.baruch.cuny.edu/holowczak/oracle/install/9ids/http://cisnet.baruch.cuny.edu/holowczak/oracle/install/9ids/8/12/2019 Forms Reports- Overview
9/139
To run the >iDS or!s "uilder under Windows clic* on the tart - ProFra$s -
OraBleiDS 0eports "uilder under Windows clic* on the tart - ProFra$s -OraBleiDS installs in 8&IG or +inu use the 7ollowing scripts
or!s "uilder 9iDS tools.
7) T$e 9iDS Forms uilder ,ain Screen
Once the appropriate !enu ite! has $een clic*ed on ;7or Windows
8/12/2019 Forms Reports- Overview
10/139
This screen is called the Object Navigatorand displa,s all o7 the 7or! ele!ents data$loc*s !enu ite!s user de7ined code li$raries $uilt in procedures and 7unctions and
data$ase o$%ects ;ta$les views
8/12/2019 Forms Reports- Overview
11/139
The !enu $ar across the top provides access to al!ost all o7 the 7eatures o7 Oracle
or!s.
The (ile!enu has options to create open save and print 7or!s. This !enu also
includes an option to connect to the data$ase and the =d!inistration option thatis used to co!pile 7or!s and !enu code. The last option on the (ile!enu is
the EHitoption that will eit Oracle or!s "uilder.
The E7it!enu has options to cut cop, and paste o$%ects to invo*e an editor
and to undo an operation.
The VieC!enu toggles the o$%ect navigator displa, $etween visual ele!ents and
ownership ele!ents.
The La&out!enu has ite!s that control o$%ects on a 7or! !uch in the wa, a
drawing pac*age does. O$%ects can $e resiCed !oved painted and otherwise!anipulated using ite!s on this !enu.
The ProFra$!enu has ite!s that control 7or! co!pilation generation and
eecution ;0un
8/12/2019 Forms Reports- Overview
12/139
2. Menus6 'ontains !enu o$%ects and all o7 their su$6o$%ects such as !enu ite!s
para!eters and progra! units. #ore than one !enu can $e open at a ti!e.3. PL/>L Liraries6 These are li$raries o7 P+S+ code ;stored either in the
data$ase or in .%l7iles
8/12/2019 Forms Reports- Overview
13/139
8&IG the $utton is la$eled O
8/12/2019 Forms Reports- Overview
14/139
This 7or! has two data $loc*s one 7or the EMPLOYEEta$le and one 7orthe DEPE!DE!Tta$le. These data $loc*s are arranged in aMaster/Detailsetup where a
single -!plo,ee record ;the !aster< is associated with one or !ore Dependents records;the details
8/12/2019 Forms Reports- Overview
15/139
inall, at the $otto! o7 each 7or! is a status $ar that displa,s an, relevant pro!pts or
error !essages and an indication o7 the records in the current data $loc*.
There are 7our !ain t,pes o7 7or!s that can $e designed.Single "loc*
or!. This7or! contains
a single data
$loc*corresponding
to a single
data$aseta$le.
Single $loc*
or! withloo*up 7ield.
This 7or!
contains asingle data
$loc*
correspondingto a single
data$ase ta$le
with the
addition o7
one or !ore7ields that
displa, data7ro! so!e
other ta$les.
Such data isHloo*ed upH
when the 7or!
runs.
#asterDetailor!. This
7or! containstwo data$loc*s that are
arranged in a
!asterdetail;one to !an,uer&7ro! the >uer&!enu places the 7or! in&nter
'uery!ode. In enter quer, !ode the 7or! is cleared and the user can navigate
in the various 7ields. -a!ple values can $e supplied as criteria 7or the quer,.
or ea!ple a user loo*ing 7or all e!plo,ees in the 0-S-=0'B depart!ent
!ight t,pe a H(H in the D&O 7ield while in enter quer, !ode.
'lic*ing on the uer, $utton a second ti!e ;or pulling down the >uer&!enu
and choosing EHeBute >uer&< eecutes the current quer, using an, supplied
data as criteria in a WB-0- clause. I7 no criteria are supplied then all records
in the ta$le will $e displa,ed. 'ontinuing the a$ove ea!ple suppl,ing a H(H
7or the D&O 7ield while in enter quer, !ode would cause the 7ollowing S+
quer, to $e su$!itted to the data$ase
ELE"T 9na$e+ lna$e+ ssn+ 7ate+ salar&+ 7no(OM e$%lo&ee?)EE 7no K 5
#ost o7 the co!!ands on the !enus and on the $utton $ar can also $e
activated using special *e, co!$inations or 7unction *e,s. or ea!ple within
the ava $ased 7or!s displa, pressing the (117unction *e, places the 7or! in
-nter uer, !ode. Pressing the "TL(117unction *e, eecutes a quer,. ;&ote
Please chec* the Belp !enu to see i7 the *e,s in ,our s,ste! are the sa!e
8/12/2019 Forms Reports- Overview
43/139
To enter new data into the 7or! the user can scroll to the last record and then
down once !ore to !ove to a $lan* record. Data can then $e t,ped into the
7ields and the T=" *e, can $e pressed to !ove $etween 7ields on the 7or!.
To save $oth changed and new records on a 7or! pull down the ABtion!enu
and choose the aGe!enu ite!. =n, records that have $een changed arecollected and su$!itted to the data$ase as S+ 8PD=T- state!ents. =n, new
records are collected and su$!itted to the data$ase as I&S-0T state!ents.
These state!ents are su$!itted as a single logical unit o7 wor*. Thus i7 a
7ailure occurs during an, o7 the state!ents the entire transaction will $e rolled
$ac*.
I7 the user atte!pts to clear the $loc* or eit the 7or! and there are so!e
changes that have not ,et $een applied to the data$ase the, will $e pro!pted to
co!!it the changes $e7ore eiting or clearing the 7or!. The $loc* is cleared
when the -nter uer, !ode is invo*ed. = $loc* can also $e cleared using
the "lear #loB3and "lear (or$!enu ite!s.
To eit 7ro! a running 7or! pull down the ABtion!enu and select
the EHit!enu ite!. Warning> Do not simpl0 close t$e we5 5rowser as t$is
will leave a @ava Applet process running and t$is will loc' 0our form )fm?
fileB)
=s a review here are a 7ew $asic 7unctions that can $e per7or!ed $, de7ault in
an, or!
Forms
functionNotes
uer,ing a
7or!
To see all records in the ta$le si!pl, H-ecute uer,H ;via uer, !enu or
$, pressing 9 in Windows
8/12/2019 Forms Reports- Overview
44/139
records
0ecords !enu and choose Delete record. Then save the changes.
or !asterdetail 7or!s atte!pting to delete a !aster record when detailrecords eist t,picall, results in an error. In such cases all o7 the detail
records should $e deleted 7irst and then the !aster record should $e a$le to
$e deleted.
-iting the
or!
Pull down the ABtion!enu and choose the EHit!enu ite!. -isting inthis wa, will release an, ava processes that !ight loc* up ,our 7or!s
7iles.
;). 4?ercise> Creating a a Single loc' Form
or this eercise create a si!ple data entr, 7or! 7or the D-P=0T#-&T ta$le
with the 7ollowing characteristics
Select and displa, all o7 the colu!ns in the D-P=0T#-&T ta$le.
In the la,out wiCard use the Ta$ularla,out and displa, ( 0ecordsin the
7or!. =dd a scroll$ar.
In the +a,out -ditor !a*e the D&=#- 7ield a $it wider to
acco!!odate longer depart!ent na!es.
'hange the Properties o7 the D-P=0T#-&T $loc* so that that data is
O0D-0 "? D&=#-.
Save the 7or! under the 7ile na!e 7e%art.9$
The resulting 7or! should loo* li*e the 7ollowing
http://www.holowczak.com/oracle/dev9i/#tabularlayouthttp://www.holowczak.com/oracle/dev9i/#numberofrecordshttp://www.holowczak.com/oracle/dev9i/#tabularlayouthttp://www.holowczak.com/oracle/dev9i/#numberofrecords8/12/2019 Forms Reports- Overview
45/139
8se the enter quer, !ode and eecute quer, 7unctions to quer, the depart!ent
ta$le 7or a speci7ic depart!ent na!e andor nu!$er.
) Creating a ,aster:Detail Form
In this section the $asic steps 7or creating a #asterDetail 7or! are introduced.
= #asterDetail 7or! is a 7or! that has two $loc*s arranged in a !aster6detail
relationship.
8/12/2019 Forms Reports- Overview
46/139
)( T$e ,aster:Detail Relations$ip
The #aster6Detail relationship is a co!!on relationship $etween entities in a
$usiness. In an -ntit,60elationship diagra! these are shown as HOne to #an,H
relationships. In a ph,sical data$ase design a singleMasterrecord re7erences
one or !ore detailrecords in another ta$le. = record in the detail ta$le willrelate to eactl, one !aster record in the !aster ta$le. =nother na!e 7or this
relationship is called parent6child. -a!ples o7 this relationship include
= 'usto!er Order with !an, OrderIte!s.
= Depart!ent with !an, -!plo,ees.
=n -!plo,ee with !an, Dependents.
= 'o!pan, with !an, "ranch O77ices.
= 0ecipe with !an, 0ecipeSteps.
=n Inventor, location with !an, Inventor, Ite!s.
Oracle or!s i!ple!ents the !aster6detail relationship using two data $loc*s.
The 7irst $loc* corresponds to the !aster ta$le and the second $loc*
corresponds to the detail ta$le. There are two !a%or 7unctions in a #aster6
Detail 7or!
Oracle or!s coordinates values $etween the two $loc*s through a
series o7 7or! and $loc* level triggers.
Oracle or!s guarantees that the detail $loc* will displa, onl, records
that are associated with the current record in the !aster $loc*.
&ote that a #aster6Detail 7or! is si!pl, one wa, o7 viewing the data in tworelated ta$les. or!s do not a77ect the sche!a in ter!s o7 creating dropping or
en7orcing data$ase level re7erential integrit, constraints.
) Steps to Create a ,aster:Detail Form
In this section a set o7 step $, step instructions 7or creating a #aster6detail
7or! are given. The 7or! will allow a user to quer, a given depart!ent in the
co!pan, and then will displa, all o7 the e!plo,ees in that co!pan,.
The sche!a used is the sa!e one suggested in the Prerequisitessection at the$eginning o7 this tutorial. &otice that the D&O colu!n in the EMPLOYEEta$le
gets its values 7ro! the D&8#"-0 colu!n in the DEPATME!Tta$le. In other
words to %oin the two ta$les in a quer, one !ight speci7, a WB-0- clause
such thatEMPLOYEE.D!O K DEPATME!T.D!M#E.
http://www.holowczak.com/oracle/dev9i/#prerequisiteshttp://www.holowczak.com/oracle/dev9i/#prerequisites8/12/2019 Forms Reports- Overview
47/139
))( Create t$e ,aster loc'
In the O$%ect &avigator clic* on the (or$s$ranch at the ver, top. 'reate a new
7or! $, pulling down the (ile!enu and choosing the !eC!enu ite!. Then
choose (or$7ro! the 7l,out !enu.
8sing the sa!e steps given in the prior section on ). 'reating a or! with a
Single "loc* create a new $loc* na!ed DEPATME!Tthat contains all o7 the
colu!ns in the DEPATME!Tta$le. "rie7l,
1. Pull down the Tools!enu and choose the Data "loc* wiCard.
2. 'reate a data $loc* 7or a ta$leview.
3. Speci7, the D-P=0T#-&T ta$le and select all o7 the colu!ns
;D&=#- D&8#"-0 #/0SS& and #/0S=0TD=T-
8/12/2019 Forms Reports- Overview
48/139
>. Speci7, a 7ra!e title o7 HDepart!entsH and select onl, 1 record to $e
displa,ed.
1A. Save the 7or! as 7e%te$%.9$and then co!pile and run it to !a*e sure it
is wor*ing properl,.
11. 8se the "- 7eatures to retrieve onl, those depart!ents with
D&8#"-0 greater than 2. Then do another "- quer, to retrieve onl,
those depart!ents with the letter )in their na!e ;tr, )
8/12/2019 Forms Reports- Overview
49/139
)) Create t$e Detail loc'
&ow that we have the !aster $loc* D-P=0T#-&T created we can now
create the detail $loc* -#P+O?-- and associate it with the !aster $loc*.
Per7or! the 7ollowing steps
1. 0eturn to the O$%ect &avigator ;pull down the Tools!enu and
choose OIeBt !aGiFator
8/12/2019 Forms Reports- Overview
50/139
2. In the O$%ect &avigator clic* on the Data "loc*s $ranch o7 the
D-PT-#P 7or! ;do not clic* on the depart!ent data $loc* however
8/12/2019 Forms Reports- Overview
51/139
Bowever such relationships are not alwa,s i!ple!ented in ta$le level
constraints.
The developer can also speci7, the relationship !anuall,. In this case
the relationship will $e speci7ied !anuall,.
De6select the Auto-Ioin 7ata loB3soption.'lic* on the "reate elationsi%$utton to list the availa$le data
$loc*s.
In the net dialog $o 0elation T,pe choose #ase7 on a Ioin
Bon7itionand clic* the O$utton.
When the list o7 $loc*s appears choose the D-P=0T#-&T data $loc*.
=rrange the Detail Ite! ;D!O< and #aster Ite! ;D!M#E< such as that the
%oin condition $eco!es EMPLOYEE.D!O K DEPATME!T.D!M#E
8/12/2019 Forms Reports- Overview
52/139
). &a!e the data $loc* -#P+O?--.5. 'reate the data $loc* and then call the +a,out wiCard.
9. "e sure to choose the eisting canvas ;'=&:=S4 in this ea!ple< and
include all o7 the ite!s e)ce$t t*e DNOas displa,ed.
The D&O colu!n ;ite!< will still $e a part o7 the -#P+O?-- data
$loc* however it will not $e displa,ed to the user.
8/12/2019 Forms Reports- Overview
53/139
>. Touch up the la$els 7or the 7ields and choose the Tabularla,out.
1A./ive the ra!e Title as H-!plo,eesH and select ( 0ecords displa,edwith A distance $etween records.
11. Save the 7or! ;it should alread, have the na!e 7e%te$%.9$< and then
co!pile and run it. &ote that a7ter co!pilation an, errors encountered
will $e displa,ed.
The 7ollowing 7igure shows the !aster6detail 7or! running
8/12/2019 Forms Reports- Overview
54/139
&otice that $, scrolling the !aster $loc* D-P=0T#-&T to a new depart!entnu!$er ;using the up and down arrow *e,s
8/12/2019 Forms Reports- Overview
55/139
To view the properties 7or the D-P=0T#-&TF-#P+O?-- relation open up
the D-P=0T#-&T $loc* and then open the 0elations $loc* $, clic*ing on
the s,!$ols. Then clic* on the D-P=0T#-&TF-#P+O?-- relation with
the right !ouse $utton and select Properties.
There are several interesting properties in the relations propert, sheet
8/12/2019 Forms Reports- Overview
56/139
Name6 The na!e o7 the 0elation. This is t,picall, !ade up o7 the
na!es o7 the $loc*s.
Relation T0pe6 The t,pe o7 the relation oin or 0e7.
= oin relation uses the t,pical S+ %oin ;in the Where clause< to $ring
the two ta$les ;data $loc*s< together. The+efrelation t,pe is used 7or
a$stract data t,pes and o$%ect re7erences.
Detail Data loc'6 The na!e o7 the detail data $loc* speci7ied when
the detail data $loc* was created.
@oin Condition6 This is the %oin condition in e77ect 7or queries to the
data$ase. This was speci7ied when the detail data $loc* was created.
Delete Record e$avior6 8sed to speci7, how the deletion o7 a record
in the !aster $loc* a77ects records in the detail $loc*. It supports the
7ollowing settings
o &on6isolated Prevents the deletion o7 a !aster record i7
associated detail records eist in the data$ase.
o Isolated Deleting the !aster record will not a77ect the associated
detail records in the data$ase.
o 'ascading Deletes the !aster record and auto!aticall, deletes
an, associated detail records.
Coordination : Deferred6 Indicates when detail records should $e
queried when a !aster record is queried.
o ?es or! does not quer, the detail records until the user
navigates to the detail $loc*.
o &o Detail records are 7etched i!!ediatel, when a user queries
the !aster record.
De7erred is so!eti!es set to ?es in cases where there are a lot o7 detail
records 7or each !aster record. In such cases a lot o7 data !ust $e
queried and delivered to the client each ti!e a new record is displa,ed in
the !aster $loc*. When De7erred is set to ?es the user can scroll down
to the !aster record o7 interest and then navigate to the detail $loc*
;'T0+6PageDown< to quer, the related detail records.
Coordination : Auto:+uer06 =pplied to de7erred queries onl,
o ?es the quer, is auto!aticall, eecuted when the user navigatesto the detail $loc*.
o &o the quer, !ust $e eecuted !anuall, $, the user a7ter the,
navigate to the detail $loc*.
#revent ,asterless operation6 Speci7ies whether users are allowed to
quer, or insert records in a detail $loc* when no !aster record is in
place.
8/12/2019 Forms Reports- Overview
57/139
8/12/2019 Forms Reports- Overview
58/139
P+S+ is OracleEs procedural language etensions to S+. To view the
P+S+ code 7or a Progra! 8nit clic* on the na!e o7 the progra! unit with
the right !ouse $utton and then choose PL/>L E7itor7ro! the pop6up !enu.
The code 7or the 'B-'MFP='M=/-F=I+80- procedure is show here
8/12/2019 Forms Reports- Overview
59/139
The 'B-'MFP='M=/-F=I+80- procedure chec*s to see i7 a prior 7or!co!!and or S+ state!ent was success7ul or i7 it 7ailed.
"elow is the P+S+ code 7or the 8-0?F#=ST-0FD-T=I+S procedure.
The tet a7ter the --;two !inus signs< are co!!ents.
PO"EDE >uer&4Master4Details'rel4i7 elation+7etail ")A* ,ol7$sF ")A'2* -- Ol7 MessaFe LeGel ettinFrel7e9 ")A'5* -- elation De9erre7 ettinF#E,!
---- ,nitialie LoBal Variale's*--rel7e9 :K et4elation4Pro%ert&'rel4i7+ DE(EED4"OOD,!AT,O!*ol7$sF :K :&ste$.MessaFe4LeGel---- ,9 !OT De9erre7+ oto 7etail an7 eHeBute te Nuer&.--,( rel7e9 K (ALE T)E!o4#loB3'7etail*"eB34PaB3aFe4(ailure:&ste$.MessaFe4LeGel :K 10EHeBute4>uer&:&ste$.MessaFe4LeGel :K ol7$sFELE---- elation is 7e9erre7+ $ar3 te 7etail loB3 as un-Boor7inate7--et4#loB34Pro%ert&'7etail+ "OOD,!AT,O!4TAT+ !O!4"OOD,!ATED*E!D ,(
E"EPT,O!?)E! (or$4TriFFer4(ailure T)E!
8/12/2019 Forms Reports- Overview
60/139
:&ste$.MessaFe4LeGel :K ol7$sFA,EE!D >uer&4Master4Details
The 8-0?F#=ST-0FD-T=I+S procedure is eecuted whenever the user
navigates to the detail $loc* in a !aster detail 7or!. I7 the De7erred'oordination propert, is set to 7alse then the detail $loc* is auto!aticall,
queried.
inall, the '+-=0F#=ST-0FD-T=I+S procedure is called each ti!e a new
!aster record is retrieved ;e.g. when the user scrolls to a di77erent !aster
record< or deleted. In this case i7 an, o7 the detail records have $een inserted
updated or deleted the changes !ust $e saved into the data$ase $e7ore the
detail $loc* can $e cleared. I7 there are an, outstanding changes to $e saved
the user will $e pro!pted to save those changes $e7ore the detail $oc* is
cleared.
). 4?tending ,aster:Detail Forms
#aster6Detail 7or!s can $e etended to include additional levels o7 details. or
ea!ple consider a 'usto!er listing with detail on Orders a custo!er has
placed. or each Order there are then !an, Ite!s. =n etension to the a$ove
ea!ple would $e to include the D-P-&D-&TS o7 the e!plo,ees as a details
o7 the -#P+O?--S $loc*. The steps outlined a$ove can $e repeated allowing
several levels o7 detail to $e added. -ach additional level o7 detail will add a
new $loc* that is related to the level a$ove it.
); 4?ercise> Creating a ,aster/Detail Form
or this eercise create a #asterDetail 7or! using the -#P+O?-- and
D-P-&D-&T ta$les. -!plo,ee will $e the #aster $loc* and Dependents will
$e the Detail $loc*. The %oin condition $etween the two ta$les is where the
SS& colu!n o7 -#P+O?-- is equal to the -SS& colu!n o7 D-P-&D-&T.
The 7ollowing is an outline o7 the steps
1. 'reate the -!plo,ee data $loc* and include the &=#- +&=#-
SS& =DD0-SS and S-G 7ields on the 7or!. 8se the or! la,out and
onl, displa, one record at a ti!e.
2. /o $ac* to the O$%ect &avigator and select the HData "loc*sH tree. #a*e
sure the -#P+O?-- $loc* is not selected and run the Data "loc*
WiCard again.
8/12/2019 Forms Reports- Overview
61/139
3. 'reate the Dependents data $loc* and include all o7 the colu!ns.
or the !asterDetail relationship de6select the HautoH option use a oin
relationship choose the -#P+O?-- data $loc* as the #aster and
setDEPE!DE!T.E! K EMPLOYEE.!7or the %oin relationship.
4. In the +a,out WiCard 7or the Dependents data $loc* displa, all o7 the
7ields e)ce$t t*e &SSN field. The -SS& 7ield will re!ain part o7 the data
$loc* $ut it will not $e visi$le on the 7or!. 'hoose a Ta$ular st,le and
displa, 4 up to records at once with A space $etween each record.
(. Save the 7or! using the na!e e$%7e%n.9$
The co!pleted 7or! should loo* li*e the 7ollowing
8/12/2019 Forms Reports- Overview
62/139
uer, the !aster $loc* and practice navigating $etween the two $loc*s using
the 'T0+6PageDown and 'T0+6Page8p *e,s.
While in the -!plo,ee $loc* scroll to the -!plo,ee na!ed -&&I-0
W=++='- navigate to the Dependents $loc* and add a new record 7or a SO&
na!ed =&D0-W $orn on 2A6O'T61>)2. &avigate $ac* to the -!plo,ee
$loc* and atte!pt to scroll to another e!plo,ee record. = pro!pt should $e
displa,ed to save the new Dependent record.
8/12/2019 Forms Reports- Overview
63/139
While in the #aster $loc* 7or -!plo,ees scroll to an e!plo,ee who has so!e
dependents. Tr, to delete the -!plo,ee record and see i7 an error !essage
appears.
inall, alter the -#P+O?--FD-P-&D-&T relation properties and set the
'oordination6De7erred to ?es and then run the 7or!. &otice now that the detailrecords will not $e displa,ed auto!aticall,. &avigate to the Dependents $loc*
and hit the -ecute quer, $utton ;or pull down the >uer&!enu and
chooseEHeBute
8/12/2019 Forms Reports- Overview
64/139
In the ea!ple $elow a record group and +O: 7or the D&O ;depart!ent
nu!$er< 7ield in the -!plo,ee ta$le will $e created.
)( Creating a 2ist of Ealues
'reating a +ist o7 :alues requires 4 $asic steps.
)()( Create a new 2OE O58ect
To create an +O: clic* on the +O:s node in the O$%ect &avigator. Then pull
down the E7it!enu and choose the "reate!enu ite!. = dialog $o will
appear as*ing i7 ,ou would li*e to create the +O: !anuall, or i7 ,ou would
li*e to use the +O: WiCard.
'hoose H8se the +O: WiCardH and clic* the OM $utton. The 7irst step o7 the
+O: WiCard will appear as $elow
8/12/2019 Forms Reports- Overview
65/139
The de7ault is set to create a new 0ecord /roup $ased on a quer,. #a*e sure
this selection is highlighted and then clic* the &et $utton.
In !ost cases ,ou will not have a record group created previousl,. Bowever
one can $e created on the 7l, at this point $, speci7,ing a quer,. In this
ea!ple enter the +O: quer, as 7ollows ELE"T 7nu$er (OM 7e%art$ent
8/12/2019 Forms Reports- Overview
66/139
Then clic* on the &et $utton.
The net step is to speci7, which colu!ns in the record group will $e returned
to 7or use $, the +O:. In this ea!ple we onl, return D&8#"-0 so select
that colu!n as shown $elow and clic* &et.
8/12/2019 Forms Reports- Overview
67/139
The net step is to speci7, the displa, properties o7 the +O: colu!ns and also
to !ap the +O: ite! to the 7ield on the 7or!.
8/12/2019 Forms Reports- Overview
68/139
To !ap the +O: colu!n to a 7ield clic* on the D&8#"-0 entr, and then
clic* on the H+oo* up return Ite!H $utton. Bighlight the -#P+O?--.D&O
7ield and clic* on the OM $utton.
8/12/2019 Forms Reports- Overview
69/139
&ote that i7 ,our +O: contains !ore than one ite! at this ti!e ,ou would also
!ap the! as well ;this is not the case with this ea!ple $ut in the netea!ple we will need to !ap two +O: colu!ns
8/12/2019 Forms Reports- Overview
70/139
The advanced properties relate to how the records should $e 7etched 7or the
+O:. I7 there are !an, hundreds or thousands o7 possi$le records returned $,
the +O: ,ou !a, consider changing these options. Otherwise 7or this
ea!ple si!pl, clic* &et.
8/12/2019 Forms Reports- Overview
71/139
In this 7inal step the +O: is returning so!e colu!ns and the, were assigned to
7ields on the 7or! in a previous step. =t this point we need to associate the
+O: with a particular ite! on the 7or!. or ea!ple $, assigning the +O: to
the -#P+O?--.D&O 7ield the user will $e a$le to call up the +O: onl,
when the cursor is positioned in the -#P+O?--.D&O 7ield. 'hoose
-#P+O?--.D&O and clic* the &et $utton.
8/12/2019 Forms Reports- Overview
72/139
inall, clic* inish to create the 0ecord /roup and the +O:.
8/12/2019 Forms Reports- Overview
73/139
In the 7igure $elow the +O: has $een created. = de7ault na!e o7 +O:) was
given to $oth the +O: and to its associated record group. Depending on what
other parts o7 this tutorial ,ou have co!pleted the de7ault na!e !a, $e
slightl, di77erent.
8/12/2019 Forms Reports- Overview
74/139
Save 'o!pile and 0un the 7or!. When entering new data navigate to the
D&O ;Depart!ent nu!$er< 7ield. &otice at the $otto! o7 the 7or! a !essage
appearsList o9 Valuesindicating a list o7 values is availa$le 7or this 7ield.
8/12/2019 Forms Reports- Overview
75/139
8nder 8&IG and under the ava $ased applet the *e, to displa, the list o7
values is 'ontrol6l ;hold down the control *e, ;'trl< and press the letter +
8/12/2019 Forms Reports- Overview
76/139
) Non:ase Ta5le fields
In the previous ea!ple o7 adding a +ist o7 :alues the supplied list o7
appropriate values can $e use7ul in cases where the values the!selves are sel76
eplanator,. Bowever in the prior ea!ple the depart!ent nu!$ers !a, not
have !eaning to the user.
It would $e !ore help7ul to include the na!e o7 the depart!ent $oth in the pop6
up list o7 values and on the 7or!. Bowever the depart!ent na!e is not part o7
the -#P+O?-- ta$le or data $loc*. Thus we need a wa, to displa, this
in7or!ation on the -#P+O?-- data $loc* in a non base table field.
=dding this ite! and !a*ing it 7unctional will ta*e several steps
1. irst the new ite! will have to $e added to the -#P+O?-- data $loc*.
WeEll call this new ite! D-PT&=#-.2. &et the D-PT&=#- 7ield should $e populated with the depart!ent
na!e each ti!e the value o7 the D&O 7ield changes. = triFFerwill $e
created to handle this 7unctionalit,.
3. inall, the list o7 values will $e changed to include the Depart!ent
na!e in the +O:.
))( Adding a New *tem to an 4?isting Data loc'
Switch to the +a,out -ditor $, clic*ing on the Tools!enu and selecting
the La&out E7itor!enu ite!.
'lic* on the Tet Ite! tool and create a new 7ield on the
-#P+O?-- $loc* $, clic*ing and dragging the !ouse net to the D&O
ite!.
Displa, the properties 7or the new Tet Ite! $, dou$le clic*ing on it.
'hange its na!e to D-PT&=#-. 'hange the 7ollowing properties 7or
D-PT&=#-
8/12/2019 Forms Reports- Overview
77/139
4na5led>?es
e05oard Naviga5le>&o
Data5ase *tem>&o
1uer0 Onl0>&o#rimar0 e0>&o
*nsert Allowed>&o
1uer0 Allowed>&o
=pdate Allowed>&o
8/12/2019 Forms Reports- Overview
78/139
", setting Me,$oard &aviga$le toNo we prevent the user 7ro! ta$$ing
into this 7ield. Since this 7ield is not used 7or data entr, or quer,ing this
prevents the potential con7usion.
The Data$ase Ite! propert, is set toNowhich indicates that this 7iled
does not !ap to an actual colu!n in the -#P+O?-- ta$le.
The re!aining properties are all set toNoto *eep the 7ield 7ro!
participating in an, o7 these activities Delete Insert 8pdate and uer,.
=t this point the new ite! D-PT&=#- has $een added to the -#P+O?--
data $loc* as a non6$ase ta$le 7ield.
Save the 7or! at this point $, pulling down the (ile!enu and choosing
the aGeoption.
)) Creating a Trigger
&et we will create a trigger to populate the D-PT&=#- 7ield whenever the
value o7 D&O changes. Triggers in Oracle or!s have 7our general 7or!s
PE-Trigger 7ires $e7ore an event is eecuted.
POT-Trigger 7ires a7ter an event is eecuted.
?)E!-Trigger 7ires in place o7 the eecution o7 an event.
EY-Trigger 7ires when a particular *e, is pressed.
In this ea!ple we would li*e to populate the D-PT&=#- 7ield with the
appropriate depart!ent na!e %ust a7ter the D&O 7ield changes on the
-#P+O?-- $loc*. Thus we will use a POT-")A!Etrigger onthe :EMPLOYEE.D!O7ield.
Switch to the O$%ect &avigator view $, clic*ing on the Tools!enu and
choosing the OIeBt !aGiFator!enu ite!.
Open up the -#P+O?-- data $loc* and the D&O ite!.
'lic* on the Triggerspropert, and create a new trigger $, pulling down
the E7it!enu and choosing the "reate!enu ite!.
= list o7 possi$le trigger na!es appears. 'hoose the POT-")A!Etrigger
and clic* on the OM $utton.
8/12/2019 Forms Reports- Overview
79/139
When the P+S+ editor appears t,pe the 7ollowing P+S+ code
-- Po%ulate te non-ase tale 9iel7 :EMPLOYEE.DEPT!AME
-- usinF a Galue 9ro$ te DEPATME!T tale.
#E,!
ELE"T D!AME
,!TO :EMPLOYEE.DEPT!AME
(OM DEPATME!T
?)EE DEPATME!T.D!M#E K :EMPLOYEE.D!OE!D
Ite!s on a $loc* are preceded $, a 7ull colon to di77erentiate the! 7ro!
colu!ns in a ta$le.
'o!pile the trigger $, clic*ing on the 'o!pile $utton ;this icon is in the
upper le7t corner o7 the P+S+ editor window
8/12/2019 Forms Reports- Overview
80/139
'lose the P+S+ editor $, clic*ing on the 'lose $utton.
Save co!pile$uild and run the 7or! to test the 7unctionalit,. &otice that when
the -#P+O?-- $loc* is queried the associated depart!ent na!e now appearsin the new D-PT&=#- 7ield. -ach ti!e the D&O 7ield is changed the POST6
'B=&/- trigger will 7ire and will 7etch the appropriate D&=#- colu!n 7ro!
the D-P=0T#-&T ta$le and place it in the D-PT&=#- 7ield on the 7or!.
8/12/2019 Forms Reports- Overview
81/139
))- Create a new 2ist of Ealues
inall, a new list o7 values should $e created to displa, $oth the depart!entnu!$er and na!e when the user calls up the +O:.
I7 ,ou co!pleted the previous section on creating the si!ple +O: use the
O$%ect &avigator to delete this +O: $e7ore proceeding with this section.
8/12/2019 Forms Reports- Overview
82/139
ro! the O$%ect &avigator clic* on the +O:s 7or the -#P+O?--
7or!. Pull down the E7it!enu and choose the "reate!enu ite!.
'hoose the +O: WiCard.
T,pe the 7ollowing S+ state!ent into the 1uer0 Te?t7ield ELE"T DEPATME!T.D!M#E+ DEPATME!T.D!AME (OM DEPATME!T
Then clic* on the &et $utton.
Include $oth the D&8#"-0 and D&=#- colu!ns 7ro! the 0ecord
/roup in the +O:.
#ap the D&8#"-0 +O: colu!n to the -#P+O?--.D&O tet ite!
and !ap the D&=#- +O: colu!n to the -#P+O?--.D-PT&=#-
tet ite! ;created in the previous section
8/12/2019 Forms Reports- Overview
83/139
)- 4?ercise> Creating an 2OE and Non:ase ta5le field
or this eercise create a new single data $loc* 7or! $ased on all o7 thecolu!ns in the D-P=0T#-&T ta$le. Then add a non6$ase ta$le 7ield 7or the
last na!e o7 the depart!ent !anager and create an +O: to populate it
'reate a new 7or! called 7e%art$F.9$that includes all o7 the colu!ns
in the D-P=0T#-&T ta$le. In the la,out wiCard use
the Ta$ularla,out anddispla, ( 0ecordsin the 7or!. =dd a scroll$ar.
http://www.holowczak.com/oracle/dev9i/#tabularlayouthttp://www.holowczak.com/oracle/dev9i/#numberofrecordshttp://www.holowczak.com/oracle/dev9i/#tabularlayouthttp://www.holowczak.com/oracle/dev9i/#numberofrecords8/12/2019 Forms Reports- Overview
84/139
In the +a,out -ditor create a new tet ite! called #/0F+=STF&=#-
in the D-P=0T#-&T data $loc*. "e sure the D-P=0T#-&T $loc* is
selected when the new ite! is created. 'hange the properties o7
#/0F+=STF&=#- so it is not a Data$ase ite!.
=dd a tet la$el to this new #/0F+=STF&=#- 7ield.
'reate a list o7 values called +O:F#/0 $ased upon the quer, ELE"T ssn+ lna$e (OM e$%lo&ee
#ap the e!plo,ee.ssn colu!n to the D-P=0T#-&T.#/0SS& 7ield.
#ap the e!plo,ee.lna!e colu!n to the
D-P=0T#-&T.#/0F+=STF&=#- 7ield.
'reate a POST6'B=&/- trigger on the #/0SS& ite! so that when it
changes the 7ollowing code will eecute ELE"T lna$e
,!TO :DEPATME!T.M4LAT4!AME (OM e$%lo&ee
?)EE e$%lo&ee.ssn K :DEPATME!T.M!
This will auto!aticall, populate the non $ase ta$le 7ield
#/0F+=STF&=#- on the 7or! when the 7or! is queried.
The 7or! should loo* li*e the 7ollowing
8/12/2019 Forms Reports- Overview
85/139
9) Oracle Forms #rogram =nits and Stored #rogram
=nits
Oracle or!s provides a !echanis! to store procedures ;called Progra! 8nitsIndicates what *ind o7 co!!and should $e run
or! 0eport P+S+ other !enu. In general the P+S+
co!!and t,pe is used to launch Oracle or!s and Oracle
0eports. The speci7ic or! and 0eport co!!and t,pes are
!aintained 7or $ac*wards co!pati$ilit, onl,.
o ,enu *tem Code;or Command Te?t
8/12/2019 Forms Reports- Overview
136/139
E!D
-GITFO0# is a $uilt6in procedure that eits the current 7or!.
= :iew o7 the co!plete $&$enuis show $elow
(())7 Save and Henerate t$e ,enu ,odule
=t this point all o7 the !enu structure has $een created and co!!ands 7or each
!enu ite! have $een speci7ied. The !enu !odule !ust now $e saved to a 7ile
;with a .$$etension< and /enerated or 'o!piled.
To save the !enu !odule !a*e sure the na!e o7 the !enu is highlighted pull
down the ile !enu and choose the aGe!enu ite!. Speci7, a 7ile na!e with
a .$$etension. This is the Hsource codeH 7or the !enu. or this ea!ple use
the 7ile na!e $&$enu.$$.
#re:Oracle9iDS Oracle 9iDS
To generate or co!pile the !enu !odule pull down
the (ile!enu clic* on the A7$inistration!enu ite!
and choose enerate7ro! the 7l,out !enu. In so!e
versions o7 the or!s "uilder the !enu ite! !ight $ecalled "o$%ile (ile.
To generate or co!pile the
!enu !odule pull down
the ProFra$!enu and
choose enerate Mo7ule.
/enerating or co!piling a !enu !odule results in a 7ile with a .$$Hetension.
In this ea!ple the generated !enu !odule $eco!es $&$enu.$$H
(()). Attac$ing a ,enu ,odule to a Form
8/12/2019 Forms Reports- Overview
137/139
= custo! !enu !ust $e attached to a 7or! in order to $e displa,ed. T,picall,
a 7or! with no data entr, on it is used as the !ain screen to host the custo!
!enu.
The 7ollowing steps are di77erent depending on the version o7 or!s $eing
used.
For Oracle Forms version 7). For Oracle Forms version ;i and laterB
1. 'reate a new 7or! with no $loc*s orite!s on it. Pull down the(ile!enu
select !eCand then select (or$.
2. Displa, the properties 7or the 7or!and set the ,enu ,odulepropert, to
the 7ile na!e o7 the !enu !odule
;see previous step
8/12/2019 Forms Reports- Overview
138/139
as ,our !enuEs .$$H7ile
8/12/2019 Forms Reports- Overview
139/139
The $lan* 7or! that is used to host the !enu need not $e $lan*. ?ou !a, wish
to use the +a,out -ditor to place so!e graphics and a title o7 the application on
the canvas.
=nother use 7or this space would $e 7or so!e si!ple instructions the user can
read to get started with the data$ase application.