You are on page 1of 25

SQL, PL/SQL FAQ

About Triggers:
1. What is triggers? What are the different types of triggers?

A database trigger is a stored subprogram associated with a
database table, view, or event. For instance, you can have
Oracle fire a trigger automatically before or after
an INSERT, UPDATE, or DELETE statement affects a table.
A Database Trigger is a stored procedure that is fired when
a D! operation is performed on the table. "n total there are
1# types of $riggers
%ynta& for creating a trigger'
()*A$* O) )*+!A(* $)",,*)
-$)",,*).A*/ before 0 after
1".%*)$ 0 2+DA$* 0 D*!*$* 3 O. -$A4!*
.A*/
5For each %tatement 0 )ow6
5When -condition7../6
$ypes of $riggers'
4efore
After
For each )ow
For each %tatement 8default9
Instead of Trigger: $his trigger is defined on a view rather
than a table.
System Triggers: A new feature of Oracle:i, wherein the
trigger is fired when the database startup 0 shutdown process.
Schema Triggers: $hese triggers are fired whenever a DD!
statement is e&ecuted. 8(reation or Deletion of any D4
Ob;ects9
1
Order of Trigger Firing:
4efore %tatement trigger 8"f present9
*ach row affected by the statement
8a9*&ecute row level trigger 8"f present9
8b9 *&ecute the statement itself
8c9*&ecute the after row level trigger 8"f +resent9
After statement trigger 8"f +resent9
<. What are the different types of ;oins available in Oracle?
!ui "oin: When primary and foreign =ey relationship e&ists
between the tables that are going to be ;oined.
Se#f "oin: "f comparison comes in a single table
$artesian "oin: When tables are ;oined without giving any
;oin condition.
Inner "oin: $he resultant set includes all the rows that
satisfy the ;oin condition.
Outer "oin: $he resultant set includes the rows which
doesn>t satisfy the ;oin condition. $he outer ;oin operator
+lus sign 8?9 will be included in the ;oin condition.
%am&#e: %*!*($ a. column1, a. column<, b.column#7..
From a, b where
a.column1 8?9 @b.(olumn1
Aere the rows from table which doesn>t satisfy the ;oin
condition will also be fetched.
#. What are "nde&es? What are the different types of "nde&? "f
a table consists of more than one "nde& how to enforce the
statement to use the second "nde&?
An "nde& is a D4 ob;ect, which is used to improve the
performance of the data retrieval.
()*A$* ".D*B -".D*B .A*/ O. -$A4!* name/.
8-(O!2. name/9
<
$ypes of "nde&es'
4itmap "nde& 82sed for !ow cardinality column9
4tree "nde& 82sed for high cardinality column9
.ote' "t is not possible to crea
C. What is utating $able?
$able under transition is called utating $able.
D. What is views? What is "nline Eiew??
Eiews are window to a table. "t contains no data, it is based
on the actual table called the base table or a view.
"nline Eiew means writing select statement in the Fuery
itself instead of selecting a (olumn .ame.
G. What is a (ursor? When it is used? What are different
types of (ursors.
(ursor is a private %F! area created in %,A to do multi row
operation in a +!0%F! programme
*&plicit (ursor, "mplicit (ursor.
"mplicit (ursor' %ystem 8Oracle9 automatically declares and
uses for all D! %F! %tatements.
*&plicit (ursor' (ursor declared e&plicitly in the +!0%F!
programme to do multi row operation
%ynta&'
Declare
(ursor (1 is %*!*($ %A!, *+.O F)O *+
B numberH
I Earchar<8#J9H
4egin
Open (1H
!oop
Fetch (1 ".$O &, yH
*&it when c1K.O$FO2.D
*nd !oopH
*ndH
#

L. What is for (ursor? When it is used? "s it necessary to write
an e&plicit e&it in case for (ursor?
A (ursor for loop can be used simplify the e&plicit cursor, no
need to e&plicitly Open, fetch and close. .o e&plicity *B"$
statement is reMuired.
:. What are (ursor attributes? What is use of FO) 2+DA$* in
(ursor?
KFound
K.otFound
K)ow(ount
K"sOpen

FO) 2+DA$* statement in (ursor is used to update a (olumn in
the selected table by using the (2))*.$ OF -cursor name/.
N. What is a +ac=age? What is the advantage of using
+ac=ages?
A +ac=age is a +!0%F! (onstruct that allow related ob;ect to
be stored together. +ac=age contains < parts, +ac=age
%pecification and +ac=age 4ody, each stored separately in
the Data Dicitionary.
Once the +ac=age is called all the related +rocedure and
functions of the pac=age gets compiled and stored in the
memory as +Ocode.
Aow do u call a +ac=age.
-+ac=age.ame/.-+rocedure 0 Function .ame/ 8)elated
+arameters7.9
1J. .ame some important +ac=ages provided by Oracle?
D4%P%F!, D4%PQO4%, D4%PDD!, D4%P!O(R
11. What is Overloading?
Overloading is oops concept8Ob;ect Oriented +rogramming9
C
4y 2sing the same name we can write any number of
+rocedure or functions in a pac=age but either number of
parameters in the procedure0function must be vary or
parameter datatype must vary.
1<. What is a Function? Difference between +rocedure
and Function?
Function is a ob;ect that ta=es one or more arguments and
returns only value. 4ut in case of procedures we can return
more than one parameters.
Function always returns a value, whereas procedure may or
may not return a value.
1#. What is the +ac=age used in Oracle to do the File
Operation?
2$!PF"!*
1C. What is Dynamic %F!? Aow Dynamic %F! can be
built?
$he %F! statement which are built at run time are called the
Dynamic %F!. Dynamic %F! can be built by using
D4%P%F! pac=age.
+rocedure of Dynamic %F!
O+*.P(2)%O), +A)%*, 4".DPEA)"A4!*,
D*F".*P(O!2., *B*(2$*, F*$(AP)OW%,
(!O%*P(2)%O).
Oracle:i onwards there is another built in to construct
Dynamic %F! called *B*(2$*P"*D"A$*.
1D. What is an e&ception? What are the different types of
*&ception? Aow do u
declare a user defined e&ception?
D
$he error condition in +!0%F! is termed as an e&ception.
$wo types of
*&ception'
Pre'Defined %ce&tion' *&ample .oPDataPFound,
%torageP*rror,
SeroP*rror, "nvlidP(ursor, $ooPanyP)ows
(ser'Defined %ce&tion' Anything
%ynta&'
Declare
ByT *&ceptionH
4egin
%*!*($ *.A* F)O *+
)A"%* BISH
*ndH
1G. what could happen if we use WA*. O$A*)% before
any predefined e&ceptions
According to the Oracle standards U When Others U e&ception
must be the last e&ception. All the +redefined e&ceptions
must be used before the UWhen othersV e&ception.
"f U When othersV e&ception used before any preO
defined e&ceptions then procedure0function shows the
compilations errors

1L. !ist out some features in :i
4itmap "nde&es, Drop a (olumn, 4ul= "nsert and 4ul=
2pdate
aterialiTed views, Dynamic %Ml8*&ecute "mmediate etc9

1:. !ist some NiFeatures
*&ternal tables 8 We Muery the data directly from a file li=e
select W from Uc'0abcd.csvV 9
ulti $able "nsert with single command, resumable process
etc.
G

1N. What are %F!(OD* and %F!*)) and why are they
important for +!0%F!
developers?
%F!(OD* returns the value of the error number for the last
error encountered. $he %F!*)) returns the actual error
message for the last error encountered. $hey can be used in
e&ception handling to report, or, store in an error log table,
the error that occurred in the code. $hese are especially
useful for the WA*. O$A*)% e&ception
<J. What is the use of +ragmaP"nit e&ception
4y using this we can define our messages by handling the
oracle messages
<1. What are temporary tables? Aow many types?
$emporary tables are used to store the data temporarly.
ainly there are < types
$hey are transaction and %ession types
%ynta&' (reate global temporary table -tempPtab/ as select W
from empH
$his temporarly table is used to store the data temparorly
once you e&it from session then that table will get erased
<<. %ome of the %ystem $ables
a. 2serPsource table will stores the
information of the user defined definitions
b. AllP%ource and dbaPsource tables will
stores the system defined schema ob;ects definitions as
well as user defined.
c. AllP$abP(olumns and
benPallPtabPcolumns are used to list out the all the
columns name and respected table names also.
L
<#. Write a Muery to list out the employees with their
respective manager levels?
select lpad8XWX, level W <9, empno, ename, mgr from emp
connect by prior empno @ mgr start with empno @ L:#N
"t results the hierarchy of the employees
)ote : For Ans*ers $hec+ the )e%t Page
W What is +!0%F! and what is it used for?
W %hould one use +!0%F! or Qava to code procedures and triggers?
W Aow can one see if somebody modified any code?
W Aow can one search +!0%F! code for a =ey?
W Aow can one =eep a history of +!0%F! code changes?
W Aow can " protect my +!0%F! source code?
W (an one print to the screen from +!0%F!?
W (an one read0write files from +!0%F!?
W (an one call DD! statements from +!0%F!?
W (an one use dynamic %F! statements from +!0%F!?
W What is the difference between K$I+* and K)OW$I+*?
W Aow does one get the value of a seMuence into a +!0%F!
variable?
W (an one e&ecute an operating system command from +!0%F!?
W Aow does one loop through tables in +!0%F!?
W Aow often should one (O"$ in a +!0%F! loop? 0 What is
the best commit strategy?
W " can %*!*($ from %F!W+lus but not from +!0%F!. What is
wrong?
W What is a mutating and constraining table?
W (an one pass an ob;ect0table as an argument to a remote
procedure?
W "s it better to put code in triggers or procedures? What is the
difference?
W "s there a +!0%F! *ngine in %F!W+lus?
W "s there a limit on the siTe of a +!0%F! bloc=?
W Where can one find more info about +!0%F!?
:
What is +!0%F! and what is it used for?
+!0%F! is OracleXs +rocedural !anguage e&tension to %F!.
+!0%F!Xs language synta&, structure and data types are similar to
that of ADA. $he +!0%F! language includes ob;ect oriented
programming techniMues such as encapsulation, function
overloading, information hiding 8all but inheritance9. +!0%F! is
commonly used to write dataOcentric programs to manipulate data
in an Oracle database.
%hould one use +!0%F! or Qava to code procedures and triggers?
"nternally the Oracle database supports two procedural languages,
namely +!0%F! and Qava. $his leads to Muestions li=e YWhich of
the two is the best?Y and YWill Oracle ever desupport +!0%F! in
favour of Qava?Y.
any Oracle applications are based on +!0%F! and it would be
difficult of Oracle to ever desupport +!0%F!. "n fact, all
indications are that +!0%F! still has a bright future ahead of it.
any enhancements are still being made to +!0%F!. For e&ample,
Oracle NiD4 supports native compilation of +l0%F! code to
binaries.
+!0%F! and Qava appeal to different people in different ;ob roles.
$he following table briefly describes the difference between these
two language environments'
+!0%F!'
Data centric and tightly integrated into the database
+roprietary to Oracle and difficult to port to other database systems
Data manupilation is slightly faster in +!0%F! than in Qava
*asier to use than Qava 8depending on your bac=ground9
Qava'
N
Open standard, not proprietary to Oracle
"ncurs some data conversion overhead between the Database and
Qava type systems
Qava is more difficult to use 8depending on your bac=ground9
Aow can one see if somebody modified any code?
(ode for stored procedures, functions and pac=ages is stored in the
Oracle Data Dictionary. One can detect code changes by loo=ing at
the !A%$PDD!P$"* column in the 2%*)PO4Q*($%
dictionary view. *&ample'
%*!*($ O4Q*($P.A*,
$OP(AA)8()*A$*D, XDDOonO)) AA<C'"X9
()*A$*P$"*,
$OP(AA)8!A%$PDD!P$"*, XDDOonO))
AA<C'"X9 ODP$"*,
%$A$2%
F)O 2%*)PO4Q*($%
WA*)* !A%$PDD!P$"* / XZ(A*(RPF)OPDA$*XH
Aow can one search +!0%F! code for a =ey?
$he following Muery is handy if you want to =now where a certain
table, field or e&pression is referenced in your +!0%F! source
code.
%*!*($ $I+*, .A*, !".*
F)O 2%*)P%O2)(*
WA*)* 2++*)8$*B$9 !"R* XKZR*IWO)DKXH
W 4y useing D4APD*+*.D*.("*% table you can find out. O
*Thil
Aow can one =eep a history of +!0%F! code changes?
1J
One can build a history of +!0%F! code changes by setting up an
AF$*) ()*A$* schema 8or database9 level trigger 8available
from Oracle :.1.L9. $his way one can easily revert to previous code
should someone ma=e any catastrophic changes. !oo= at this
e&ample'
()*A$* $A4!* %O2)(*PA"%$ OO (reate
history table
A% %*!*($ %I%DA$* (AA.,*PDA$*,
2%*)P%O2)(*.W
F)O 2%*)P%O2)(* WA*)* 1@<H
()*A$* O) )*+!A(* $)",,*) changePhist OO %tore
code in hist table
AF$*) ()*A$* O. %(O$$.%(A*A OO
(hange %(O$$ to your schema name
D*(!A)*
4*,".
if D"($"O.A)IPO4QP$I+* in 8X+)O(*D2)*X,
XF2.($"O.X,
X+A(RA,*X, X+A(RA,* 4ODIX, X$I+*X9 then
OO %tore old code in %O2)(*PA"%$ table
".%*)$ ".$O %O2)(*PA"%$
%*!*($ sysdate, userPsource.W F)O
2%*)P%O2)(*
WA*)* $I+* @ D"($"O.A)IPO4QP$I+*
A.D .A* @ D"($"O.A)IPO4QP.A*H
end ifH
*B(*+$"O.
WA*. O$A*)% $A*.
raisePapplicationPerror 8O<JJJJ, %F!*))9H
*.DH
0
show errors
Aow can " protect my +!0%F! source code?
11
+!0%F! E<.<, available with OracleL.<, implements a binary
wrapper for +!0%F! programs to protect the source code.
$his is done via a standalone utility that transforms the +!0%F!
source code into portable binary ob;ect code 8somewhat larger than
the original9. $his way you can distribute software without having
to worry about e&posing your
proprietary algorithms and methods. %F!W+lus and %F!WD4A
will still understand and =now how to e&ecute such scripts. Qust be
careful, there is no YdecodeY command available.
$he synta& is'
wrap iname@myscript.sMl oname@&&&&.plb
(an one print to the screen from +!0%F!?
One can use the D4%PO2$+2$ pac=age to write information to
an output buffer. $his buffer can be displayed on the screen from
%F!W+lus if you issue the %*$ %*)E*)O2$+2$ O.H command.
For e&ample'
set serveroutput on
begin
dbmsPoutput.putPline8X!oo= a, " can print from
+!0%F![[[X9H
endH
0
D4%PO2$+2$ is useful for debugging +!0%F! programs.
Aowever, if you print too much, the output buffer will overflow. "n
that case, set the buffer siTe to a larger value, eg.' set serveroutput
on siTe <JJJJJ
1<
"f you forget to set serveroutput on type %*$ %*)E*)O2$+2$
O. once you remember, and then *B*( .2!!H. "f you havenXt
cleared the D4%PO2$+2$ buffer with the disable or enable
procedure, %F!W+lus will display the entire contents of the buffer
when it e&ecutes this dummy +!0%F! bloc=.
$an one read/*rite fi#es from PL/SQL,
"ncluded in Oracle L.# is an 2$!PF"!* pac=age that can read and
write operating system files. $he directory you intend writing to
has to be in your "."$.O)A file 8see 2$!PF"!*PD")@...
parameter9. 4efore Oracle L.# the only means of writing a file was
to use D4%PO2$+2$ with the %F!W+lus %+OO! command.
(opy this e&ample to get started'
D*(!A)*
fileAandler 2$!PF"!*.F"!*P$I+*H
4*,".
fileAandler '@ 2$!PF"!*.FO+*.8X0tmpX, XmyfileX, XwX9H
2$!PF"!*.+2$F8fileAandler, X!oo= ma, "XXm writing to a
file[[[\nX9H
2$!PF"!*.F(!O%*8fileAandler9H
*B(*+$"O.
WA*. utlPfile.invalidPpath $A*.
raisePapplicationPerror8O<JJJJ, X*))O)' "nvalid path for
file or path not in "."$.O)A.X9H
*.DH
0
$an one ca## DDL statements from PL/SQL,
One can call DD! statements li=e ()*A$*, D)O+, $)2.(A$*,
etc. from +!0%F! by using the Y*B*(2$* "*DA$*Y
1#
statement. 2sers running Oracle versions below :i can loo= at the
D4%P%F! pac=age 8see FAF about Dynamic %F!9.
begin
*B*(2$* "*D"A$* X()*A$* $A4!* B8A
DA$*9XH
endH
.O$*' $he DD! statement in Muotes should not be terminated
with a semicolon.
(an one use dynamic %F! statements from +!0%F!?
From +!0%F! E<.1 one can use the D4%P%F! pac=age to
e&ecute dynamic %F! statements. *g'
()*A$* O) )*+!A(* +)O(*D2)* DI.%F! A%
cur integerH
rc integerH
4*,".
cur '@ D4%P%F!.O+*.P(2)%O)H
D4%P%F!.+A)%*8cur, X()*A$* $A4!* B 8I DA$*9X,
D4%P%F!..A$"E*9H
rc '@ D4%P%F!.*B*(2$*8cur9H
D4%P%F!.(!O%*P(2)%O)8cur9H
*.DH
0
Another e&ample'
()*A$* O) )*+!A(* +)O(*D2)*
D*+A)$*.$%8.O ". D*+$.D*+$.OK$I+*9 A%
vPcursor integerH
vPdname char8<J9H
vProws integerH
4*,".
vPcursor '@ D4%P%F!.O+*.P(2)%O)H
1C
D4%P%F!.+A)%*8vPcursor, Xselect dname from dept
where deptno / '&X, D4%P%F!.EL9H
D4%P%F!.4".DPEA)"A4!*8vPcursor, X'&X, no9H
D4%P%F!.D*F".*P(O!2.P(AA)8vPcursor, 1,
vPdname, <J9H
vProws '@ D4%P%F!.*B*(2$*8vPcursor9H
loop
if D4%P%F!.F*$(AP)OW%8vPcursor9 @ J then
e&itH
end ifH
D4%P%F!.(O!2.PEA!2*P(AA)8vPcursor, 1,
vPdname9H
D4%PO2$+2$.+2$P!".*8XDeptartment name' X]]
vPdname9H
end loopH
D4%P%F!.(!O%*P(2)%O)8vPcursor9H
*B(*+$"O.
when others then
D4%P%F!.(!O%*P(2)%O)8vPcursor9H
raisePapplicationPerror8O<JJJJ, X2n=nown *&ception
)aised' X]]sMlcode]]X X]]sMlerrm9H
*.DH
0
-hat is the difference bet*een .T/P and .0O-T/P,
$he K$I+* and K)OW$I+* constructs provide data
independence, reduces maintenance costs, and allows programs to
adapt as the database changes to meet new business needs.
K)OW$I+* is used to declare a record with the same types as
found in the specified database table, view or cursor. *&ample'
D*(!A)*
vP*mp)ecord empK)OW$I+*H
1D
K$I+* is used to declare a field with the same type as that of a
specified tableXs column. *&ample'
D*(!A)*
vP*mp.o emp.empnoK$I+*H
Aow does one get the value of a seMuence into a +!0%F! variable?
As you might =now, oracle prohibits this'
i '@ sMPseMuence..*B$EA!H
8for some silly reason9. 4ut you can do this'
select sMPseMuence..*B$EA! into 'i from dualH
$han=s to )onald van Woensel
(an one e&ecute an operating system command from +!0%F!?
$here is no direct way to e&ecute operating system commands
from +!0%F! in OracleL. Aowever, one can write an e&ternal
program 8using one of the precompiler languages, O(" or +erl with
Oracle access modules9 to act as a listener on a database pipe
8%I%.D4%P+"+*9. Iour +!0%F! program then put reMuests to
run commands in the pipe, the listener pic=s it up and run the
reMuests. )esults are passed bac= on a different database pipe. For
an +roW( e&ample, see chapter : of the Oracle Application
Developers ,uide.
"n Oracle: one can call e&ternal #,! code in a dynamically lin=ed
library 8D!! or shared ob;ect9. One ;ust write a library in (0 (??
to do whatever is reMuired. Defining this (0(?? function to
+!0%F! ma=es it e&ecutable. !oo= at this *&ternal +rocedure
e&ample.
Aow does one loop through tables in +!0%F!?
!oo= at the following nested loop code e&ample.
1G
D*(!A)*
(2)%O) deptPcur "%
%*!*($ deptno
F)O dept
O)D*) 4I deptnoH
OO *mployee cursor all employees for a dept number
(2)%O) empPcur 8vPdeptPno D*+$.D*+$.OK$I+*9
"%
%*!*($ ename
F)O emp
WA*)* deptno @ vPdeptPnoH
4*,".
FO) deptPrec ". deptPcur !OO+
dbmsPoutput.putPline8X*mployees in Department X]]
$OP(AA)8deptPrec.deptno99H
FO) empPrec in empPcur8deptPrec.deptno9 !OO+
dbmsPoutput.putPline8X...*mployee is X]]
empPrec.ename9H
*.D !OO+H
*.D !OO+H
*.DH
0
Aow often should one (O"$ in a +!0%F! loop? 0 What is the
best commit strategy?
(ontrary to popular believe, one should (O"$ less freMuently
within a +!0%F! loop to prevent O)AO1DDD 8%napshot too old9
errors. $he higher the freMuency of commit, the sooner the e&tents
in the rollbac= segments will be cleared for new transactions,
causing O)AO1DDD errors.
$o fi& this problem one can easily rewrite code li=e this'
FO) records ". myPcursor !OO+
...do some stuff...
1L
(O"$H
*.D !OO+H
... to ...
FO) records ". myPcursor !OO+
...do some stuff...
i '@ i?1H
"F mod8i, 1JJJJ9 $A*. OO (ommit every 1JJJJ records
(O"$H
*.D "FH
*.D !OO+H
"f you still get O)AO1DDD errors, contact your D4A to increase the
rollbac= segments.
.O$*' Although fetching across (O"$s wor= with Oracle, is
not supported by the A.%" standard.
" can %*!*($ from %F!W+lus but not from +!0%F!. What is
wrong?
+!0%F! respect ob;ect privileges given directly to the user, but
does not observe privileges given through roles. $he conseMuence
is that a %F! statement can wor= in %F!W+lus, but will give an
error in +!0%F!. (hoose one of the following solutions'
,rant direct access on the tables to your user. Do not use roles[
,)A.$ select O. scott.emp $O myPuserH

Define your procedures with invo=er rights 8Oracle :i and higher9H
ove all the tables to one user0schema.
What is a mutating and constraining table?
YutatingY means YchangingY. A mutating table is a table that is
currently being modified by an update, delete, or insert statement.
1:
When a trigger tries to reference a table that is in state of flu&
8being changed9, it is considered YmutatingY and raises an error
since Oracle should not return data that has not yet reached its final
state.
Another way this error can occur is if the trigger has statements to
change the primary, foreign or uniMue =ey columns of the table off
which it fires. "f you must have triggers on tables that have
referential constraints, the wor=around is to enforce the referential
integrity through triggers as well.
$here are several restrictions in Oracle regarding triggers'
A rowOlevel trigger cannot Muery or modify a mutating table. 8Of
course, .*W and O!D still can be accessed by the trigger9 .
A statementOlevel trigger cannot Muery or modify a mutating table
if the trigger is fired as the result of a (A%(AD* delete.
*tc.
(an one pass an ob;ect0table as an argument to a remote
procedure?
$he only way the same ob;ect type can be referenced between two
databases is via a database lin=. .ote that it is not enough to ;ust
use the same type definitions. !oo= at this e&ample'
OO Database A' receives a +!0%F! table from database 4
()*A$* O) )*+!A(* +)O(*D2)* pcalled8$abB
D4%P%F!.EA)(AA)<%9 "%
4*,".
OO do something with $abB from database 4
nullH
*.DH
0
OO Database 4' sends a +!0%F! table to database A
()*A$* O) )*+!A(* +)O(*D2)* pcalling "%
1N
$abB D4%P%F!.EA)(AA)<%^D4!".R<H
4*,".
pcalled^D4!".R<8$abB9H
*.DH
0
"s it better to put code in triggers or procedures? What is the
difference?
"n earlier releases of Oracle it was better to put as much code as
possible in procedures rather than triggers. At that stage procedures
e&ecuted faster than triggers as triggers had to be reOcompiled
every time before e&ecuted 8unless cached9. "n more recent
releases both triggers and procedures are compiled when created
8stored pOcode9 and one can add as much code as one li=es in either
procedures or triggers.
"s there a +!0%F! *ngine in %F!W+lus?
.o. 2nli=e Oracle Forms, %F!W+lus does not have a +!0%F!
engine. $hus, all your +!0%F! is sent directly to the database
engine for e&ecution. $his ma=es it much more efficient as %F!
statements are not stripped off and sent to the database
individually.
"s there a limit on the siTe of a +!0%F! bloc=?
Ies, the ma& siTe is not an e&plicit byte limit, but related to the
parse tree that is created when you compile the code. Iou can run
the following select statement to Muery the siTe of an e&isting
pac=age or procedure'
%F!/ select W from dbaPob;ectPsiTe where name @
XprocedurePnameXH
<J
Forms/0e&orts
1. Aow you declare global variables in forms ?
,lobal variable will declared in WhenO.ewOFormO"nstance
$riggers
<. What are $able Aandlers and *vent Aandlers?
#. What are new feature in forms Gi compared to formsC.D
C.What is the Difference between callform, .ewform, Openform
D.What is the 2se of +rogram 2nits in form0reports ?
G.Aow many triggers is there in reports and what are they and what
is the Order of firing
4efore +arameter Form
After +arameter Form
4efore report
4etween pages
After )eport
L.Which trigger will get fired while opening an !OE in forms
ReyO!istOEalue
:. Aow any $ypes of reports are there? .ame it??

N. What is the 2se of Anchors in )eports
1J. What is the uses and differences between %ummary (olumn,
Formula column and +lace holder column?
<1
11. What is the Difference between 4ind parameter and le&ical
parameter? Which trigger will be used to specify the conditions for
a le&ical parameter.
1<. What is the use of Destype, Desname, Desformat in +arameter
form.
1#.When the 4etween +ages $rigger will fire?
After first page this trigger will fire until last
page and after that for last page it wont fire.
1C. What are the form odules?
$hey are C types of form modules are there 19 Alerts <9 Forms
odules #9 enu
odules C9 +!%F! !ibraries
1D.%ome of the .ew Features in )eportsGi
"n Gi we can generate the report in different types li=e
+DF,A$!,B!, )$F etc
"n reports goto O/ !ayout model Aeader or 4ody or argin
sections property
+allate Distributions. %pecify the $ype and file name with
path.
$hen goto File Distribute.
1G. What is the difference between Format $riggers and Action
$riggers
Action $rigger is +rocedure whereas Format $rigger is
+rocedure
4y using Action trigger we can open the other form or report
1L What is the Difference between Fle&ode and (onfine ode
and their differences
<<
1:. What is the Order of triggers firing
WO.OFO", +reOForm, WO.O"O", WO.O4O" ??
1N What is the a;or Differences and uses between +roperty (lass
and Eisual Attribute
<J. Other than )unP+roduct how can we run a report from a form
4y using )unP)eportPOb;ect function we can run the
reports8 $his is Gi .ew Feature9
$o use this Add that report in Form Ob;ect .avigator and pass
the "d of that report.
<1. What are the Default triggers will be created when a masterO
detail form is created
$here are # types are triggers will be created in form level when a
masterOdetail form is
created.
<<. What is the Diiference between .pll, .pls and .pl& in !ibraries
<#. What is Ob;ect !ibrary and Attached !ibrary
Ob;ect !ibrary can be used to stored Function, +rocedure,
+ac=age. Attached library will be used to avoid any change in
source code. Ob;ect library can be converted into .+!B and
attached to Attache library.
<C What is the difference between writing code in +rogramme
2nit and !ibrary Files?
$he code written in +rogramme unit is form>s specific, whereas
code written in
!ibrary files, can be used across the forms.
<D. When a form is run, which are the triggers fire, and in what
seMuence they fire?
+)*OFO)
<#
WA*.O.*WOFO)O".%$A.(*
+)*O4!O(R
WA*.O.*WO4!O(RO".%$A.(*
WA*.O.*WO"$*O".%$A.(*
+O%$O4!O(R
+O%$OFO)
1. What is the difference between Forms C.D and Forms Gi
$ab +age utility is not available in C.D Eersion
<. What is the utility used to call the report from the forms?
)2.P)*+O)$
#. What is a +roperty (lass? Different methods of creating
property class?
+roperty (lass is defining properties of ob;ects along with
their settings. $he property class inheritance allows the user
to perform global changes very Muic=ly and efficiently.
ethods'
Ob;ect .avigator ethod
+roperties Window ethod
C. WA*.O.*WOFO) trigger written at Form !evel, 4loc=
!evel and "tem !evel
which one will fire first?
The trigger *ritten at the #o*er #e1e# Item Le1e# Fires
first then at 2#oc+ Le1e# and at #ast it fires in Form Le1e#3
D. "n the previous Muestion circumstance, is it possible to
change the order of trigger
*&ecution? "f Ies, where it needs to be changed?
Ies, in the trigger property 84efore, After, Default9by
changing the attributes.
<C
G. What are the different =inds of +arameters available in the
report?
%ystem and 2ser defined +arameters.84ind and !e&ical
+arameters9
<D

You might also like