You are on page 1of 241

1

SQL
Q) In comparison with Oracle 8i, 9i is have lot many new features. important is
Dynamic database parameters Data Guard Log Miner Enhanced RMAN Enhanced for Data Warehousing Real Application luster !ero Data Loss Log "ransport Granular ontrol o#er resources "hree "ier Security Enhanced $a#a Support Enhanced Data management and many more %racle&i Database ne' features are in the categories listed belo'( A#ailability Scalability )erformance Security Manageability De#elopment )latform for E*+usiness Applications Windo's ,ntegration ,nternet ontent Management E*+usiness ,ntegration )ac-aged Applications +usiness ,ntelligence Q) What is the difference between TRIM and Truncate functions in oracle?

A) "rim* enables to trim the characters from the string i(e from either sides
Eg. trim /010 from 011203 "runc* truncates the #alue to specified decimal Eg.trunc/2&4(15673 or truncates the date to nearest date Eg.trunc/sysdate60year03

Q) Write a query to display all the odd numbers from a table 8


A23 SELE " DE %DE/M%D/column9name67362623

:R%M table9name

2
W;ERE DE %DE/M%D/)"R9,D67362623<2 A73 SELE " DE %DE/M%D/column9name673626column9name3 odd9Numbers :R%M table9name W;ERE DE %DE/M%D/)"R9,D67362623<2 Q) what is the difference between CREATE INDEX and CREATE UNI UE INDEX!?
A) We should create an inde= if a column contains a 'ide range of #alues6 a column contains a large number of null #alues6 one or more columns are fre>uently used together in a W;ERE clause or a ?oin condition and the table is large and most >ueries are e=pected to retrie#e less than 7*@A of the ro'( :ormat of reate ,nde=.

reate ,nde= emp9last9name9id= %N emp /dept9id3B ,f you 'ant to e=force uni>unes6 you should define a uni>ue or primary -ey constraint in the table definition( then a uni>ue inde= is created automatially( onstraint emp9email9u- CN,QCE/email3B

Q) What is "Rollu#" And "cube"? $ow does these different fro% "&rou#b'"
A) "he R%LLC) is an e=tension to the GR%C) +D caluse( the rollup operator can be used by report 'rites to e=tract statistics and summary information from results sets( the rollup operator creates groupings by mo#ing in one directon6 from right ot left6 along the list of coumns specified in the group by clause( it then applies the aggregae function to these groupings( the cube operator is an addintional s'itch in the GR%C) +D clause in a select statement( the cube operator can be applied to all aggregate fuctions6 inluding AEG6 SCM 6 MAF6 M,N6 and %CN"( it is used to produce results sets that are typically used for cross*tabulat reports( 'hile R%LLC) produces only a fraction of possible subtotal combinations6 cube produces subtotals for all possible combinations of groupings specified in the GR%C) +D clause6 and a grand total( the grouping function can be used 'ith either the C+E or R%LLC) operator(

using the GR%C),NG function6 you can differentiate stored NCLL #alues from NCLL #alues created by R%LLC) or C+E( the GR%C),NG function returns 1 or 2(

Q) if we create a table ha(in& a colu%n of )*+) data t'#e then how we ha(e to
insert and retrie(e the data? A) We can Read and Write BLOB Data to a Database Table Through an Anonymous PL/SQL Block The !rimary ad"antage o# using anonymous PL/SQL blocks is im!ro"ed !er#ormance $they can be used to batch a series o# SQL calls together in a single round$tri! This #eature allo%s multi!le commands& se!arated by semi$colons& to be e'ecuted one a#ter another (urther& the batch SQL can include a number o# S)L)*T or non$S)L)*T statements+ i# the batch contains multi!le S)L)*T statements& multi!le number o# result sets %ill be returned Anonymous Pl/SQL blocks can be used #or the retrie"al o# LOBs They can also be

3
used to #ill a Dataset %ith multi!le tables& by setting multi!le commands in the Oracle*ommand ,one #or each table in the Dataset- .n such a scenario you can return multi!le R)( cursors #rom a PL/SQL Anonymous Block& #or e'am!le& like this/ B)0.1 OP)1 /2 (OR S)L)*T 3 (RO4 A+ OP)1 /5 (OR S)L)*T 3 (RO4 B+ OP)1 /6 (OR S)L)*T 3 (RO4 *+ )1D+ ) The round,-.!/0.1234-) is &i(in& out#ut as 5! Can an' one e6#lain 3wh' it was 5? A) as in u0r comment second prameter is negati#e6so it 'ill count 7 digit from decimal point to left side (i(e 7G this 7G is less than H1 so it 'ill round it Iero( if u ta-e abo#e H1 it 'ill round it to 211 for e=ampleB s>lJ select round/44(H&G4@6*73 from dualB R%CND/44(H&G4@6*73 ****************** 211

Q) which function is used to tra# the error code and error %essa&e of an e6ce#tion!
A) SQLERRM ** for error Message SQL %DE ** for error ode( eg( EF E)",%N W;EN %";ERS ";EN err9code .< SQL %DEB err9msg .< substr/SQLERRM6267113B ,NSER" ,N"% audit9table /error9code6error9msg3 EALCES /err9code6err9msg3B ENDB D+MS9%C")C"()C"9L,NE is used to #ie' the Error occured during e=ecution6 the functions 'hich are used to trap the error are SQL %DE and SQLERRM it is Raise7A!!lication7error Q- difference between oracle 8i and 9i !) "he ma?or diffferences are* ,n &i merge 6 insert all6 case is introduced ( ,n &i ne'datatype called timestamp ,n &i you can moniter inde= using alter inde= Kinde= nameJ monitering usage

4
or u can chec- user9ob?ects table from system user( ,n &i ne' performance monitering tools called S"A")A L ( ,n &i Dou can dynamically change init ora parameter using alter system KparameterJ scope<MpathM of your spfileMpfile ,n &i ne' concept for undo transaction called CND% tablespace ,n &i by default "EM) tablespace is considering 'hile creating ne' oracle users ,n &i ne' partition called L,S" ,n &i tablespace ne=t e=tent can be managed automatically

Q) what is materialised view


!) Since 'hen 'e are 'oring 'ith #arious databases running in different system6So sometime 'e may needed to fetch some records from the remote location6so it may >uit e=pensi#e in terms of resourse of fetching data directly from remote location("o to minimiIe to response time and to increse the throughput 'e may create the copy to that on local database by using data from remote database("his duplicate copy is Lno'n as materialised #ie'6'hich may be refreshed as per as re>uirment as option a#ilable 'ith oracle such as fast6complete and refresh( Q3 Which one is faster "#$#%#&%'()*!%# Why !) "runcante is performs better than delete because 'hen you delete the records from the database6 database has to perform 7 actions( 2(delete from the database 7('rite the deleted records into Nrollbac-N segments( +ut incase of N"runcateN the second acti#ity is not re>uired( Q) When we &i(e 7E*ECT 8 9R+M EM:; $ow does oracle res#ond! A) Oracle #irst !arsed that SQL then make a e'ecution !lan #or that %hich %ill take minimum *P8 ./O and 4emory and internally it9s declare a im!licit cursor %hich %ill return all the record #rom that !articular table )4P by using set theory o# cartesdian !roduct ) $ow to retrie(in& the data fro% <<th colu%n to n th colu%n in a table! A<) select O from emp 'here ro'id in / select ro'id from emp 'here ro'num K<Pupto minus select ro'id from emp 'here ro'num KPstartfrom3 Q) difference between decode and case! in which case we are usin& case and in which case we are usin& decode? with an e6a%#le? A) SELE " DE %DE/DE)"N%62160"EN067160"WAN"D06G160";,R"D06@160:%R"D060%";ER03 :R%M DE)"

5
SELE " ASE DE)"N% 'hen 21 then 0"EN0 'hen 71 then 0"WAN"D0 'hen G1 then 0";,R"D0 'hen @1 then 0:%R"D0 ELSE 0%";ER0 END :R%M DE)" Difference bet'een ASE and DE %DE 23 Decode is a function 'hile ase statement( 73 ase cannot process null 'hile decode can( Q) What are the advanta+es and disadvanta+es of ,iew !) Ad#antages of #ie's. 2( Eie' the data 'ithout storing the data into the ob?ect( 7( Restict the #ie' of a table i(e( can hide some of columns in the tables( G( $oin t'o or more tables and sho' it as one ob?ect to user( @( Restict the access of a table so that nobody can insert the ro's into the table( Disad#atages. 2( an not use DML operations on this( 7( When table is dropped #ie' becomes inacti#e(( it depends on the table ob?ects( G( ,t is an ob?ect6 so it occupies space( Q) what is an inline view !) ,f 'e 'rite a >uery in the from clause then this is called inline #ie' or online >uery( Q) What is the difference between sin&le =uote ,>) and double =uote,") in relates to usin& in 7 *! When do 'ou use >666> and "666"? what is the difference both of the%? A) single >uote is used to 'rite a character string or character in s>l >uery( but6double >uotes are used to print the name in s>l screen( for eg.* select sysdate Ncurrent dateN from dualB current date ***************** 7@*mar*15(

in single >uote oracle ta-es the character as a -ey'ord( Q3 what is the difference between 'OW)(- and 'OWI"

A) rowid is a he=adecimal representation and


rownum is normal representation of ro's uni>uely( .Q$/ select rowid,rownum,i from t01 R%W,D R%WNCM , ********************************************* ************** ********** AAAM5MAA+AAA%4>AAA 2 2 AAAM5MAA+AAA%4>AA+ 7 7 AAAM5MAA+AAA%4>AA G G AAAM5MAA+AAA%4>AAD @ @ AAAM5MAA+AAA%4>AAE H H .Q$/ select rowid,rownum,i from t0 where i in 20,3,4,5)1 R%W,D R%WNCM , ********************************************* ************** ********** AAAM5MAA+AAA%4>AAA 2 2 AAAM5MAA+AAA%4>AA+ 7 7 AAAM5MAA+AAA%4>AAD G @ AAAM5MAA+AAA%4>AAE @ H
Q) $ow to &et first / Records then ne6t / records till end of row count in 7 * ?+racle A<) We can get the first H records by the follo'ing s>l./Let the table is emp3 select O from emp 'here ro'numK5 "hen 'e can get the ne=t H records by the follo'ing s>l. select O from emp 'here ro'numK5 M,NCS select O from emp 'here ro'numK22 !3) select 3 #rom em! %here not in ,select ro%num bet%en : and count,ro%num-$: #rom em!) $ow to find errors of :R+CEDURE at run ti%e, not co%#lie ti%e) ? A) sho err is used to find in compile time ?ust use the e=ception handlers in run time use s>lerrm6s>lcode functions

Q) is there an' wa' we can chan&e the colu%n na%e in a table

7
!) Des 'e can alter olumn name in a table using the follo'ing >uery. alter table KtablenameJ rename column Kold

olumn NameJ to KNe' olumn NameJ

Q) Write =uer' for the followin& =uestions <! s=l =uer' for selectin& alternate rows in a table -! s=l =uer' for deletin& alternate rows in a table A3 select * from emp where (rowid,0) in (select rowid,mod(rownum,2) from

emp)
select * from emp where (rowid,0) not in (select rowid,mod(rownum,2) from

emp) Q) what is the differences between +racle1i and 0i?


A) <! *an dro! a column in oracle ;i but can9t do the same in oracle <i 7(Cser defined datatypes are applicable only for oracle &i but not oracle 4i( G( datatype for character large ob?ect is L%NG for oracle 4i but it is L%+S for oracle&i( olumn rename is not possible in 4i 7( We dont ha#e C+E and R%LLC) functions in 4i G( We dont ha#e merge statement in 4i @( We dont ha#e the datatype timestamp 'ith local timeIone in 4i H( :rom D+A Side * We cannot dynamically set the siIe of sga in 4i 'ithout shutting do'n the instance and lots more

Q) What is *omple6 ,iew Where we can use


!) =ie% de"elo!ed by >oin o# t%o or more table is called *om!le' "ie% ) what is the difference between oracle3s=l and s=l ser(er? A<) %racle is based on RD+MS( SQL is Structured Query Language( SQL Ser#er is another tool for RD+MS pro#ided by MicroSoft

A2) SQL * A RD+MS language6 is ANS, std(


%racle * a database #endorMdatabase ser#er6 'hich can run across multiple operating system6 has number features than any other databases6 'hich is hot in mar-et al'ays .*3

8
SQL ser#er * another database ser#er6 ?ust li-e oracle6 can run on only 'indo's platform and has been limited to 'indo's based clients /if , am not 'rong3(

Q) how to &et the #ri%e nu%ber rows fro% table ie li@e<3.3/3A3<< ?


A- select 3 #rom table7name %here ,ro%id&2- in , select ro%id&mod,ro%num&5- #rom table7name Q) how to &et <323A3<5!!!!!rows fro% a table A) select ro%num&em!no #rom em! grou! by ro%num&em!no ha"ing mod,ro%num&6-?2+ ) is there an' chance to re%o(e a colu%n of a table A) 7es we can drop the column of table. but the column contains no data. AL"ER "A+LE Ktable9nameJ DR%)

%LCMN Kcolumn9nameJ

Q3 What are various constraints used in .Q$ !) There are #i"e classes o# constraints/ 1OT 18LL S!eci#ies that a column does not acce!t nulls PR.4AR@ A)@ S!eci#ies the column or columns %hose "alues uniBuely identi#y a ro% in a table Primary key columns are automatically 1OT 18LL 81.Q8) S!eci#ies that a column has all uniBue "alues *C)*A Limits the domain o# acce!table "alues #or a column (OR).01 A)@ Aka a DR. constraint ,Declarati"e Relational .ntegrity- .denti#ies relationshi!s bet%een tables A #oreign key in a table !oints to a candidate key ,usu a !rimary key- in another table A table can ha"e u! to 5:6 (OR).01 A)@ contraints ) What are different Oracle database ob8ects !) "A+LES OE,EWS OSEQCEN ES OSDN%NDMS O,NDEFES Q) Su!!ose there are t%o #ields in table,)m!loyee- say 1ame and Salary and there are in total 2DD records in table 1o% my Buery gi"es the name o# an em!loyee %hose salary is 2Dth among 2DD salaries this Buery should be sol"e in SQL not in PL/SQL E A2- select name&salary #rom em!loyee %here ro%id?, select 4a',ro%id- #rom em!loyee %here ro%numF?2D-+ A5- S)L)*T D.ST.1*T ,a sal- (RO4 )4P A WC)R) 2D ? ,S)L)*T *O81T ,D.ST.1*T ,b sal-(RO4 )4P B WC)R) a salF?b sal-+ Q) Dis#la' the nu%ber (alue in Words?

9
A) SQLG select sal& ,to7char,to7date,sal&9>9-& 9>s!9-#rom em!+ the out!ut like& SAL ,TO7*CAR,TO7DAT),SAL&9H9-&9HSP9-$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ <DD eight hundred 2IDD one thousand si' hundred 25:D one thousand t%o hundred #i#ty .# you %ant to add some te't like& Rs Three Thousand only SQLG select sal JSalary J& ,9 Rs 9KK ,to7char,to7date,sal&9>9-& 9Hs!9--KK 9 only 9-JSal in WordsJ #rom em! / Salary Sal in Words $$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ <DD Rs )ight Cundred only 2IDD Rs One Thousand Si' Cundred only 25:D Rs One Thousand T%o Cundred (i#ty only This Buery %orks only #or the numbers bet%een 2 and :6L6M<M What should %e do i# the number is out o# this rangeE ;ere the 0?0 used as a format in to9date function return the number in ?ulian year(Whereas the 0?sp0 used in to9char made the ?ulian year spelled out( i(e( ?*?ulian year and sp*spelling so ?sp( Q) *an a primary 9ey contain more than one columns A- @es A !rimary key can ha"e more than one column .# it does it is called a *om!osite Primary Aey But a table cannot ha"e more than one !romary key ) 7u##ose a custo%er table is ha(in& different colu%ns li@e custo%er no3 #a'%ents!What will be the =uer' to select to# three %a6 #a'%ents? A) select ename&sal #rom ,select ename&sal #rom Ftable7nameG order by sal desc - %here ro%num FM Q- *an you use a commit statement within a database tri++er A- @es %e can use commit inside a trigger by using !ragma7autonomous7transactions ) Wh' statistics are different in oracle0i and oracle <5& E A- 2( AWR / Automatics Wor- Load repository 3* 'hich collects statistics e#ery one hour by default and 'rite them into a number tables and stores them in SDSACF tablespace( in &i6 'e use D+MS9S"A"S pac-age and schedule a ?ob to collect stats at specified inter#als of time( +ut this pac-age still e=ists( 7( AS; / Acti#e Session ;istory 3 Dou can store the session statistics data and use them later on for analysis( "his 'as not possible in &i( %nce session is disconnected or instance is bounced6 all the session stats 'ere gone( ,f you 'ant to -no' 'hat -ind of >ueries 'here e=ecuted at FF.DD time6 then it is easy to find6 using AS;

1,
G( "ime Model statistics are also collected( System statistics are also collected @( ,t is possible to collect statistics only for changed tables / yet to -no' 'hat it is((i 'ill get bac- to you soon 3 ) What is difference between .(:.%' and I).%'

A) S8BSTR returns a s!eci#ied !ortion o# a string eg S8BSTR,9B*D)(9&M- out!ut B*D)


.1STR !ro"ides character !osition in %hich a !attern is #ound in a string eg .1STR,9AB*$D*$ (9&9$9&5- out!ut L ,5nd occurence o# 9$9substr gi#es the substring of the position 'e gi#es 'here as instr gi#es the the character present in the particular position ) $ow will 'ou delete du#licatin& rows fro% a base table?

A<) delete #rom table7name %here ro%id not in ,select ma',ro%id- #rom table grou! by
du!licate7"alues7#ield7name-+ or delete du!licate7"alues7#ield7name d" #rom table7name ta %here ro%id F,select min,ro%id#rom table7name tb %here ta d"?tb d"-+ A5- DE*ETE Table1ame W$ERE rowid N+T IN , 7E*ECT MIN,rowid) 9R+M Table1ame BR+U: )C ColumnName); ) What are (arious #ri(ile&es that a user can &rant to another user? A) Select, Insert,update,delete,connect,alter ,inde= ,references Q) ;ow you will avoid duplicatin+ records in a query !) the best %ay is to use !rimary key+second thought i# u dont ha"e any constraints&go #or distinct but my "ie% is %e can used distinct to select rather then to a"iod Q- What is difference between .Q$ and .Q$<=$(.

A1) SQL is a language: Structured Query Language. It has een !in"ented! y I#$. SQL*Plus is a c%&&and line t%%l 'r%& (racle )%r*. t% use the SQL language '%r a gi"en data ase.
Q) Which dataty!e is used #or storing gra!hics and imagesE

A- LO10 RAW data ty!e is used #or storing BLOB9s ,binary large ob>ectsQ) When do you use WC)R) clause and %hen do you use CA=.10 clauseE A2- Where *lause .* Csed to filter the records from the table before group by cluse( ;avin+ *lause .* Csed to filter the grouped records after group By clause(

+2) CA=.10 clause is used %hen you %ant to s!eci#y a condition #or a grou! #unction and it is
%ritten a#ter 0RO8P B@ clause The WC)R) clause is used %hen you %ant to s!eci#y a

11
condition #or columns& single ro% #unctions e'ce!t grou! #unctions and it is %ritten be#ore 0RO8P B@ clause i# it is used Q) Which is more faster > I) or #?I.%. !) it is al%ays better to use e'ists %hen u go correlated sub Bueries in #or ordinary sub Bueries ) What is a +UTER D+IN? A<) Outer Hoin$$.ts a >oin condition used %here you can Buery all the ro%s o# one o# the tables in the >oin condition e"en though they donNt satis#y the >oin condition A5- Su!!ose %e ha"e t%o tables 1o% %ith the hel! o# outer >oin&%e can add those ro%s o# a table %hich doesn9t matchs the >oin condition e gtable a table bname roll name roll m 2 m 2n 5 n 5o 6 g L! M h <so the sBl #or adding all in#ormation o# table a into the result %ill be/select name&roll #rom a&b %here a name?b name,O-+>ust run the sBl to see the result you can alternati"ely use the O on the le#t side to "ie% another result ) $ow 'ou will a(oid 'our =uer' fro% usin& inde6es?

A) S)L)*T 3 (RO4 em!


Where em!7noO9 9?256M:+ i e you ha"e to concatenate the column name %ith s!ace %ithin codes in the %here condition S)L)*T /3O (8LL,a- 3/ ename& em!7no #rom em! %here em!7no?256M+ i e using C.1TS Q) "ifference between )O "!%! @O()" and A)O%@O()"

A) 1O DATA (O81D is an e'ce!tion raised only #or the S)L)*T

.1TO statements %hen the %here clause o# the Buerydoes not match any ro%s When the %here clause o# the e'!licit cursor does not match any ro%s the P1OT(O81D attribute is set to TR8) instead Q) "ifference between procedure and function. !) The main di##erence is D4L ,Data 4ani!ulation- Through Stored !rocedure you can mani!ulate data i e u can insert&u!date&delete records #rom table but in #unction u can9t mani!ulate data then comes secondary di##erences like #unction returns a "alue and stored !rocedures does not until and unless u s!eci#y an out!ut !arameter stores !rocedure is a !recom!lied #unction i e it has to be com!lied oly once but a #unction %hen called is com!lied again and again Q- Difference between database tri&&ers and for% tri&&ers? A<) Data base trigger,DBT- #ires %hen a D4L o!eration is !er#ormed on a data base table (orm trigger,(T- (ires %hen user !resses a key or na"igates bet%een #ields on the screen

*an be ro% le"el or statement le"el 1o distinction bet%een ro% le"el and statement le"el *an mani!ulate data stored in Oracle tables "ia SQL *an mani!ulate data in Oracle tables as %ell as "ariables in #orms *an be #ired #rom any session e'ecuting the triggering D4L statements *an be #ired only #rom the #orm that de#ine the trigger

12

*an cause other database triggers to #ire *an cause other database triggers to #ire& but not other #orm triggers

!3) form triggers is fired 'hen an e#ent occurs6 for eg6 'hen mouse is clic-ed6 'hen list item changed6 'hereas database triggers fires for each DML operations performed on the associated table and it can be at ro' le#el or statement le#el( Q) $ow can we order the colu%n of da' ,%on to sun)such that %onda' co%es first then tues and so no!7u##ose we ha(e retrie(ed da' out of hiredate colu%n? A2- select hire9date6 to9char/hire9date6 0day03 as day from employees order by to9char/hire9date6 0d03 A73 select to7char,hiredate&9day9- #rom em! order by to7char,hiredate$2&9d9) what is Ref cursor when we use ref cursor and ad(anta&e of ref cursor A<) Ref cursor is used for dynamic 'here clause 6and it is used for fast processing A73 1ormally in cursors& Buery is de#ined at the time the cursor is created but in some cases& the Buery %e need to use #or a cursor is unkno%n until run$time Oracle uses re#$cursors and cursor "ariables to satis#y this reBuirement ) difference between view and table !) Eie's. 2( "his is one type of relation 'hich is not a part of the physical database( 7( ,t has no direct or physical relation 'ith the database( G( Eie's can be used to pro#ide security mechanism( @( Modification through a #ie' /e(g( insert6 update6 delete3 generally not permitted +ase Relation. 2( A base relation is a relation that is not a deri#ed relation( 7( While it can manipulate the conceptual or physical relations stored in the data( G( ,t does not pro#ide security( @( Modification may be done 'ith a base relation( We can assign the #ie'6 a name P relate it the >uery e=pression as reate Eie' KEie' NameJ as KQuery E=pressionJ Let EM)L%DEE be the relation( We create the table EM)L%DEE as follo's.* reate table EM)L%DEE /Emp9No integer of null6 Name char /7136 S-ill chars /7136 Sal9Rate decimal /216 736 D%+ date6 Address char /211363 :or a #ery personal or confidential matter6 e#ery user is not permitted to see the Sal9Rate of an EM)L%DEE( :or such users6 D+A can create a #ie'6 for e=ample6 EM)9E,EW defined as.* reate #ie' EM)9E,EW as

13
/Select Emp9No6 Name6 S-ill6 D%+6 Address :rom EM)L%DEE3 A E,EW is only a mirror image of table 'hich is used at places 'here large access to a table is re>uired( Eie's cannot be updated6deleted and modified but 'e could select data from #ie's easily( Q) how to decr'#t the #assword on oracle 1E1i in s'ste%Escott user? what is the =uer' fired to see the #assword? A) use DB4S7OB(8S*AT.O17TOOLA.T !ackage see Oracle su!!lied !l/sBl !ackages docs #or more in#o ) what is the difference between Inner and equi 8oin !0) E>ui ?oin results in a table containing all the feilds of the tables on 'hich ?oin is operated upon based on the property that the field defined in the >uery must ha#e e>ual or same #alues in both the tables( "he ,NNER $%,N is also similar to the e>ui ?oin e=cept that it also refers to the $oin performed in the same table itself/self ?oin3( A73 , 'ould say that e#ery comment on this >uestion is 'rong in one 'ay or another( ,nner and e>ui ?oins are not self*?oins per se( A self*?oin ?oins the table to itself( "his is al'ays a form of ,NNER ?oin( the term inner ?oin has been coined to differentiate bet'een inner ?oins and %C"ER ?oins( ,t0s true that an e>ui*?oin uses < in the ?oin*predicate( Dou should pro#e to yoursel#es that not e>ual /KJ or Q<3 in a ?oin 'ill gi#e you a cartesian product in the result( An e>ui*?oin can be either an inner ?oin or an outer ?oin( "he true definition of e>ui*?oin /in addition to the < relation in the predicate3 is that both ?oin columns appear in the result( ,f one is pro?ected out the e>ui*?oin is called a natural ?oin( ,f other operators are used /K6 J 'hich is rare in business databases3 the ?oin is called a theata ?oin( both the e>ui ?oin and the natural ?oin are forms of the more general theata ?oin( Q) #6plain ()IO), -I)(., ()IO) !$$ and I)%#'.#*% !0) 81.O1 $ the "alues o# the #irst Buery are returned %ith the "alues o# the second Buery eliminating du!licates 4.18S $ the "alues o# the #irst Buery are returned %ith du!licates "alues o# the second Buery remo"ed #rom the #irst Buery 81.O1 ALL $ the "alues o# both Bueries are returned including all du!licates .1T)RS)*T $ only the du!licate "alues are returned #rom both Bueries !3) CN,%N. "a-e the common record once/ No Duplicate3 CN,%N ALL . "a-es Duplicates also E=ampl . Say there is EM) ha#ing 2@ reconds then((( select count(1) from (select ename from emp) returns 2@ select count(1) from (select ename from emp union select ename from emp e1) returns 2@

14

+ut
select count(1) from (select ename from emp union All select ename from emp e1)

returns 74(
Q) What is the sub>query !) a subBuery is a S)L)*T statement that is %ritten inside another SQL statement ,%hich is o#ten& but does not ha"e to be& another S)L)*T- To distinguish the subBuery ,or inner Buery#rom its enclosing Buery ,or outer Buery-& it must be enclosed %ithin !arentheses Cere is an e'am!le/ S)L)*T 3 (RO4 clients WC)R) clno .1 $$ outer Buery ,S)L)*T clno (RO4 #irms WC)R) city ? 9leduc9-+ $$ inner Buery Q- *an a view be updated&inserted&deleted !) A simple #ie' can be updatedMinsertedMdeleted but the comple= #ie' 'hich is constructed by using multiple tables or by using group functions can0t be updatedMdeletedMinserted directly for that 'e ha#e to 'rite instead*of*triggers( Q) "iff b&w .ubquery vs Boin !) The main di##erence bet%en subBuery and >oin is subBuery is #aster %hen %e ha"e to retrie"e data #rom large number o# tables Because it becomes tedious to >oin more tables >oin is #aster to retrie"e data #rom database %hen %e ha"e less number o# tables Q- What are the different types of .Q$ !) there are H types 2(data definition type 7(data manipulation G(data control @(transaction control H(data >uery ) What is a 8oin !) A >oin is a Buery that combines ro%s #rom t%o or more tables& "ie%s& or materialiQed "ie%s Oracle !er#orms a >oin %hene"er multi!le tables a!!ear in the Buery9s (RO4 clause The Buery9s select list can select any columns #rom any o# these tables .# any t%o o# these tables ha"e a column name in common& then you must Buali#y all re#erences to these columns throughout the Buery %ith table names to a"oid ambiguity 4ost >oin Bueries contain WC)R) clause conditions that com!are t%o columns& each #rom a

15
di##erent table Such a condition is called a >oin condition To e'ecute a >oin& Oracle combines !airs o# ro%s& each containing one ro% #rom each table& #or %hich the >oin condition e"aluates to TR8) The columns in the >oin conditions need not also a!!ear in the select list To e'ecute a >oin o# three or more tables& Oracle #irst >oins t%o o# the tables based on the >oin conditions com!aring their columns and then >oins the result to another table based on >oin conditions containing columns o# the >oined tables and the ne% table Oracle continues this !rocess until all tables are >oined into the result The o!timiQer determines the order in %hich Oracle >oins tables based on the >oin conditions& inde'es on the tables& and& in the case o# the cost$based o!timiQation a!!roach& statistics #or the tables ) What is difference between *;!' and ,!'*;!'3 !0) char is a #i'ed length charater data ty!e "archar is a "ariable length length character data ty!e A5- *har %ill store null "alues e"en i# the data inside the #ield is less than the s!eci#ied length Storage %ill be same as s!eci#ied length =archar5 %ill store null "alues& i# data is less than s!eci#ied length& storage %ill be that much only ) What are the #re4re=uisites to %odif' datat'#e of a colu%n and to add a colu%n with N+T NU** constraint A) 2- to modi#y dataty!e o# a column $ EEE 5- to add a column %ith 1OT 18LL constraint $ the table must ha"e D ro%s ) The use of $AFINB 3 W$ERE and BR+U:)C in one 7 * A) J%hereJ #ilters data be#ore grou!ing JCa"ingJ #ilters data a#ter grou!ing ) ;ow to access the current value and ne6t value from a sequence !) #or current "alue the #unction is /$ seBuence7name curr"al and #or the ne't "alue it is seBuence7name ne't"al Q- ;ow many $O)C columns are allowed in a table !) Only one Long column can be !resent in a table Q- Is it possible to use $O)C columns in W;#'# clause or O'"#' :7 !) not !ossible Q- What is 'OWI" !)

-%.id is the *hysical address '%r each rec%rd in the data ase and it is a 'i/ed0length inary data.

1he '%r&at %' the r%.id is: #######.----.22222

16 .here: ####### is the l%c3 in the data ase 'ile4 ---- is the r%. in the l%c34 22222 is the data ase 'ile.
) What is correlated sub>query !) A correlated sub$Buery is a subBuery that re#erences the "alue/s #rom the main Buery e'am!le / S)L)*T colA & colB (RO4 tableA WC)R) colB F , S)L)*T ma',colR(RO4 tableB WC)R) tableB col@ ? tableA colAOracle e'ecutes correlated subBuery #or each record #rom o# main Buery hence these ty!es o# Bueries ha"e greater im!act on !er#ormance and must be a"oided Q- What is the fastest way of accessin+ a row in a table

A) Quote

A R%W,D is created by %racle for each ne' ro' in e#ery table6 it is a pseudo column that has a #alue for e#ery ro' in a table( "he R%W,D gi#es us the physical address of a ro' and is the fastest 'ay to access any ro'( "he R%W,D contains G bits of information6 they are .* 2( "he bloc- 'ithin the database file( 7( Ro' R 'ithin the bloc-( G( Database file ,D( An e=ample could be .* DDDD88*9.D090.DDD3

"he R%W,D has three important uses6 it is .* 2( "he fastest path to any ro'( 7( A 'ay of speeding the %MM," process in application code( G( Cni>ue identifiers of any gi#en ro'( Cn>uote
) What is O) "#$#%# *!.*!"#

17
!) %hen the user deletes a record in the master table & all the corres!onding records in the detail table along %ith the records in the master table %ill be deleted Q- %o view installed Oracle version information !) select 3 #rom "S"ersion+ Q- What is *7*$#&)O *7*$# in a .equence !) 'hen a se>uence is created 'ith D LE option6 this mean that 'hen a se>uence reaches its MAFEALCE6 it 'ill start o#er at the M,NEALCE( "he D LE option is not 'ise for the primary -ey column( And 'hen a se>uence is created 'ith N% D LE option6 this mean that 'hen the se>uence reaches its MAFEALCE6 it 'ill not start o#er at the M,NEALCE but an error is generated by the oracle ser#er( Note. +ecause D LEMN% D LE #alue is optional6 When no option is defined6 the default #alue 'ill N% D LE( Q) What is the use of TN7NAME!+RA and *I7TENER!+RA files A) tnsnames ora is used to connect to the remote db To get the connection listener ora should be con#igured at the ser"er and it should be u! and running ) Which date function returns number value !) months7bet%eenThis date #unction takes 5 "alid dates and returns number o# months in bet%een them ) ;ow do I display row number with records !) 7E*ECT rownum3table_name!8 9R+M table_name; ) What is the usa+e of .!,#=OI)%. !) SA=)PO.1TS are used to subdi"ide a transaction into smaller !arts .t enables rolling back !art o# a transaction 4a'imum o# #i"e sa"e !oints are allo%ed ) What is the fastest wa' of accessin& a row in a table ? A) by using the inde' and ro%ed ) What is an Inte+rity *onstraint !) ,ntegrity constraint restricts #alues of a column so that only meaningful #alues as per the business logic of the table be entered into the column( ,ntegrity constraints are of the follo'ing types. 2 5 6 M : 1ot null 8niBue Primary Aey (oreign Aey ,re#erential integrity*heck $$ custom constraints e g check sal G D& check >oiningdate G date,-

18
) What is a )on> corelated subquery A) 1on corelated subBuery& %here the subBuery has been e'ecuted once #or the entire !arent statement

.Q$ 'eal %ime Questions Q) Dual table e6#lain! Is an' data internall' storin& in dual table! *ot of users are accessin& select s'sdate fro% dual and the' &ettin& so%e %illisecond differences! If we e6ecute 7E*ECT 7C7DATE 9R+M EM:; what error will we &et! Wh' A2- select 3 #rom dual+out!ut %ill be/D844@R.t has a #ield called D844@ %ith a "alue R When you run select sysdate #rom em!+@ou %ill not get any error @ou %ill get system in all ro%s ,as number o# ro%s in em! tableA5- The built$in #unction S@SDAT) returns a DAT) "alue containing the current date and time on your system D8AL is built$in relation in Oracle %hich ser"es as a dummy relation to !ut in the (RO4 clause %hen nothing else is a!!ro!riate (or e'am!le& try Jselect 2O5 #rom dual+J So Jselect sysdate #rom )4PJ %on9t generate the desired result ) What is %utated tri&&er3 is it the #roble% of loc@s! In sin&le user %ode we &ot %utated error3 as a D)A how 'ou will resol(e it A) mutated trigger/ e'am!le/Table A has an insert trigger .n that Trigger/ There is a statement like insert into Table A& %hich caues mutated trigger A"oid to ha"e those kind o# triggers in the database ) ;ow can you see the source code of the pac9a+e !) SELE " "EF" :R%M CSER9S%CR EMALL9S%CR EMD+A9S%CR E W;ERE NAME<KNAME %: ";E )A LAGEJ AND "D)E<0)A LAGE0B ;ERE ";E "D)E MAD +E )A LAGE6)R% EDCRE Q) ;ow do you increase the performance of A$IE# operator !) ne"er user 9P9 be#ore a seraching %ord e g 9PTABL)P9 Al%ays uses 9TABL)P9 ) create a matri6 query to display the 8ob, the salary for that 8ob based on department number and the total salary for that 8ob, for departments 3D,5D,8D, and 9D,+ivin+ each column and appropriate headin+. !) select department9id6?ob9id6sum/salary3 from employees 'here department9id in/716H16416&3 group by rollup/department9id6?ob9id3

19
Q) What is the Difference between Re#lace and Translate! A- +oth Replace and "ranslate are single ro' functions in %racle &i( "he Replace :unction replaces single character 'ith multiple characters( +ut in "ranslate :unction replaces single character 'ith single character only Q) There are how %an' %a6i%u% no of colu%ns in a table in oracle? ( A3 4a'imum number o# columns in a table is 5:M ) What is difference between varchar and varchar3 !) #archar means fi=ed length char #archar7 means #ariable length char Q3 What is =ro<* What is O*I A3 )ro O "he )roO cM SS precompiler ta-es the SQL statement that embeded in M SS code con#ert into standard M SS code ( 'hen succefully precompile this code 6the result is a or SS programe that 'e compile and used to build the application that access the %racle Application % , .* % , refere to %racle all interface is set of Lo' La#el A),/Applcation )rogram ,nterface all3 used to intract 'ith %racle Database( +y % , one can use the operation such as Logon6:atch6parse 6e=cute etc( Generally these are 'ritten in M SS( Q) What is the difference between "NU** in C" and "NU** in +racle?" A) The 18LL in * treated as Tero or "oid but in SQL 18LL "alue is 1on or blank re!resented it can9t manu!lated

2,

:*E7 *
<) su##ose we ha(e <555 of records3o@!then we want to u#date onl' /55 records3how can we sol(e this #roble%? A<) C)DA"E K"A+LE NAMEJ EALCE KEALCESJ W;ERE R%WNCMK<H11 A73 Cpdate "ablename set columnname<#alue 'here ro'idK<H11B
Q3) how can u create session variable in pa9a+es !) By declaring a "aiable in !ackage s!eci#ication

.) what is datat'#e of 6 when we sa' define 6 in oracle A) define is use for predefine #ariable
its depends on user( Dou can use char or number

2) $ow to find the nth hi&htest record holder fro% a table

A) ,f u 'ant to find the nth record in salary basis then(( , thni- this 'ill 'orselect O from/select O from emp order by sal desc3 'here ro'num<Knth numberJ Q5) what are the constraints on Mutatin& tables? $ow to re%o(e the %utatin& errors in tri&&ers? A) "rigger Mutating 'ill araise6 'hen u 'ant to do more than one DML operation on a table u 'ill get "rigger Mutation( :or e=ample C ha#e table Stud 'ith Sno6 Mar-26 Mar-76 total6A#g fields( C 'rite a trigger Li-e belo' reate or Replace "rigger Stud9"rig A:"ER ,NSER" %N S"CD :%R EA ; R%W begin Cpdate Stud SE" total<.NEW(mar-2 S .NEW(mar-76 A#g < /.Ne'(mar-2 S .ne'(mar-73 M 7 'here sno < .ne'(snoB endB ;ere u 'ill get trigger Mutating( "he "rigger Mutating also appear in another time( , am not sure abt that time(

21
G) $ow to disable %ulti#le tri&&ers of a table at a ti%e? A) ALT)R TABL)FTABL) 1A4)G D.SABL) ALL TR.00)R A) $ow to a(oid usin& cursors? What to use instead of cursor and in what cases to do so? A) ?ust use sub >uery in for clause e=. for emprec in /select O from emp3 loop dbms9output(put9line/emprec(empno3B end loopB no e=it statement needed implicit open6fetch6close occurs( Q8) $ow we can create a table in :*E7 * bloc@! Insert records into it??? is it #ossible b' so%e #rocedure or function?? :lease &i(e e6a%#le!!! !) *'#!%# O' '#=$!*# ='O*#"('# ddl9create9proc /p9table9name I) ,!'*;!'33 !. l9stmt ,!'*;!'3/7113B :#CI)

":-.FO(%=(%(put9line/0S"AR",NG 03B l9stmt .< 0create table 0TT p9table9name TT 0 as /select O from emp 30B e6ecute I--#"I!%# l9stmtB ":-.FO(%=(%(put9line/0end 03B #?*#=%IO)
W;#) OTHERS %;#)

":-.FO(%=(%(put9line/0e=ception 0TT.Q$#''- TT 0message0TTsqlcode3B #)"B


Q9) %hat is the starting Joracle error numberJE%hat is meant by #or%ard declaration in #unctionsE

22
A- S"AR",NG %RA LE ERR%R N% ,S %RA 11112 One must declare an identi#ier be#ore re#erencing it Once it is declared it can be re#erred e"en be#ore de#ining it in the PL/SQL This rule a!!lies to #unction and !rocedures also <5) e6#lian rowid3rownu%?what are the #soducolu%ns we ha(e? A<) R%W,D * ;e=a decimal number each and e#ery ro' ha#ing uni>ue(Csed in searching R%WNCM * ,t is a integer number also uni>ue for sorting Normally "%) N Analysys( %ther )sudo olumn are

NEF"EAL6 CRREAL6sysdate %f se>uence are some e=ampls Q00) 7tate the difference between i%#lict and e6#lict cursor>s A) .m!licit *ursor are declared and used by the oracle internally %hereas the e'!licit cursors are declared and used by the user more o"er im!licitly cursors are no need to declare oracle creates and !rocess and closes autometically the e'!licit cursor should be declared and closed by the user

+ 3EF)L, ," CRS%RS are used6 'hen you are getting more than a single ro' of data that needs to be processed further( E=plicit cursor re>uires the cursor to be declared6 opened6 fetched and then closed( ,M)L, ," CRS%RS are used primarily 'hen returning a single ro' of data( 5ith I&*licit curs%rs6 the declarati%n6 %*en6 'etch and cl%se 'uncti%ns are d%ne aut%&atically
Q03) .tate the advata+e and disadvanta+e of *ursorGs !) ad#antage . ,n plMs>l if you 'ant perform some actions more than one records you should user these cursors only( bye using these cursors you process the >uery records( you can easily mo#e the records and you can e=it from procedure 'hen you re>uired by using cursor attributes( disad#antage. using implicitMe=plicit cursors are depended by sutiation( if the result set is les than H1 or 211 records it is better to go for implicit cursors( if the result set is large then you should use e=licit cursors( other 'ise it 'ill put burdon on cpu( Q0H) how to trace the errors in pl&sql bloc9 code.. !0) Cser9Errors table %R sho' error on s>l promt

23
!3) ,f you meant to chec- the logic then you can put some dbms statements 'ithin the )LMSQL bloc- and then before e=ecuting it on prompt Set ser#eroutput on this command 'ill print each dbms statements hence this 'ill help to trac- 'here e=actly the procedure is producing the 'rong oMp( Q04) What can be the -a6imum siIe of a plsql bloc9 !) "here is no limitation on the siIe of a pls>l bloc-( Q05) what is diffrence between I. and !. in procedure !) There is no di##erence Any o# these can be used <G) what is #ra&%a? can an' one &i(e %e the e6a%#le of autono%ous Transaction A<) )ragama is compile directi#e ( E=ample of Autonomous transactions Suppose you are updating #alue from table and you don0t ha#e update trigger on that table but still you 'ant to maintain a log entry for this update in seprate table( Dou can 'rite a procedure and call that procedure to do this ( +ut you can not use %MM," in this called procedure because it 'ill sa#e the entire transaction( "o a#oid this you can delclare this procedure as autonomous transaction procedure so that the e=ecution of this procedure 'ill be treated as totally diff( transaction and you can issue commit in called procedure 'ithout affecting the main transaction( !3) prgma is a compiler directi#e6 it ta-es the oracle description error name from database for oracle error code( E=ample of autonous transaction.

Autonomous Transaction is a feature of oracle 8i which maintains the state of its transactions and save it , to affect with the commit or rollback of the surrounding transactions.

Here is the simple example to understand this :-

ora80J .am.Q$ K/ declare 3 =rocedure InsertIn%estF%ableF: H is

24
4 5 J L 8 9 0D 00 03 0H & :#CI) I).#'% into %estF%ableF:26) values 20)1 *ommit1 #)" 1 :#CI) I).#'% I)%O %estF%ableF!26) values 203H)1 InsertIn%estF%ableF:1 'ollbac91 #)"1

=$&.Q$ procedure successfully completed.

ora80J .am.Q$ K/ .elect < from %estF%ableF!1 ? >>>>>>>>>> 03H ora80J .am.Q$ K/ .elect < from %estF%ableF:1 ? >>>>>>>>>> 0

otice in above pl!s"l #$%%&T at line no ' , commits the transaction at line-no ( and line-no ). The *ollback at line-no ++ actuall, did nothing. #ommit!*$--.A#/ at nested transactions will commit!rollback all other 0%transaction before that. 1*A2%A A3T$ $%$345T*A 4A#T&$ override this behavior.

25
$et us the see the followin+ e6ample with ='!C-! !(%O)O-O(.F%'!).!*%IO).

ora80J .am.Q$ K/ declare 3 H 4 5 J L 8 9 0D 00 03 0H 04 & =rocedure InsertIn%estF%ableF: is ='!C-! !(%O)O-O(.F%'!).!*%IO)1 :#CI) I).#'% into %estF%ableF:26) values 20)1 *ommit1 #)" 1 :#CI) I).#'% I)%O %estF%ableF!26) values 203H)1 InsertIn%estF%ableF:1 'ollbac91 #)"1

=$&.Q$ procedure successfully completed.

ora80J .am.Q$ K/ .elect < from %estF%ableF!1

no rows selected

ora80J .am.Q$ K/ .elect < from %estF%ableF:1

26
>>>>>>>>>> 0

With PRAGMA AUTONOMOUS_TRANSACTION , the transaction state maintained independently Commit!Roll"ac# o$ nested transaction %ill no e$$ect the other transaction It is ad&isa"le to increase the &al'e o$ TRANSACTIONS parameter in the INIT parameter $ile to allo% $or the e(tra conc'rrent transaction .
)*+, can we use commit in tri++er and cursors A, Des 'e 'rite commit on trigger but only in autonomous transaction only( +ut is hardy recommended(

Q083 difference between truncate and delete !) "RCN A"E ,t is possible to Delete data permanantly from the table 'ithout commit( After deletion don0t ha#e rollbac- option( D4L O!eration DELE"E Re>uire commit to ma-e changes permanantly after delete command( and also u can select particular ro' to delete 'ith 'here conditions( here after deletion ha#e rollbac- option( DDL O!eration <0) wh' do we need to create a force (iew?what is its #ur#ose?&i(e so%e e6a%#les? A) :orce #ie' When 'e are creating a #ie' for an e=isting table that is called a normal #ie'( ,f there is no table but 'e need to create a #ie'( "hen 'e 'ill go for this force #ie'( means there is no table also 'e can create a #ie' by using this force -ey 'ord( E=. create or replace #ie' force as

27
select O from emp Q3D) What is the data type of )ull !) What is the Data Ty!e o# 18LLE .n Tech S!eack& 18LL is a age old conce!t o# nothing This is not true in case o# oracle Oracle treats 18LL as character "alue o# length o# D So& the de#ault data ty!e o# 18LL is a character data ty!e and to !ro"e it& %e create a "ie% on a null column %ith an alias a& and then describe it to see the dataty!e and length o# the string Cere is the code create "ie% my"ie% as select null a #rom dual+ describe my"ie%+ The describe command sho%s that the column a has a data ty!e o# a "archar5,DSo the Ans%er is / *haracter Ty!e Q30) What is the purpose of @O'*# while creatin+ a ,I#W... !) usually the #ie's are created from the basetable if only the basetable e=ists( "he purpose of :%R E -ey'ord is to create a #ie' if the underlying base table doesnot e=ists( e= . create or replace :%R E #ie' K#ie'nameJ as K>ueryJ 'hile using the abo#e synta= to create a #ie' the table used in the >uery statement doesnot necessary to e=ists in the database -- )$ow can I s#eed u# the e6ecution of =uer' when nu%ber of rows in the tables increased A) 2( ,nde=ed the columns /)rimary -ey3 7( Cse the inde=ed M )rimary -ey columns in the 'here clause G( chec- the e=plain paln for the >uery and a#oid for the nested loops M full table scan /depending on the siIe of data retrie#ed and M or master table 'ith fe' ro's3 -. )$ow can one (iew all the #rocedures3functions3tri&&ers and #ac@a&es created b' the user A<) Cse the >uery Select ob?ect9name6ob?ect9type from all9ob?ects 'here o'ner < 0username0B !3) select ob?ect9name6 ob?ect9type from user9ob?ects 'here ob?ect9type in /0)A LAGE060)R% EDCRE060:CN ",%N060"R,GGER03 Q34) What is :*E7=l tables?

28
A) )LMSQL tables are li-e arrays in 6 the inde=ing starts from 2( Q34) ;ow to display current "ate M %ime in =l&.ql !) SELE " sysdate from DCALB ,t 'ill ?us return the date alone( "o get the date 'ith time the follo'ing >uery 'ill help( select to9char/sysdate60MM*DD*DDDD ;;.Mi.SS03 from dualB

%utput
************* 1H*12*7115 27.@2.@4

declare #9sysdate timestampB begin select to9char/sysdate6 0DD*M%N*DDDD ;;.MM.SS03 into #9sysdate from dualB D+MS9%C")C"()C"9L,NE/#9sysdate3B endB Q35) what is difference between (arra' and nested table! can u e6#lain in brief and clear %' these conce#ts! also &i(e a s%all and sweet e6a%#le of both these! A)

Index-By Table Dimensionality Usable in SQL? Usable as column datatype in a table? Uninitiali ed state Single No No

Nested Table Single Yes Yes; data stored "out of line" (in separate table)

VARRAY Single Yes Yes; data stored "in line" (in same table)

!mpty (cannot be null); elements undefined

"tomically null; illegal to "tomically null; illegal reference elements to reference elements

29

Index-By Table #nitiali ation "utomatic$ %&en declared +#N",Y-#N.!/!, #n (L)SQL$ elements referenced *ia (01$234$356$734 88 1$234$356$734) Yes

Nested Table 'ia constructor$ fetc&$ assignment

VARRAY 'ia constructor$ fetc&$ assignment

(ositi*e integer bet%een (ositi*e integer 2 and 1$234$356$734 bet%een 2 and 1$234$356$734 #nitially$ no; after deletions$ yes 9an be e:tended No; may need to !;.!ND first No

Sparse?

+ounded?

No

Yes No; may need to !;.!ND first$ and cannot !;.!ND past upper bound !;.!ND (or .,#<)$ but only up to declared ma:imum si e

9an assign *alue to any Yes element at any time?

<eans of e:tending

"ssign *alue to element %it& a ne% subscript

Use built0in !;.!ND procedure (or .,#< to condense)$ %it& no predefined ma:imum No

9an be compared for e=uality?

No

No

,etains ordering and N)" subscripts %&en stored in and retrie*ed from database?

No

Yes

Q3J) What ste#s should a #ro&ra%%er should follow for better tunnin& of the :*E7 * bloc@s?

A) 7 * ueries ? )est :ractices 1.


Al%ays use the %here clause in your select statement to narro% the number o# ro%s returned .# %e donNt use a %here clause& the Oracle !er#orms a #ull table scan on our table and returns all o# the ro%s 8se )R.STS clause instead o# .1 clause as it is more e##icient than .1 and !er#orms #aster E6H

-!

3,
Re!lace 7E*ECT 8 9R+M DE:T W$ERE DE:TN+ IN ,7E*ECT DE:TN+ 9R+M EM: E) With 7E*ECT 8 9R+M DE:T D W$ERE EXI7T7 ,7E*ECT < 9R+M EM: E W$ERE D!DE:TN+ I E!DE:TN+) NoteH .1 checks all ro%s e'tremely small .! Only use .1 i# the table in the sub$Buery is

When you ha"e a choice o# using the .1 or the B)TW))1 clauses in your SQL& use the B)TW))1 clause as it is much more e##icient than .1 De!ending on the range o# numbers in a B)TW))1& the o!timiQer %ill choose to do a #ull table scan or use the inde' A"oid WC)R) clauses that are non$sargable 1on$sargable search arguments in the WC)R) clause& such as J.S 18LLJ& JORJ& JFGJ& JU?J& JUGJ& JUFJ& J1OTJ& J1OT )R.STSJ& J1OT .1J& J1OT L.A)J& and JL.A) P:DDJ can !re"ent the Buery o!timiQer #rom using an inde' to !er#orm a search .n addition& e'!ressions that include a #unction on a column& or e'!ressions that ha"e the same column on both sides o# the o!erator& are not sargable *on"ert multi!le +R clauses to UNI+N A**

2!

/!

8se eBui>oins .t is better i# you use %ith inde'ed column >oins (or ma'imum !er#ormance %hen >oining t%o or more tables& the inde'es on the columns to be >oined should ha"e the same data ty!e A"oid a #ull$table scan i# it is more e##icient to get the reBuired ro%s through an inde' .t decides #ull table scan i# it has to read more than :P o# the table data ,#or large tablesA"oid using an inde' that #etches 2D&DDD ro%s #rom the dri"ing table i# you could instead use another inde' that #etches 2DD ro%s and choose selecti"e inde'es .nde'es can9t be used %hen Oracle is #orced to !er#orm im!licit dataty!e con"ersion *hoose the >oin order so you %ill >oin #e%er ro%s to tables later in the >oin order use smaller table as dri"ing table ha"e #irst >oin discard most ro%s Set u! the dri"ing table to be the one containing the #ilter condition that eliminates the highest !ercentage o# the table .n a %here clause ,or ha"ing clause-& constants or bind "ariables should al%ays be on the right hand side o# the o!erator Do not use SQL #unctions in !redicate clauses or WC)R) clauses or on inde'ed columns& ,e g concatenation& substr& decode& rtrim& ltrim etc - as this !re"ents the use o# the inde' 8se #unction based inde'es %here !ossible

G!

A!

1! 0!

<5! <<! <-!

31

7E*ECT 8 9R+M EM: W$ERE 7U)7TR ,ENAME3 <3 .) I JKE7L 8se the L.A) #unction instead o# S8BSTR ,<.! .# you %ant the inde' used& donNt !er#orm an o!eration on the #ield Re!lace 7E*ECT 8 9R+M EM:*+CEE W$ERE 7A*ARC M<555 I HNEW7A*ARC With 7E*ECT 8 9R+M EM:*+CEE W$ERE 7A*ARC I HNEW7A*ARC ?<555 <2! </! <G! All SQL statements %ill be in mi'ed lo%er and lo%er case All reser"e %ords %ill be ca!italiQed and all user$su!!lied ob>ects %ill be lo%er case ,Standard4inimiQe the use o# D.ST.1*T because it #orces a sort o!eration Try >oins rather than sub$Bueries %hich result in im!licit >oins Re!lace 7E*ECT 8 9R+M A W$ERE A!CITC IN ,7E*ECT )!CITC 9R+M )) With 7E*ECT A!8 9R+M A3 ) W$ERE A!CITC I )!CITC <A! Re!lace Outer Hoin %ith 8nion i# both >oin columns ha"e a uniBue inde'/ Re!lace 7E*ECT A!CITC3 )!CITC 9R+M A3 ) W$ERE A!7TATEI)!7TATE ,M) With 7E*ECT A!CITC3 )!CITC 9R+M A3 ) W$ERE A!7TATEI)!7TATE UNI+N 7E*ECT NU**3 )!CITC 9R+M ) W$ERE N+T EXI7T7 ,7E*ECT >X> 9R+M A!7TATEI)!7TATE) <1! <0! -5! 8se bind "ariables in Bueries !assed #rom the a!!lication ,PL/SQL- so that the same Buery can be reused This a"oids !arsing 8se Parallel Query and Parallel D4L i# your system has more than 2 *P8 4atch SQL %here !ossible A!!lications should use the same SQL statements %here"er !ossible to take ad"antage o# Oracle9s Shared SQL Area The SQL must match e'actly to take ad"antage o# this 1o matter ho% many inde'es are created& ho% much o!timiQation is done to Bueries or ho% many caches and bu##ers are t%eaked and tuned i# the design o# a database is #aulty& the !er#ormance o# the o"erall system su##ers A good a!!lication starts %ith a good design The #ollo%ing o!erations al%ays reBuire a sort/ S)L)*T D.ST.1*T

-<!

--!

32
S)L)*T 81.Q8) S)L)*T ORD)R B@ S)L)*T 0RO8P B@ *R)AT) .1D)R *R)AT) TABL) AS S)L)*T %ith !rimary key s!eci#ication 8se o# .1T)RS)*T& 4.18S& and 81.O1 set o!erators 8ninde'ed table >oins Some correlated sub$Bueries
Q38) ;ow to return more than one value from a function ... !0 More than one #alues can be returned to the calling en#ironment by a function is achie#ed by declaring ,N%C" parameters or %C" parameters in the function ( but it is not good programming practise to force a function to return more than one #alues((( !3) 2( +y default a function 'ould return only one #alue( 7( :or returning multiple #alues declare a ref cursor in pac-age spec and use the same in the functionMprocedure in the pac-age body( G( Declare multiple #ariables as out parameters in the functionMprocedure being used ( "his 'ill also return multple #alues( !H) .# you %ant to return more than 2 "alue V dont %ant to use re# curser try this& 2 Return comma se!arated "archar V then use dbms7utility comma7to7table #unction to !arse them 5 Try returning "ariable o# ty!e !l/sBl table or "array . ha"e not tried number 5& but should %ork -0) Is there an' li%itation on no! of tri&&ers that can be created on a table? A) Till oracle L D only 25 triggers could be associated %ith a gi"en table& but in higher "ersions o# Oracle there is no such limitation )) 25 triggers ma' .5) What is the difference between allN and userN tables ?

A)

An ALL_ "ie% dis!lays all the in#ormation accessible to the current user& including in#ormation #rom the current user9s schema as %ell as in#ormation #rom ob>ects in other schemas& i# the current user has access to those ob>ects by %ay o# grants o# !ri"ileges or roles While A USER_ "ie% dis!lays all the in#ormation #rom the schema o# the current user 1o s!ecial !ri"ileges are reBuired to Buery these "ie%s .<) can i write plsql bloc9 inside e6pection

A) 7es y%u can .rite 8L9SQL l%c3 inside e/ce*ti%n secti%n. Su**%se y%u .ant t% insert the e/ce*ti%n detail int% y%ur err%r l%g ta le6 that ti&e y%u can .rite insert int% state&ent in e/ce*ti%n *art. 1% handle the e/ce*ti%n .hich &ay e raised in y%ur e/ce*ti%n *art6 y%u can .rite the 8L9SQL c%de in e/ce*ti%n *art.

33
QH3) what happens when a pac9a+e is initialiIed !) When a !ackage is initialiQed that is called #or the #irst time the entire !ackage is loaded into S0A and any "ariable declared in the !ackage is initialiQes Q66- What are the restrictions on @unctions !0) We can use ,N and ,N %C" parameters 'ith function6 in %racle &i #er( &(7( See belo'6 create or replace function f2 /num in out number3 return number as begin dbms9output(put9line /0,nside f2 num<0TTnum3B num.<211B return 21B endB M declare n2 number .< 2B begin dbms9output(put9line/0return #al<0TTf2/n233B dbms9output(put9line/0out param<0TTn23B endB M !3) %e can return more then one "alue using .1O8T !arameters

Q) What is the difference between RE9 Cursor O Nor%al Cursor?


A) Generally ref cursor used for passing cursor parameter and also dynamically building the >uery( Normal cursor are static cursors and also 'e can0t able to pass li-e paramater

Q) Wh' 9unctions are used in oracle ?

Can 9unctions Return %ore than < (alues? Wh' :rocedures are used in oracle ? A2- 2- A #unction %ill return a "alue& adding to that & it is !ossible to use a #unction in SQL statements& %hereas !rocedures cannot be used 5-1o& #unctions cannot retrun more than one "alue& instead one can get this done in other %ay round by using O8T !arameters #or a #unction 6-To !er#orm "alidations and transactions on database tables M-4emory usage is more :-The "ariable de#ined inside Package S!eci#ication are treated as 0lobal "ariables& %hich can be re#erred e'ternally A5- function can return more than one #alue * one by return staement and others by %C" parameters( AG3 +oth functions and procedures are using to do a special tas- or action6 ,n functions it is must to return a single #alue6 'here as in procedures its not compulsory6 ,n functions 'ith the help of %C" parameter 'e can pass multiple outputs( "he functions can be used in DML statements 6 but it should satiesfy the function purity le#el( but procedures cant use in DML statements( ) we use co%%it or rollbac@ co%%and in the e6ce#tion #art of :*E7 * bloc@?

34
A) Des create table test2/= #archar7/7133 declare = numberB begin select sal into = from emp 'here ename li-e 0"""A0B e=ception 'hen no9data9found then insert into test2 #alues/0no data03B commitB endB M Q) What is the out#ut of the followin& #lEs=l bloc@ ? declare (Ne%#no e%#!e%#noPt'#e; be&in select e%#no into (Ne%#no fro% e%# where e%#no I <5; e6ce#tion when others then db%sNout#ut!#utNline , >no data found>); when noNdataNfound then db%sNout#ut!#utNline , >ther is no data found >); end; A- %hen others then 3 )RROR at line I/ ORA$DI::D/ line I& column 5/ PLS$DD6LD/ OTC)RS handler must be last among the e'ce!tion handlers o# a block ORA$DI::D/ line D& column D/ PL/SQL/ *om!ilation unit analysis terminated ) Tal@ about "E6ce#tion $andlin&" in :*E7 *? A) "here are 7 types of E=ception ;andlers.%RA LE defined/Named E=ception ;andler and Numbered E=ception ;andler3 and Cser Defined E=ceptions( Named E=ceptions . e=amples* L%G,N9DEN,ED6"%%9MAND9R%WS etc( Numbered E=ceptions. "here are about 71 L numbered e=ceptions6 one can o#er'rite these numbered e=ception such that instead of sho'ing a number for the raised e=ception6 user specifed EF E)",%N9NAME 'ill be sho'n(

35
Cser Defined. "hese are the e=ceptions defined and raised by user code( "his includes +usiness Rule #alidations li-e /Amount K 13 etc( Q) What is difference between a :R+CEDURE O 9UNCTI+N?

A< A (81*T.O1 is al%ays returns a "alue using the return statement


A PRO*)D8R) at all A5- (unctions can be called inside select stmt but not the !rocedures ) Is it #ossible to use Transaction control 7tate%ents such a R+**)ACK or C+MMIT in Database Tri&&er ? Wh' ? A) 0enerally .n triggers you can9t use T*L commands But you can use T*L commands in Autonomous Triggers @ou can declare a trigger as Autonomous by !ro"iding PRA04A A8TO1O4O8S7TRA1SA*T.O1 in the beginning o# the trigger At a same time you ha"e to end your trigger %ith commit/rollback @ou can use these ty!e o# triggers to maintain log details o# a table ) What is +(erloadin& of #rocedures? may return one or more "alues through !arameters or may not return

A) The

Same !rocedure name is re!eated %ith !arameters o# di##erent dataty!es and !arameters in di##erent !ositions& "arying number o# !arameters is called o"erloading o# !rocedures

) What is a #ac@a&e? What are the ad(anta&es of #ac@a&es?


A) "he main ad#antages of pac-ages are * 2* Since pac-ages has specification and body separate so6 'hene#er any ddl is run and if any procMfunc/inside pac-3 is dependent on that6 only body gets in#alidated and not the spec( So any other procMfunc dependent on pac-age does not gets in#alidated( 7* Whene#er any funcMproc from pac-age is called6 'hole pac-age is loaded into memory and hence all ob?ects of pac- is a#ailaible in memory 'hich means faster e=ecution if any is called( And since 'e put all related procMfunc in one pac-age this feature is useful as 'e may need to run most of the ob?ects( G 3'e can declare global #ariables in the pac-age ) What is the basic structure of =$&.Q$ .

+ 8L9SQL l%c3 has three *arts: a declarati"e *art6 an e/ecuta le *art6 and an e/ce*ti%n0handling *art.
!)

2irst c%&es the declarati"e *art6 in .hich ite&s can e declared. (nce declared6 ite&s can e &ani*ulated in the e/ecuta le *art. :/ce*ti%ns raised during e/ecuti%n can e dealt .ith in the e/ce*ti%n0handling

36 *art.
) What are the co%#onents of a :*E7 * bloc@ ? A) )LMSQL +loc- contains . "eclare . optional Eariable declaration :e+in . Manadatory )rocedural statements( #6ception . %ptional any errors to be trapped #nd . Mandatory So only begin and end -ey'ords are re>uired6 as needed6 to process a plMs>l bloc-( ) What are P TC:E and P R+WTC:E ? What are the ad(anta&es of usin& these o(er datat'#es?

A)

P T@P) !ro"ides the data ty!e o# a "ariable or a database column to that "ariable

P ROWT@P) !ro"ides the record ty!e that re!resents a entire ro% o# a table or "ie% or columns selected in the cursor The ad"antages are / . 1eed not kno% about "ariable9s data ty!e ii .# the database de#inition o# a column in a table changes& the data ty!e o# a "ariable changes accordingly Q- What is =$&.Q$ table

!0) )lMSQL tables are the ro'6 column structure as of the table but cannot perform any select >uery on the plMs>l tables because the data isfrom fetched only by the inde=es li-e *** store empno6 ename from emp table thru cursor to plMs>l tables( declare type ty9pls>l is record / empno number6 ename #archar7/H133B ty9pls>l2 ty9pls>lB cursor c is select empno6ename from empB begin for i in c loop

37
ty9pls>l/i3(empno .< i(empnoB ty9pls>l/i3(ename .< i(enameB end loopB endB A5- A )LMSQL table is a one*dimensional6 unbounded6 sparse collection of homogenous elements6 inde=ed by integers One-dimensional A )LMSQL table can ha#e only one column( ,t is6 in this 'ay6 similar to a one*dimensional array( Unbounded or Unconstrained "here is no predefined limit to the number of ro's in a )LMSQL table( "he )LMSQL table gro's dynamically as you add more ro's to the table( "he )LMSQL table is6 in this 'ay6 #ery different from an array( Related to this definition6 no ro's for )LMSQL tables are allocated for this structure 'hen it is defined( Sparse ,n a )LMSQL table6 a ro' e=ists in the table only 'hen a #alue is assigned to that ro'( Ro's do not ha#e to be defined se>uentially( ,nstead you can assign a #alue to any ro' in the table( So ro' 2H could ha#e a #alue of U:o=0 and ro' 2H@@5 a #alue of URed06 'ith no other ro's defined in bet'een( Homogeneous elements +ecause a )LMSQL table can ha#e only a single column6 all ro's in a )LMSQL table contain #alues of the same datatype( ,t is6 therefore6 homogeneous( With )LMSQL Release 7(G6 you can ha#e )LMSQL tables of records( "he resulting table is still6 ho'e#er6 homogeneous( Each ro' simply contains the same set of columns( Indexed by integers )LMSQL tables currently support a single inde=ing mode. by +,NARD9,N"EGER( "his number acts as the Nprimary -eyN of the )LMSQL table( "he range of a +,NARD9,N"EGER is from *7G2*2 to 7G2*26 so you ha#e an a'ful lot of ro's 'ith 'hich to 'orA.) Aee! the #ollo%ing restrictions in mind %hen you %ork %ith PL/SQL tables/

"here is no concept of transaction integrity 'ith )LMSQL tables( Dou cannot commit information to a )LMSQL table or roll bac- changes from the table( Dou cannot SELE " from )LMSQL tables( "here is no 'ay to perform set*at*a*time processing to retrie#e data from a )LMSQL table( "his is a programmatic construct in a programmatic language( ,nstead you can use )LMSQL loops to mo#e through the contents of a )LMSQL table6 one ro' at a time(

38

Dou cannot issue DML statements /,NSER"s6 C)DA"Es6 and DELE"Es3 against )LMSQL tables /though )LMSQL Release 7(G does offer a DELE"E operator3(

) What are the cursor attributes used in :*E7 * ? A) P.SOP)1 $ to check %hether cursor is o!en or not P ROW*O81T $ number o# ro%s #etched/u!dated/deleted P (O81D $ to check %hether cursor has #etched any ro% True i# ro%s are #etched P 1OT (O81D $ to check %hether cursor has #etched any ro% True i# no ro%s are #eatched These attributes are !roceeded %ith SQL #or .m!licit *ursors and %ith *ursor name #or )'!licit *ursors ) What is a cursor for loop

!) "he for loop in cursors are used to ma-e less statements to 'rite cursor( if u are opening a cursor normally using the open cursor 6then open cursor9nameB fetch cursor9name into #ariable loop e=it 'hen cursor9nameAnotfound B end loopB close cursor in the abo#e statement u ha#e to e=plicitly open and close the cursor6 and also 'rite e=it statement to end the cursor loop if 'e 'rite the same using for loop then compare the statements( for #arible in cursor9name loop statements end loopB the abo#e for loop does not need a open and close e=plicitly since those are in#ol#ed in the for loop itself( and also ne#er re>uire the loop to e=plicitly end using any condition6 since it ends the loop if there are no more ro's in the memory( ) What will happen after commit statement !0) The changes %ill be !ermanently %ritten to hard disk 1o undo,rollback- is !ossible A5- The cursor ha"ing Buery %ill get closed& because once the #or u!date clause is #ired it locks all the ro%s %hich is been modi#ied and once it encounters a commit/rollback it automatically comes out o# that session& and %ill be !rocessing a #resh loo! altogether ) $ow %an' t'#es of database tri&&ers can be s#ecified on a table ? What are the'

39

A) Be#ore Ro% A#ter Ro%

.nsert ok ok ok ok

8!date ok ok ok ok

Delete ok ok ok ok

Be#ore Statement A#ter Statement

.# (OR )A*C ROW clause is s!eci#ied& then the trigger #or each Ro% a##ected by the statement .# WC)1 clause is s!eci#ied& the trigger #ires according to the returned Boolean "alue ) What is :ra&%a EXEC:TI+NNINIT ? E6#lain the usa&e ? A<) The PRA04A )R)*PT.O17.1.T tells the com!lier to associate an e'ce!tion %ith an oracle error To get an error message o# a s!eci#ic oracle error e g PRA04A )R*)PT.O17.1.T ,e'ce!tion name& oracle error number-

A-) )ragma e=ception9init Allo' you to handle the %racle predefined message by you0r o'n message( means you can instruct compiler toassociatethe specific message to oracle predefined message at compile time("his 'ay you ,mpro#e the Readbility of your program6and handle it accoding to your o'n 'ay( ,t should be declare at the DE LARE section( e=ample declare salary numberB :%CND9N%";,NG e=ceptionB )ragma e=ception9init/:%CND9N%";,NG 62113B begin select sal in to salaryfrom emp 'here ename <0ANCRAG0B dbms9output(put9line/salary3B e=ception W;EN :%CND9N%";,NG ";EN dbms9output(put9line/SQLERRM3B endB ) What are ad(anta&es for 7tored :rocedures!

4,

A) )'tensibility&4odularity&

Reusability&

4aintainability

and one time

com!ilation
) What are the %odes of #ara%eters that can be #assed to a #rocedure ?

A) (in. in parameter mode is used to pass #alues to subprogram 'hen in#o-ed( 7(out. out is used to return #alues to callers of subprograms G(in out. it is used to define in and out

Q) What is an E6ce#tion ? What are t'#es of E6ce#tion ? A<) )'ce!tion is the error handling !art o# PL/SQL block The ty!es are Prede#ined and
user de#ined Some o# Prede#ined e'ce!tions are *8RSOR7ALR)AD@7OP)1 D8P7=AL7O17.1D)R 1O7DATA7(O81D TOO74A1@7ROWS .1=AL.D7*8RSOR .1=AL.D7184B)R LO0O17D)1.)D 1OT7LO00)D7O1 PRO0RA4$)RROR STORA0)7)RROR T.4)O8T7O17R)SO8R*) =AL8)7)RROR T)RO7D.=.D) OTC)RS

A2) #?*#=%IO). =redefined "o not declare and allow the Oracle server to raise implicitly )OF"!%!F@O()" %OOF-!)7F'OW. I),!$I"F*('.O' N#'OF"I,I"# I),!$I"F*('.O' W;#) #?*#=%IO) %;#) O )on predefined "eclare within the declarative section and allow allow Oracle server to raise implicitly o .Q$*O"# P 'eturns the numeric value for the see or code o .Q$#''- P 'eturns the messa+e associated with error number

41

"#*$!'# >> ='!C-! #?*#=%IO)FI)I% 2e6ception, errorFnumber) '!I.# P W;#) #?*#=%IO)F)!-# %;#) O (ser defined "eclare within the declarative section and rise explicitly. I@ condition the '!I.# #?*#=%IO) or '!I.#F!==$I*!%IO)F#''O' Q) What are the return (alues of functions 7 *C+DE and 7 *ERRM ?

A<) SQL*OD) returns the latest code o# the error that has occurred
SQL)RR4 returns the rele"ant error message o# the SQL*OD)

!3) )l M S>l )ro#ides Error ,nformation #ia t'o +uilt*in functions6 SQL %DE P SQLERRM(
SQL %DE Returns the urrent Error ode( Returns 2( SQLERRM Returns the urrent Error Message "e=t( Returns N Cser Defined E=ception N

Q) E6#lain how #rocedures and functions are called in a :*E7 * bloc@ ?

A) (unction is called as !art o# an e'!ression


sal /? calculate7sal ,9a<559-+ !rocedure is called as a PL/SQL statement calculate7bonus ,9A<559-+

Q) Na%e the tables where characteristics of :ac@a&e3 #rocedure and functions


are stored E A- 8ser7ob>ects& 8ser7Source and 8ser7error

Q)subquery & correlated subquery

;sing a su <uery in the FROM clause6 the '%ll%.ing <uery returns the nu& er and na&e %' each de*art&ent .ith 'i"e %r &%re e&*l%yees:
DECLARE CURSOR c1 IS SELECT t1.deptno, dname, "STAFF" FROM dept t1, (SELECT deptno, COUNT(* "STAFF" FROM emp !ROU" #$ deptno t% &'ERE t1.deptno ( t%.deptno AND "STAFF" )( *+

5hereas a su <uery is e"aluated %nly %nce '%r each ta le6 a correlated subquery is e"aluated %nce '%r each r%.. )%nsider the <uery el%.6 .hich returns the na&e and salary %' each e&*l%yee .h%se salary e/ceeds the de*art&ental a"erage. 2%r each r%. in

42 the emp ta le6 the c%rrelated su <uery c%&*utes the a"erage salary '%r that r%.!s de*art&ent. 1he r%. is returned i' that r%.!s salary e/ceeds the a"erage.
DECLARE CURSOR c1 IS SELECT deptno, ename, ,a- FROM emp t &'ERE ,a- ) (SELECT A.!(,a- FROM emp &'ERE t.deptno ( deptno ORDER #$ deptno+

1)

how to retrive data usin+ view

A( you 'ant to retri#e the data by using #ie'6 so its depend that 'hich type of data you 'ant( find some >uery belo'. 2( select O from #ie'9nameB 7( select column9name from #ie'9nameB G( select column9name from #ie'9name 'here column9name <Mli-e 00B #ie' is nothing ?ust li-e as a table( - What is a #ie'8 Why use it8 A "ie% is a "irtual table made u! o# data #rom base tables and other "ie%s& but not stored se!arately . 'hat is the differnece bet'een materialiIed #ie' and snapshot A materialiQed "ie% is a re!lica o# a target master #rom a single!oint in time The conce!t %as #irst introduced %ith OracleL termed asS1APSCOT .n Or '#K What is the siIe of the oracle database for -no'ing the siIe of the database6 you 'ill calculate the siIe of datafile because database siIe is nothing your datafile siIe is database siIe( select count/O3 from dba9data9filesB 0 What is a Data Dictionary 8 The data dictionary o# an ORA*L) database is a set o# tables and "ie%s that are used as a read$only re#erence about the database .t stores in#ormation

43
Suppose a customer table is ha#ing different columns li-e customer no6 payments( What 'ill be the >uery to select top three ma= payments8 S)L)*T customer7no& !ayments #rom customer *2WC)R) 6F ?,S)L)*T *O81T,3- #rom customer *5WC)R) *2 !ayment F ? *5 !ayment'#K what is the difference between sql and sql plus SQL e'e'cutes single instructions %hile PLsBl e'ecutes block o# instructions SQL <J Structured Query Language 'hich is ?ust li-e English Language( SQLO)lus <J ,s a tool de#eloped to ,nteract 'ith %racle Database( SQL/ Abbre"iation #or JStructure Query LanguageJ it9s a s!ecial kind o# Buery language similar to )nglish language and used to interact %ith data stored in a Database *ategories o# SQL language along %ith ty!es o# mani!ulation "alid under each categories are as #ollo%s/$ D4L/ Data 4ani!ulation Languageselect& insert& delete& u!date& lock table etc $ DDL/ Data De#inition Languagecreate& dro!& alter& truncate& comment& grant& re"oke etc $ D*L/ Data *ontrol Languagecommit& rollback& sa"e!oint& set transection etc SQL Plus/ .t is a tool #rom %here you can submit your SQL statements Q- Co% can you handle multi!le ro%s %ithout using loo!s in PL/SQL E A- 8sing cursors Q- What are Autonomous transactions E 0i"e a scenario %here you ha"e used Autonomous transaction in your re!orts E A2- An autonomous transaction is an independent transaction started by another transaction6 the main transaction( Autonomous transactions let you suspend the main transaction6 do SQL operations6 commit or roll bac- those operations6 then resume the main transaction( %nce started6 an autonomous transaction is fully independent( ,t shares no loc-s6 resources6 or commit* dependencies 'ith the main transaction( So6 you can log e#ents6 increment retry counters6 and so on6 e#en if the main transaction rolls bac-( More important6 autonomous transactions help you build modular6 reusable soft'are components( :or e=ample6 stored procedures can start and finish autonomous transactions on their o'n( A calling application need not -no' about a procedure0s autonomous operations6 and the procedure need not -no' about the application0s transaction conte=t( "hat ma-es autonomous transactions less error*prone than regular transactions and easier to use( :urthermore6 autonomous transactions ha#e all the functionality of regular transactions( "hey allo' parallel >ueries6 distributed processing6 and all the transaction control statements including SE" "RANSA ",%N( Scenario . Dou can use autonomous transaction in your report for 'riting error messages in your database tables( A73 autonomous transaction is transaction that is used for independentle commited basically it is used in triggers 6procedures6 create or replace procedure ins9rec pragma autonomous9transaction begin

44
insert into aa2 #alues/0pa'an06223B commitB endB step 7 begin insert into aa2 #alues/0hello062223B ins9recB rollbac-B endB but here hello and 222 'ill be rollbac-( but in ins9rec 'ill be sa#ed < E=plain the t'o type of ursors 8 There are t%o ty!es o# cursors& .m!licit *ursor and )'!licit *ursor PL/SQL uses .m!licit *ursors #or Bueries 8ser de#ined cursors ar - What is the use of cursors in )LMSQL 8 What is RE: ursor 8 The cursor are used to handle multi!le ro% Buery in PL/SQL Oracle uses im!licit cursors to handle all itNs Bueries Oracle uses unnamed memory s!aces . Setting the ursors( De#ault *ursor W D ODB* *ursor ,*lient side- W 2 Ser"erSide *ursors ,4ore 1et%ork tra##ic- $ 5 2 Difference bet'een an implicit P an e=plicit cursor( PL/SQL declares a cursor im!licitly #or all SQL data mani!ulation statements& including Buries that return only one ro% Co%e"er& Bueries that return m / What are the cursor attributes used in )LMSQL 8 P.SOP)1 $ to check %hether cursor is o!en or not P ROW*O81T $ number o# ro%s #etched/u!dated/dele ted P (O81 G What is use of a cursor #ariable8 ;o' it is defined8 A cursor "ariable is associated %ith di##erent statements at run time& %hich can hold di##erent "alues at run time Static cursors can only be associa A What is a cursor 8 Why ursor is re>uired 8 *ursor is a named !ri"ate SQL area #rom %here in#ormation can be accessed *ursors are reBuired to !rocess ro%s indi"idu ****call procedure

SQL <!Which is the subset of 7 * co%%ands used to %ani#ulate +racle Database structures3 includin& tables? Data De#inition Language ,DDL-

45

-! What o#erator #erfor%s #attern %atchin&? L.A) o!erator .! What o#erator tests colu%n for the absence of data? .S 18LL o!erator 2! Which co%%and e6ecutes the contents of a s#ecified file? START F#ilenameG or XF#ilenameG /! What is the #ara%eter substitution s'%bol used with IN7ERT INT+ co%%and? V G! Which co%%and dis#la's the 7 * co%%and in the 7 * buffer3 and then e6ecutes it? R81 A! What are the wildcards used for #attern %atchin&? 7 #or single character substitution and P #or multi$character substitution 1! 7tate true or false! EXI7T73 7+ME3 ANC are o#erators in 7 *! True 0! 7tate true or false! QI3 RS3 TI all denote the sa%e o#eration! True <5! What are the #ri(ile&es that can be &ranted on a table b' a user to others? .nsert& u!date& delete& select& re#erences& inde'& e'ecute& alter& all <<! What co%%and is used to &et bac@ the #ri(ile&es offered b' the BRANT co%%and? R)=OA) <-! Which s'ste% tables contain infor%ation on #ri(ile&es &ranted and #ri(ile&es obtained? 8S)R7TAB7PR.=S74AD)& 8S)R7TAB7PR.=S7R)*D

<.! Which s'ste% table contains infor%ation on constraints on all the tables created? 8S)R7*O1STRA.1TS <2! TRUNCATE TA)*E EM:; DE*ETE 9R+M EM:; Will the out#uts of the abo(e two co%%ands differ? Both %ill result in deleting all the ro%s in the table )4P </! What is the difference between TRUNCATE and DE*ETE co%%ands? TR81*AT) is a DDL command %hereas D)L)T) is a D4L command Cence D)L)T) o!eration can be rolled back& but TR81*AT) o!eration cannot be rolled back WC)R) clause can be used %ith D)L)T) and not %ith TR81*AT)

46

<G! What co%%and is used to create a table b' co#'in& the structure of another table? Ans%er / *R)AT) TABL) AS S)L)*T command )'!lanation / To co!y only the structure& the WC)R) clause o# the S)L)*T command should contain a (ALS) statement as in the #ollo%ing *R)AT) TABL) 1)WTABL) AS S)L)*T 3 (RO4 )R.ST.10TABL) WC)R) 2?5+ .# the WC)R) condition is true& then all the ro%s or ro%s satis#ying the condition %ill be co!ied to the ne% table <A! What will be the out#ut of the followin& =uer'? S)L)*T R)PLA*),TRA1SLAT),LTR.4,RTR.4,9UU ATC)1 UU9&9U9-& 9U9-& 9A19& 9339-&939&9TRO8BL)9- (RO4 D8AL+ TRO8BL)TC)TRO8BL) <1! What will be the out#ut of the followin& =uer'? S)L)*T D)*OD),TRA1SLAT),9A9&9256M:IL<;D9&922222222229-& 929&9@)S9& 91O9 -+ Ans%er / 1O )'!lanation / The Buery checks %hether a gi"en string is a numerical digit <0! What does the followin& =uer' do? S)L)*T SAL O 1=L,*O44&D- (RO4 )4P+ This dis!lays the total salary o# all em!loyees The null "alues in the commission column %ill be re!laced by D and added to salary -5! Which date function is used to find the difference between two dates? 4O1TCS7B)TW))1 -<! Wh' does the followin& co%%and &i(e a co%#ilation error? DROP TABL) VTABL)71A4)+ =ariable names should start %ith an al!habet Cere the table name starts %ith an 9V9 symbol

--! What is the ad(anta&e of s#ecif'in& WIT$ BRANT +:TI+N in the BRANT co%%and? The !ri"ilege recei"er can #urther grant the !ri"ileges he/she has obtained #rom the o%ner to any other user -.! What is the use of the DR+: o#tion in the A*TER TA)*E co%%and? .t is used to dro! constraints s!eci#ied on the table -2! What is the (alue of Jco%%L and JsalL after e6ecutin& the followin& =uer' if the initial (alue of JsalL is <5555? 8PDAT) )4P S)T SAL ? SAL O 2DDD& *O44 ? SAL3D 2+ sal ? 22DDD& comm ? 2DDD

47
-/! What is the use of DE7C in 7 *? Ans%er / D)S* has t%o !ur!oses .t is used to describe a schema as %ell as to retrie"e ro%s #rom table in descending order )'!lanation / The Buery S)L)*T 3 (RO4 )4P ORD)R B@ )1A4) D)S* %ill dis!lay the out!ut sorted on )1A4) in descending order -G! What is the use of CA7CADE C+N7TRAINT7? When this clause is used %ith the DROP command& a !arent table can be dro!!ed e"en %hen a child table e'ists -A! Which function is used to find the lar&est inte&er less than or e=ual to a s#ecific (alue? (LOOR -1! What is the out#ut of the followin& =uer'? S)L)*T TR81*,256M :IL<&$5- (RO4 D8AL+ 25DD 7 *? UERIE7

. S*C)4AS Table 2 / ST8D.)S P1A4) ,=AR*CAR-& SPLA*) ,=AR*CAR-& *O8RS) ,=AR*CAR-& **OST ,184B)RTable 5 / SO(TWAR) P1A4) ,=AR*CAR-& T.TL) ,=AR*CAR-& D)=.1 ,=AR*CAR-& S*OST ,184B)R-& D*OST ,184B)R-& SOLD ,184B)RTable 6 / PRO0RA44)R P1A4) ,=AR*CAR-& DOB ,DAT)-& DOH ,DAT)-& S)R ,*CAR-& PRO(2 ,=AR*CAR-& PRO(5 ,=AR*CAR-& SAL ,184B)RL)0)1D / P1A4) W Programmer 1ame& SPLA*) W Study Place& **OST W *ourse *ost& D)=.1 W De"elo!ed in& S*OST W So#t%are *ost& D*OST W De"elo!ment *ost& PRO(2 W Pro#iciency 2 UERIE7 H 2 5 6 M : I L (ind out the selling cost a"erage #or !ackages de"elo!ed in Oracle Dis!lay the names& ages and e'!erience o# all !rogrammers Dis!lay the names o# those %ho ha"e done the P0D*A course What is the highest number o# co!ies sold by a !ackageE Dis!lay the names and date o# birth o# all !rogrammers born in A!ril Dis!lay the lo%est course #ee Co% many !rogrammers ha"e done the D*A course

48
< Co% much re"enue has been earned through the sale o# !ackages de"elo!ed in * ; Dis!lay the details o# so#t%are de"elo!ed by Rakesh 2D Co% many !rogrammers studied at Penta#our 22 Dis!lay the details o# !ackages %hose sales crossed the :DDD mark 25 (ind out the number o# co!ies %hich should be sold in order to reco"er the de"elo!ment cost o# each !ackage 26 Dis!lay the details o# !ackages #or %hich the de"elo!ment cost has been reco"ered 2M What is the !rice o# costliest so#t%are de"elo!ed in =BE 2: Co% many !ackages %ere de"elo!ed in Oracle E 2I Co% many !rogrammers studied at PRA0ATC.E 2L Co% many !rogrammers !aid 2DDDD to 2:DDD #or the courseE 2< What is the a"erage course #eeE 2; Dis!lay the details o# !rogrammers kno%ing * 5D Co% many !rogrammers kno% either * or PascalE 52 Co% many !rogrammers donNt kno% * and *OOE 55 Co% old is the oldest male !rogrammerE 56 What is the a"erage age o# #emale !rogrammersE 5M *alculate the e'!erience in years #or each !rogrammer and dis!lay along %ith their names in descending order 5: Who are the !rogrammers %ho celebrate their birthdays during the current monthE 5I 5L 5< 5; 6D 62 65 Co% many #emale !rogrammers are thereE What are the languages kno%n by the male !rogrammersE What is the a"erage salaryE Co% many !eo!le dra% :DDD to L:DDE Dis!lay the details o# those %ho donNt kno% *& *OO or Pascal Dis!lay the costliest !ackage de"elo!ed by each !rogrammer Produce the #ollo%ing out!ut #or all the male !rogrammers

KEC7H 2 S)L)*T A=0,S*OST- (RO4 SO(TWAR) WC)R) D)=.1 ? 9ORA*L)9+ 5 S)L)*T P1A4)&TR81*,4O1TCS7B)TW))1,S@SDAT)&DOB-/25- JA0)J& TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- J)RP)R.)1*)J (RO4 PRO0RA44)R+ 6 S)L)*T P1A4) (RO4 ST8D.)S WC)R) *O8RS) ? 9P0D*A9+ M S)L)*T 4AR,SOLD- (RO4 SO(TWAR)+ : S)L)*T P1A4)& DOB (RO4 PRO0RA44)R WC)R) DOB L.A) 9PAPRP9+ I S)L)*T 4.1,**OST- (RO4 ST8D.)S+ L S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) *O8RS) ? 9D*A9+ < S)L)*T S84,S*OST3SOLD$D*OST- (RO4 SO(TWAR) 0RO8P B@ D)=.1 CA=.10 D)=.1 ? 9*9+ ; S)L)*T 3 (RO4 SO(TWAR) WC)R) P1A4) ? 9RAA)SC9+ 2D S)L)*T 3 (RO4 ST8D.)S WC)R) SPLA*) ? 9P)1TA(O8R9+ 22 S)L)*T 3 (RO4 SO(TWAR) WC)R) S*OST3SOLD$D*OST G :DDD+ 25 S)L)*T *).L,D*OST/S*OST- (RO4 SO(TWAR)+ 26 S)L)*T 3 (RO4 SO(TWAR) WC)R) S*OST3SOLD G? D*OST+ 2M S)L)*T 4AR,S*OST- (RO4 SO(TWAR) 0RO8P B@ D)=.1 CA=.10 D)=.1 ? 9=B9+

49
2: S)L)*T *O81T,3- (RO4 SO(TWAR) WC)R) D)=.1 ? 9ORA*L)9+ 2I S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) SPLA*) ? 9PRA0ATC.9+ 2L S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) **OST B)TW))1 2DDDD A1D 2:DDD+ 2< S)L)*T A=0,**OST- (RO4 ST8D.)S+ 2; S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 ? 9*9 OR PRO(5 ? 9*9+ 5D S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 .1 ,9*9&9PAS*AL9- OR PRO(5 .1 ,9*9&9PAS*AL9-+ 52 S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 1OT .1 ,9*9&9*OO9- A1D PRO(5 1OT .1 ,9*9&9*OO9-+ 55 S)L)*T TR81*,4AR,4O1TCS7B)TW))1,S@SDAT)&DOB-/25-- (RO4 PRO0RA44)R WC)R) S)R ? 949+ 56 S)L)*T TR81*,A=0,4O1TCS7B)TW))1,S@SDAT)&DOB-/25-- (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ 5M S)L)*T P1A4)& TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- (RO4 PRO0RA44)R ORD)R B@ P1A4) D)S*+ 5: S)L)*T P1A4) (RO4 PRO0RA44)R WC)R) TO7*CAR,DOB&94O19- ? TO7*CAR,S@SDAT)&94O19-+ 5I S)L)*T *O81T,3- (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ 5L S)L)*T D.ST.1*T,PRO(2- (RO4 PRO0RA44)R WC)R) S)R ? 949+ 5< S)L)*T A=0,SAL- (RO4 PRO0RA44)R+ 5; S)L)*T *O81T,3- (RO4 PRO0RA44)R WC)R) SAL B)TW))1 :DDD A1D L:DD+ 6D S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 1OT .1 ,9*9&9*OO9&9PAS*AL9- A1D PRO(5 1OT .1 ,9*9&9*OO9&9PAS*AL9-+ 62 S)L)*T P1A4)&T.TL)&S*OST (RO4 SO(TWAR) WC)R) S*OST .1 ,S)L)*T 4AR,S*OST- (RO4 SO(TWAR) 0RO8P B@ P1A4)-+ 65 S)L)*T 94r 9 KK P1A4) KK 9 $ has 9 KK TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- KK 9 years o# e'!erience9 YProgrammerZ (RO4 PRO0RA44)R WC)R) S)R ? 949 81.O1 S)L)*T 94s 9 KK P1A4) KK 9 $ has 9 KK TR81* ,4O1TCS7B)TW))1 ,S@SDAT)&DOH-/25- KK 9 years o# e'!erience9 YProgrammerZ (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ .. S*C)4A / Table 2 / D)PT D)PT1O ,1OT 18LL & 184B)R,5--& D1A4) ,=AR*CAR5,2M--& LO* ,=AR*CAR5,26Table 5 / )4P )4P1O ,1OT 18LL & 184B)R,M--& )1A4) ,=AR*CAR5,2D--& HOB ,=AR*CAR5,;--& 40R ,184B)R,M--& C.R)DAT) ,DAT)-& SAL ,184B)R,L&5--& *O44 ,184B)R,L&5--& D)PT1O ,184B)R,5-40R is the em!no o# the em!loyee %hom the em!loyee re!orts to D)PT1O is a #oreign key UERIE7 2 List all the em!loyees %ho ha"e at least one !erson re!orting to them 5 List the em!loyee details i# and only i# more than 2D em!loyees are !resent in de!artment no 2D 6 List the name o# the em!loyees %ith their immediate higher authority M List all the em!loyees %ho do not manage any one

5,
: List the em!loyee details %hose salary is greater than the lo%est salary o# an em!loyee belonging to de!tno 5D I List the details o# the em!loyee earning more than the highest !aid manager L List the highest salary !aid #or each >ob < (ind the most recently hired em!loyee in each de!artment ; .n %hich year did most !eo!le >oin the com!anyE Dis!lay the year and the number o# em!loyees 2D Which de!artment has the highest annual remuneration billE 22 Write a Buery to dis!lay a [3N against the ro% o# the most recently hired em!loyee 25 Write a correlated sub$Buery to list out the em!loyees %ho earn more than the a"erage salary o# their de!artment 26 (ind the nth ma'imum salary 2M Select the du!licate records ,Records& %hich are inserted& that already e'ist- in the )4P table 2: Write a Buery to list the length o# ser"ice o# the em!loyees ,o# the #orm n years and m monthsKEC7H 2 S)L)*T D.ST.1*T,A )1A4)- (RO4 )4P A& )4P B WC)R) A )4P1O ? B 40R+ or S)L)*T )1A4) (RO4 )4P WC)R) )4P1O .1 ,S)L)*T 40R (RO4 )4P-+ 5 S)L)*T 3 (RO4 )4P WC)R) D)PT1O .1 ,S)L)*T D)PT1O (RO4 )4P 0RO8P B@ D)PT1O CA=.10 *O81T,)4P1O-G2D A1D D)PT1O?2D-+ 6 S)L)*T A )1A4) J)4PLO@))J& B )1A4) JR)PORTS TOJ (RO4 )4P A& )4P B WC)R) A 40R?B )4P1O+ M S)L)*T 3 (RO4 )4P WC)R) )4P1O .1 , S)L)*T )4P1O (RO4 )4P 4.18S S)L)*T 40R (RO4 )4P-+ : S)L)*T 3 (RO4 )4P WC)R) SAL G , S)L)*T 4.1,SAL- (RO4 )4P 0RO8P B@ D)PT1O CA=.10 D)PT1O?5D-+ I S)L)*T 3 (RO4 )4P WC)R) SAL G , S)L)*T 4AR,SAL- (RO4 )4P 0RO8P B@ HOB CA=.10 HOB ? 94A1A0)R9 -+ L S)L)*T HOB& 4AR,SAL- (RO4 )4P 0RO8P B@ HOB+ < S)L)*T 3 (RO4 )4P WC)R) ,D)PT1O& C.R)DAT)- .1 ,S)L)*T D)PT1O& 4AR,C.R)DAT)- (RO4 )4P 0RO8P B@ D)PT1O-+ ; S)L)*T TO7*CAR,C.R)DAT)&9@@@@9- J@)ARJ& *O81T,)4P1O- J1O O( )4PLO@))SJ (RO4 )4P 0RO8P B@ TO7*CAR,C.R)DAT)&9@@@@9- CA=.10 *O81T,)4P1O- ? ,S)L)*T 4AR,*O81T,)4P1O-- (RO4 )4P 0RO8P B@ TO7*CAR,C.R)DAT)&9@@@@9--+ 2D S)L)*T D)PT1O& LPAD,S84,253,SALO1=L,*O44&D---&2:- J*O4P)1SAT.O1J (RO4 )4P 0RO8P B@ D)PT1O CA=.10 S84, 253,SALO1=L,*O44&D--- ? ,S)L)*T 4AR,S84,253,SALO1=L,*O44&D---- (RO4 )4P 0RO8P B@ D)PT1O-+ 22 S)L)*T )1A4)& C.R)DAT)& LPAD,939& JR)*)1TL@ C.R)DJ (RO4 )4P WC)R) C.R)DAT) ? ,S)L)*T 4AR,C.R)DAT)- (RO4 )4P- 81.O1 S)L)*T )1A4) 1A4)& C.R)DAT)& LPAD,9 9&2:- JR)*)1TL@ C.R)DJ (RO4 )4P WC)R) C.R)DAT) U? ,S)L)*T 4AR,C.R)DAT)- (RO4 )4P-+ 25 S)L)*T )1A4)&SAL (RO4 )4P ) WC)R) SAL G ,S)L)*T A=0,SAL- (RO4 )4P ( WC)R) ) D)PT1O ? ( D)PT1O-+ 26 S)L)*T )1A4)& SAL (RO4 )4P A WC)R) V1 ? ,S)L)*T *O81T ,D.ST.1*T,SAL-- (RO4 )4P B WC)R) A SALF?B SAL-+ 2M S)L)*T 3 (RO4 )4P A WC)R) A )4P1O .1 ,S)L)*T )4P1O (RO4 )4P 0RO8P B@ )4P1O CA=.10 *O81T,)4P1O-G2- A1D A ROW.DU?4.1 ,ROW.D--+

51
2: S)L)*T )1A4) J)4PLO@))J&TO7*CAR,TR81*,4O1TCS7B)TW))1,S@SDAT)&C.R)DAT)-/25--KK9 @)ARS 9KK TO7*CAR,TR81*,4OD,4O1TCS7B)TW))1 ,S@SDAT)& C.R)DAT)-&25---KK9 4O1TCS 9 JL)10TC O( S)R=.*)J (RO4 )4P+

ORACLE FA/, 1. &'AT IS DATA OR INFORMATION0 An,1 T2e Matte3 t2at 4e 5eed 6nto t2e Comp7te3 6, ca--ed Data o3 In5o3mat6on. %. &'AT IS DATA#ASE0 An,1 T2e Co--ect6on o5 Inte33e-ated Data 6, ca--ed Data #a,e. 8. &'AT IS A DATA#ASE MANA!EMENT S$STEM (D#MS "AC9A!E0 An,1 T2e Co--ect6on o5 Inte33e-ated Data and ,ome "3o:3am, to acce,, t2e Data 6, Ca--ed Data #a,e Mana:ement S;,tem (D#MS . <. &'EN CAN &E SA$ A D#MS "AC9A!E AS RD#MS0 An,1 Fo3 a ,;,tem to /7a-65; a, RELATIONAL DATA#ASE MANA!EMENT ,;,tem, 6t m7,t 7,e 6t, RELATIONAL 5ac6-6t6e, to MANA!E t2e DATA#ASE. *. &'AT IS ORD#MS0 An,1 O=>ect (o36ented Re-at6ona- Data #a,e Mana:ement S;,tem 6, one t2at can ,to3e data, t2e 3e-at6on,26p o5 t2e data, and t2e =e2a?6o3 o5 t2e data (6.e., t2e 4a; 6t 6nte3act, 46t2 ot2e3 data . @. NAME SOME CODDAS RULES.

52
An,1 D3. E.F. Codd p3e,ented 1% 37-e, t2at a data=a,e m7,t o=e; 65 6t 6, to =e con,6de3ed t37-; 3e-at6ona-. O7t t2o,e, ,ome a3e a, 5o--o4, a T2e 37-e, ,tem 53om a ,6n:-e 37-eB t2e CDe3o 37-eE1 Fo3 a ,;,tem to /7a-65; a, RELATIONAL DATA#ASE MANA!EMENT ,;,tem, 6t m7,t 7,e 6t, RELATIONAL 5ac6-6t6e, to MANA!E t2e DATA#ASE. = In5o3mat6on R7-e1 Ta=7-a3 Rep3e,entat6on o5 In5o3mat6on. c !7a3anteed Acce,, R7-e1 Un6F7ene,, o5 t7p-e, 5o3 :7a3anteed acce,,6=6-6t;. d M6,,6n: In5o3mat6on R7-e1 S;,temat6c 3ep3e,entat6on o5 m6,,6n: 6n5o3mat6on a, NULL ?a-7e,. e Comp3e2en,6?e Data S7=BLan:7a:e R7-e1 /L to ,7ppo3t Data de56n6t6on, .6e4 de56n6t6on, Data man6p7-at6on, Inte:36t;, A7t2o36Dat6on and Sec736t;. G. &'AT ARE 'IERARC'ICAL, NET&OR9, AND RELATIONAL DATA#ASE MODELS0 An,1 a '6e3a3c26ca- Mode-1 T2e '6e3a3c26ca- Mode- 4a, 6nt3od7ced 6n t2e In5o3mat6on Mana:ement S;,tem (IMS de?e-oped =; I#M 6n 1H@I. In t26, data 6, o3:an6Ded a, a t3ee ,t37ct73e. Eac2 t3ee 6, made o5 node, and =3anc2e,. T2e node, o5 t2e t3ee 3ep3e,ent t2e 3eco3d t;pe, and 6t 6, a co--ect6on o5 data att36=7te, ent6t; at t2at po6nt. T2e topmo,t node 6n t2e ,t37ct73e 6, ca--ed t2e 3oot. Node, ,7cceed6n: -o4e3 -e?e-, a3e ca--ed c26-d3en. = Net4o3J Mode-1 T2e Net4o3J Mode-, a-,o ca--ed a, t2e CODS$L data=a,e ,t37ct73e, 6, an 6mp3o?ement o?e3 t2e '6e3a3c26ca- mode, 6n t26, mode- concept o5 pa3ent and c26-d 6, eKpanded to 2a?e m7-t6p-e pa3entBc26-d 3e-at6on,26p,, 6.e. an; c26-d can =e ,7=o3d6nate to man; d655e3ent pa3ent, (o3 node, . Data 6, 3ep3e,ented =; co--ect6on o5 3eco3d,, and 3e-at6on,26p, amon: data a3e 3ep3e,ented =; -6nJ,. A -6nJ 6, an a,,oc6at6on =et4een p3ec6,e-; t4o 3eco3d,. Man;BtoBman; 3e-at6on,26p, can eK6,t, =et4een t2e pa3ent and c26-d. c Re-at6ona- Mode-1 T2e Re-at6ona- Data=a,e Mode- e-6m6nate, t2e need 5o3 eKp-6c6t pa3entBc26-d 3e-at6on,26p,. In RD#MS, data 6, o3:an6Ded 6n t4oBd6men,6ona- ta=-e, con,6,t6n: o5 3e-at6ona-, 6.e. no po6nte3, a3e ma6nta6ned =et4een ta=-e,. I. &'AT IS DATA MODELIN!0 An,1 Data Mode-6n: de,c36=e, 3e-at6on,26p =et4een t2e data o=>ect,. T2e 3e-at6on,26p, =et4een t2e co--ect6on, o5 data 6n a ,;,tem ma; =e :3ap26ca--; 3ep3e,ented 7,6n: data mode-6n:. H. DEFINE ENTIT$, ATTRI#UTE AND RELATIONS'I". An,1 Ent6t;1 An Ent6t; 6, a t26n:, 426c2 can =e ea,6-; 6dent656ed. An ent6t; 6, an; o=>ect, p-ace, pe3,on, concept o3 act6?6t; a=o7t 426c2 an ente3p36,e 3eco3d, data. Att36=7te1 An att36=7te 6, t2e p3ope3t; o5 a :6?en ent6t;. Re-at6on,26p1 Re-at6on,26p 6, an a,,oc6at6on amon: ent6t6e,. 1L. &'AT IS ERBMODELIN!0

53
An,1 T2e EBR mode-6n: tec2n6F7e 6, t2e Top Do4n App3oac2. Ent6t; 3e-at6on,26p 6, tec2n6F7e 5o3 ana-;,6, and -o:6ca- mode-6n: o5 a ,;,temE, data 3eF763ement,. It 6, t2e mo,t 46de-; 7,ed and 2a, :a6ned acceptance a, t2e 6dea- data=a,e de,6:n. It 7,e, t23ee =a,6c 7n6t,1 ent6t6e,, t2e63 att36=7te, and t2e 3e-at6on,26p t2at eK6,t, =et4een t2e ent6t6e,. It 7,e, a :3ap26ca- notat6on 5o3 3ep3e,ent6n: t2e,e. 11. &'AT IS NORMALIMATION0 An,1 No3ma-6Dat6on 6, a ,tepB=;B,tep decompo,6t6on o5 comp-eK 3eco3d, 6nto ,6mp-e 3eco3d,. 1%. &'AT ARE .ARIOUS NORMAL FORMS OF DATA0 An,1 T2e F63,t No3ma- Fo3m 1NF, T2e Second No3ma- Fo3m %NF, T2e T263d No3ma- Fo3m 8NF, T2e #o;ce and Codd No3ma- Fo3m #C NF. 18. &'AT IS DENORMALIMATION0 An,1 T2e 6ntent6ona- 6nt3od7ct6on o5 3ed7ndanc; to a ta=-e to 6mp3o?e pe35o3mance 6, ca--ed DENORMALIMATION. 1<. &'AT ARE 1BTIER, %BTIER, 8BTIER OR NBTIER DATA#ASE ARC'ITECTURES0 An,1 1BT6e3 Data=a,e A3c26tect73e 6, =a,ed on ,6n:-e ,;,tem, 426c2 act, a, =ot2 ,e3?e3 and c-6ent. %BT6e3 A3c26tect73e 6, =a,ed on one ,e3?e3 and c-6ent. 8BT6e3 A3c26tect73e 6, =a,ed on one ,e3?e3 and c-6ent o7t t2at on c-6ent act a, a 3emote ,;,tem. NBT6e3 A3c26tect73e 6, =a,ed on N no. O5 ,e3?e3, and N no. O5 c-6ent,. 1*. &'AT ARE A TA#LE, COLUMN, AND RECORD0 An,1 Ta=-e1 A Ta=-e 6, a data=a,e o=>ect t2at 2o-d, ;o73 data. It 6, made 7p o5 man; co-7mn,. Eac2 o5 t2e,e co-7mn, 2a, a data t;pe a,,oc6ated 46t2 6t. Co-7mn1 A co-7mn, 3e5e33ed to a, an att36=7te, 6, ,6m6-a3 to a 56e-d 6n t2e 56-e ,;,tem. Reco3d1 A 3o4, 7,7a--; 3e5e33ed to a, t7p-e, 6, ,6m6-a3 to 3eco3d 6n t2e 56-e ,;,tem. 1@. &'AT IS DIFFERENCE #ET&EEN A "ROCEDURAL LAN!UA!E AND A NONB "ROCEDURAL LAN!UA!E0 An,1 "3oced73a- Lan:7a:e NONB"3oced73a- Lan:7a:e A p3o:3am 6n t26, 6mp-ement, a ,tepB=;B,tep a-:o36t2m to ,o-?e t2e p3o=-em. It conta6n, 42at to do =7t not 2o4 to do 1G.&'AT T$"E OF LAN!UA!E "S/L" IS0 An,1 S/L 6, a NonBp3oced73a-, <t2 :ene3at6on Lan:7a:e,N 426c2 conce3t, 42at to do 3at2e3 t2an 2o4 to do an; p3oce,,. 1I. An,1 CLASSIFICATION OF S/L COMMANDS0

54
DDL (Data De56n6t6on Lan:7a:e DML (Data Man6p7-at6n: Lan:7a:e DCL (Data Cont3oLan:7a:e DTL(Data T3an,act6on Lan:7a:e C3eate A-te3 D3op Se-ect In,e3t Update De-ete Ro--=acJ Comm6t !3ant Re?oJe 1H. &'AT IS DIFFERENCE #ET&EEN DDL AND DML COMMANDS0 An,1 Fo3 DDL command, a7tocomm6t 6, ON 6mp-6c6t-; 42e3ea, Fo3 DML command, a7tocomm6t 6, to =e t73ned ON eKp-6c6t-;. %L. &'AT IS DIFFERENCE #ET&EEN A TRANSACTION AND A /UER$0 An,1 A T3an,act6on 6, 7n6t o5 ,ome command, 42e3e a, /7e3; 6, a ,6n:-e -6ne 3eF7e,t 5o3 t2e 6n5o3mat6on 53om t2e data=a,e. %1. &'AT IS DIFFERENCE #ET&EEN TRUNCATE AND DELETE COMMANDS0 An,1 T37ncate Command 46-- de-ete a-- t2e 3eco3d, 42e3e a, De-ete Command 46-- de-ete ,pec656ed o3 a-- t2e 3eco3d, depend6n: on-; on t2e cond6t6on :6?en. %%. &'AT IS DIFFERENCE #ET&EEN U"DATE AND ALTER COMMANDS0 An,1 A-te3 command 6, 7,ed to mod65; t2e data=a,e o=>ect, 42e3e a, t2e Update command 6, 7,ed to mod65; t2e ?a-7e, o5 a data =a,e o=>ect,. %8. &'AT ARE COMMANDS OF TCL CATE!OR$0 An,1 !3ant and Re?oJe a3e t2e t4o command, =e-on: to t2e TCL Cate:o3;. %<. &'IC' IS AN EFFICIENT COMMAND B TRUNCATE OR DELETE0 &'$0 An,1 De-ete 6, t2e e556c6ent command =eca7,e 7,6n: t26, command 4e can de-ete on-; t2o,e 3eco3d, t2at a3e not 3ea--; 3eF763ed. %*. &'AT ARE RULES FOR NAMIN! A TA#LE OR COLUMN0 An,1 1 Name, m7,t =e 53om 1 to 8L =;te, -on:. % Name, cannot conta6n F7otat6on ma3J,. 8 Name, a3e not ca,e ,en,6t6?e. < A name m7,t =e:6n 46t2 an a-p2a=et6c c2a3acte3 53om ;o73 data=a,e c2a3acte3 ,et and t2e c2a3acte3, O and P. #7t t2e,e c2a3acte3, a3e d6,co73a:ed. * A name cannot =e ORACLE 3e,e3?ed 4o3d. @ A name m7,t =e 7n6F7e ac3o,, 6t, name,pace. O=>ect, 6n t2e name ,pace m7,t 2a?e d655e3ent name,. G A name can =e enc-o,ed 6n do7=-e F7ote,. %@. 'O& MAN$ COLUMNS CAN A TA#LE 'A.E0 An,1 A Ta=-e can 2a?e 1LLL co-7mn,. %G. &'AT ARE DIFFERENT DATAT$"ES SU""ORTED An,1 C2a3 (,6De , Nc2a3 (,6De , .a3c2a3% (,6De t;pe, 5o3 c2a3acte3 ?a-7e,, N7m=e3 (p3ec6,6on, ,ca-e , N7m=e3, N7m=e3 (n , p3ec6,6on data t;pe, 5o3 n7me36ca- ?a-7e,, Date data t;pe 5o3 date ?a-7e,, Lon:, Ra4 (,6De , Lon: Ra4, C-o=, #-o=, Nc-o=, #$ S/L0 , N?a3c2a3% (,6De data

F-oat, F-oat (=6na3; #56-e 5o3 -a3:e o=>ect,.

55
%I. &'AT IS DIFFERENCE #ET&EEN LON! AND LO# DATAT$"ES0 An,1 LO# LON! 1 T2e maK6m7m ,6De 6, <!#. % LO#, (eKcept NCLO# can =e att36=7te, o5 an o=>ect t;pe. 8 LO#, ,7ppo3t 3andom acce,, to data. < M7-t6p-e LO# co-7mn, pe3 ta=-e o3 LO# att36=7te, 6n an o=>ect t;pe. 1 T2e maK6m7m ,6De 6, %!#. % LON!, cannot. 8 LON!, ,7ppo3t on-; ,eF7ent6a- acce,,. < On-; one LON! co-7mn 4a, a--o4ed 6n a ta=-e %H. &'AT IS DIFFERENCE #ET&EEN C'AR AND .ARC'AR% DATAT$"ES0 An,1 .a3c2a3% 6, ,6m6-a3 to C2a3 =7t can ,to3e ?a36a=-e no. O5 c2a3acte3, and 426-e F7e3;6n: t2e ta=-e ?a3c2a3% t36m, t2e eKt3a ,pace, 53om t2e co-7mn and 5etc2e, t2e 3o4, t2at eKact-; matc2 t2e c36te36a. 8L. 'O& MUC' MEMOR$ IS ALLOCATED FOR DATE DATAT$"E0 &'AT IS DEFAULT DATE FORMAT IN ORACLE0 An,1 Fo3 Date data t;pe o3ac-e a--ocate, G =;te, Memo3;. De5a7-t Date Fo3mat 6,1 DDBMONB$$. 81. &'AT IS RAN!E FOR EAC' DATAT$"E OF S/L0 An,1 Datat;pe Ran:e C2a3 .a3c2a3% N7m=e3 F-oat LON!, RA&, LON!RA& La3:e O=>ect, (LO#E, %LLL =;te, <LLL =;te, "3ec6,6on 1 to 8I Sca-e BI< to 1%G "3ec6,6on 8I dec6ma-, O3 1%% =6na3; p3ec6,6on % !# <!# 8%. 'O& TO RENAME A COLUMN0 An,1 &e canEt 3ename a Co-7mn o5 a ta=-e d63ect-;. So 4e 5o--o4 t2e 5o--o46n: ,tep,. To Rename a Co-7mn1 a A-te3 t2e ta=-e ,pec65;6n: ne4 co-7mn name to =e :6?en and data t;pe. = T2en cop; t2e ?a-7e, 6n t2e co-7mn to =e 3enamed 6nto ne4 co-7mn. c d3op t2e o-d co-7mn. 88. 'O& TO DECREASE SIME OR C'AN!E DATAT$"E OF A COLUMN0 An,1 To Dec3ea,e t2e ,6De o5 a Data t;pe o5 a co-7mn 6. T37ncate t2e ta=-e 563,t. 66. A-te3 t2e ta=-e co-7mn 42o,e ,6De 6, to =e dec3ea,ed 7,6n: t2e ,ame name and data t;pe =7t ne4 ,6De. 8<. &'AT IS A CONSTRAINT0 &'AT ARE ITS .ARIOUS LE.ELS0 An,1 Con,t3a6nt1 Con,t3a6nt, a3e 3ep3e,entato3, o5 t2e co-7mn to en5o3ce data ent6t; and con,6,tenc;.T2e3e 3 t4o -e?e-, 1 Co-7mnB-e?e- con,t3a6nt, % Ta=-eB-e?e- con,t3a6nt,. 8*. LIST OUT ALL T'E CONSTRAINTS SU""ORTED #$ S/L. An,1 Not N7--, Un6F7e, C2ecJ, "36ma3; 9e; and Fo3e6:n 9e; o3 Re5e3ent6a- Inte:36t;.

56
8@. &'AT IS DIFFERENCE #ET&EEN UNI/UEQNOT NULL AND "RIMAR$ 9E$0 An,1 Un6F7e and Not N7-- 6, a com=6nat6on o5 t4o Con,t3a6nt, t2at can =e p3e,ent an; n7m=e3 o5 t6me, 6n a ta=-e and canEt =e a 3e5e3ent6a- Je; to an; co-7mn o5 an anot2e3 ta=-e 42e3e a, "36ma3; 9e; 6, ,6n:-e Con,t3a6nt t2at can =e on-; once 5o3 ta=-e and can =e a 3e5e3ent6a- Je; to a co-7mn o5 anot2e3 ta=-e =ecom6n: a 3e5e3ent6a- 6nte:36t;. 8G. &'AT IS A COM"OSITE "RIMAR$ 9E$0 An,1 A "36ma3; Je; c3eated on com=6nat6on o5 co-7mn, 6, ca--ed Compo,6te "36ma3; 9e;. 8I. &'AT IS A CANDIDATE COLUMN0 'O& MAN$ CANDIDATE COLUMNS CAN #E "OSSI#LE "ER COM"OSITE "RIMAR$ 9E$0 An,1 8H. 'O& An,1 A NULL no3 a ,pace ca-c7-at6on TO DEFINE A NULL .ALUE0 ?a-7e 6, ,omet26n: 426c2 6, 7na?a6-a=-e, 6t 6, ne6t2e3 De3o and an; mat2emat6ca46t2 NULL 6, a-4a;, NULL.

<L. &'AT IS NULL0 A CONSTRAINT OR DEFAULT .ALUE0 An,1 It 6, a de5a7-t ?a-7e. <1. &'AT IS DEFAULT .ALUE FOR E.ER$ COLUMN OF A TA#LE0 An,1 NULL. <%. &'AT IS CREATED IM"LICITL$ FOR E.ER$ UNI/UE AND "RIMAR$ 9E$ COLUMNS0 An,1 IndeK. <8. &'AT ARE LIMITATIONS OF C'EC9 CONSTRAINT0 An,1 In t26, 4e canAt ,pec65; ",e7do Co-7mn, -6Je ,;,date etc. <<. &'AT IS DIFFERENCE #ET&EEN REFERENCES AND FOREI!N 9E$ CONSTRAINT0 An,1 Re5e3ence, 6, 7,ed a, co-7mn -e?e- Je; 4o3d 42e3e a, 5o3e6:n Je; 6, 7,ed a, ta=-e -e?e- con,t3a6nt. <*. &'AT IS "ON DELETE CASCADE"0 An,1 42en t26, Je; 4o3d 6, 6nc-7ded 6n t2e de56n6t6on o5 a c26-d ta=-e t2en 42ene?e3 t2e 3eco3d, 53om t2e pa3ent ta=-e 6, de-eted a7tomat6ca--; t2e 3e,pect6?e ?a-7e, 6n t2e c26-d ta=-e 46-- =e de-eted. <@. &'AT IS "ARENTBC'ILD OR MASTERBDETAIL RELATIONS'I"0 An,1 A ta=-e 426c2 3e5e3ence, a co-7mn o5 anot2e3 ta=-e(7,6n: Re5e3ence, 6, ca--ed a, a c26-d ta=-e(deta6- ta=-e and a ta=-e 6, =e6n: 3e5e33ed 6, ca--ed "a3ent (Ma,te3 Ta=-e . <G. 'O& TO DRO" A "ARENT TA#LE &'EN ITES C'ILD TA#LE ERISTS0 An,1 U,6n: "on de-ete ca,cade". <I. IS ORACLE CASE SENSITI.E0 An,1 NO <H. 'O& ORACLE IDENTIFIES EAC' RECORD OF TA#LE UNI/UEL$0

426c2

57
An,1 #; C3eat6n: 6ndeKe, and 3e5e3ence ID,. *L. &'AT IS A "SEUDOBCOLUMN0 NAME SOME "SEUDOBCOLUMNS OF ORACLE0 An,1 Co-7mn, t2at a3e not c3eated eKp-6c6t-; =; t2e 7,e3 and can =e 7,ed eKp-6c6t-; 6n F7e36e, a3e ca--ed ",e7doBCo-7mn,. EK1c733?a-,neKt?a-,,;,dateS. *1. &'AT FOR "ORDER #$" CLAUSE FOR A /UER$0 An,1 To a33an:e t2e F7e3; 3e,7-t 6n a ,pec656ed o3de3(a,cend6n:,de,cend6n: =; de5a7-t 6t taJe, a,cend6n: o3de3. *%. &'AT IS "!ROU" #$" /UERIES0 An,1 To :3o7p t2e F7e3; 3e,7-t, =a,ed on cond6t6on. *8. NAME SOME A!!RE!ATE FUNCTIONS OF S/L0 An,1 A.!, MAR, SUM, MIN,COUNT. *<. &'AT IS DIFFERENCE #ET&EEN COUNT ( , COUNT (* FUNCTIONS0 An,1 Co7nt ( 46-- co7nt t2e ,pec656ed co-7mn 42e3ea, co7nt (* co7nt tota- no. o5 3o4, 6n a ta=-e. **. &'AT FOR ROLLU" AND CU#E O"ERATORS ARE0 An,1 To :et ,7=tota-, and :3and tota- o5 ?a-7e, o5 a co-7mn. *@. &'AT IS A SU#B/UER$0 An,1 A F7e3; 46t26n a F7e3; 6, ca--ed a ,7= F7e3; 42e3e t2e 3e,7-t o5 6nne3 F7e3; 46-- =e 7,ed =; t2e o7te3 F7e3;. *G. &'AT ARE S/L O"ERATORS0 An,1 .a-7e ( , Re5 ( 6, S/L ope3ato3. *I. ER"LAIN "AN$","SOME","ALL","ERISTS" O"ERATORS0 An,1 An;1 T2e An; (o3 6tE, ,;non;m SOME ope3ato3 comp7te, t2e -o4e,t ?a-7e 53om t2e ,et and compa3e, a ?a-7e to eac2 3et73ned =; a ,7= F7e3;. A--1 ALL compa3e, a ?a-7e to e?e3; ?a-7e 3et73ned =; S/L. EK6,t,1 T26, ope3ato3 p3od7ce, a #OOL&AN 3e,7-t,. I5 a ,7= F7e3; p3od7ce, an; 3e,7-t t2en 6t e?a-7ate, 6t to TRUE e-,e 6t e?a-7ate, 6t to FALSE. *H. &'AT IS A CORRELATED SU# /UER$, 'O& IT IS DIFFERENT FROM A NORMAL SU# /UER$0 An,1 A co33e-ated ,7=F7e3; 6, a ne,ted ,7=F7e3;, 426c2 6, eKec7ted once 5o3 eac2 CCand6date 3o4E =; t2e ma6n F7e3;, 426c2 on eKec7t6on 7,e, a ?a-7e 53om a co-7mn 6n t2e o7te3 F7e3;. In no3ma- ,7= F7e3; t2e 3e,7-t o5 6nne3 F7e3; 6, d;nam6ca--; ,7=,t6t7ted 6n t2e cond6t6on o5 t2e o7te3 F7e3; 42e3e a, 6n a co33e-ated ,7=F7e3;, t2e co-7mn ?a-7e 7,ed 6n 6nne3 F7e3; 3e5e3, to t2e co-7mn ?a-7e p3e,ent 6n t2e o7te3 F7e3; 5o3m6n: a co33e-ated ,7=F7e3;. @L. &'AT IS A TOIN B T$"ES OF TOINS0 An,1 A >o6n 6, 7,ed to com=6ne t4o o3 mo3e ta=-e, -o:6ca--; to :et F7e3; 3e,7-t,. T2e3e a3e 5o73 t;pe, o5 To6n, name-; 46--

58
E/UI To6n NONBE/UI To6n SELF To6n OUTER To6n. @1. &'AT ARE MINIMUM RE/UIREMENTS FOR AN E/UIBTOIN0 An,1 T2e3e ,2o-d =e at-ea,t one common co-7mn =et4een t2e >o6n6n: ta=-e,. @%. &'AT IS DIFFERENCE #ET&EEN LEFT, RI!'T OUTER TOIN0 An,1I5 t2e3e 3 an; ?a-7e, 6n one ta=-e t2at do not 2a?e co33e,pond6n: ?a-7e, 6n t2e ot2e3,6n an eF76 >o6n t2at 3o4 46-- not =e ,e-ected.S7c2 3o4, can =e 5o3ce57--; ,e-ected =; 7,6n: o7te3 >o6n ,;m=o-(Q on e6t2e3 o5 t2e ,6de,(-e5t o3 36:2t =a,ed on t2e 3eF763ement. @8. &'AT IS DIFFERENCE #ET&EEN E/UI AND SELF TOINS0 An,1 SELF TOIN 6, made 46t26n t2e ta=-e 42e3ea, E/UI TOIN 6, made =et4een d655e3ent ta=-e, 2a?6n: common co-7mn. @<. &'AT ARE "SET" O"ERATORS0 An,1 UNION, INTERSECT o3 MINUS 6, ca--ed SET O"ERATORS. @*. &'AT IS DIFFERENCE #ET&EEN "UNION" AND "UNION ALL" O"ERATORS0 An,1 UNION 46-- 3et73n t2e ?a-7e, d6,t6nct-; 42e3ea, UNION ALL 46-3et73n e?en d7p-6cate ?a-7e,. @@. NAME SOME NUM#ER, C'ARACTER, DATE, CON.ERSION, OT'ER FUNCTIONS. An,1 N7m=e3 F7nct6on,1 Ro7nd (m, UnV , T37nc (m, UnV , "o4e3 (m, n , SF3t, A=, (m , Ce6- (m , F-oo3 (m , Mod (m, n C2a3acte3 F7nct6on,1 C23 (K Conce3t (,t36n:1, ,t36n:% Lo4e3 (,t36n: Uppe3 (,t36n: S7=,t3 (,t36n:, 53om_,t3, to_,t3 ASCII (,t36n: Len:t2 (,t36n: In6tcap (,t36n: . Date F7nct6on,1 ,;,date Mont2, =et4een (d1, d% To_c2a3 (d, 5o3mat La,t da; (d NeKt_da; (d, da; . Con?e3,6on F7nct6on,1 To_c2a3 To_date

59
To_n7m=e3 @G. &'AT IS DIFFERENCE #ET&EEN MAR ( AND !REATEST ( FUNCTIONS0 An,1 MAR 6, an a::3e:ate 57nct6on 426c2 taJe, on-; one co-7mn name o5 a ta=-e a, pa3amete3 42e3ea, !3eate,t 6, a :ene3a- 57nct6on 426c2 can taJe an; n7m=e3 o5 ?a-7e, and co-7mn name, 53om d7a- and ta=-e 3e,pect6?e-;. @I. &'AT FOR N.L ( FUNCTION IS0 An,1 N.L F7nct6on 2e-p, 6n ,7=,t6t7t6n: a ?a-7e 6n p-ace o5 a NULL. @H. &'AT FOR DECODE ( FUNCTION IS0 An,1 It 6, ,7=,t6t7te, ?a-7e =a,6, and 6t act7a--; doe, an A65Bt2enB e-,eA te,t. GL. &'AT IS DIFFERENCE #ET&EEN TRANSLATE ( AND RE"LACE ( FUNCTIONS0 An,1 T3an,-ate( 6, a ,7pe3,et o5 57nct6ona-6t; p3o?6ded =; Rep-ace( . G1. &'AT IS DIFFERENCE #ET&EEN SU#STR ( AND INSTR ( FUNCTIONS0 An,1 S7=,t3( 46-- 3et73n t2e ,pec656ed pa3t o5 a ,t36n: 42e3ea, In,t3( 3et73n t2e po,6t6on o5 t2e ,pec656ed pa3t o5 t2e ,t36n:. G%. &'AT IS A TULIAN DA$ NUM#ER0 An,1 It 46-- 3et73n co7nt o5 t2e no. O5 da;, =et4een Tan7a3; 1, <G1% #C and t2e :6?en date. G8. 'O& TO DIS"LA$ TIME FROM A DATE DATA0 An,1 #; 7,6n: t6me 5o3mat a, A22 U22%<V1 m61 ,,A 6n to_c2a3( G<. 'O& TO INSERT DATE AND TIME INTO A DATE COLUMN0 An,1 #; 7,6n: 5o3mat AddBmonB;; 22 U22%<V1 m61 ,,A 6n to_date( 57nct6on. G*. &'AT IS DIFFERENCE #ET&EEN TO_DATE ( AND TO_C'AR ( CON.ERSION FUNCTIONS0 An,1 To_date con?e3t, c2a3acte3 date to date 5o3mat 42e3ea, To_c2a3 57nct6on con?e3t, date o3 n7me36ca- ?a-7e, to c2a3acte3,. G@. &'AT IS A .IE&0 'O& IT IS DIFFERENT FROM A TA#LE0 An,1 .6e4 6, data=a,e o=>ect, 426c2 eK6,t, -o:6ca--; =7t conta6n, no p2;,6ca- data and man6p7-ate, t2e =a,e ta=-e. .6e4 6, ,a?ed a, a ,e-ect ,tatement 6n t2e data=a,e and conta6n, no p2;,6ca- data 42e3ea, Ta=-e eK6,t, p2;,6ca--;. GG. &'AT IS DIFFERENCE #ET&EEN SIM"LE AND COM"LER .IE&S0 An,1 S6mp-e ?6e4, can =e mod656ed 42e3ea, Comp-eK ?6e4,(c3eated =a,ed on mo3e t2an one ta=-e cannot =e mod656ed. GI. &'AT IS AN INLINE .IE&0 An,1 In-6ne ?6e4 6, =a,6ca--; a ,7=F7e3; 46t2 an a-6a, t2at 7 can 7,e -6Je a ?6e4 6n,6de a S/L ,tatement. It 6, not a ,c2ema o=>ect -6Je S/LBo=>ect. GH. 'O& TO U"DATE A COM"LER .IE&0 An,1 U,6n: AINSTEAD OFA TRI!!ERS Comp-eK ?6e4, can =e Updated. 57nct6on.

6,

IL. &'AT FOR "&IT' C'EC9 O"TION" FOR A .IE&0 An,1 "&IT' C'EC9 O"TION" c-a7,e ,pec656e, t2at 6n,e3t, and 7pdate, 3 pe35o3med t23o7:2 t2e ?6e4 3 not a--o4ed to c3eate 3o4, 426c2 t2e ?6e4 cannot ,e-ect and t2e3e5o3e a--o4, 6nte:36t; con,t3a6nt, and data ?a-6dat6on c2ecJ, to =e en5o3ced on data =e6n: 6n,e3ted o3 7pdated. I1. &'AT IS AN INDER0 AD.ANTA!E OF AN INDER An,1 An IndeK 6, a data=a,e o=>ect 7,ed n O3ac-e to p3o?6de F76cJ acce,, to 3o4, 6n a ta=-e. An IndeK 6nc3ea,e, t2e pe35o3mance o5 t2e data=a,e. I%. &'AT IS A SE/UENCE0 "SEUDOBCOLUMNS ASSOCIATED &IT' SE/UENCE0 An,1 SeF7ence 6, a Data=a,e O=>ect 7,ed to :ene3ate 7n6F7e 6nte:e3, to 7,e a, p36ma3; Je;,. NeKt?a-, C733?a- a3e t2e ",e7do Co-7mn, a,,oc6ated 46t2 t2e ,eF7ence. **I8. &'AT IS A CLUSTER0 &'EN TO USE A CLUSTER0 'O& TO DRO" A CLUSTER &'EN CLUSTERED TA#LE ERISTS0 An,1 C-7,te3 and IndeKe, a3e t3an,pa3ent to t2e 7,e3. C-7,te36n: 6, a met2od o5 ,to36n: ta=-e, t2at a3e 6nt6mate-; 3e-ated and a3e o5ten >o6ned to:et2e3 6nto t2e ,ame a3ea on t2e d6,J. &2en c-7,te3 ta=-e eK6,t, t2en to d3op c-7,te3 4e 2a?e to d3op t2e ta=-e 563,t t2en on-; c-7,te3 6, to =e d3opped. I<. &'AT IS A SNA"S'OT OR MATERIALIMED .IE&0 An,1 Mate36a-6Ded ?6e4, can =e 7,ed to 3ep-6cate data. Ea3-6e3 t2e data 4a, 3ep-6cated t23o7:2 CREATE SNA"S'OT command. No4 CREATE MATERIALIMED .IE& can =e 7,ed a, ,;non;m 5o3 CREATE SNA"S'OT. /7e3; pe35o3mance 6, 6mp3o?ed 7,6n: t2e mate36a-6Ded ?6e4 a, t2e,e ?6e4, p3e ca-c7-ate eKpen,6?e >o6n, and a::3e:ate ope3at6on, on t2e ta=-e. I*. &'AT IS A S$NON$M0 An,1 A S;non;m 6, a data=a,e o=>ect t2at a--o4, ;o7 to c3eate a-te3nate name, 5o3 O3ac-e ta=-e, and ?6e4,. It 6, an a-6a, 5o3 a ta=-e, ?6e4, ,nap,2ot, ,eF7ence, p3oced73e, 57nct6on o3 pacJa:e. I@. &'AT IS DIFFERENCE #ET&EEN "RI.ATE AND "U#LIC S$NON$M0 An,1 On-; t2e 7,e3 o3 ta=-e o4ne3 can 3e5e3ence "36?ate ,;non;m 42e3ea, an; 7,e3 can 3e5e3ence t2e "7=-6c ,;non;m. IG. &'AT IS DIFFERENCE #ET&EEN "S/L" AND "S/L*"LUS" COMMANDS0 An,1 S/L command, a3e ,to3ed 6n t2e =755e3 42e3ea, S/L*"LUS a3e not. **II. NAME SOME S/L*"LUS COMMANDS0 An,1 DESC UCRI#EV, START, !ET, SA.E, N a3e S/L*"LUS COMMANDS. IH. &'AT ARE "S/L*"LUS RE"ORTIN!" COMMANDS0 An,1 S"OOL 56-eBname, S"OOL OUT, TTITLE, #TITLE, #REA9 ON, COM"UTE Wan; a::3e:ate 57nct6on)

61
OF Wco-7mn name) U=3eaJV ON Wco-7mn name) etc a3e S/L*"LUS RE"ORTIN! COMMANDS. HL. &'AT ARE S$STEM AND O#TECT "RI.ILE!ES0 An,1 Connect and Re,o73ce etc a3e S;,tem "36?6-e:e,. C3eate Wo=>ect), Se-ect, In,e3t, A-te3 etc a3e O=>ect "36?6-e:e,. H1. &'AT FOR DCL COMMANDS ARE0 An,1 Comm6t, Ro--=acJ a3e DCL command,. H%. &'AT FOR !RANT COMMAND &IT' "&IT' !RANT O"TION"0 An,1 X&6t2 !3ant Opt6onY 46t2 !3ant Command :6?e, p36?6-e:e, to t2e 7,e3 to :3ant p36?6-e:e, to ot2e3 7,e3(, amon: t2e p36?6-e:e, 2eN,2e 2a,. H8. 'O& TO C'AN!E "ASS&ORD OF A USER0 An,1 U,6n: "a,,4o3d command o3 U,6n: ALTER USER W7,e3 name) IDENTIFIED #$ Wne4 pa,,4o3d) COMAND. H<. &'AT IS A SC'EMA AND SC'EMA O#TECTS0 An,1 A ,c2ema 6, a co--ect6on o5 -o:6ca- ,t37ct73e, o5 data, o3 ,c2ema o=>ect,. A ,c2ema 6, o4ned =; t2e data=a,e 7,e3 and 2a, t2e ,ame name a, t2at o5 7,e3. Eac2 7,e3 o4n, a ,6n:-e ,c2ema. Sc2ema o=>ect, 6nc-7de 5o--o46n: t;pe o5 o=>ect, C-7,te3,, Data=a,e L6nJ,, F7nct6on,, IndeKe,, "acJa:e,, "3oced73e,, SeF7ence,, S;non;m,, Ta=-e,, Data=a,e T36::e3,, .6e4,. **H*. 'O& TO STARTU" AND S'UTDO&N ORACLE DATA#ASE0 An,1 Sta3t7p and S27tdo4n O3ac-e data=a,e can =e done =; on-; t2e adm6n6,tato3. Sta3t7p 6, done =; 7,6n: STARTU" command and S27tdo4n 6, done =; S'UTDO&N command H@. &'AT IS A SESSION0 An,1 T2e pe36od =et4een Lo:6n and Lo:o55 on ,c2ema. HG. &'AT IS A CLIENT "ROCESS0 &'AT IS A SER.ER "ROCESS0 An,1 3e51 1G% / Z A. HI. 'O& TO MA9E E.ER$ DML O"ERATION AS AUTO COMMIT0 An,1 #; 7,6n: SET AUTOCOMMIT ON command. HH. 'O& TO DIS"LA$ DATA "A!E &ISE IN S/L0 An,1 #; 7,6n: SET "AUSE ON command. 1LL. 'O& TO C'AN!E LINE SIME, "A!E SIME AND S/L "ROM"T0 An,1 #; 7,6n: SET LINESIME W?a-7e), SET "A!ESIME W?a-7e), SET S/L"ROM"T Wne4 p3ompt). 1L1. 'O& "LNS/L IS DIFFERENT FROM S/L0 An,1 S/L 6, nonBp3oced73a- -an:7a:e 42e3ea, "LNS/L 6, p3oced73a-an:7a:e t2at 6nc-7de, 5eat73e, and de,6:n o5 p3o:3amm6n: -an:7a:e. 1L%. &'AT IS ARC'ITECTURE OF "LNS/L0 An,1

62
1L8. &'AT IS A "LNS/L #LOC90 An,1 DECLARE Wdec-a3at6on,) #E!IN WEKecec7ta=-e Statement,) ERCE"TION WEKcept6on 'and-e3(, ) END+ 1L<. &'AT ARE DIFFERENT T$"ES OF "LNS/L #LOC9S0 An,1 DECLARE #LOC91 In t26, =-ocJ a-- t2e dec-a3at6on, o5 t2e ?a36a=-e 7,ed 6n t2e p3o:3am 6, made. I5 no ?a36a=-e, a3e 7,ed t26, =-ocJ 46-- =ecome opt6ona-. #E!IN #LOC91 In t26, =-ocJ a-- t2e eKec7ta=-e ,tatement, a3e p-aced. T26, =-ocJ 6, Mandato3;. ERCE"TION #LOC91 In t26, =-ocJ a-- t2e eKcept6on, a3e 2and-ed. T26, =-ocJ 6, a-,o ?e3; opt6ona-. END1 E?e3; =e:6n m7,t =e ended 46t2 t26, END+ ,tatement. 1L*. &'AT ARE COM"OSITE DATA T$"ES0 An,1 Reco3d,, Ta=-e, a3e t4o Compo,6te data t;pe,. 1L@. &'AT IS SCO"E OF A .ARIA#LE IN "LNS/L #LOC90 An,1 T2e ?6,7a=6-6t; and acce,,6=6-6t; o5 a ?a36a=-e 46t26n t2e =-ocJ(, 6, ca--ed ,cope o5 a ?a36a=-e. 1LG. &'AT IS A NESTED #LOC90 An,1 A =-ocJ 46t26n a =-ocJ 6, ca--ed Ne,ted #-ocJ. 1LI. &'AT IS A "LNS/L EN!INE0 An,1 T2e "LNS/L en:6ne accept, an; ?a-6d "LNS/L =-ocJ a, 6np7t, eKec7te, t2e p3oced73a- pa3t o5 t2e ,tatement, and ,end, t2e S/L ,tatement, to t2e S/L ,tatement eKec7to3 6n t2e O3ac-e ,e3?e3. 1LH. &'AT IS DEFAULT .ALUE FOR A NUMERIC "LNS/L .ARIA#LE0 An,1 NULL 11L. &'AT IS DIFFERENCE #ET&EEN SIM"LE LOO" AND A FOR LOO"0 An,1 S6mp-e 3eF763e, dec-a3at6on o5 ?a36a=-e, 7,ed 6n 6t and eK6t cond6t6on =7t Fo3 Loop doe,nEt 3eF763e t26,. 111. &'AT IS A CURSOR0 STE"S TO USE A CURSOR0 An,1 C73,o3 6, "36?ate S/L a3ea 6n "LNS/L. Dec-a3e t2e C73,o3, Open t2e C73,o3, Fetc2 ?a-7e, 53om S/L 6nto t2e -oca- .a36a=-e,, C-o,e t2e C73,o3. 11%. 'O& MAN$ T$"ES OF CURSORS ARE SU""ORTED #$ ORACLE0 An,1 T2e3e a3e t4o t;pe, o5 c73,o3, name-; Imp-6c6t C73,o3, EKp-6c6t C73,o3.

63
118. &'AT IS A CURSOR FOR LOO"0 An,1 C73,o3 Fo3 Loop 6, ,2o3tc7t p3oce,, 5o3 EKp-6c6t C73,o3, =eca7,e t2e C73,o3 6, Open, Ro4, a3e 5etc2ed once 5o3 eac2 6te3at6on and t2e c73,o3 6, c-o,ed a7tomat6ca--; 42en a-- t2e 3o4, 2a?e =een p3oce,,ed. 11<. &'AT ARE CURSOR ATTRI#UTES0 An,1 [Fo7nd [NotFo7nd [I,Open [Ro4Co7nt a3e t2e c73,o3 att36=7te,. 11*. &'AT IS USE OF CURSOR &IT' "FOR U"DATE OF" CLAUSE0 An,1 T26, C-a7,e ,top acce,,6n: o5 ot2e3 7,e3, on t2e pa3t6c7-a3 co-7mn, 7,ed =; t2e c73,o3 7nt6- t2e COMMIT 6, 6,,7ed. 11@. &'AT IS AN ERCE"TION0 'O& IT IS DIFFERENT FROM ERROR0 An,1 &2ene?e3 an e33o3 occ73, EKcept6on 3a6,e,. E33o3 6, a =7: 42e3ea, t2e EKcept6on 6, a 4a3n6n: o3 e33o3 cond6t6on. 11G. NAME SOME #UILTBIN ERCE"TIONS. An,1 Too_Man;_Ro4, No_Data_Fo7nd Me3o_D6?6de Not_Lo::ed_On Sto3a:e_E33o3 .a-7e_E33o3 etc. 11I. 'O& TO CREATE A USERBDEFINED ERCE"TION0 An,1 U,e3BDe56ned EKcept6on 6, c3eated a, 5o--o4,1 DECLARE WeKcept6on name) ERCE"TION+ B B B B B B B B B + B B B B B B B B B+ #E!IN B B B B B B B B B+ B B B B B B B B B+ RAISE WeKcept6on name)+ ERCE"TION &'EN WeKcept6on name) T'EN B B B B B B B B B+ B B B B B B B B B+ END+ 11H. &'AT IS "OT'ERS" ERCE"TION0 An,1 It 6, 7,ed to a-on: 46t2 one o3 mo3e eKcept6on 2and-e3,. T26, 46-- 2and-e a-- t2e e33o3, not a-3ead; 2and-ed 6n t2e =-ocJ. 1%L. &'AT IS SCO"E OF ERCE"TION 'ANDLIN! IN NESTED #LOC9S0 An,1 EKcept6on ,cope 46-- =e 46t2 6n t2at =-ocJ 6n 426c2 eKcept6on 2and-e3 6, 436tten. 1%1. &'AT IS A SU#B"RO!RAM0 An,1 A SU#"RO!RAM IS A "LNS/L #LOC9, &'IC' &ILL #E IN.O9ED #$ TA9IN! "ARAMATERS.

64

1%%. &'AT ARE DIFFERENT T$"ES OF SU#B"RO!RAMS0 An,1 T'E$ R T&O T$"ES1 1 "ROCEDURE % FUNCION. 1%8. 'O& A "ROCEDURE IS DIFFERENT FROM A FUNCTION0 An,1 F7nct6on 2a, 3et73n Je; 4o3d and 3et73n, a ?a-7e 42e3ea, a "3oced73e doe,nEt 3et73n an; ?a-7e. 1%<. &'AT ARE T$"ES OF "ARAMETERS T'AT CAN #E "ASSED TO FUNCTION OR "ROCEDURE0 An,1 IN, IN OUT, OUT. 1%*. &'AT IS "IN OUT" "ARAMETER0 An,1 A pa3amete3, 426c2 :et, ?a-7e 6nto t2e "3oced73e o3 F7nct6on and taJe, t2e ?a-7e o7t o5 t2e "3oced73e o3 F7nct6on a3ea, 6, ca--ed IN OUT pa3amete3. 1%@. DOES ORACLE SU""ORTS "ROCEDURE O.ERLOADIN!0 An,1 NO. 1%G. &'AT IS A "AC9A!E AND "AC9A!E #OD$0 An,1 "acJa:e 6, dec-a3at6?e pa3t o5 t2e 57nct6on, and p3oced73e, ,to3ed 6n t2at pacJa:e and pacJa:e =od; 6, t2e de56n6t6on pa3t o5 t2e 57nct6on, and p3oced73e, o5 t2at pacJa:e. 1%I. &'AT IS AD.ANTA!E OF "AC9A!E O.ER "ROCEDURE OR FUNCTION0 An,1 "acJa:e, p3o?6de, F7nct6on, o3 "3oced73e, O?e3-oad6n: 5ac6-6t; and ,ec736t; to t2o,e F7nct6on, o3 "3oced73e,. 1%H. IS IT "OSSI#LE TO 'A.E A "ROCEDURE AND A FUNCTION &IT' T'E SAME NAME0 An,1 NO 65 6t 6, o7t ,6de a "acJa:e, $ES 65 6t 6, 46t26n a "acJa:e. 18L. DOES ORACLE SU""ORTS RECURSI.E FUNCTION CALLS0 An,1 $ES. 181. &'AT IS A TRI!!ER0 'O& IT IS DIFFERENT FROM A "ROCEDURE0 An,1 T36::e31 A T36::e3 6, a ,to3ed "LNS/L p3o:3am 7n6t a,,oc6ated 46t2 a ,pec656c data=a,e ta=-e. "3oced73e1 A "3oced73e 6, to =e eKp-6c6t-; ca--ed =; t2e 7,e3 42e3ea, T36::e3, a3e a7tomat6ca--; ca--ed 6mp-6c6t-; =; O3ac-e 6t,e-5 42ene?e3 e?ent Occ73,. 18%. &'AT IS DIFFERENCE #ET&EEN A TRI!!ER AND A CONSTRAINT0 An,1 Con,t3a6nt, a3e a-4a;, TRUE 42e3ea, T36::e3, a3e NOT a-4a;, TRUE and Con,t3a6nt, 2a, ,ome -6m6tat6on, 42e3ea, T36::e3 2a, no -6m6tat6on,. 188. &'AT ARE DIFFERENT E.ENTS FOR A TRI!!ER AND T'EIR SCO"ES0 An,1 In,e3t, Update o3 De-ete. 18<. &'AT IS DIFFERENCE #ET&EEN TA#LE LE.EL AND RO& LE.EL TRI!!ERS0 An,1 Ta=-e -e?e- T36::e3, eKec7te once 5o3 eac2 ta=-e =a,ed t3an,act6on 42e3ea, Ro4 -e?e- T36::e3, 46-- eKec7te once FOR EAC' RO&.

65

** 18*. &'AT ARE AUTONOMOUS TRI!!ERS0 An,1 18@. &'AT IS AN "INSTEAD OF" TRI!!ER0 An,1 T2e,e T36::e3, a3e 7,ed 46t2 t2e Comp-eK .6e4, on-; to maJe po,,6=-e o5 In,e3t, Update and De-ete on t2o,e .6e4,. ** 18G. 'O& MAN$ TRI!!ERS CAN #E CONFI!URED ON A TA#LE AND .IE&0 An,1 18I. &'AT IS "TA#LE MUTATIN!" ERROR0 'O& TO SOL.E IT0 An,1 ORABL<LH11 Ta=-e name 6, m7tat6n:, t36::e3N57nct6on ma; not ,ee 6t Ca7,e 1 A t36::e3 o3 a 7,e3Bde56ned "LNS/L 57nct6on t2at 6, 3e5e3enced 6n t2e ,tatement attempted to F7e3; o3 mod65; a ta=-e t2at 4a, 6n t2e m6dd-e o5 =e6n: mod656ed =; t2e ,tatement t2at 563ed =; a t36::e3. Act6on 1 Re436te t2e t36::e3 o3 57nct6on ,o 6t doe, not 3ead t2e ta=-e. 18H. &'EN TO USE "1NE&" AND "1OLD" S"ECIFIERS0 An,1 T2e p3e56K 1o-d 6, 7,ed to 3e5e3 to ?a-7e, a-3ead; p3e,ent 6n t2e ta=-e. T2e p3e56K1 ne4 6, a co33e-at6on name t2at 3e5e3, to t2e ne4 ?a-7e t2at 6, 6n,e3ted N 7pdated. ** 1<L. &'AT IS A CONDITIONAL TRI!!ER0 An,1 ** 1<1. 'O& TO CREATE A USERBDEFINED .ARIA#LE IN "LNS/L0 An,1 1<%. 'O& TO CREATE AN ARRA$ .ARIA#LE IN "LNS/L0 An,1 U,6n: CREATE UOR RE"LACEV T$"E Wt;pe name) AS .ARRA$ (,6De OF ELEMENT_T$"E (NOT NULL Command+ **1<8. 'O& TO MA9E A USERBDEFINED DATA T$"E !LO#AL IN "LNS/L0 An,1 1<<. 'O& TO CREATE AN O#TECT IN ORACLE0 An,1 U,6n: CREATE UOR RE"LACEV T$"E Wt;pe name) AS O#TECT (ATTRI#UTE NAME DATA T$"E,.. Command 1<*. &'AT IS A TRANSIENT AND "ERSISTENT O#TECT0 An,1 T2e O=>ect c3eated 6n a ta=-e 6, ca--ed "e3,6,tent O=>ect. O=>ect c3eated on eKec7t6on o5 "LNS/L =-ocJ 6, ca--ed T3an,6ent O=>ect. **1<@. &'AT IS A COLUMN O#TECT AND TA#LE O#TECT0 An,1 A Co-7mn O=>ect 6, on-; a Co-7mn o5 a ta=-e. 1<G. 'O& TO !RANT "ERMISSION ON AN O#TECT TO OT'ER USER0 An,1 !RANT Wpe3m6,,6on) ON Wo=>ect name) TO W7,e3 name). 1<I. &'AT IS A COLLECTION OF ORACLE0 An,1 .a33a;, Ne,ted Ta=-e 6, a co--ect6on o5 O3ac-e. 1<H. &'AT IS DIFFERENCE #ET&EEN .ARRA$ AND NESTED TA#LE0

66
An,1 .a33a; 2a, a 56Ked ,6De. Ne,ted ta=-e, can ca33; an; n7m=e3 o5 ?a-7e,. 1*L. 'O& TO MODIF$ CONTENTS OF A .ARRA$ IN ORACLE0 An,1 To mod65; a ,to3ed .ARRA$ 6t 2a, to ,e-ected 6nto a "LNS/L ?a36a=-e and t2en 6n,e3ted =acJ 6nto t2e ta=-e. 1*1. &'AT IS USE OF "T'E" O"ERATOR FOR NESTED TA#LE0 An,1 T'E ope3ato3 a--o4, ne,ted ta=-e, to =e man6p7-ated 7,6n: DML 42en 6t 6, ,to3ed 6n a Ta=-e. 1*%. &'IC' "AC9A!E IS USED FOR FILE IN"UTNOUT"UT IN ORACLE0 An,1 UTL_FILE "acJa:e 6, 7,ed 5o3 F6-e 6np7tNo7tp7t 6n O3ac-e. 1*8. NAME SOME MET'ODS AND "ROCEDURES OF FILE INO "AC9A!E0 An,1 FO"EN FCLOSE FFLUS' IS_O"EN !ET_LINE "UT_LINE "UTF NE&_LINE **1*<. &'AT IS S/LT0 'O& IT IS DIFFERENT FROM TD#C CONNECTI.IT$0 An,1 S/LT 6, =a,6ca--; a Ta?a p3o:3am conta6n6n: em=edded ,tat6c S/L ,tatement, t2at a3e compat6=-e 46t2 Ta?a de,6:n p26-o,op2;. 1**. &'AT IS AN ITERATOR0 Name ,ome T$"ES OF ITERATORS0 An,1 S/LT Ite3ato3, a3e =a,6ca--; 3eco3d :3o7p, :ene3ated d736n: t3an,act6on, 426c2 3eF763e, man6p7-at6on o5 mo3e t2an one 3eco3d, 53om one o3 mo3e ta=-e,. T2e3e a3e t4o t;pe, Ite3ato3, name-; Named Ite3ato3 and "o,6t6ona- Ite3ato3. ** 1*@. &'AT ARE DIFFERENT STE"S TO &RITE A D$NAMIC S/L "RO!RAM0 An,1 E:1 c2a3 c_,F-,t36n:UV(\XDELETE FROM ,a6-o3, &'ERE 3at6n:)*Y]+ EREC S/L "RE"ARE 3ead;to:o FROM 1c_,F-,t36n:+ EREC S/L ERECUTE 3ead;to:o+ 1*G. &'AT IS TA#LE "ARTITIONIN! AND INDER "ARTITIONIN!0 An,1 O3ac-eI a--o4, ta=-e, and IndeKe, to =e pa3t6t6oned o3 =3oJen 7p 6nto ,ma--e3 pa3t, =a,ed on 3an:e o5 Je; ?a-7e,. "a3t6t6on6n: 6, a Xd6?6de and conF7e3Y ,t3ate:; t2at 6mp3o?e, adm6n6,t3at6on and pe35o3mance 6n data 4a3e2o7,e and OLT" ,;,tem,. 1*I. &'AT IS "ARALLEL "ROCESSIN!0 An,1 1*H. &'AT IS "'$SICAL MEMOR$ STRUCTURE OF ORACLE0 An,1 T2e =a,6c o3ac-e memo3; ,t37ct73e a,,oc6ated 46t2 O3ac-e 6nc-7de,1 So5t4a3e Code A3ea, T2e S;,tem !-o=a- A3ea (S!A T2e Data=a,e #755e3 Cac2e

67
T2e ,2a3ed "ooT2e "3o:3am !-o=a- A3ea, ("!A StacJ A3ea, Data A3ea, So3t A3ea, 1@L. &'AT IS LO!ICAL MEMOR$ STRUCTURE OF ORACLE0 D#_ST! STUDENT S$STEM EM" DE"T EM"_IND S.. .. DATA DATA INDER An,1 Data=a,e Ta=-e,pace D# O=>ect Se:ment EKtend, 1@1. &'AT IS S!A0 An,1 A S;,tem !-o=a- A3ea 6, a :3o7p o5 ,2a3ed memo3; a--ocated =; O3ac-e t2at conta6n, data and cont3o6n5o3mat6on 5o3 one O3ac-e data=a,e 6n,tance. IF t2e m7-t6p-e 7,e3, a3e conc733ent-; connected to t2e ,ame 6n,tance, t2e data 6n t2e 6n,tanceE, S!A 6, X,2a3edY amon: t2e 7,e3,. Con,eF7ent-;, t2e S!A 6, o5ten 3e5e33ed to a, e6t2e3 t2e X,;,tem !-o=a- A3eaY o3 t2e XS2a3ed !-o=a- A3eaY. 1@%. &'AT IS "!A0 An,1 T2e "3o:3am !-o=a- A3ea 6, a memo3; =755e3 t2at conta6n, data and cont3o- 6n5o3mat6on 5o3 a ,e3?e3 p3oce,,. A "!A 6, c3eated =; O3ac-e 42en a ,e3?e3 p3oce,, 6, ,ta3ted. T2e 6n5o3mat6on 6n a "!A depend, on t2e con56:73at6on o5 O3ac-e. 1@8. &'AT IS AN ORACLE INSTANCE0 An,1 E?e3; t6me a data=a,e 6, ,ta3ted, an S!A 6, a--ocated and O3ac-e =acJ:3o7nd p3oce,,e, a3e ,ta3ted. T2e com=6nat6on o5 t2e,e p3oce,,e, and memo3; =755e3, 6, ca--ed an O3ac-e 6n,tance. 1@<. &'AT ARE DIFFERENT ORACLE "ROCESSES0 An,1 A p3oce,, 6, a Xt23ead o5 cont3o-Y o3 a mec2an6,m 6n an ope3at6n: ,;,tem t2at can =e eKec7te a ,e36e, o5 ,tep,. Some ope3at6n: ,;,tem, 7,e te3m, >o=, o3 ta,J. A p3oce,, no3ma--; 2a, 6t, o4n p36?ate memo3; a3ea 6n 426c2 6t 37n,. An O3ac-e data=a,e ,;,tem 2a, :ene3a- t;pe, o5 p3oce,,1 U,e3 "3oce,,e, and O3ac-e "3oce,,e,. **1@*. &'AT IS DIFFERENCE #ET&EEN "MON AND SMON0 An,1 SMON (S;,tem Mon6to3 pe35o3m, 6n,tance 3eco?e3; at 6n,tance o5 ,ta3t7p. In a m7-t6p-e 6n,tance ,;,tem (one t2at 7,e, t2e pa3a--e- ,e3?e3 , SMON o5 one 6n,tance can a-,o pe35o3m 6n,tance 3eco?e3; ot2e3 6n,tance t2at 2a?e 5a6-ed 42e3ea, T2e "MON ("3oce,, Mon6to3 pe35o3m, p3oce,, 3eco?e3; 42en a 7,e3 p3oce,, 5a6-,.

68

**1@@. &'AT IS DIFFERENCE #ET&EEN DATA#ASE AND TA#LES"ACE0 An,1 1@G. &'AT IS TO# OF DATA#ASE &RITER (D#&R "ROCESS0 An,1 T2e Data #a,e &36te3 436te, mod656ed =-ocJ, 53om t2e data=a,e =755e3 cac2e to t2e data 56-e,. 1@I. &'AT IS TO# OF LO! &RITER (L!&R "ROC*SS0 An,1 T2e Lo: &36te3 436te, 3edo -o: 56-e, to d6,J. Redo -o: data 6, :ene3ated 6n t2e 3edo -o: =755e3 o5 t2e S!A. A, t3an,act6on, comm6t and -o: =755e3 56--,, L!&R 436te, 3edo ent36e, 6nto an on-6ne 3edo -o: 56-e. 1@H. &'AT IS RECO.ERER0 An,1 T2e Reco?e3 (RECO 6, 7,ed to 3e,o-?e d6,t36=7ted t3an,act6on, t2at a3e pend6n: d7e to net4o3J o3 ,;,tem 5a6-73e 6n a d6,t36=7ted data=a,e. At t6med 6nte3?a-,, t2e -ocaRECO attempt, to concept to 3emote data=a,e and a7tomat6ca--; comp-ete t2e comm6t o3 3o--=acJ o5 t2e -ocapo3t6on o5 an; pend6n: d6,t36=7ted t3an,act6on,. 1GL. &'AT IS ARC'I.ER0 An,1 T2e A3c26?e3 (ARC' cop6e, t2e on-6ne 3edo -o: 56-e, to a3c26?a,to3a:e 42en t2e; a3e 57--. ARC' 6, act6?e on-; 42en a data=a,eE, 3edo -o: 6, 7,ed ARC'ILO! mode. ** 1G1. &'AT IS A STORED /UER$0 An,1 .IE& 1G%. &'AT IS USER "ROCESS AND SER.ER "ROCESS0 An,1 A U,e3 p3oce,, 6, c3eated and ma6nta6ned to eKec7te t2e ,o5t4a3e code o5 an app-6cat6on p3o:3am (,7c2 a, "RO * "3o:3am o3 an ORACLE too- (,7c2 a, S/L * D#A . T2e U,e3 p3oce,, a-,o mana:e, t2e comm7n6cat6on 46t2 ,e3?e3 p3oce,,e,. U,e3 p3oce,,e, comm7n6cat6on 46t2 t2e ,e3?e3 p3oce,,e, t23o7:2 t2e p3o:3am 6nte35ace. Ot2e3 p3oce,,e, ca-- ORACLE p3oce,,e,. In a ded6cated ,e3?e3 con56:73at6on, a ,e3?e3 "3oce,, 2and-e, 3eF7e,t, 5o3 a ,6n:-e 7,e3 p3oce,,. A m7-t6t23ead ,e3?e3 con56:73at6on a--o4, man; 7,e3 p3oce,,e, to ,2a3e a ,ma-- n7m=e3 o5 ,e3?e3 p3oce,,e,, m6n6m6D6n: t2e 7t6-6Dat6on o5 a?a6-a=-e ,;,tem 3e,o73ce,. **1G8. &'AT IS A SELF REFERENTIAL INTE!RIT$0 An,1 Ta=-e 3e-ated to 6t,e-5 .Fo3e6:n Je; o5 t2e ta=-e -6nJ, to p36ma3; Je; o5 t2e ,ame ta=-e. 1G<. &'AT IS A "RAISE" STATEMENT0 An,1 It 6, 7,ed to Ra6,e EKcept6on,. 1G*. &'AT IS RO&ID0 'O& IT IS DIFFERENT FROM RO&NUM0 An,1 Ro46d 6, t2e add3e,, o5 t2e 3o4 at 42e3e 6t 6, ,to3ed 6n t2e data=a,e. Ro4n7m 6, co7nt o5 3eco3d, 42e3ea,

69
Ro46d 6, 6dent656cat6on o5 t2e eac2 3o4.

#:=:2I1S (2 8L9SQL:0 1. Integrati%n 2. I&*r%"ed *er'%r&ance 3. 8%rta ility 4. $%dularity %' *r%gra& de"el%*&ent 8L9SQL #L()>S S1;)1;-::0 ?eclare @aria les6 curs%rs6 user de'ined e/ce*ti%ns #egin S<l state&ents6 *l9s<l state&ents :/ce*ti%n +cti%ns t% *er'%r& .hen err%r %ccur :nd #L()> 178:S 1. +n%ny&%us0Ala eled l%c3s 2. =a&ed 1. Su *r%gra&s 0A*r%cedures B 'uncti%ns 2. 1riggers ?i'' #9. 8r%cedures B 1 $ay -eturn "alues 2. )%nn%t #e used inside select st&t :rr%r handling 1. S<lc%de 0 -eturn :rr%r c%de 2. S<lerr& 0 -eturn :rr%r $essage ;sing la eled 'iles )reate 'ile 0A:d *rint.s<l 2uncti%ns $ust return a single "alue )an e used inside select st&t

7, -un 'ile 0A C*rint

178:S (2 @+-I+#L:S:0 1. Scalar ty*e0Aint6 char6 date 2. )%&*%site ty*e als% 3n%.n as c%llecti%ns0Arec%rd6 nested ta le6 inde/0 y ta le6 @array. 3. -e'erence ty*e0Are' curs%r6 re' % Dect ty*e 4. L% ty*e0A 'ile6 l% 6 cl% 6 nl% 5. ( Dect ty*e0A% Dect ty*e6 sys.anyty*e6 sys.anydata6 sys.anydataset +11-I#;1:S:0 1. E178: 0 -eturn structure %' c%lu&n %' a ta le F;ser de'ined ty*es) su ty*e00Ais used t% gi"e alternate na&e '%r dataty*e Li3e"archar2 t% cnu 0 FSu ty*e cnu is inary integer) 2. E-%.ty*e 0 -eturn structure %' r%. %' a ta le #ul3 inding 0A2%rall )%n"erting et.een ?ata ty*es:0 1. i&*licit00Anu& er t% "archar2 2. :/*licit00t%Gdate6 t%Gchar 1( @I:5 (;18;1 (= S)-::=:0S:1 S:-@:-(;18;1 (= 1( 8-I=1 (;18;1: 0 ?#$SG(;18;1.8;1GLI=: Le/ical units can e classi'ied as:0 1. ?eli&iters 2. Identi'iers6 reser"ed .%rds6 <u%ted identi'iers 3. Literals character literals6 nu&eric literals6 #%%lean literals 4. )%&&ents00single0line6 &ultiline )urs%r: 0 S<l 8ri"ate 5%r3 area .here &ulti*le rec%rds are retrie"ed B &ani*ulated. 1. 1y*es:0 1. I&*licit curs%r +ttri utes:01.s<lEr%.c%unt 2. S<lE'%und 3. S<lEn%t'%und 4. S<lEis%*en 2. :/*licit curs%r +ttri utes: 0 1. Er%.c%unt 2. E'%und 3. En%t'%und 4. Eis%*en 2. 8r%cessing curs%r: 0 1. ?eclare

71 2. (*en 3. 2etch 4. )l%se e/ec s<l3 all%cate: "Gcurs%r"ar

)lient all%cati%n 0

1H-:: 2(-$S (2 I2 S1+1:$:=1S Fc%ntr%l structures) 1. I' 0 then 0 end 0 i' 2. I' 0 then 0 else 0 end 0 i' 3. I' 0 then 0 elsi' 0 end 0 i' 178:S (2 L((8S:0 1. #asic l%%* Fsi&*le) 2. '%r l%%* Fnu&eric) 3. 5hile l%%* 4. '%r l%%* Fcurs%r) :I):81I(=S:0 1. 178:S:0 1. *rede'ined %racle ser"er err%r 2. n%n0*rede'ined %racle ser"er err%r 3. user0de'ined err%r 2. 8-:?:2I:? :I):81I(=S:0 1. =(G?+1+G2(;=? 2. 1((G$+=7G-(5S 3. I=@+LI?G);-S(4. J:-(G?I@I?: 5. ?;8G@+LG(=GI=?:I 1( -+IS: :I):81I(=: 0 -+IS:G+88LI)+1I(=G:--(1( S:: :--(: 0 SH(5 :--(?ata ase % Dects F=+$:? S;# 8-(K-+$S) 1. 8r%cedures 2. 2uncti%ns 8+-+$:1:- $(?:S:0 1. In00de'ault 2. (ut 3. In%ut $:1H(?S 2(- 8+SSI=K 8+-+$:1:-S:0 1. 8(SI1I(=+L 2. =+$:? 3. )($#I=+1I(=

72 #ind "aria le is declared in h%st en"ir%n&ent 8l9s<l err%r handling 'uncti%ns 1. S<lc%de 2. S<lerr& 8+)>+K:S:0 1. )(=SIS1S (2:0 1. S8:)I2I)+1I(= 2. #(?7 2. S)(8::0 1. 8;#LI) 2. 8-I@+1: 1-IKK:-S 1. >inds 1. ?&l 0AI=S:-16 ;8?+1:6 ?:L:1: 2. Instead0%' F"ie.s) 3. Syste& 2. 1y*es 1. #e'%re 2. +'ter 3. Le"els 1. -%. 2. State&ent 4. )%rrelati%n identi'iers Fs*ecial 3ind %' *l9s<l ind "aria les) als% 3n%.n as 8seudrec%rds. ;sed %nly at -%. Le"el. 1.: ne. 0Aunde'ined '%r delete state&ent F=;LL) 2.:%ld 0Aunde'ined '%r insert state&ent F=;LL) 3.:*arent

73

(-+)L: 9I 2:+1;-:S:0 1. Scala lity 2. -elia lity 3. Single de"el%*&ent &%del 4. )%&&%n s3ill sets 5. (ne &anage&ent inter'ace 6. (ne "end%r (-+)L: H+S 2 8-(?;)1S 2(- )($8L:1: I=1:-=:1 +8LLI)+1I(=S:0 1. (racle 9i a**licati%n ser"er 2. (racle 9i data ase S7S1:$ ?:@:L(8$:=1 LI2: )7)L::0 1. Stratergy and +nalysis 2. ?esign 3. #uild and ?%cu&ent 4. 1ransiti%n 5. 8r%ducti%n ?+1+#+S:S 178:S: 0 1. 2lat 'ile syste& 2. Hierarchial 3. =et.%r3 4. -elati%nal 5. ( Dect relati%nal (-+)L: S1+-:$:=1S:0 1. ?QL9?-L 0 S:L:)1 2. ?$L 0 I=S:-1 ;8?+1:6 ?:L:1:6 and $:-K: 3. ??L 0 )-:+1: +L1:-6 ?-(86 -:=+$:6 1-;=)+1:6 $(?I27 +=? -:$(@: 4. 1)L 0 )($$I16 -(LL#+)>6 S+@:8(I=1

74 5. ?)L 0 K-+=16 -:@(>:

)+8+#ILI1I:S (2 S:L:)1 S1+$:=1S:0 1. 8r%Decti%n 2. Selecti%n 3. L%ining (*erat%r *recedence 0AM6 96 N6 0 )%ncatenati%n %*erat%r 0A OO Literals 0A Pis aQ -e&%"e du*licate r%.s 0Adistinct )%ntinuati%n character 0A 0 c%&*aris%n %*erat%rsF R6A6AR6S6SR6SA6) c%nditi%ns F et.een....and....6in6li3e6is null) L%gical c%nditi%n 0Aand6 %r6 n%t -;L:S (2 8-:):?:=)::0 1. +rith&etic %*erat%rs 2. )%ncatinati%n %*erat%r 3. )%&*arisi%n c%nditi%ns 4. is Tn%tU null6 li3e6 Tn%tU in 5. T=%tU et.een 6. =%t l%gical c%nditi%n 7. and l%gical c%nditi%n 8. %r l%gical c%nditi%n S%rt r%.s0A %rder y +S)9?:S) 0 last in select state&ent 2uncti%ns: 1y*es 1. Single -%. 2uncti%ns 1. )haracter 2uncti%ns 1. )ase $ani*ulati%n 2uncti%ns 0 l%.er6 u**er6 initca* 2. )haracter $ani*ulati%n 2uncti%ns 1. )%ncat 2.Su str 3.Length 4.Instr 5.L*ad 9 -*ad 6.1ri&9Ltri&9-tri& 7.-e*lace 2. =u& er 2uncti%ns 0 -%und6 1runcate6 $%d 3. ?ate 2uncti%ns 1. $%nthsG et.een 2.addG&%nths 3.ne/tGday 4.lastGday 5.r%und 6.trunc 4. )%n"ersi%n 2uncti%ns 1. 1%Gchar 2.t%Gnu& er 3.t%Gdate 5. Keneral 2uncti%ns 1. ="l 2.="l2 3.=ulli' 4.)%alesce )%nditi%nal e/*ressi%ns 0 )ase6 ?ec%de 2. $ulti*le r%. 'uncti%ns Fgr%u* 'uncti%ns) 1. +"g 2. )%unt 3. $a/ 4. Stdde" 5. Su& 6. @ariance 7. Kr%u* y 8. Ha"ing $ulti*le -%. (*erat%rs: 0 1. In 2. +ny 3. +ll

75 S;#S1I1;1I(= @+-I+#L:S: 01. Single +&*ersand 2. ?%u le +&*ersand 8-:?I2I=: @+-I+#L:S: 0 1. ?e'ine 2. ;nde'ine )($$+=?S: 0 1. @eri'y 2. :ch% S:10 is used t% set the c%&&ands SH(5 0 is used t% see the c%&&ands )%&&and @aria les 1. +rraysiVe 2. 2eed ac3 3. Heading 4. L%ng 2%r&at )%&&ands 1. )%lu&n 0 clear6 heading6 '%r&at6 n%*rint9*rint6 null 2. 1title 3. #title 4. #rea3 178:S (2 S;#Q;-:I:S:0 1. Single -%. su <uery 2. $ulti*le -%. su <uery ?+1+ 178: )%n"ersi%ns:0 1. I&*licit ?ataty*e c%n"ersi%n 2. :/*licit ?ataty*e c%n"ersi%n L(I=S: 0 -etrie"ing the rec%rds 'r%& &%re than %ne ta le using a c%nditi%n 1. :<ui D%in %r si&*le D%in %r inner D%in 2. =%n :<ui D%in 3. (uter D%in 4. Sel' D%in 5. )r%ss D%in %r )artesian *r%duct 6. =atural D%ins 0is ased %n all c%lu&ns in the ta les that ha"e the sa&e na&e 7. ;sing clause Fusing6 %n) 0t% &atch %nly %ne c%lu&n 8. 2ull %r t.% sided %uter D%in 9. +r itrary D%in c%nditi%ns '%r %uter D%ins L()>I=K:0 1. :/*licit l%c3ing 2. I&*licit l%c3ing ?e'ault %*ti%n 0 dataty*e &ust e sa&e as the c%lu&n dataty*e ?ata ?icti%nary 0 are the c%llecti%n %' ta les created y the %racle ser"er.

76

4 categ%ries %' data dicti%naries "ie.: 0 1. ;serG 2. +llG 3. ? aG 4. @W =+$:S (2 1+#L:S Q5:? #7 ;S:-: 0 Select ta le na&e 'r%& userGta les4 @ie. ?istinct ( Dects 1y*es (.ed y ;S:Select distinct % DectGty*e 'r%& userG% Dects4 ?+1+ 178:S:0 "archar26 char6 nu& er F*6s)6date6l%ng6cl% 6ra. and l%ng ra. #l% 6 'ile6 r%.id @ie. c%&&ents 1. +llGc%lGc%&&ents 2. ;serGc%lGc%&&ents 3. +llGta Gc%&&ents 4. ;serGta Gc%&&ents )%nstraints: ty*es 1. =%t null 0 )%ntains n% null "alues 2. ;ni<ue 0 )%ntains null "alues ut n% du*licate "alues 3. 8ri&ary 3ey 0 )%ntains n% null "alues and n% du*licate "alues 4. 2%reign 3ey 0 -e'erences the 8ri&ary c%lu&ns 5. )hec3 0 ?e*ends %n c%nditi%n @I:5I=K )(=S1-+I=1:0 Select )%nstraintG=a&e6 )%nstraintGX1y*e6 SearchG)%nditi%n 'r%& ;S:-G)(=S1-+I=1S .here 1a leG=a&e R!:$8!4 8S:;?()(L;$=S:0 1. )urr"al 2. =e/t"al 3. Le"el 4. -%.nu& 5. -%.id Set (*erat%rs 1. ;ni%n 2. ;ni%n all 3. Intersect 4. $inus 0 Selects %nly uni<ue -ec%rds 'r%& ta les 0 Selects all -ec%rds 'r%& ta les 0 Selects c%&&%n -ec%rds 'r%& ta les 0

?+1+#+S: (#L:)1S:0 1. 1a le 2. @ie. 0 Fsi&*le9c%&*le/) L%gically re*resents su sets %' data 'r%& %ne %r &%re ta les F2%rced "ie.) FSu <uery in 'r%& clause) FInline in .here clause)

77 3. Se<uence 4. Inde/ 0uni<ue9n%n uni<ue 5. Sysn%ny& 0*u lic 9*ri"ate Security: ty*es 1. Syste& security 2. ?ata security Syste& *ri"ileges 0 Kaining access t% the ?ata ase ( Dect 8ri"ileges 0 $ani*ulating the )%ntent %' the ?ata ase ( Dects Sche&as 0 )%llecti%ns %' ( Dects :/ternal 1a les 0 are read %nly ta les in .hich the data is st%red %utside the data ase in 2lat 'iles
Inde6 .earch !dd @!Q !s9 Question

Oracle SQL FAQ


VDate. 24*:eb*711G V VRe#ision. 2(&1 V VAuthor. :ran- NaudW V

Topics

What is SQL and 'here does it come from8 What are the difference bet'een DDL6 DML and D L commands8 ;o' does one escape characters 'hen building SQL >ueries8 ;o' does one eliminate duplicate ro's from a table8 ;o' does one generate primary -ey #alues for a table8 ;o' does one get the time difference bet'een t'o date columns8 ;o' does one add a dayMhourMminuteMsecond to a date #alue8 ;o' does one count different data #alues in a column8 ;o' does one countMsum RANGES of data #alues in a column8 an one retrie#e only the Nth ro' from a table8 an one retrie#e only ro's F to D from a table8 ;o' does one select EEERD Nth ro' from a table8 ;o' does one select the "%) N ro's from a table8 ;o' does one code a tree*structured >uery8 ;o' does one code a matri= report in SQL8 ;o' does one implement ,:*";EN*ELSE in a select statement8 ;o' can one dumpM e=amine the e=act content of a database column8 an one drop a column from a table8 an one rename a column in a table8 ;o' can , change my %racle pass'ord8 ;o' does one find the ne=t #alue of a se>uence8

78
Wor-around for snapshots on tables 'ith L%NG columns Where can one get more info about SQL8
+ac- to %racle :AQ ,nde=

What is SQL and where does it come rom!


Structured Query Language FSQL) is a language that *r%"ides an inter'ace t% relati%nal data ase syste&s. SQL .as de"el%*ed y I#$ in the 197,s '%r use in Syste& -6 and is a de 'act% standard6 as .ell as an IS( and +=SI standard. SQL is %'ten *r%n%unced S:Q;:L. ,n common usage SQL also encompasses DML /Data Manipulation Language36 for ,NSER"s6 C)DA"Es6 DELE"Es and DDL /Data Definition Language36 used for creating and modifying tables and other database structures( "he de#elopment of SQL is go#erned by standards( A ma?or re#ision to the SQL standard 'as completed in 2&&76 called SQL7( SQLG support ob?ect e=tensions and are /partially83 implemented in %racle4 and &( +ac- to top of file

What are the di erence "etween ##L$ #%L and #&L commands!
""$ is "ata "efinition $an+ua+e statements. .ome e6amplesK REA"E * to create ob?ects in the database AL"ER * alters the structure of the database DR%) * delete ob?ects from the database "RCN A"E * remo#e all records from a table6 including all spaces allocated for the records are remo#ed %MMEN" * add comments to the data dictionary GRAN" * gi#es user0s access pri#ileges to database REE%LE * 'ithdra' access pri#ileges gi#en 'ith the GRAN" command

"-$ is "ata -anipulation $an+ua+e statements. .ome e6amplesK S:L:)1 0 retrie"e data 'r%& the a data ase I=S:-1 0 insert data int% a ta le ;8?+1: 0 u*dates e/isting data .ithin a ta le ?:L:1: 0 deletes all rec%rds 'r%& a ta le6 the s*ace '%r the rec%rds re&ain )+LL 0 call a 8L9SQL %r La"a su *r%gra& :I8L+I= 8L+= 0 e/*lain access *ath t% data L()> 1+#L: 0 c%ntr%l c%ncurrency

79
"*$ is "ata *ontrol $an+ua+e statements. .ome e6amplesK )($$I1 0 sa"e .%r3 d%ne S+@:8(I=1 0 identi'y a *%int in a transacti%n t% .hich y%u can later r%ll ac3 -(LL#+)> 0 rest%re data ase t% %riginal since the last )($$I1 S:1 1-+=S+)1I(= 0 )hange transacti%n %*ti%ns li3e .hat r%ll ac3 seg&ent t% use

+ac- to top of file

'ow does one escape special characters when "uildin( SQL )ueries!
1he LI>: 3ey.%rd all%.s '%r string searches. 1he !G! .ild card character is used t% &atch e/actly %ne character6 !E! is used t% &atch Ver% %r &%re %ccurrences %' any characters. 1hese characters can e esca*ed in SQL. :/a&*le: SELECT name FROM emp &'ERE 6d LI9E A[^_[A ESCA"E A^A+ Cse t'o >uotes for e#ery one displayed( E=ample. SELECT AF3anJ,AA, O3ac-e ,6teA FROM DUAL+ SELECT AA AAF7otedAA 4o3d.A FROM DUAL+ SELECT AA AAAAdo7=-e F7otedAAAA 4o3d.A FROM DUAL+

+ac- to top of file

'ow does one eliminate duplicates rows rom a ta"le!


)h%%se %ne %' the '%ll%.ing <ueries t% identi'y %r re&%"e du*licate r%.s 'r%& a ta le lea"ing %nly uni<ue rec%rds in the ta le: -ethod 0K S/L) DELETE FROM ta=-e_name A &'ERE RO&ID ) ( % SELECT m6n(3o46d FROM ta=-e_name # 8 &'ERE A.Je;_?a-7e, ( #.Je;_?a-7e, + %ethod 2* S/L) c3eate ta=-e ta=-e_name% a, ,e-ect d6,t6nct * 53om ta=-e_name1+ S/L) d3op ta=-e_name1+ S/L) 3ename ta=-e_name% to ta=-e_name1+ S/L) BB Remem=e3 to 3ec3eate a-- 6ndeKe,, con,t3a6nt,, t36::e3,, etc on ta=-e... %ethod +* ,than-s to "ennis Curnic9) S/L) de-ete 53om m;_ta=-e t1 S/L) 42e3e eK6,t, (,e-ect AKA 53om m;_ta=-e t% S/L) 42e3e t%.Je;_?a-7e1 ( t1.Je;_?a-7e1 S/L) and t%.Je;_?a-7e% ( t1.Je;_?a-7e% S/L) and t%.3o46d ) t1.3o46d + =%te: (ne can eli&inate =Y2 unnecessary %*erati%ns y creating an inde/ %n the D%ined 'ields in the inner l%%* Fn% need t% l%%* thr%ugh the entire ta le %n each *ass y a rec%rd). 1his .ill s*eed0u* the deleti%n *r%cess. Note 7. ,f you are comparing N%"*NCLL columns6 use the NEL function( Remember that NCLL is not e>ual to NCLL( "his should not be a problem as all -ey columns should be N%" NCLL by definition(

8,
+ac- to top of file

'ow does one (enerate primar. -e. /alues or a ta"le!


)reate y%ur ta le .ith a =(1 =;LL c%lu&n Fsay S:Q=(). 1his c%lu&n can n%. e *%*ulated .ith uni<ue "alues: S/L) U"DATE ta=-e_name SET ,eFno ( RO&NUM+ or use a se>uences generator. S/L) CREATE SE/UENCE ,eF7ence_name START &IT' 1 INCREMENT #$ 1+ S/L) U"DATE ta=-e_name SET ,eFno ( ,eF7ence_name.NERT.AL+ 2inally6 create a uni<ue inde/ %n this c%lu&n. +ac- to top of file

'ow does one (et the time di erence "etween two date columns!
L%%3 at this e/a&*le <uery: ,e-ect 5-oo3(((date1Bdate% *%<*@L*@L N8@LL __ A 'OURS A __ 5-oo3((((date1Bdate% *%<*@L*@L B 5-oo3(((date1Bdate% *%<*@L*@L N8@LL *8@LL N@L __ A MINUTES A __ 3o7nd((((date1Bdate% *%<*@L*@L B 5-oo3(((date1Bdate% *%<*@L*@L N8@LL *8@LL B (5-oo3((((date1Bdate% *%<*@L*@L B 5-oo3(((date1Bdate% *%<*@L*@L N8@LL *8@LL N@L *@L __ A SECS A t6me_d655e3ence 53om ... ,f you don0t 'ant to go through the floor and ceiling math6 try this method /contributed by EriWile3. ,e-ect to_c2a3(to_date(ALL1LL1LLA,A''%<1MI1SSA Q (date1 B date% , A''%<1MI1SSA t6me_d655e3ence 53om ... Note that this >uery only uses the time portion of the date and ignores the date itself( ,t 'ill thus ne#er return a #alue bigger than 7G.H&.H&( +ac- to top of file

'ow does one add a da.0hour0minute0second to a date /alue!


1he S7S?+1: *seud%0c%lu&n sh%.s the current syste& date and ti&e. +dding 1 t% S7S?+1: .ill ad"ance the date y 1 day. ;se 'racti%ns t% add h%urs6 &inutes %r sec%nds t% the date. L%%3 at these e/a&*les: S/L) ,e-ect ,;,date, ,;,dateQ1N%<, ,;,date Q1N1<<L, ,;,date Q 1NI@<LL 53om d7a-+ S$SDATE S$SDATEQ1NI@<LL S$SDATEQ1N%< S$SDATEQ1N1<<L

81
BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBB L8BT7-B%LL% LI18%11% L8BT7-B%LL% LH18%11% L8BT7-B%LL% LI18811% L8BT7-B%LL% LI18%118 1he '%ll%.ing '%r&at is 're<uently used .ith (racle -e*licati%n: ,e-ect ,;,date NO&, ,;,dateQ8LN(%<*@L*@L NO&_"LUS_8L_SECS 53om d7a-+ NO& NO&_"LUS_8L_SECS BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBB L8BTULB%LL% 1@1<G1%8 L8BTULB%LL% 1@1<G1*8

+ac- to top of file

'ow does one count di erent data /alues in a column!


;se this si&*le <uery t% c%unt the nu& er %' data "alues in a c%lu&n: ,e-ect m;_ta=-e_co-7mn, co7nt(* 53om m;_ta=-e :3o7p =; m;_ta=-e_co-7mn+ + &%re s%*histicated e/a&*le... ,e-ect dept, ,7m( decode(,eK,AMA,1,L MALE, ,7m( decode(,eK,AFA,1,L FEMALE, co7nt(decode(,eK,AMA,1,AFA,1 TOTAL 53om m;_emp_ta=-e :3o7p =; dept+ +ac- to top of file

'ow does one count0sum 1A234S o data /alues in a column!


+ "alue / .ill e et.een "alues y and V i' K-:+1:S1F/6 y) R L:+S1F/6 V). L%%3 at this e/a&*le: ,e-ect 5%, ,7m(decode(:3eate,t(51,*H , -ea,t(51,1LL , 1, L "Ran:e @LB1LL", ,7m(decode(:3eate,t(51,8L , -ea,t(51, *H , 1, L "Ran:e 8LB*H", ,7m(decode(:3eate,t(51, L , -ea,t(51, %H , 1, L "Ran:e LLB%H" 53om m;_ta=-e :3o7p =; 5%+ 2%r e<ual siVe ranges it &ight e easier t% calculate it .ith ?:)(?:F1-;=)F"alue9range)6 ,6 rateG,6 16 rateG16 ...). :g. ,e-ect ename "Name", ,a- "Sa-a3;", decode( t37nc(5%N1LLL, L , L, L.L, 1, L.1, %, L.%, 8, L.81 "TaK 3ate" 53om m;_ta=-e+ +ac- to top of file

&an one retrie/e onl. the 2th row rom a ta"le!


Shai- Lhaleel *r%"ided this s%luti%n t% select the =th r%. 'r%& a ta le:

SELECT * FROM (

82
SELECT ENAME,RO&NUM RN FROM EM" &'ERE RO&NUM W 1L1 &'ERE RN ( 1LL+ =%te: =%te: In this 'irst it select %nly %ne &%re than the re<uired r%.6 then it selects the re<uired %ne. Its 'ar etter than using $I=;S %*erati%n.
Ra#i )achalla pro#ided this solution.

SELECT 51 FROM t1 &'ERE 3o46d ( ( SELECT 3o46d FROM t1 &'ERE 3o4n7m W( 1L MINUS SELECT 3o46d FROM t1 &'ERE 3o4n7m W 1L + +lternati"ely... SELECT * FROM emp &'ERE 3o4n7m(1 AND 3o46d NOT IN (SELECT 3o46d FROM emp &'ERE 3o4n7m W 1L + 8lease n%te6 there is n% e/*licit r%. %rder in a relati%nal data ase. H%.e"er6 this <uery is <uite 'un and &ay e"en hel* in the %dd situati%n. +ac- to top of file

&an one retrie/e onl. rows 5 to 6 rom a ta"le!


Shai- Lhaleel *r%"ided this s%luti%n t% the *r% le&:

SELECT * FROM ( SELECT ENAME,RO&NUM RN FROM EM" &'ERE RO&NUM W 1L1 &'ERE RN =et4een H1 and 1LL + =%te: the 1,1 is Dust %ne greater than the &a/i&u& r%. %' the re<uired r%.s F&eans /R 9,6 yR1,,6 s% the inner "alues is yN1). Another solution is to use the M,NCS operation( :or e=ample6 to display ro's H to X6 construct a >uery li-e this. SELECT * FROM ta=-eR &'ERE 3o46d 6n ( SELECT 3o46d FROM ta=-eR &'ERE 3o4n7m W( G MINUS SELECT 3o46d FROM ta=-eR &'ERE 3o4n7m W * + 8lease n%te6 there is n% e/*licit r%. %rder in a relati%nal data ase. H%.e"er6 this <uery is <uite 'un and &ay e"en hel* in the %dd situati%n. +ac- to top of file

'ow does one select 47416 2th row rom a ta"le!


(ne can easily select all e"en6 %dd6 %r =th r%.s 'r%& a ta le using SQL <ueries li3e this: -ethod 0K Csing a sub>uery SELECT * FROM emp

83
IN (SELECT RO&ID, MOD(RO&NUM,< FROM emp + %ethod 2* ;se dyna&ic "ie.s Fa"aila le 'r%& (racle7.2): SELECT * FROM ( SELECT 3o4n7m 3n, empno, ename FROM emp temp &'ERE MOD(temp.RO&NUM,< ( L+ 8lease n%te6 there is n% e/*licit r%. %rder in a relati%nal data ase. H%.e"er6 these <ueries are <uite 'un and &ay e"en hel* in the %dd situati%n. +ac- to top of file &'ERE (RO&ID,L

'ow does one select the TOP 2 rows rom a ta"le!


2%r& (racle8i %ne can ha"e an inner0<uery .ith an (-?:- #7 clause. L%%3 at this e/a&*le: SELECT * FROM (SELECT * FROM m;_ta=-e ORDER #$ co-_name_1 DESC &'ERE RO&NUM W 1L+ ;se this .%r3ar%und .ith *ri%r releases: SELECT * FROM m;_ta=-e a &'ERE 1L )( (SELECT COUNT(DISTINCT maKcoFROM m;_ta=-e = &'ERE =.maKco- )( a.maKcoORDER #$ maKco- DESC+ +ac- to top of file

'ow does one code a tree8structured )uer.!


1ree0structured <ueries are de'initely n%n0relati%nal Fen%ugh t% 3ill )%dd and &a3e hi& r%ll in his gra"e). +ls%6 this 'eature is n%t %'ten '%und in %ther data ase %''erings. "he S %""M",GER database schema contains a table EM) 'ith a self*referencing relation /EM)N% and MGR columns3( "his table is perfect for tesing and demonstrating tree*structured >ueries as the MGR column contains the employee number of the NcurrentN employee0s boss( "he LEEEL pseudo*column is an indication of ho' deep in the tree one is( %racle can handle >ueries 'ith a depth of up to 7HH le#els( Loo- at this e=ample. ,e-ect LE.EL, EM"NO, ENAME, M!R 53om EM" connect =; p36o3 EM"NO ( M!R ,ta3t 46t2 M!R 6, NULL+ (ne can *r%duce an indented re*%rt y using the le"el nu& er t% su string %r l*adF) a series %' s*aces6 and c%ncatenate that t% the string. L%%3 at this e/a&*le: ,e-ect -pad(A A, LE.EL * % __ ENAME ........ (ne uses the Zstart .ithZ clause t% s*eci'y the start %' the tree. $%re than %ne rec%rd can &atch the starting c%nditi%n. (ne disad"antage %' ha"ing a Zc%nnect y *ri%rZ clause is that y%u cann%t *er'%r& a D%in t% %ther ta les. 1he Zc%nnect y *ri%rZ clause is rarely i&*le&ented in the %ther data ase %''erings. 1rying t% d% this *r%gra&&atically is di''icult as %ne has t% d% the t%* le"el <uery 'irst6 then6 '%r each %' the rec%rds %*en a curs%r t% l%%3 '%r child n%des.

84
%ne 'ay of 'or-ing around this is to use )LMSQL6 open the dri#ing cursor 'ith the Nconnect by priorN statement6 and the select matching records from other tables on a ro'*by*ro' basis6 inserting the results into a temporary table for later retrie#al( +ac- to top of file

'ow does one code a matri9 report in SQL!


L%%3 at this e/a&*le <uery .ith sa&*le %ut*ut: SELECT * FROM (SELECT >o=, ,7m(decode(deptno,1L,,a,7m(decode(deptno,%L,,a,7m(decode(deptno,8L,,a,7m(decode(deptno,<L,,aFROM ,cott.emp !ROU" #$ >o= ORDER #$ 1+

DE"T1L, DE"T%L, DE"T8L, DE"T<L

+ac- to top of file

TO# DE"T1L DE"T%L DE"T8L DE"T<L BBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB ANAL$ST @LLL CLER9 18LL 1HLL H*L MANA!ER %<*L %HG* %I*L "RESIDENT *LLL SALESMAN *@LL

'ow does one implement :F8T'4284LS4 in a select statement!


1he (racle decode 'uncti%n acts li3e a *r%cedural state&ent inside an SQL state&ent t% return di''erent "alues %r c%lu&ns ased %n the "alues %' %ther c%lu&ns in the select state&ent. .ome e6amplesK ,e-ect decode(,eK, AMA, AMa-eA, AFA, AFema-eA, AUnJno4nA 53om emp-o;ee,+ ,e-ect a, =, decode( a=,(aB= , aB=, Aa ) =A, L, Aa ( =A, Aa W =A 53om

ta=-eR+

,e-ect decode( !REATEST(A,# , A, AA 6, :3eate3 OR E/UAL t2an #A, A# 6, :3eate3 t2an AA ... ,e-ect decode( !REATEST(A,# , A, decode(A, #, AA NOT !REATER T'AN #A, AA !REATER T'AN #A , AA NOT !REATER T'AN #A ... 2ote* 1he dec%de 'uncti%n is n%t +=SI SQL and is rarely i&*le&ented in %ther -?#$S %''erings. It is %ne %' the g%%d things a %ut (racle6 ut use it s*aringly i' *%rta ility is re<uired. :rom %racle 4i one can also use ASE statements in SQL( Loo- at this e=ample.

85
SELECT ename, CASE &'EN ,a-)1LLL T'EN AO?e3 pa6dA ELSE AUnde3 pa6dA END FROM emp+ +ac- to top of file

'ow can one dump0 e9amine the e9act content o a data"ase column!
SELECT DUM"(co-1 FROM ta=1 &'ERE cond1 ( ?a-1+ DUM"(COL1 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB T;p(H@ Len(<1 @*,@@,@G,8% 2%r this e/a&*le the ty*e is 966 indicating )H+-6 and the last yte in the c%lu&n is 326 .hich is the +S)II c%de '%r a s*ace. 1his tells us that this c%lu&n is lan30*added. +ac- to top of file

&an one drop a column rom a ta"le!


2r%& (racle8i %ne can ?-(8 a c%lu&n 'r%& a ta le. L%%3 at this sample script6 de&%nstrating the ALTER TABLE table_name DROP COLUMN column_name; c%&&and. %ther 'or-arounds. 1. S/L) 7pdate t1 ,et co-7mn_to_d3op ( NULL+ S/L) 3ename t1 to t1_=a,e+ S/L) c3eate ?6e4 t1 a, ,e-ect W,pec656c co-7mn,) 53om t1_=a,e+ %. S/L) c3eate ta=-e t% a, ,e-ect W,pec656c co-7mn,) 53om t1+ S/L) d3op ta=-e t1+ S/L) 3ename t% to t1+ +ac- to top of file

&an one rename a column in a ta"le!


=%6 this is listed as :nhance&ent -e<uest 163519. S%&e .%r3ar%unds: 1. BB U,e a ?6e4 46t2 co33ect co-7mn name,... 3ename t1 to t1_=a,e+ c3eate ?6e4 t1 Wco-7mn -6,t 46t2 ne4 name) a, ,e-ect * 53om t1_=a,e+ %. BB Rec3eate t2e ta=-e 46t2 co33ect co-7mn name,... c3eate ta=-e t% Wco-7mn -6,t 46t2 ne4 name) a, ,e-ect * 53om t1+ d3op ta=-e t1+ 3ename t% to t1+ 8. BB Add a co-7mn 46t2 a ne4 name and d3op an o-d co-7mn... a-te3 ta=-e t1 add ( ne4co-ame datat;pe + 7pdate t1 ,et ne4co-name(o-dco-name+ a-te3 ta=-e t1 d3op co-7mn o-dco-name+ +ac- to top of file

86

'ow can : chan(e m. Oracle password!


Issue the '%ll%.ing SQL c%&&and: ALTER USER W7,e3name) IDENTIFIED #$ Wne4_pa,,4o3d) N :rom %racle4 you can ?ust type Npass'ordN from SQLO)lus6 or if you need to change another user0s pass'ord6 type Npass'ord user9nameN( +ac- to top of file

'ow does one ind the ne9t /alue o a se)uence!


8er'%r& an Z+L1:- S:Q;:=): ... =()+)H:Z t% unl%ad the unused cached se<uence nu& ers 'r%& the (racle li rary cache. 1his .ay6 n% cached nu& ers .ill e l%st. I' y%u then select 'r%& the ;S:-GS:Q;:=):S dicti%nary "ie.6 y%u .ill see the c%rrect high .ater &ar3 "alue that .%uld e returned '%r the ne/t =:I1@+LL call. +'ter.ards6 *er'%r& an Z+L1:- S:Q;:=): ... )+)H:Z t% rest%re caching. Dou can use the abo#e techni>ue to pre#ent se>uence number loss before a SHUTDOW A!ORT6 or any other operation that 'ould cause gaps in se>uence #alues( +ac- to top of file

Wor-around or snapshots on ta"les with LO23 columns


7%u can use the SQLM8lus )(87 c%&&and instead %' sna*sh%ts i' y%u need t% c%*y L(=K and L(=K -+5 "aria les 'r%& %ne l%cati%n t% an%ther. :g: CO"$ TO SCOTTNTI!ER`REMOTE B CREATE IMA!E_TA#LE USIN! B SELECT IMA!E_NO, IMA!E B FROM IMA!ES+ =%te: I' y%u run (racle86 c%n"ert y%ur L(=Ks t% L(#s6 as it can e re*licated.

:*E7 * Basiscs o# PL/SQL 2 What is PL/SQL E PL/SQL is a !rocedural language that has both interacti"e SQL and !rocedural !rogramming language constructs such as iteration& conditional branching 5 What is the basic structure o# PL/SQL E PL/SQL uses block structure as its basic structure Anonymous blocks or nested blocks can be used in PL/SQL

87
6 What are the com!onents o# a PL/SQL block E A set o# related declarations and !rocedural statements is called block M What are the com!onents o# a PL/SQL Block E Declarati"e !art& )'ecutable !art and )'ec!tion !art Dataty!es PL/SQL : What are the dataty!es a a"ailable in PL/SQL E Some scalar data ty!es such as 184B)R& =AR*CAR5& DAT)& *CAR& LO10& BOOL)A1 Some com!osite data ty!es such as R)*ORD V TABL) I What are P T@P) and P ROWT@P) E What are the ad"antages o# using these o"er dataty!esE P T@P) !ro"ides the data ty!e o# a "ariable or a database column to that "ariable P ROWT@P) !ro"ides the record ty!e that re!resents a entire ro% o# a table or "ie% or columns selected in the cursor The ad"antages are / . 1eed not kno% about "ariable9s data ty!e ii .# the database de#inition o# a column in a table changes& the data ty!e o# a "ariable changes accordingly L What is di##erence bet%een P ROWT@P) and T@P) R)*ORD E P ROWT@P) is to be used %hene"er Buery returns a entire ro% o# a table or "ie% T@P) rec R)*ORD is to be used %hene"er Buery returns columns o# di##erent table or "ie%s and "ariables )g -+ T@P) r7em! is R)*ORD ,eno em! em!noP ty!e&ename em! ename Pty!e

e7rec em!P ROWT@P) cursor c2 is select em!no&de!tno #rom em!+ e7rec c2 PROWT@P)

< What is PL/SQL table E Ob>ects o# ty!e TABL) are called JPL/SQL tablesJ& %hich are modelled as ,but not the same as- database tables& PL/SQL tables use a !rimary PL/SQL tables can ha"e one column and a !rimary key Cursors ; What is a cursor E Why *ursor is reBuired E

88
*ursor is a named !ri"ate SQL area #rom %here in#ormation can be accessed *ursors are reBuired to !rocess ro%s indi"idually #or Bueries returning multi!le ro%s 2D )'!lain the t%o ty!e o# *ursors E There are t%o ty!es o# cursors& .m!lict *ursor and )'!licit *ursor PL/SQL uses .m!lict *ursors #or Bueries 8ser de#ined cursors are called )'!licit *ursors They can be declared and used 22 What are the PL/SQL Statements used in cursor !rocessing E D)*LAR) *8RSOR cursor name& OP)1 cursor name& ()T*C cursor name .1TO or Record ty!es& *LOS) cursor name 25 What are the cursor attributes used in PL/SQL E P.SOP)1 $ to check %hether cursor is o!en or not P ROW*O81T $ number o# ro%s #etched/u!dated/deleted P (O81D $ to check %hether cursor has #etched any ro% True i# ro%s are #etched P 1OT (O81D $ to check %hether cursor has #etched any ro% True i# no ro%s are #etched These attributes are !roceeded %ith SQL #or .m!licit *ursors and %ith *ursor name #or )'!licit *ursors 26 What is a cursor #or loo! E *ursor #or loo! im!licitly declares PROWT@P) as loo! inde'&o!ens a cursor& #etches ro%s o# "alues #rom acti"e set into #ields in the record and closes %hen all the records ha"e been !rocessed eg (OR em!7rec .1 *2 LOOP salary7total /? salary7total Oem!7rec sal+ )1D LOOP+ 2M What %ill ha!!en a#ter commit statement E *ursor *2 is Select em!no& ename #rom em!+ Begin o!en *2+ loo! (etch *2 into eno ename+ )'it When *2 Pnot#ound+$$$$$ commit+ end loo!+ end+ The cursor ha"ing *O44.T/ROLLBA*A Buery as S)L)*T (OR 8PDAT) gets closed a#ter

89
The cursor ha"ing *O44.T/ROLLBA*A Buery as S)L)*T does not get closed e"en a#ter

2: )'!lain the usage o# WC)R) *8RR)1T O( clause in cursors E WC)R) *8RR)1T O( clause in an 8PDAT)&D)L)T) statement re#ers to the latest ro% #etched #rom a cursor Database Tri&&ers 2I What is a database trigger E 1ame some usages o# database trigger E Database trigger is stored PL/SQL !rogram unit associated %ith a s!eci#ic database table 8sages are Audit data modi#icateions& Log e"ents trans!arently& )n#orce com!le' business rules Deri"e column "alues automatically& .m!lement com!le' security authoriQations 4aintain re!licate tables 2L Co% many ty!es o# database triggers can be s!eci#ied on a table E What are they E .nsert Be#ore Ro% A#ter Ro% ok ok ok ok 8!date ok ok ok ok Delete ok ok ok ok

Be#ore Statement A#ter Statement

.# (OR )A*C ROW clause is s!eci#ied& then the trigger #or each Ro% a##ected by the statement .# WC)1 "alue clause is s!eci#ied& the trigger #ires according to the retruned boolean

2< .s it !ossible to use Transaction control Statements such a ROLLBA*A or *O44.T in Database Trigger E Why E .t is not !ossible As triggers are de#ined #or each table& i# you use *O44.T ROLLBA*A in a trigger& it a##ects logical transaction !rocessing 2; What are t%o "irtual tables a"ailable during database trigger e'ecution E The table columns are re#erred as OLD column7name and 1)W column7name (or triggers related to .1S)RT only 1)W column7name "alues only a"ailable (or triggers related to 8PDAT) only OLD column7name 1)W column7name "alues only a"ailable (or triggers related to D)L)T) only OLD column7name "alues only a"ailable 5D What ha!!ens i# a !rocedure that u!dates a column o# table R is called in a database trigger o# the same table E o#

9,
4utation o# table occurs 52 Write the order o# !recedence #or "alidation o# a column in a table E . done using Database triggers ii done using .ntegarity *onstraints

. V ii )'ce!tion / 55 What is an )'ce!tion E What are ty!es o# )'ce!tion E )'ce!tion is the error handling !art o# PL/SQL block The ty!es are Prede#ined and user7de#ined Some o# Prede#ined e'ec!tions are *8RSOR7ALR)AD@7OP)1 D8P7=AL7O17.1D)R 1O7DATA7(O81D TOO74A1@7ROWS .1=AL.D7*8RSOR .1=AL.D7184B)R LO0O17D)1.)D 1OT7LO00)D7O1 PRO0RA4$)RROR STORA0)7)RROR T.4)O8T7O17R)SO8R*) =AL8)7)RROR T)RO7D.=.D) OTC)RS 56 What is Pragma )R)*PT.O17.1.T E )'!lain the usage E The PRA04A )R)*PT.O17.1.T tells the com!lier to associate an e'ce!tion %ith an oracle error To get an error message o# a s!eci#ic oracle error e g PRA04A )R*)PT.O17.1.T ,e'ce!tion name& oracle error number5M What is Raise7a!!lication7error E Raise7a!!lication7error is a !rocedure o# !ackage DB4S7STA1DARD %hich allo%s to issue an user7de#ined error messages #rom stored sub$!rogram or database trigger 5: What are the return "alues o# #unctions SQL*OD) and SQL)RR4 E SQL*OD) returns the latest code o# the error that has occured SQL)RR4 returns the rele"ant error message o# the SQL*OD) 5I Where the Pre7de#ined7e'ce!tions are stored E .n the standard !ackage Procedures& (unctions V Packages +

91
5L What is a stored !rocedure E A stored !rocedure is a seBuence o# statements that !er#orm s!eci#ic #unction 5< What is di##erence bet%een a PRO*)D8R) V (81*T.O1 E A (81*T.O1 is al%ay returns a "alue using the return statement A PRO*)D8R) may return one or more "alues through !arameters or may not return at all 5; What are ad"antages #o Stored Procedures / )'tensibility&4odularity& Reusability& 4aintainability and one time com!ilation

6D What are the modes o# !arameters that can be !assed to a !rocedure E .1&O8T&.1$O8T !arameters 62 What are the t%o !arts o# a !rocedure E Procedure S!eci#ication and Procedure Body 65 0i"e the structure o# the !rocedure E PRO*)D8R) name ,!arameter list is local "ariable declarations B)0.1 )'ecutable statements )'ce!tion e'ce!tion handlers end+ 66 0i"e the structure o# the #unction E (81*T.O1 name ,argument list local "ariable declarations Begin e'ecutable statements )'ce!tion e'ecution handlers )nd+ - Return dataty!e is -

6M )'!lain ho% !rocedures and #unctions are called in a PL/SQL block E (unction is called as !art o# an e'!ression sal /? calculate7sal ,9a<559-+ !rocedure is called as a PL/SQL statement calculate7bonus ,9A<559-+

92

6: What is O"erloading o# !rocedures E The Same !rocedure name is re!eated %ith !arameters o# di##erent dataty!es and !arameters in di##erent !ositions& "arying number o# !arameters is called o"erloading o# !rocedures e g DB4S7O8TP8T !ut7line 6I What is a !ackage E What are the ad"antages o# !ackages E Package is a database ob>ect that grou!s logically related !rocedures The ad"antages o# !ackages are 4odularity& )asier A!!licaton Design& .n#ormation Ciding& reusability and Better Per#ormance 6L What are t%o !arts o# !ackage E The t%o !arts o# !ackage are PA*AA0) SP)*.(.*AT.O1 V PA*AA0) BOD@ Package S!eci#ication contains declarations that are global to the !ackages and local to the schema Package Body contains actual !rocedures and local declaration o# the !rocedures and cursor declarations 6< What is di##erence bet%een a *ursor declared in a !rocedure and *ursor declared in a !ackage s!eci#ication E A cursor declared in a !ackage s!eci#ication is global and can be accessed by other !rocedures or !rocedures in a !ackage A cursor declared in a !rocedure is local to the !rocedure that can not be accessed by other !rocedures 6; Co% !ackaged !rocedures and #unctions are called #rom the #ollo%ingE a Stored !rocedure or anonymous block b an a!!lication !rogram such a PR* 3*& PRO3 *OBOL c SQL 3PL8S a PA*AA0) 1A4) PRO*)D8R) 1A4) ,!arameters-+ "ariable /? PA*AA0) 1A4) (81*T.O1 1A4) ,arguments-+ )R)* SQL )R)*8T) b B)0.1 PA*AA0) 1A4) PRO*)D8R) 1A4) ,!arameters"ariable /? PA*AA0) 1A4) (81*T.O1 1A4) ,arguments-+ )1D+ )1D )R)*+ c )R)*8T) PA*AA0) 1A4) PRO*)D8R) i# the !rocedures does not ha"e any out/in$out !arameters A #unction can not be called MD 1ame the tables %here characteristics o# Package& !rocedure and #unctions are stored E 8ser7ob>ects& 8ser7Source and 8ser7error

93

7 *E:*7 *
<! -! .! 2! /! G!

5hat is the use %' H+@I=K clause[ 5hich date 'uncti%n .ill return nu& er[ 5hat is the di''erence et.een uni%n and uni%n all[ 5hat are gr%u* 'uncti%ns[ List the&. 5rite synta/ t% create a syn%ny&[ 5hether truncate is ddl %r d&l[

A! What is a ROW.D and Why do . need thatE AnsH ROW.D is the !hysical address ,location- o# the ro% on the disk This is the #astest %ay to access a ro% in a table 1! What are these "S& 'S tables and "ie%s AnsThese are tables that are intended #or the dba to manage !er#ormance related in#ormation These are also re#erred to as dynamic !er#ormance "ie%s and gi"e the dba9s enough in#ormation to see %hatNs ha!!ening in the database at a !articular !oint in time 0!What is ROW184 AnsHROW184 is a Psuedo$*olumn that returns the the seBuence o# the ro% returned @ou cannot use it to limit ro%s since ro%num is only incremented a#ter a ro% is returned in the result set <5! To retrie"e the t%o de!artments in the )4P/D)PT tables %ith lo%est total salaries you could %rite the #ollo%ing Buery/ AnsH S)L)*T d dname& e total7sal (RO4 ,S)L)*T de!tno& sum,sal- total7sal (RO4 em! 0RO8P B@ de!tno ORD)R B@ sum,sal- AS*- e& de!t d WC)R) d de!tno ? e de!tno A1D ROW184 F? 5+

94
<<! Co% long %ill a "ariable remain de#ined in SBl PlusE AnsH A =ariable de#ined by a user %ill remain till the end o# the session or i# the user unde#ines the "ariable <-! What are the ad"antage and disad"antages o# using a select #or u!date in a cursor AnsH 8sing the J#or u!date clauseJ and then using using Ju!date #or current cursorJ is a good %ay to make sure that no one else is changing the ro%s you are %orking %ith .# you use this then you cannot issue a commit %ithin the loo! A commit %ill release all locks and in"alidate your cursor <.! Co% can . select e"ery 1 th ro% #rom a tableE AnsH One can easily select all e"en& odd& or 1th ro%s #rom a table using SQL Bueries like this/ 4ethod 2/ 8sing a subBuery S)L)*T 3 (RO4 em! WC)R) ,ROW.D&D- .1 ,S)L)*T ROW.D& 4OD,ROW184&M(RO4 em!-+ 4ethod 5/ 8se dynamic "ie%s ,a"ailable #rom OracleL 5-/ S)L)*T 3 (RO4 , S)L)*T ro%num rn& em!no& ename (RO4 em! - tem! WC)R) 4OD,tem! ROW184&M- ? D+ Please note& there is no e'!licit ro% order in a relational database Co%e"er& these Bueries are Buite #un and may e"en hel! in the odd situation <2! Co% can . "ie% constraints on a table AnsH S)L)*T constraint7name& table7name& r7o%ner& r7constraint7name (RO4 all7constraints WC)R) table7name ? 9table7name9 and o%ner ? 9o%ner7name9+ Cere all7constraints is a "ie% in the data dictionary %hich has the abo"e columns There is another "ie% called ALL7*O1S7*OL841S %hich !resents in#ormation about the columns that are incor!orated into constraints on a table </! . am trying to insert the ro%s into a table like this insert into em!re!,ename& hiredate& salaryselect #rom em! order by hiredate+

95
AnsH @ou cannot use an order by clause in a sub select @ou ha"e to %ork around it by using a grou! by or by using an anonymous PL/SQL Block insert into em!re!, select , - #rom em! grou! by hiredate& em!no&salary+ This %ill be slo%er but grou! by %ill order thre ro%s in ascending order 8sing an anonymous block you can B)0.1 #or r2 in ,select 3 #rom em! order by hiredate- loo! insert into em!re!, "alues, end loo!+ end+ <G! What are the t%o integrity constraints that en#orce uniBuenessE AnsH The t%o integrity constraints that en#orces uniBueness are 81.Q8) And PR.4AR@ keys These constraints creates an inde' to assist in the !rocess <A! What is a 4utating Table Co% do . en#orce Re#erential *onstraints in this case AnsH A mutating table is a table that is currently being modi#ied by an u!date& delete& or insert statement @ou %ill encounter the ORA$DMD;2 error i# you ha"e a ro% trigger that reads or modi#ies the mutating table (or e'am!le& i# your trigger contains a select statement or an u!date statement re#erencing the table it is triggering o## o# you %ill recei"e the error Another %ay this error can occur is i# the trigger has statements to change the !rimary& #oreign or uniBue key columns o# the table the trigger is triggering #rom .# you must ha"e triggers on tables that ha"e re#erential constraints& the %ork <1! .s BOOL)A1 a "alid dataty!e in Oracle databaseE AnsH BOOL)A1 is a "alid dataty!e in PL/SQL and not in oracle database *annot create a column in the table %ith boolean as a dataty!e The only allo%ed dataty!es are *har& "archar5& number& date& ra%& long& long ra%& ro%id& blob& clob& nclob& b#ile around is to en#orce the re#erential integrity through triggers as %ell <0! What is a column alias E AnsH *olumn alais is meaning#ul headings gi"en to the out!ut #rom a Buery it is another name gi"en to columns in a table Alias #or a column or columns can be s!eci#ied in a select statement

96
-5! Co% can . get the source code #or a #unction or a !rocedure or a !ackage #rom the databaseE AnsH Query the "ie% ALL7SO8R*) .t has a #ield called T@P)& %hich says %hether the ob>ect is a (81*T.O1 or a PA*AA0) or a PA*AA0) BOD@ or a PRO*)D8R) The #ield T)RT gi"es the actual source code #or that ob>ect )'am!le/ S)L)*T T)RT (RO4 ALL7SO8R*) WC)R) 1A4)?9(81*T.O171A4)9+ S)L)*T T)RT (RO4 8S)R7SO8R*) WC)R) 1A4)?9(81*T.O171A4)9+ S)L)*T T)RT (RO4 DBA7SO8R*) WC)R) 1A4)?9(81*T.O171A4)9+ -<! *an one read/%rite #iles #rom PL/SQLE AnsH .ncluded in Oracle is an 8TL7(.L) !ackage that can read and %rite o!erating system #iles The directory you intend %riting to has to be set in the init ora by using 8TL7(.L)7D.R !arameter .t can be set to 3 to allo% %rites to any directory in the #ile system Be#ore Oracle L 6 the only means o# %riting a #ile %as to use DB4S7O8TP8T %ith the SQL3Plus SPOOL command #ollo%ing is the e'am!le to o!en and %rite to a #ile 9#ile29 and then close D)*LAR) #ileCandler 8TL7(.L) (.L)7T@P)+ B)0.1 #ileCandler /? 8TL7(.L) (OP)1,9/tm!9& 9#ile29& 9%9-+ 8TL7(.L) P8T(,#ileCandler& 9the lines o# te't\n9-+ 8TL7(.L) (*LOS),#ileCandler-+ )R*)PT.O1 WC)1 utl7#ile in"alid7!ath TC)1 raise7a!!lication7error,$5DDDD& 9)RROR/ .n"alid !ath #or #ile or !ath not in .1.T ORA 9-+ )1D+ --! Co% does one get the "alue o# a seBuence into a PL/SQL "ariableE AnsH %ell& oracle does9nt allo% to assign a seBuence "alue to a !l/sBl "arable as i /? sB7seBuence 1)RT=AL+ ,#or some silly reasonBut you can do this/ select my7seBuence 1)RT=AL into /i #rom dual+ and then use the "ariable in the needed area -.! What are the t%o %ays to s!eci#y a column alias E

97
AnsH 2 1aming the alias a#ter the column s!eci#ication se!arated by a s!ace )'/ Select em!id id& #name #irst #rom em!loyee 5 8se o# an 9AS9 %ord to s!eci#y the alais more clearly )'/ Select em!id as id& #name as #irst #rom em!loyee -2! What is a Result Set E and %hen is it created AnsH The result set can be de#ined as a logical set o# ro%s that meet the Buery submitted to the ser"er !rocess The only %ay to re#erence this ob>ect is through the cursor handle This is created %hen the *ursor is o!ened -/! %hat are .1ST)AD O( triggersE AnsH .1ST)AD O( triggers !ro"ide a trans!arent %ay o# modi#ying "ie%s that cannot be modi#ied directly through SQL D4L statements ,.1S)RT& 8PDAT)& and D)L)T)These triggers are called .1ST)AD O( triggers because& unlike other ty!es o# triggers& Oracle #ires the trigger instead o# e'ecuting the triggering statement The trigger !er#orms u!date& insert& or delete o!erations directly on the underlying tables -G!%hat is the signi#icance o# SQL*OD) V SQL)RR4 in !l/sBl e'ce!tion handlerE AnsH (or internal e'ce!tions& SQL*OD) returns the number o# the Oracle error The number that SQL*OD) returns is negati"e unless the Oracle error is no data #ound& in %hich case SQL*OD) returns O2DD SQL)RR4 returns the corres!onding error message The message begins %ith the Oracle error code (or user$de#ined e'ce!tions& SQL*OD) returns O2 and SQL)RR4 returns the message 8ser$De#ined )'ce!tion .# no e'ce!tion has been raised& SQL*OD) returns Qero and SQL)RR4 returns the message ORA$DDDD/ normal& success#ul com!letion -A!*an one only retrei"e ro%s R to @ #rom a tableE AnsH @es&there is a method to do that #or e'am!le to dis!lay ro%s L to ;& construct a Buery like this/ S)L)*T 3 (RO4 tab2 WC)R) ro%id in ,

98
S)L)*T ro%id (RO4 tab2 WC)R) ro%num F? ; 4.18S S)L)*T ro%id (RO4 tab2 WC)R) ro%num F L-+ a!art #rom this there is no direct method to do the s!eci#ic >ob -1! 1eed SQL scri!t to remo"e dash ,9$9- #rom data )'am!le/ data in #ield ? 9:22D$29 should be 9:22D29 AnsH Cere is the #unction that can eliminate any string #rom the gi"en string create or re!lace #unction D)L)T)7*CAR, *CAR7T@P) "archar5& STR.107T@P) "archar5 return "archar5 as R)T8R17STR.10 "archar5,2DDD- /? STR.107T@P)+ STR.107L)10TC number /? D+ *CAR7L)10TC number /? D+ *CAR7POS.T.O1 number /? D+ begin select length,STR.107T@P)- into STR.107L)10TC #rom dual+ select length,*CAR7T@P)- into *CAR7L)10TC #rom dual+ i# STR.107L)10TC G D and *CAR7L)10TC G D then select instr,STR.107T@P)& *CAR7T@P)- into *CAR7POS.T.O1 #rom dual+ i# *CAR7POS.T.O1 ? D then return R)T8R17STR.10+ else R)T8R17STR.10 /? substr,STR.107T@P)& 2& *CAR7POS.T.O1$2-KK substr,STR.107T@P)& *CAR7POS.T.O1O*CAR7L)10TC& STR.107L)10TC-+ R)T8R17STR.10 /? D)L)T)7*CAR, *CAR7T@P)& R)T8R17STR.10 -+ end i#+ end i#+ return R)T8R17STR.10+ end+

39. "escribe the use of =$&.Q$ tables Ans.E=pected ans'er. )LMSQL tables are scalar arrays that can be referenced by a binary integer( "hey can be used to hold #alues for use in later >ueries or calculations( ,n %racle 4 they 'ill be able to be of the AR%W"D)E designation6 or RE %RD( HD. When is a declare statement needed Ans."he DE LARE statement is used in )LMSQL anonymous bloc-s such as 'ith stand alone6 non*stored )LMSQL procedures( ,t must come first in a )LMSQL stand alone file if it is used( H0. What are the types of tri++ers Ans.E=pected Ans'er. "here are 27 types of triggers in )LMSQL that consist of combinations of the +E:%RE6 A:"ER6 R%W6 "A+LE6 ,NSER"6 C)DA"E6 DELE"E and ALL -ey 'ords. +E:%RE ALL R%W ,NSER" A:"ER ALL R%W ,NSER"

99 +E:%RE ,NSER" A:"ER ,NSER" etc( H3. ;ow do you e6ecute a host operatin+ system command from within .Q$ Ans.E=pected ans'er. +y use of the e=clamation point NQN /in CN,F and some other %S3 or the ;%S" /;%3 command( HH. What is t9prof and how is it used Ans.E=pected ans'er. "he t-prof tool is a tuning tool used to determine cpu and e=ecution times for SQL statements( Dou use it by first setting timed9statistics to true in the initialiIation file and then turning on tracing for either the entire database #ia the s>l9trace parameter or for the session using the AL"ER SESS,%N command( %nce the trace file is generated you run the t-prof tool against the trace file and then loo- at the output from the t-prof tool( "his can also be used to generate e=plain plan output( H4. What is e6plain plan and how is it used Ans. "he EF)LA,N )LAN command is a tool to tune SQL statements( "o use it you must ha#e an e=plain9table generated in the user you are running the e=plain plan for( "his is created using the utl=plan(s>l script( %nce the e=plain plan table e=ists you run the e=plain plan command gi#ing as its argument the SQL statement to be e=plained( "he e=plain9plan table is then >ueried to see the e=ecution plan of the statement( E=plain plans can also be run using t-prof(
./! What is sche%a? Ans/A schema is collection o# database ob>ects o# a 8ser .G! What is Database *in@? Ans/A database link is a named ob>ect that describes a J!athJ #rom one database to another .A! Describe the different t'#e of Inte&rit' Constraints su##orted b' +RAC*E? Ans/1OT 18LL *onstraint $ Disallo%s 1ulls in a table9s column 81.Q8) *onstraint $ Disallo%s du!licate "alues in a column or set o# columns PR.4AR@ A)@ *onstraint $ Disallo%s du!licate "alues and 1ulls in a column or set o# columns (OR).01 A)@ *onstrain $ ReBuire each "alue in a column or set o# columns match a "alue in a related table9s 81.Q8) or PR.4AR@ A)@ *C)*A *onstraint $ Disallo%s "alues that do not satis#y the logical e'!ression o# the constraint I< What is *ursorE A *ursor is a handle ,a name or !ointer- #or the memory associated %ith a s!eci#ic statement .1! What is 7AFE :+INT? Ans/(or long transactions that contain many SQL statements& intermediate markers or sa"e !oints can be declared %hich can be used to di"ide a transaction into smaller !arts This allo%s the o!tion o# later rolling back all %ork !er#ormed #rom the current !oint in the transaction to a declared sa"e !oint %ithin the transaction .0! What are the differences between Database Tri&&er and Inte&rit' constraints?

1,,
Ans/A declarati"e integrity constraint is a statement about the database that is al%ays true A constraint a!!lies to e'isting data in the table and any statement that mani!ulates the table A trigger does not a!!ly to data loaded be#ore the de#inition o# the trigger& there#ore& it does not guarantee all data in a table con#orms to the rules established by an associated trigger A trigger can be used to en#orce transitional constraints %here as a declarati"e integrity constraint cannot be used 25! What is Two4:hase Co%%it? Ans/T%o$!hase commit is mechanism that guarantees a distributed transaction either commits on all in"ol"ed nodes or rolls back on all in"ol"ed nodes to maintain data consistency across the global distributed database .t has t%o !hases& a Pre!are Phase and a *ommit Phase Di## bet%een sBl 3 loader and im!ortE SQL 3 Loader $ .t loads data #rom standard o!erating system #iles ,(lat #iles- into ORA*L) database tables )'!ort ,)RP- and .m!ort ,im!- utilities allo% you to mo"e e'isting data in ORA*L) #ormat to and #rom ORA*L) database 2<! What is difference between TRUNCATE O DE*ETE?what tri&&ers will &et fired if tri&&ers are thereE Ans/TR81*AT) commits a#ter deleting entire table i e & canNt be rolled back Database triggers do not #ire on TR81*AT) D)L)T) allo%s the #iltered deletion Deleted records can be rolled back or committed Database triggers #ire on D)L)T)

2-! What is a Uoin? E6#lain the different t'#es of Uoins? Ans/ Hoin is a Buery& %hich retrie"es related columns or ro%s #rom multi!le tables Sel# Hoin $ Hoining the table %ith itsel# )Bui Hoin $ Hoining t%o tables by eBuating t%o common columns 1on$)Bui Hoin $ Hoining t%o tables by eBuating t%o common columns Outer Hoin $ Hoining t%o tables in such a %ay that Buery can also retri"e ro%s that do not ha"e corres!onding >oin "alue in the other table 2.! Difference between 7U)7TR and IN7TR? Ans/ .1STR ,String2& String 5,n& ,m--& .1STR returns the !osition o# the mth occurrence o# the string 5 in String2 The search begins #rom nth !osition o# string2 S8BSTR ,String2 n&mS8BSTR returns a character string o# siQe m in string2& starting #rom nth !ostion o# string2 22! E6#lain UNI+N3 MINU73 UNI+N A**3 INTER7ECT?

1,1
Ans/ .1T)RS)*T returns all distinct ro%s selected by both Bueries 4.18S $ returns all distinct ro%s selected by the #irst Buery but not by the second 81.O1 $ returns all distinct ro%s selected by either Buery 81.O1 ALL $ returns all ro%s selected by either Buery&including all du!licates 2/! What is difference between P R+WTC:E and TC:E REC+RD ? Ans/ P ROWT@P) is to be used %hene"er Buery returns a entire ro% o# a table or "ie% T@P) rec R)*ORD is to be used %hene"er Buery returns columns o# di##erent table or "ie%s and "ariables )g -+ T@P) r7em! is R)*ORD ,eno em! em!noP ty!e&ename em! ename Pty!e

e7rec em!P ROWT@P) cursor c2 is select em!no&de!tno #rom em!+ e7rec c2 PROWT@P)

2G! What is :*E7 * table ?&i(e the s'nta6 for this? Ans/ Ob>ects o# ty!e TABL) are called JPL/SQL tablesJ& %hich are modelled as ,but not the same as- database tables& PL/SQL tables use a !rimary PL/SQL tables can ha"e one column and a !rimary key

178: ena&eGta leGty*e IS 1+#L: (2 e&*.ena&eE178: #I=+-7GI=1:K:-4

I=?:I #7

2A! E6#lain the two t'#e of Cursors ? Ans/ There are t%o ty!es o# cursors& .m!lict *ursor and )'!licit *ursor PL/SQL uses .m!lict *ursors #or Bueries 8ser de#ined cursors are called )'!licit *ursors They can be declared and used

21! What is :ra&%a EXEC:TI+NNINIT ? E6#lain the usa&e ? Ans/ The PRA04A )R)*PT.O17.1.T tells the com!lier to associate an e'ce!tion %ith an oracle error To get an error message o# a s!eci#ic oracle error e g PRA04A )R*)PT.O17.1.T ,e'ce!tion name& oracle error number20! What is difference between a Cursor declared in a #rocedure and Cursor declared in a #ac@a&e s#ecification ?

1,2

Ans/A cursor declared in a !ackage s!eci#ication is global and can be accessed by other !rocedures or !rocedures in a !ackage A cursor declared in a !rocedure is local to the !rocedure that can not be accessed by other !rocedures /5! Na%e the tables where characteristics of :ac@a&e3 #rocedure and functions are stored ? Ans/ 8ser7ob>ects& 8ser7Source and 8ser7error /<! A colu%n defined as :RIMARC KEC can ha(e NU**>s a] TR8) b] (ALS) Ans / B /-! Which of the followin& is N+T FA*ID is :*E7 * a] Bool boolean+ b] 1842& 1845 number+ c] de!tname de!t dnamePty!e+ d] date2 date /? sysdate Ans / B /.! Which of the followin& is not correct about UserNDefined E6ce#tions ? a] 4ust be declared b] 4ust be raised e'!licitly c] Raised automatically in res!onse to an Oracle error d] 1one o# the abo"e Ans / * /2! Which of the followin& is not correct about an E6ce#tion ? a] Raised automatically / )'!licitly in res!onse to an ORA*L)7)RROR b] An e'ce!tion %ill be raised %hen an error occurs in that block c] Process terminates a#ter com!letion o# error seBuence d] A Procedure or SeBuence o# statements may be !rocessed Ans / * //! Declare a number /? :+ b number /? null+ c number /? 2D+ Begin i# a G b A1D a F c then a /? c 3 a+ end i#+ )nd+ What will be the (alue of >a> after e6ecution ? a] :D b] 18LL

1,3
c] : d] 1one o# the abo"e

56. Create a matrix query to display t e !ob" t e salary #or t at !ob based on department number" and t e total salary #or t at !ob #or all departments" $i%in$ ea& &olumn an appropriate eadin$.
>ob 0000000000 "N"LYS. 9L!,@ <"N"/!, (,!S#D!N. S"L!S<"N Dept 2? 000000000000000 26?? 13B? B??? Dept 1? 0000000000000 7??? 2A?? 1A4B Dept 6? 0000000000000 AB? 15B? B7?? .otal 000000000 7??? 32B? 514B B??? B7??

"ns CD S!L!9. Eob ">ob"$ SU< (D!9FD! (deptno$ 2?$ sal)) "Dept 2?"$ SU< (D!9FD! (deptno$ 1?$ sal)) "Dept 1?"$ SU< (D!9FD! (deptno$ 6?$ sal)) "Dept 6?"$ SU< (sal) ".otal" G,F< emp /,FU( +Y Eob ;

5L. What is .hare 'ow>#6clusive loc9 S2a3e Ro4 EKc-7,6?e -ocJ, a3e 7,ed to -ooJ at a 42o-e ta=-e and to a--o4 ot2e3, to -ooJ at 3o4, 6n t2e ta=-e =7t to p3o26=6t ot2e3, 53om -ocJ6n: t2e ta=-e 6n S2a3e mode o3 7pdat6n: 3o4,.

58. What are pseudo-columns in ORACLE? T2e co-7mn, t2at a3e not pa3t o5 t2e ta=-e a3e ca--ed a, p,e7do co-7mn,.

59. What is a translate function

1,4 An,1T2e 57nct6on t2at 3et73n, a c2a3acte3 a5te3 3ep-ac6n: a-- occ733ence, o5 t2e c2a3acte3 ,pec656ed 46t2 t2e co33e,pond6n: c2a3acte3 6, ca--ed a, t3an,-ate 57nct6on. E.:. TRANSLATE (A'e--oA,A-A,ALA :6?e, ;o7 'eLLo

60. WHA !" O#E !$E O#L% &ROCE'(RE An,1 #ASICALL$ &E USE T'IS IN "AC9A!ES. T'IS IS A "ROCEDURE &IT' OUT NAME IN T'E "AC9A!E #OD$.#ASICALL$ &E USE T'IS TO INITIALIME T'E "AC9A!E .ARIA#LES.T'IS IS LI9E CONSTRUCTORS IN 8!L ,. 6). Ho* can ! a+oid a di+ide ,U,e t2e DECODE 57nct6on. =36--6ant and 57nct6on, -6Je a CASE to 3et73n d655e3ent co-7mn, =a,ed on .ero error? T26, 57nct6on 6, a=,o-7te-; ,tatement, and can =e 7,ed t2e ?a-7e, o5 ot2e3,.

;2. What is 2O&OP6! +ns: #y de'ault the I= *ara&eter is *assed y re'erence and the (;1 and I= (;1 *ara&eters are *assed y "alue. 2O&OP6 * is a c%&*iles hint that can e used .ith (;1 and I= (;1 *ara&eter t% re<uest t% *ass y re'erence. 1his i&*r%"es the *er'%r&ance .ith (;1 and I=(;1
parameters(

JH. what are parameteriIed cursors

+ns:Parameteri<ed &ursors*8
0 0 0 8ara&eters can e *assed t% the curs%r in a curs%r '%r l%%*. It all%. t% %*en and cl%se an e/*licit curs%r se"eral ti&es in a l%c36 returning a di''erent acti"e set %n each %ccasi%n '%r each e/ecuti%n6 the *re"i%us curs%r is cl%sed and re%*ened .ith a ne. set %' *ara&eters. SiVes sh%uld n%t e &enti%ned '%r the data ty*es %' *ara&eters the *ara&eters na&es are '%r re'erences in the <uery e/*ressi%n %' the curs%r.

1,5

;=. What are Autonomous Transactions!


+ns: 0 0 0 +ut%n%&%us transacti%ns are the *r%cesses run inde*endently %' its *arent. #y &eans %' +ut%n%&%us 1ransacti%n6 the current transacti%n can e te&*%rarily sus*ended and an%ther %*erati%n can e egun. 1he asic idea ehind this is t% ha"e s%&e %*erati%n ta3e *lace inde*endently %' the current transacti%n.

G/!

What are %ateriali<ed 7iews! What is the #i erence "etween /iew and materiali<ed /iew! What are the re reshin( t.pes o material /iew!

+ns:$aterialiVed @ie.: 0 0 + $aterialiVed "ie. is a re*lica %' a target &aster 'r%& a single *%int in ti&e. )reate &aterialiVed "ie. Sna&eA -e'resh 'ast Start .ith sysdate =e/t sysdate N1 as Select M'r%& S&aster ta leA4
The di## is "ie% doesnNt contain data %here as the latter contains

-e'resh 1y*es 0 )%&*lete -e'resh6 2ast -e'resh6 2%rce -e'resh M )%&*lete -e'resh is *er'%r&ed y deleting the r%.s 'r%& the sna*sh%t and inserting the r%.s satis'ying the $@I:5 <uery. M In 2ast re'resh %nly the r%.s u*dated since last re'resh are *ulled 'r%& the &aster ta le t% insert int% $@I:5. M 1his re<uires a l%g ta le called as $@I:5 L%g t% e created %n the $aster 1a le. M 2%rce re'resh 'irst tries t% run a 2ast re'resh i' *%ssi le. M I' 'ast re'resh is n%t *%ssi le6 it *er'%r&s c%&*lete re'resh.

;;. What is a 2ested Ta"le!


+ns: =ested 1a le is an %rdered gr%u* %' ite&s %' ty*e 1+#L:. =ested 1a le c%ntain &ulti*le c%lu&ns and can e used as "aria les6 *ara&eters6 results6 attri utes and c%lu&ns.

1,6 1hey can e th%ught %' as %ne c%lu&n data ase ta les. -%.s %' a nested ta le are n%t st%red in any *articular %rder. 1he siVe %' a nested ta le can e increased dyna&ically i.e. nested ta les are un %unded. :le&ents in a ta le initially ha"e c%nsecuti"e su scri*ts6 ut as ele&ents are deleted6 they can ha"e n%n0c%nsecuti"e su scri*ts. 1he range %' "alues '%r nested ta le su scri*ts is 1 ..2147483647. 1% e/tend a nested ta le6 the uilt0in *r%cedure :I1:=? &ust e used. 1% delete ele&ents6 the uilt0in *r%cedure ?:L:1: &ust e used. +n un initialiVed nested ta le is aut%&atically null6 s% the IS =;LL c%&*aris%n %*erat%r can e used t% ses i' nested ta le is null. 1he %*erat%rs )+S16 1H: and $;L1IS:1 are used %r &ani*ulating nested ta les.

;>. What is a 7A11A6!


+ns: @+--+7S are %rdered gr%u* %' ite&s %' ty*e @+--+7. @+--+7S can e used t% ass%ciate a single identi'ier .ith an entire c%llecti%n. 1his all%.s &ani*ulati%n %' the c%llecti%n as a .h%le and easy re'erence %' indi"idual ele&ents. 1he &a/i&u& siVe %' @+--+7 needs t% e s*eci'ied in its ty*e de'initi%n. 1he range %' "alues '%r the inde/ %' a @+--+7 is 'r%& 1 t% the &a/i&u& s*eci'ied in its ty*e de'initi%n. I' n% ele&ents are in the Fta le) +--+76 then the +--+7 is aut%&atically null. 1he &ain use %' @+--+7 is t% gr%u* s&all %' uni'%r&0siVed c%llecti%n %' % Dects. :le&ents %' a @+--+7 cann%t e accessed indi"idually SQL6 alth%ugh they can e accessed in 8L9SQL6 ()I6 %r 8r%M) using the array style su scri*t. 1he ty*e %' the ele&ent %' a @+--+7 can e any 8L9SQL ty*e e/ce*t the '%ll%.ing. #((L:+=6 1+#L:6 @+--+7 etc. @+--+7S can e used t% retrie"e an entire c%llecti%n as a "alue. @+--+7 data is st%red in0line6 in the ta le s*ace as the %ther data in its r%.. 5hen a @+--+7 is declared6 a c%nstruct%r .ith the sa&e na&e as the @+--+7 is i&*licitly de'ined. 1he c%nstruct%r creates a @+--+7 'r%& the ele&ents *assed t% it. + @+--+7 can e assigned t% an%ther @+--+76 *r%"ided the data ty*es are the e/act sa&e ty*e. 178: &yG@+--+71 IS @+--+7 F1,) (2 $7G1y*e4 Is =;LL c%&*aris%n %*erat%r can e used t% see i' a @+--+7 is null. @++-+7S cann%t e c%&*ared '%r e<uality %r in e<uality. ;?. how do .ou ind how ma. rows (ot updated "ecause o an update statement! Ans* @ s)lArowcount ;B. +ssu&ing the e/istence %' an e/*licit curs%r na&ed shi*s and a declared E-(5178: "aria le na&ed currentGshi*6 .hich %' the '%ll%.ing 2:1)H state&ents are c%rrect[ F)h%%se all that a**ly.) + 2:1)H currentGshi* I=1( shi*s4 #.=% +ns.er is )%rrect.

1,7

) . 2:1)H shi*s I=1( currentGshi*E-(5178:4 ? . 2:1)H shi*s I=1( currentGshi*.SHI8GI?4 E !lanat"on# F #) 1he *r%*er 2:1)H state&ent is 2:1)H shi*s I=1( currentGshi*4
LD Dou ha#e a )LMSQL bloc- that ta-es a #alue order9amount as a parameter6 computes sales ta=6 and
sends bac- the sales ta=( Dou choose to store this program unit in the database( Which of the follo'ing is true8 A ( ,t must be a function6 because it returns a #alue( + ( ,t can be neither a procedure of a function6 because it interacts 'ith sales ta=( ( ,t must be a procedure6 because it does something( DO( ,t can be either a procedure or a function(

71 . 5hat .ill ha**en .hen the '%ll%.ing c%de is e/ecuted[ #:KI= )-:+1: 1+#L: H(LI?+7S FH(LI?+7GI? =;$#:-F3)6 H(LI?+7 @+-)H+-2F3,))4 :=?4 + . 1he H(LI?+7S ta le .ill e created. #. + *arsing err%r .ill %ccur. ) . 1he 1((G$+=7G-(5S e/ce*ti%n .ill e raised6 ut since it!s n%t handled6 n%thing .ill ha**en. ? . 1he ta le .ill e created6 ut .%n!t e declared since it isn!t created in the ?:)L+-: secti%n. E !lanat"on# 1he l%c3 is atte&*ting t% e/ecute a ??L state&ent6 and ??L state&ents aren!t all%.ed in 8L9SQL. =%te6 h%.e"er6 that there is a s*ecial *ac3age in 8L9SQL that .ill su**%rt the e/ecuti%n %' ??L state&ents y uilding the& as te/t strings sending the& %'' t% the data ase in an%ther &anner. #ut that is n%t .hat is eing *er'%r&ed here.
72. )an .e use user0de'ined 'uncti%ns in select <uery[ I' yes d%es it ha"e ant li&itati%ns[ I' yes list the&[

1,8
+ns: 0 yes .e can ha"e ut the 'uncti%n sh%uldnQt c%ntains any ??L c%&&ands.

73. 7%u ha"e created a 'uncti%n called c%&*uteG%rder and an%ther called c%&*uteGta/. 1he c%&*uteG%rder 'uncti%n calls %n the c%&*uteGta/ 'uncti%n as *art %' its *r%cessing secti%n. 7%u atte&*t t% dr%* the c%&*uteGta/ 'uncti%n .ith the ?-(8 2;=)1I(= c%&&and. 5hich %' the '%ll%.ing state&ents is true[ F)h%%se all that a**ly.) +. 1he c%&*uteG%rder 'uncti%n is le't .ith a status %' I=@+LI?. 7%u need t% edit the c%de '%r c%&*uteG%rder and issue an +L1:- 2;=)1I(= )($8IL: c%&&and t% rest%re it t% a status %' @+LI?. # . +ny atte&*t t% dr%* c%&*uteGta/ .ill aut%&atically dr%* c%&*uteG%rders. ) . 7%u cann%t dr%* the c%&*uteGta/ 'uncti%n ecause it is called y c%&*uteG%rder6 .hich y%u &ust dr%* 'irst. ? . 7%u can %nly dr%* the c%&*uteGta/ 'uncti%n .ith the )+S)+?: %*ti%n. +ns:0 + 74. + 'uncti%n &ay e de'ined .ith .hich %' the '%ll%.ing[ F)h%%se all that a**ly.): +. I= *ara&eters #. (;1 *ara&eters ). I= (;1 *ara&eters ?. =% *ara&eters +ns:0 +6#6)6? 75. 7%u ha"e created a 'uncti%n called K:1G1(1+L that ta3es n% *ara&eters. +ssu&ing that any %ther "aria les are *r%*erly declared6 .hich %' the '%ll%.ing 8L9SQL state&ents includes a success'ul call t% this 'uncti%n[ +. I2 FK:1G1(1+L R 1,1) #. "Gt%tal :R K:1G1(1+L4 ). "Gt%tal :R K:1G1(1+LF)4 ? . K:1G1(1+L4 +ns:0 +6# and )

1,9

76 . 7%u ha"e st%red a 'uncti%n in the data ase .ith the '%ll%.ing header: 2;=)1I(= )+L);L+1:G?IS)(;=1 -:1;-= #((L:+= IS +ssu&ing it has een success'ully c%&*iled and has a status %' @+LI?6 .hich %' the '%ll%.ing state&ents is true[ F)h%%se all that a**ly.) + . It can e called 'r%& a SQL state&ent. #. It can e called 'r%& a 8L9SQL e/*ressi%n. ). It ta3es n% *ara&eters. ? . 7%u can e/ecute it .ith the SQLM8lus :I:) c%&&and. +ns:0 #6) E !lanat"on# It can e called 'r%& a SQL state&ent is n%t true ecause the 'uncti%n returns a data ty*e %' #((L:+=6 .hich is n%t rec%gniVed in SQL. 7%u can e/ecute it .ith the SQLM8lus :I:) c%&&and is n%t true ecause the :I:) c%&&and is %nly used .ith *r%cedures. 77. 7%u ha"e Dust su &itted a 8L9SQL l%c3 '%r c%&*ilati%n and enc%untered a c%&*ilati%n err%r. (n the sec%nd line %' the err%r &essages6 an asteris3 has a**eared %n a line y itsel'. 5hat d%es the asteris3 indicate[ +. It!s strategically *laced under the l%cati%n in the c%de .here the *arser 'irst rec%gniVed that s%&ething .as .r%ng. # . It &ar3s the eginning %' the list %' err%r &essages. ) . It!s strategically *laced under the na&e %' the err%r. ? . It!s the generic sy& %l t% indicate this is an err%r &essage. +ns:0 + 78. 7%u su &it the '%ll%.ing state&ent t% the data ase: )-:+1: (- -:8L+): 2;=)1I(= )-:?I1G)H:)> F*GcardGid =;$#:-) -:1;-= @+-)H+-2 IS );-S(- curGcardGser"ices IS S:L:)1 +88-(@+LG)(?: 2-($ )+-?GS:-@I):

11, 5H:-: )+-?GI? R *GcardGid4 "Ga**r%"alGc%de )+-?GS:-@I):.+88-(@+LG)(?:E178:4 #:KI= (8:= curGcardGser"ices4 2:1)H curGcardGser"ices I=1( "Ga**r%"alGc%de4 )L(S: curGcardGser"ices4 -:1;-= "Ga**r%"alGc%de4 :=? )-:?I1G)H:)>4 5hich %' the '%ll%.ing state&ents .ill success'ully e/ecute this 'uncti%n 'r%& SQLM8lus[ F)h%%se all that a**ly.) +. #:KI= ?#$SG(;18;1.8;1GLI=:F)-:?I1G)H:)>F1,1))4 :=?4 # . :I:) )-:?I1G)H:)>F4,2,)4 ) . S:L:)1 )-:?I1G)H:)>F*GcardGidRA1,1) 2-($ ?;+L4 ? . )-:?I1G)H:)>F4,2,)4 +ns:0 + E !lanat"on# :I:) )-:?I1G)H:)>F4,2,)4 is n%t "alid ecause the :I:)6 %r :I:);1:6 state&ent is '%r *r%cedures6 n%t 'uncti%ns. S:L:)1 )-:?I1G)H:)>F*GcardGidRA1,1) 2-($ ?;+L4 isn!t c%rrect ecause *assing *ara&eters y re'erence d%esn!t .%r3 'r%& .ithin SQL state&ents. )-:?I1G)H:)>F4,2,) is .r%ng this is the synta/ '%r in"%3ing *r%cedures6 ut %nly 'r%& .ithin a 8L9SQL l%c36 n%t as a stand0al%ne SQLM8lus c%&&and0line state&ent. #:KI= ?#$SG(;18;1.8;1GLI=:F)-:?I1G)H:)>F1,1))4 :=?4 is c%rrect 79. +ssu&ing that any re'erenced data ase % Dects e/ist and are "alid6 .hich %' the '%ll%.ing .ill *r%duce a c%&*ilati%n err%r[ F)h%%se all that a**ly.) +. )-:+1: (- -:8L+): 2;=)1I(= ?:#I1 Facc%untGid =;$#:-F3)) -:1;-= =;$#:- IS #:KI= -:1;-= 14 :=?4 # . )-:+1: (- -:8L+): 2;=)1I(= ?:#I1 -:1;-= =;$#:- IS #:KI= -:1;-= 14 :=?4 ) . )-:+1: (- -:8L+): 2;=)1I(= ?:#I1 Facc%untGid #((L:+=) -:1;-= @+-)H+-2 IS #:KI= -:1;-= !1!4 :=?4 ? . )-:+1: (- -:8L+): 2;=)1I(= ?:#I1 Facc%untGid L:?K:-.+$(;=1 E178:) -:1;-= #((L:+= IS #:KI= -:1;-= 2+LS:4 :=?4 +ns:0 + E !lanat"on#

111 )-:+1: (- -:8L+): 2;=)1I(= ?:#I1 Facc%untGid =;$#:-F3)) -:1;-= =;$#:- IS #:KI= -:1;-= 14 :=?4 *r%duces a c%&*ilati%n err%r ecause %' the *ara&eter dataty*e =;$#:-F3)6 .hich sh%uld si&*ly e =;$#:-. 1he %ther state&ents are all "alid. 8,. 5here in the data dicti%nary can y%u 'ind the status %' a st%red data ase *r%cedure[ F)h%%se all that a**ly.) + . ;S:-GS(;-): # . ;S:-GS1+1;S ). ;S:-G(#L:)1S ? . ;S:-G8-():?;-:S +ns:0 ) E !lanat"on# 1here is n% data dicti%nary "ie. called ;S:-G8-():?;-:S %r ;S:-GS1+1;S. ;S:-GS(;-): c%ntains the s%urce c%de '%r st%red data ase *r%cedures6 'uncti%ns6 and *ac3ages6 ut it d%esn!t c%ntain any in'%r&ati%n a %ut status6 .hich is 3e*t in the ;S:-G(#L:)1S "ie.. 81. 5hich %' the '%ll%.ing <ueries .ill dis*lay the s%urce c%de %' a 'uncti%n called )+=):LG(-?:-[ + . S:L:)1 1:I1 2-($ ;S:-GS(;-): 5H:-: =+$: R !)+=):LG(-?:-! (-?:- #7 1:I14 #. S:L:)1 1:I1 2-($ ;S:-GS(;-): 5H:-: 178: R !2;=)1I(=! +=? =+$: R !)+=):LG(-?:-! (-?:- #7 LI=:4 ) . S:L:)1 1:I1 2-($ ;S:-G2;=)1I(=S 5H:-: =+$: R !)+=):LG(-?:-! (-?:- #7 LI=:G=;$#:-4 ? . S:L:)1 1:I1 2-($ ;S:-GS(;-): 5H:-: (#L:)1G178: R !2;=)1I(=! +=? =+$: R !)+=):LG(-?:-! (-?:- #7 LI=:4 +ns:0 # 82. 7%ur sche&a %.ns a *r%cedure called +??G8(-1. 7%u 3n%. that the *r%cedure re'erences a ta le in y%ur sche&a6 ut y%u d%n!t 3n%. .hich %ne. 5hich %' the '%ll%.ing data dicti%nary "ie.s can identi'y the ta le[ F)h%%se all that a**ly.) + . ;S:-G(#L:)1S #. ;S:-G?:8:=?:=)I:S ). ;S:-GS(;-): ? . ;S:-G:--(-S

112 +ns:0# and ) 83. +ssu&ing y%u ha"e a *ac3age called 'r%ntG%''ice6 .hich %' the '%ll%.ing state&ents are "alid[ F)h%%se all that a**ly.) + . ?-(8 8+)>+K: S8:)I2I)+1I(= 2-(=1G(22I):. # . ?-(8 8+)>+K: 2-(=1G(22I): )($8IL:. ) . ?-(8 8+)>+K: 2-(=1G(22I): )+S)+?:. ?. ?-(8 8+)>+K: #(?7 2-(=1G(22I):. +ns:0 ? E !lanat"on# 1here is n% ?-(8 8+)>+K: S8:)I2I)+1I(= c%&&and6 and the reser"ed .%rds )($8IL: )+S)+?: aren!t rele"ant t% the ?-(8 state&ent. 1he c%&&and ?-(8 8+)>+K: #(?7 2-(=1G(22I): .ill re&%"e the *ac3age %dy 'r%& the *ac3age 'r%ntG%''ice lea"e the *ac3age s*eci'icati%n al%ne. 84. 5hich %' the '%ll%.ing is true %' a l%cal su *r%gra&[ F)h%%se all that a**ly.) + . It can e declared in a *ac3age s*eci'icati%n. #. It cann%t e re'erenced %utside the l%c3 that declares it. ) . It is aut%&atically gl% al. ? . It &ust e declared .ith a '%r.ard declarati%n. +ns:0 # 85. 5hen d%es *ac3age initialiVati%n e/ecute[ F)h%%se the single est ans.er.) + . +'ter the user l%gs int% the sche&a sessi%n. # . +'ter the 'irst *ac3aged *r%cedure is e/ecuted. ) . +'ter the *ac3age %dy is e/ecuted. ?. +'ter the 'irst *ac3aged c%nstruct is re'erenced. +ns:0 ?

113 86. 5hich %' the '%ll%.ing state&ents is n%t true %' a trigger[ + . 1riggers can st%* a ?$L state&ent 'r%& e/ecuting %n a *articular ta le. # . 1riggers can change inc%&ing data in an ;8?+1: state&ent %n a gi"en ta le. ). 1riggers can include any "alid 8L9SQL state&ent at any ti&e. ? . 1riggers can change a n%n0u*datea le "ie. t% an u*datea le "ie.. +ns:0 ) 87. 5hat data ase "ie.s can e assigned the I=S1:+? (2 trigger[ +M. +ny "ie.. # . (nly "ie.s that D%in ta les. ) . @ie.s .ith &issing *ri&ary 3ey data. ? . @ie.s that c%ntain %ther triggers. +ns:0 + 88. In a rand ne. sche&a6 y%u ha"e created t.% triggers6 the 'irst c%nsisting %' 15 lines %' 8L9SQL c%de and the sec%nd c%nsisting %' 23 lines %' 8L9SQL c%de. 1he 'irst trigger has *arsed c%rrectly6 and the sec%nd has c%&*ilati%n err%rs. H%. &any rec%rds are in the ;S:-G1-IKK:- "ie.[ +. 2 rec%rds # . 38 rec%rds ) . , rec%rds ? . 15 rec%rds +ns:0 + 89. 7%u .ant t% create a trigger that .ill st%re the na&e %' the (racle sche&a that issues any ;8?+1: state&ents against the 8;-)H+S:G(-?:-S ta le. 7%u are n%t c%ncerned .ith the actual rec%rds changed6 %nly .ith the 'act that an ;8?+1: .as issued. 5hich %' the '%ll%.ing is the est a**r%ach[ + . )reate a #:2(-: (- +21:- ;8?+1: trigger 2(- :+)H -(5. # . )reate a #:2(-: (- +21:- ;8?+1: trigger6 and use a 5H:= clause t% li&it the 'iring. ). )reate a #:2(-: ;8?+1: trigger 2(- :+)H S1+1:$:=1. ? . It cann%t e d%ne. +ns:0 ) 9,. 5hich %' the '%ll%.ing can e included in the trigger %dy %' an e/ecuta le trigger[ F)h%%se all that a**ly.)

114

+ . + )($$I1 state&ent. #. + user0de'ined "aria le de'ined .ith the E-(5178: declarati"e. ) . )alls t% a st%red *r%cedure that c%ntains a S+@:8(I=1 state&ent. ? . +n I=S:-1 state&ent %n the sa&e ta le t% .hich the trigger is assigned. +ns:0 # 91. 7%u ha"e created a trigger. 5here .ill y%u 'ind the trigger c%de in the data dicti%nary[ + . 1he 1-IKK:-G#(?7 c%lu&n %' the ;S:-GS(;-): "ie.. # . 1he 1:I1 c%lu&n %' the ;S:-GS(;-): "ie.. ). 1he 1-IKK:-G#(?7 c%lu&n %' the ;S:-G1-IKK:-S "ie.. ? . 1he 1-IKK:-G1:I1 c%lu&n %' the ;S:-G1-IKK:-S "ie.. +ns:0 ) 92. Sche&a 1 %.ns a ta le called )-;IS:S. Sche&a 2 .ants t% create a *r%cedure that issues an ;8?+1: state&ent %n sche&a 1!s ta le )-;IS:S. 5hat &ust sche&a 1 d% in %rder '%r sche&a 2 t% e a le t% create the *r%cedure[ + . Sche&a 1 &ust get a ?#+ t% grant the right *ri"ileges. #. Sche&a 1 &ust grant ;8?+1: %n the ta le t% sche&a 2. ) . It cann%t e d%ne. ? . Sche&a 1 &ust create a r%le and grant *ri"ileges %n the r%le t% sche&a 2. +ns:0 # 93. 7%u need t% create a 'uncti%n t% e called 'r%& an I2 state&ent %' an (racle 2%r&!s 8L9SQL trigger and n%.here else. 5here is the est *lace t% st%re this 'uncti%n[ + . In the data ase as a st%red 'uncti%n. # . In a te/t 'ile %n the client. ). In the '%r& as a *r%gra& unit.

115

? . In a c%&&%n li rary t% e shared y se"eral (racle 2%r&s. E !lanat"on# 1his is a su Decti"e <uesti%n6 ut n%t unli3e ()8 e/a& <uesti%ns. Ideally6 y%u sh%uld st%re a *r%gra& unit .here it has %nly the e/*%sure it re<uires and n% &%re. In this scenari%6 the 'uncti%n sh%uld e st%red in the (racle 2%r& that is calling it ecause n% %ther *r%gra& unit .ill re<uire it. In a te/t 'ile %n the client .%uldn!t .%r3 ecause y%u can!t st%re a na&ed *r%gra& unit in a te/t 'ile. F7%u can st%re the c%de that creates a na&ed *r%gra& unit in a te/t 'ile6 ut the na&ed *r%gra& unit cann%t e in"%3ed 'r%& .ithin the te/t 'ile.) In the data ase as a st%red 'uncti%n and In a c%&&%n li rary t% e shared y se"eral (racle 2%r&s .%uld technically .%r36 ut In the '%r& as a *r%gra& unit is ideal. +ns:0 ) 94. +ssu&e that any re'erenced ta les and c%lu&ns are *r%*erly declared. 5hich %' the '%ll%.ing is n%t a "alid dataty*e '%r a l%cal 'uncti%n *ara&eter[ + . #((L:+= # . )-;IS:S.)-;IS:G=+$:E178: ) . =;$#:?M. @+-)H+-2F3,) E !lanat"on# 7%u cann%t s*eci'y length6 *recisi%n6 %r scale in *ara&eter dataty*es '%r *r%cedures %r 'uncti%ns6 .hether they are l%cal %r n%t. +ns:0 ? 95. )an u create an user0de'ined %*erat%r[ I' yes gi"e the synta/ and the underlying ta le '%r this[ +ns:0 yes6
)-:+1: 2;=)1I(= e<G' Fa @+-)H+-26 #:KI= I2 a R 1H:= -:1;-= 14 :LS: -:1;-= ,4 :=? I24 :=?4 )-:+1: (8:-+1(- e<G%* #I=?I=K F@+-)H+-26 @+-)H+-2) @+-)H+-2) -:1;-= =;$#:- +S

116
-:1;-= =;$#:;SI=K e<G'4

96..hat is t% ?irect08ath I=S:-1[ +ns:0 (racle inserts data int% a ta le in %ne %' t.% .ays: ?uring c%n"enti%nal insert %*erati%ns6 (racle reuses 'ree s*ace in the ta le6 interlea"ing ne.ly inserted data .ith e/isting data. ?uring such %*erati%ns6 (racle als% &aintains re'erential integrity c%nstraints. ?uring direct0*ath I=S:-1 %*erati%ns6 (racle a**ends the inserted data a'ter e/isting data in the ta le. ?ata is .ritten directly int% data 'iles6 y*assing the u''er cache. 2ree s*ace in the e/isting data is n%t reused6 and re'erential integrity c%nstraints are ign%red. 1hese *r%cedures c%& ined can enhance *er'%r&ance. 7%u can i&*le&ent direct0*ath I=S:-1 %*erati%ns y using direct0*ath I=S:-1 state&ents %r y using (racleQs direct0*ath l%ader utility6 SQLML%ader. 1his secti%n discusses direct0*ath I=S:-1.

117

Oracle**
ORA*L) (AQs 2 WCAT .S DATA OR .1(OR4AT.O1E Ans/ The 4atter that %e #eed into the *om!uter is called Data or .n#ormation 5 WCAT .S DATABAS)E Ans/ The *ollection o# .nterrelated Data is called Data Base 6 WCAT .S A DATABAS) 4A1A0)4)1T S@ST)4 ,DB4S- PA*AA0)E Ans/ The *ollection o# .nterrelated Data and some Programs to access the Data is *alled Data Base 4anagement System ,DB4SM WC)1 *A1 W) SA@ A DB4S PA*AA0) AS RDB4SE Ans/ (or a system to Quali#y as R)LAT.O1AL DATABAS) 4A1A0)4)1T system& it must use its R)LAT.O1AL #acilities to 4A1A0) the DATABAS) : WCAT .S ORDB4SE Ans/ Ob>ect ,oriented- Relational Data Base 4anagement System is one that can store data& the relationshi! o# the data& and the beha"ior o# the data ,i e & the %ay it interacts %ith other dataI 1A4) SO4) *ODD9S R8L)S Ans/ Dr ) ( *odd !resented 25 rules that a database must obey i# it is to be considered truly relational Out those& some are as #ollo%s a- The rules stem #rom a single rule$ the [Qero ruleN/ (or a system to Quali#y as R)LAT.O1AL DATABAS) 4A1A0)4)1T system& it must use its R)LAT.O1AL #acilities to 4A1A0) the DATABAS) b- .n#ormation Rule/ Tabular Re!resentation o# .n#ormation c- 0uaranteed Access Rule/ 8niBueness o# tu!les #or guaranteed accessibility d- 4issing .n#ormation Rule/ Systematic re!resentation o# missing in#ormation as 18LL "alues e- *om!rehensi"e Data Sub$Language Rule/ QL to su!!ort Data de#inition& =ie% de#inition& Data mani!ulation& .ntegrity& AuthoriQation and Security L WCAT AR) C.)RAR*C.*AL& 1)TWORA& A1D R)LAT.O1AL DATABAS) 4OD)LSE Ans/ a- Cierarchical 4odel/ The Cierarchical 4odel %as introduced in the .n#ormation 4anagement System ,.4Sde"elo!ed by .B4 in 2;I< .n this data is organiQed as a tree structure )ach tree is made o# nodes and branches The nodes o# the tree re!resent the record ty!es and it is a collection o# data attributes entity at that !oint The to!most node in the structure is called the root 1odes succeeding lo%er le"els are called children

118
b- 1et%ork 4odel/ The 1et%ork 4odel& also called as the *ODS@L database structure& is an im!ro"ement o"er the Cierarchical mode& in this model conce!t o# !arent and child is e'!anded to ha"e multi!le !arent$child relationshi!s& i e any child can be subordinate to many di##erent !arents ,or nodes- Data is re!resented by collection o# records& and relationshi!s among data are re!resented by links A link is an association bet%een !recisely t%o records 4any$to$many relationshi!s can e'ists bet%een the !arent and child c- Relational 4odel/ The Relational Database 4odel eliminates the need #or e'!licit !arent$child relationshi!s .n RDB4S& data is organiQed in t%o$dimensional tables consisting o# relational& i e no !ointers are maintained bet%een tables < WCAT .S DATA 4OD)L.10E Ans/ Data 4odeling describes relationshi! bet%een the data ob>ects The relationshi!s bet%een the collections o# data in a system may be gra!hically re!resented using data modeling ; D)(.1) )1T.T@& ATTR.B8T) A1D R)LAT.O1SC.P Ans/ )ntity/ An )ntity is a thing& %hich can be easily identi#ied An entity is any ob>ect& !lace& !erson& conce!t or acti"ity about %hich an enter!rise records data Attribute/ An attribute is the !ro!erty o# a gi"en entity Relationshi!/ Relationshi! is an association among entities 2D WCAT .S )R$4OD)L.10E Ans/ The )$R modeling techniBue is the To! Do%n A!!roach )ntity relationshi! is techniBue #or analysis and logical modeling o# a systemNs data reBuirements .t is the most %idely used and has gained acce!tance as the ideal database design .t uses three basic units/ entities& their attributes and the relationshi! that e'ists bet%een the entities .t uses a gra!hical notation #or re!resenting these 22 WCAT .S 1OR4AL.TAT.O1E Ans/ 1ormaliQation is a ste!$by$ste! decom!osition o# com!le' records into sim!le records 25 WCAT AR) =AR.O8S 1OR4AL (OR4S O( DATAE Ans/ The (irst 1ormal (orm 21(& The Second 1ormal (orm 51(& The Third 1ormal (orm 61(& The Boyce and *odd 1ormal (orm B* 1( 26 WCAT .S D)1OR4AL.TAT.O1E Ans/ The intentional introduction o# redundancy to a table to im!ro"e !er#ormance is called D)1OR4AL.TAT.O1 2M WCAT AR) 2$T.)R& 5$T.)R& 6$T.)R OR 1$T.)R DATABAS) AR*C.T)*T8R)SE Ans/ 2$Tier Database Architecture is based on single system& %hich acts as both ser"er and client 5$Tier Architecture is based on one ser"er and client 6$Tier Architecture is based on one ser"er and client out that on client act as a remote system 1$Tier Architecture is based on 1 no O# ser"ers and 1 no O# clients

119
2: WCAT AR) A TABL)& *OL841& A1D R)*ORDE Ans/ Table/ A Table is a database ob>ect that holds your data .t is made u! o# many columns )ach o# these columns has a data ty!e associated %ith it *olumn/ A column& re#erred to as an attribute& is similar to a #ield in the #ile system Record/ A ro%& usually re#erred to as tu!le& is similar to record in the #ile system 2I WCAT .S D.(()R)1*) B)TW))1 A PRO*)D8RAL LA108A0) A1D A 1O1$PRO*)D8RAL LA108A0)E Ans/ Procedural Language 1O1$Procedural Language A !rogram in this im!lements a ste!$by$ste! algorithm to sol"e the !roblem .t contains %hat to do but not ho% to do 2L WCAT T@P) O( LA108A0) JSQLJ .SE Ans/ SQL is a 1on$!rocedural& Mth generation Language&/ %hich concerts %hat to do rather than ho% to do any !rocess 2< *LASS.(.*AT.O1 O( SQL *O44A1DSE Ans/ DDL ,Data De#inition Language- D4L ,Data 4ani!ulating Language- D*L ,Data *ontrol Language- DTL,Data Transaction Language*reate Alter Dro! Select .nsert 8!date Delete Rollback *ommit 0rant Re"oke 2; WCAT .S D.(()R)1*) B)TW))1 DDL A1D D4L *O44A1DSE Ans/ (or DDL commands autocommit is O1 im!licitly %hereas (or D4L commands autocommit is to be turned O1 e'!licitly 5D WCAT .S D.(()R)1*) B)TW))1 A TRA1SA*T.O1 A1D A Q8)R@E Ans/ A Transaction is unit o# some commands %here as Query is a single line reBuest #or the in#ormation #rom the database 52 WCAT .S D.(()R)1*) B)TW))1 TR81*AT) A1D D)L)T) *O44A1DSE Ans/ Truncate *ommand %ill delete all the records %here as Delete *ommand %ill delete s!eci#ied or all the records de!ending only on the condition gi"en 55 WCAT .S D.(()R)1*) B)TW))1 8PDAT) A1D ALT)R *O44A1DSE Ans/ Alter command is used to modi#y the database ob>ects %here as the 8!date command is used to modi#y the "alues o# a data base ob>ects 56 WCAT AR) *O44A1DS O( T*L *AT)0OR@E Ans/ 0rant and Re"oke are the t%o commands belong to the T*L *ategory 5M WC.*C .S A1 )((.*.)1T *O44A1D $ TR81*AT) OR D)L)T)E WC@E Ans/ Delete is the e##icient command because using this command %e can delete only those records that are not really reBuired 5: WCAT AR) R8L)S (OR 1A4.10 A TABL) OR *OL841E Ans/ 2- 1ames must be #rom 2 to 6D bytes long 5- 1ames cannot contain Buotation marks 6- 1ames are not case sensiti"e

12,
M- A name must begin %ith an al!habetic character #rom your database character set and the characters S and ^ But these characters are discouraged :- A name cannot be ORA*L) reser"ed %ord I- A name must be uniBue across its names!ace Ob>ects in the name s!ace must ha"e di##erent names L- A name can be enclosed in double Buotes 5I COW 4A1@ *OL841S *A1 A TABL) CA=)E Ans/ A Table can ha"e 2DDD columns 5L WCAT AR) D.(()R)1T DATAT@P)S S8PPORT)D B@ SQLE Ans/ *har ,siQe-& 1char ,siQe-& =archar5 ,siQe-& 1"archar5 ,siQe- data ty!es #or character "alues& 1umber ,!recision& scale-& 1umber& 1umber ,n-& (loat& (loat ,binary !recision- data ty!es #or numerical "alues& Date data ty!e #or date "alues& Long& Ra% ,siQe-& Long Ra%& *lob& Blob& 1clob& B#ile #or large ob>ects 5< WCAT .S D.(()R)1*) B)TW))1 LO10 A1D LOB DATAT@P)SE Ans/ LOB LO10 2- The ma'imum siQe is M0B 5- LOBs ,e'ce!t 1*LOB- can be attributes o# an ob>ect ty!e 6- LOBs su!!ort random access to data M- 4ulti!le LOB columns !er table or LOB attributes in an ob>ect ty!e 2- The ma'imum siQe is 50B 5- LO10s cannot 6- LO10s su!!ort only seBuential access M- Only one LO10 column %as allo%ed in a table 5; WCAT .S D.(()R)1*) B)TW))1 *CAR A1D =AR*CAR5 DATAT@P)SE Ans/ =archar5 is similar to *har but can store "ariable no O# characters and %hile Buerying the table "archar5 trims the e'tra s!aces #rom the column and #etches the ro%s that e'actly match the criteria 6D COW 48*C 4)4OR@ .S ALLO*AT)D (OR DAT) DATAT@P)E WCAT .S D)(A8LT DAT) (OR4AT .1 ORA*L)E Ans/ (or Date data ty!e oracle allocates L bytes 4emory De#ault Date (ormat is/ DD$4O1$@@ 62 WCAT .S RA10) (OR )A*C DATAT@P) O( SQLE Ans/ Dataty!e Range *har =archar5 1umber (loat LO10& RAW& LO10RAW Large Ob>ects ,LOBNs- 5DDD bytes MDDD bytes Precision 2 to 6< Scale $<M to 25L Precision 6< decimals Or 255 binary !recision 5 0B M0B 65 COW TO R)1A4) A *OL841E Ans/ We canNt rename a *olumn o# a table directly So %e #ollo% the #ollo%ing ste!s To Rename a *olumn/ a- Alter the table s!eci#ying ne% column name to be gi"en and data ty!e b- Then co!y the "alues in the column to be renamed into ne% column c- dro! the old column 66 COW TO D)*R)AS) S.T) OR *CA10) DATAT@P) O( A *OL841E Ans/ To Decrease the siQe o# a Data ty!e o# a column

121
i Truncate the table #irst ii Alter the table column %hose siQe is to be decreased using the same name and data ty!e but ne% siQe 6M WCAT .S A *O1STRA.1TE WCAT AR) .TS =AR.O8S L)=)LSE Ans/ *onstraint/ *onstraints are re!resentators o# the column to en#orce data entity and consistency There r t%o le"els 2-*olumn$le"el constraints 5-Table$le"el constraints 6: L.ST O8T ALL TC) *O1STRA.1TS S8PPORT)D B@ SQL Ans/ 1ot 1ull& 8niBue& *heck& Primary Aey and (oreign Aey or Re#erential .ntegrity 6I WCAT .S D.(()R)1*) B)TW))1 81.Q8)O1OT 18LL A1D PR.4AR@ A)@E Ans/ 8niBue and 1ot 1ull is a combination o# t%o *onstraints that can be !resent any number o# times in a table and canNt be a re#erential key to any column o# an another table %here as Primary Aey is single *onstraint that can be only once #or table and can be a re#erential key to a column o# another table becoming a re#erential integrity 6L WCAT .S A *O4POS.T) PR.4AR@ A)@E Ans/ A Primary key created on combination o# columns is called *om!osite Primary Aey 6< WCAT .S A *A1D.DAT) *OL841E COW 4A1@ *A1D.DAT) *OL841S *A1 B) POSS.BL) P)R *O4POS.T) PR.4AR@ A)@E Ans/ 6; COW TO D)(.1) A 18LL =AL8)E Ans/ A 18LL "alue is something %hich is una"ailable& it is neither Qero nor a s!ace and any mathematical calculation %ith 18LL is al%ays 18LL MD WCAT .S 18LLE A *O1STRA.1T OR D)(A8LT =AL8)E Ans/ .t is a de#ault "alue M2 WCAT .S D)(A8LT =AL8) (OR )=)R@ *OL841 O( A TABL)E Ans/ 18LL M5 WCAT .S *R)AT)D .4PL.*.TL@ (OR )=)R@ 81.Q8) A1D PR.4AR@ A)@ *OL841SE Ans/ .nde' M6 WCAT AR) L.4.TAT.O1S O( *C)*A *O1STRA.1TE Ans/ .n this %e can9t s!eci#y Pseudo *olumns like sysdate etc MM WCAT .S D.(()R)1*) B)TW))1 R)()R)1*)S A1D (OR).01 A)@ *O1STRA.1TE Ans/ Re#erences is used as column le"el key %ord %here as #oreign key is used as table le"el constraint M: WCAT .S JO1 D)L)T) *AS*AD)JE Ans/ %hen this key %ord is included in the de#inition o# a child table then %hene"er the records #rom the !arent table is deleted automatically the res!ecti"e "alues in the child table %ill be deleted MI WCAT .S PAR)1T$*C.LD OR 4AST)R$D)TA.L R)LAT.O1SC.PE Ans/ A table %hich re#erences a column o# another table,using Re#erences-is called as a child table,detail table- and a table %hich is being re#erred is called Parent ,4asterTable

122
ML COW TO DROP A PAR)1T TABL) WC)1 .TNS *C.LD TABL) )R.STSE Ans/ 8sing Jon delete cascadeJ M< .S ORA*L) *AS) S)1S.T.=)E Ans/ 1O M; COW ORA*L) .D)1T.(.)S )A*C R)*ORD O( TABL) 81.Q8)L@E Ans/ By *reating inde'es and re#erence .Ds :D WCAT .S A PS)8DO$*OL841E 1A4) SO4) PS)8DO$*OL841S O( ORA*L)E Ans/ *olumns that are not created e'!licitly by the user and can be used e'!licitly in Bueries are called Pseudo$*olumns )'/curr"al&ne't"al&sysdate_ :2 WCAT (OR JORD)R B@J *LA8S) (OR A Q8)R@E Ans/ To arrange the Buery result in a s!eci#ied order,ascending&descending- by de#ault it takes ascending order :5 WCAT .S J0RO8P B@J Q8)R.)SE Ans/ To grou! the Buery results based on condition :6 1A4) SO4) A00R)0AT) (81*T.O1S O( SQLE Ans/ A=0& 4AR& S84& 4.1&*O81T :M WCAT .S D.(()R)1*) B)TW))1 *O81T ,-& *O81T ,3- (81*T.O1SE Ans/ *ount ,- %ill count the s!eci#ied column %hereas count ,3- %ill count total no o# ro%s in a table :: WCAT (OR ROLL8P A1D *8B) OP)RATORS AR)E Ans/ To get subtotals and grand total o# "alues o# a column :I WCAT .S A S8B$Q8)R@E Ans/ A Buery %ithin a Buery is called a sub Buery %here the result o# inner Buery %ill be used by the outer Buery :L WCAT AR) SQL OP)RATORSE Ans/ =alue ,-& Re# ,- is SQL o!erator :< )RPLA.1 JA1@J&JSO4)J&JALLJ&J)R.STSJ OP)RATORSE Ans/ Any/ The Any ,or itNs synonym SO4)- o!erator com!utes the lo%est "alue #rom the set and com!ares a "alue to each returned by a sub Buery All/ ALL com!ares a "alue to e"ery "alue returned by SQL )'ists/ This o!erator !roduces a BOOLWA1 results .# a sub Buery !roduces any result then it e"aluates it to TR8) else it e"aluates it to (ALS) :; WCAT .S A *ORR)LAT)D S8B Q8)R@& COW .T .S D.(()R)1T (RO4 A 1OR4AL S8B Q8)R@E Ans/ A correlated subBuery is a nested subBuery& %hich is e'ecuted once #or each [*andidate ro%N by the main Buery& %hich on e'ecution uses a "alue #rom a column in the outer Buery .n normal sub Buery the result o# inner Buery is dynamically substituted in the condition o# the outer Buery %here as in a correlated subBuery& the column "alue used in inner Buery re#ers to the column "alue !resent in the outer Buery #orming a correlated subBuery ID WCAT .S A HO.1 $ T@P)S O( HO.1SE Ans/ A >oin is used to combine t%o or more tables logically to get Buery results There are #our ty!es o# Hoins namely )Q8. Hoin 1O1$)Q8. Hoin

123
S)L( Hoin O8T)R Hoin I2 WCAT AR) 4.1.484 R)Q8.R)4)1TS (OR A1 )Q8.$HO.1E Ans/ There shold be atleast one common column bet%een the >oining tables I5 WCAT .S D.(()R)1*) B)TW))1 L)(T& R.0CT O8T)R HO.1E Ans/.# there r any "alues in one table that do not ha"e corres!onding "alues in the other&in an eBui >oin that ro% %ill not be selected Such ro%s can be #orce#ully selected by using outer >oin symbol,O- on either o# the sides,le#t or right- based on the reBuirement I6 WCAT .S D.(()R)1*) B)TW))1 )Q8. A1D S)L( HO.1SE Ans/ S)L( HO.1 is made %ithin the table %hereas )Q8. HO.1 is made bet%een di##erent tables ha"ing common column IM WCAT AR) JS)TJ OP)RATORSE Ans/ 81.O1& .1T)RS)*T or 4.18S is called S)T OP)RATORS I: WCAT .S D.(()R)1*) B)TW))1 J81.O1J A1D J81.O1 ALLJ OP)RATORSE Ans/ 81.O1 %ill return the "alues distinctly %hereas 81.O1 ALL %ill return e"en du!licate "alues II 1A4) SO4) 184B)R& *CARA*T)R& DAT)& *O1=)RS.O1& OTC)R (81*T.O1S Ans/ 1umber (unctions/ Round ,m& `n]-& Trunc ,m& `n]-& Po%er ,m& n-& SBrt& Abs ,m-& *eil ,m-& (loor ,m-& 4od ,m& n*haracter (unctions/ *hr ,'*oncert ,string2& string5Lo%er ,string8!!er ,stringSubstr ,string& #rom7str& to7strAS*.. ,stringLength ,string.nitca! ,stringDate (unctions/ sysdate 4onths bet%een ,d2& d5To7char ,d& #ormatLast day ,d1e't7day ,d& day*on"ersion (unctions/ To7char To7date To7number IL WCAT .S D.(()R)1*) B)TW))1 4AR ,- A1D 0R)AT)ST ,- (81*T.O1SE Ans/ 4AR is an aggregate #unction %hich takes only one column name o# a

124
table as !arameter %hereas 0reatest is a general #unction %hich can take any number o# "alues and column names #rom dual and table res!ecti"ely I< WCAT (OR 1=L ,- (81*T.O1 .SE Ans/ 1=L (unction hel!s in substituting a "alue in !lace o# a 18LL I; WCAT (OR D)*OD) ,- (81*T.O1 .SE Ans/ .t is substitutes "alue basis and it actually does an 9i#$then$else9 test LD WCAT .S D.(()R)1*) B)TW))1 TRA1SLAT) ,- A1D R)PLA*) ,(81*T.O1SE Ans/ Translate,- is a su!erset o# #unctionality !ro"ided by Re!lace,L2 WCAT .S D.(()R)1*) B)TW))1 S8BSTR ,- A1D .1STR ,- (81*T.O1SE Ans/ Substr,- %ill return the s!eci#ied !art o# a string %hereas .nstr,- return the !osition o# the s!eci#ied !art o# the string L5 WCAT .S A H8L.A1 DA@ 184B)RE Ans/ .t %ill return count o# the no O# days bet%een Hanuary 2& ML25 B* and the gi"en date L6 COW TO D.SPLA@ T.4) (RO4 A DAT) DATAE Ans/ By using time #ormat as 9hh `hh5M]/ mi/ ss9 in to7char,- #unction LM COW TO .1S)RT DAT) A1D T.4) .1TO A DAT) *OL841E Ans/ By using #ormat 9dd$mon$yy hh `hh5M]/ mi/ ss9 in to7date,#unction L: WCAT .S D.(()R)1*) B)TW))1 TO7DAT) ,- A1D TO7*CAR ,- *O1=)RS.O1 (81*T.O1SE Ans/ To7date con"erts character date to date #ormat %hereas To7char #unction con"erts date or numerical "alues to characters LI WCAT .S A =.)WE COW .T .S D.(()R)1T (RO4 A TABL)E Ans/ =ie% is database ob>ect& %hich e'ists logically but contains no !hysical data and mani!ulates the base table =ie% is sa"ed as a select statement in the database and contains no !hysical data %hereas Table e'ists !hysically LL WCAT .S D.(()R)1*) B)TW))1 S.4PL) A1D *O4PL)R =.)WSE Ans/ Sim!le "ie%s can be modi#ied %hereas *om!le' "ie%s,created based on more than one table- cannot be modi#ied L< WCAT .S A1 .1L.1) =.)WE Ans/ .nline "ie% is basically a subBuery %ith an alias that u can use like a "ie% inside a SQL statement .t is not a schema ob>ect like SQL$ob>ect L; COW TO 8PDAT) A *O4PL)R =.)WE Ans/ 8sing 9.1ST)AD O(9 TR.00)RS *om!le' "ie%s can be 8!dated <D WCAT (OR JW.TC *C)*A OPT.O1J (OR A =.)WE Ans/ JW.TC *C)*A OPT.O1J clause s!eci#ies that inserts and u!dates r !er#ormed through the "ie% r not allo%ed to create ro%s %hich the "ie% cannot select and there#ore allo%s integrity constraints and data "alidation checks to be en#orced on data being inserted or u!dated <2 WCAT .S A1 .1D)RE AD=A1TA0) O( A1 .1D)R Ans/ An .nde' is a database ob>ect used n Oracle to !ro"ide Buick access to ro%s in a table An .nde' increases the !er#ormance o# the database

125
<5 WCAT .S A S)Q8)1*)E PS)8DO$*OL841S ASSO*.AT)D W.TC S)Q8)1*)E Ans/ SeBuence is a Database Ob>ect used to generate uniBue integers to use as !rimary keys 1e't"al& *urr"al are the Pseudo *olumns associated %ith the seBuence 33 <6 WCAT .S A *L8ST)RE WC)1 TO 8S) A *L8ST)RE COW TO DROP A *L8ST)R WC)1 *L8ST)R)D TABL) )R.STSE Ans/ *luster and .nde'es are trans!arent to the user *lustering is a method o# storing tables that are intimately related and are o#ten >oined together into the same area on the disk When cluster table e'ists then to dro! cluster %e ha"e to dro! the table #irst then only cluster is to be dro!!ed <M WCAT .S A S1APSCOT OR 4AT)R.AL.T)D =.)WE Ans/ 4aterialiQed "ie%s can be used to re!licate data )arlier the data %as re!licated through *R)AT) S1APSCOT command 1o% *R)AT) 4AT)R.AL.T)D =.)W can be used as synonym #or *R)AT) S1APSCOT Query !er#ormance is im!ro"ed using the materialiQed "ie% as these "ie%s !re calculate e'!ensi"e >oins and aggregate o!erations on the table <: WCAT .S A S@1O1@4E Ans/ A Synonym is a database ob>ect that allo%s you to create alternate names #or Oracle tables and "ie%s .t is an alias #or a table& "ie%& sna!shot& seBuence& !rocedure& #unction or !ackage <I WCAT .S D.(()R)1*) B)TW))1 PR.=AT) A1D P8BL.* S@1O1@4E Ans/ Only the user or table o%ner can re#erence Pri"ate synonym %hereas any user can re#erence the Public synonym <L WCAT .S D.(()R)1*) B)TW))1 JSQLJ A1D JSQL3PL8SJ *O44A1DSE Ans/ SQL commands are stored in the bu##er %hereas SQL3PL8S are not 33<< 1A4) SO4) SQL3PL8S *O44A1DSE Ans/ D)S* `*R.B)]& START& 0)T& SA=)& / are SQL3PL8S *O44A1DS <; WCAT AR) JSQL3PL8S R)PORT.10J *O44A1DSE Ans/ SPOOL #ile$name& SPOOL O8T& TT.TL)& BT.TL)& BR)AA O1& *O4P8T) Fany aggregate #unctionG O( Fcolumn nameG `break] O1 Fcolumn nameG etc are SQL3PL8S R)PORT.10 *O44A1DS ;D WCAT AR) S@ST)4 A1D OBH)*T PR.=.L)0)SE Ans/ *onnect and Resource etc are System Pri"ileges *reate Fob>ectG& Select& .nsert& Alter etc are Ob>ect Pri"ileges ;2 WCAT (OR D*L *O44A1DS AR)E Ans/ *ommit& Rollback are D*L commands ;5 WCAT (OR 0RA1T *O44A1D W.TC JW.TC 0RA1T OPT.O1JE Ans/ YWith 0rant O!tionZ %ith 0rant *ommand gi"es !ri"ileges to the user to grant !ri"ileges to other user,samong the !ri"ileges he/she has

126
;6 COW TO *CA10) PASSWORD O( A 8S)RE Ans/ 8sing Pass%ord command or 8sing ALT)R 8S)R Fuser nameG .D)1T.(.)D B@ Fne% !ass%ordG *O4A1D

;M WCAT .S A S*C)4A A1D S*C)4A OBH)*TSE Ans/ A schema is a collection o# logical structures o# data& or schema ob>ects A schema is o%ned by the database user and has the same name as that o# user )ach user o%ns a single schema Schema ob>ects include #ollo%ing ty!e o# ob>ects *lusters& Database Links& (unctions& .nde'es& Packages& Procedures& SeBuences& Synonyms& Tables& Database Triggers& =ie%s 33;: COW TO START8P A1D SC8TDOW1 ORA*L) DATABAS)E Ans/ Startu! and Shutdo%n Oracle database can be done by only the administator Startu! is done by using START8P command and Shutdo%n is done by SC8TDOW1 command ;I WCAT .S A S)SS.O1E Ans/ The !eriod bet%een Login and Logo## on schema ;L WCAT .S A *L.)1T PRO*)SSE WCAT .S A S)R=)R PRO*)SSE Ans/ re#/ 2L5 Q V A ;< COW TO 4AA) )=)R@ D4L OP)RAT.O1 AS A8TO *O44.TE Ans/ By using S)T A8TO*O44.T O1 command ;; COW TO D.SPLA@ DATA PA0) W.S) .1 SQLE Ans/ By using S)T PA8S) O1 command 2DD COW TO *CA10) L.1) S.T)& PA0) S.T) A1D SQL PRO4PTE Ans/ By using S)T L.1)S.T) F"alueG& S)T PA0)S.T) F"alueG& S)T SQLPRO4PT Fne% !rom!tG 2D2 COW PL/SQL .S D.(()R)1T (RO4 SQLE Ans/ SQL is non$!rocedural language %hereas PL/SQL is !rocedural language that includes #eatures and design o# !rogramming language 2D5 WCAT .S AR*C.T)*T8R) O( PL/SQLE Ans/ 2D6 WCAT .S A PL/SQL BLO*AE Ans/ D)*LAR) FdeclarationsG B)0.1 F)'ececutable StatementsG )R*)PT.O1 F)'ce!tion Candler,s-G )1D+ 2DM WCAT AR) D.(()R)1T T@P)S O( PL/SQL BLO*ASE Ans/ D)*LAR) BLO*A/ .n this block all the declarations o# the "ariable used in the !rogram is made .# no "ariables are used this block %ill become o!tional B)0.1 BLO*A/ .n this block all the e'ecutable statements are !laced This block is 4andatory

127
)R*)PT.O1 BLO*A/ .n this block all the e'ce!tions are handled This block is also "ery o!tional )1D/ )"ery begin must be ended %ith this )1D+ statement 2D: WCAT AR) *O4POS.T) DATA T@P)SE Ans/ Records& Tables are t%o *om!osite data ty!es 2DI WCAT .S S*OP) O( A =AR.ABL) .1 PL/SQL BLO*AE Ans/ The "isuability and accessibility o# a "ariable %ithin the block,s- is called sco!e o# a "ariable 2DL WCAT .S A 1)ST)D BLO*AE Ans/ A block %ithin a block is called 1ested Block 2D< WCAT .S A PL/SQL )10.1)E Ans/ The PL/SQL engine acce!ts any "alid PL/SQL block as in!ut& e'ecutes the !rocedural !art o# the statements and sends the SQL statements to the SQL statement e'ecutor in the Oracle ser"er 2D; WCAT .S D)(A8LT =AL8) (OR A 184)R.* PL/SQL =AR.ABL)E Ans/ 18LL 22D WCAT .S D.(()R)1*) B)TW))1 S.4PL) LOOP A1D A (OR LOOPE Ans/ Sim!le reBuires declaration o# "ariables used in it and e'it condition but (or Loo! doesnNt reBuire this 222 WCAT .S A *8RSORE ST)PS TO 8S) A *8RSORE Ans/ *ursor is Pri"ate SQL area in PL/SQL Declare the *ursor& O!en the *ursor& (etch "alues #rom SQL into the local =ariables& *lose the *ursor 225 COW 4A1@ T@P)S O( *8RSORS AR) S8PPORT)D B@ ORA*L)E Ans/ There are t%o ty!es o# cursors namely .m!licit *ursor& )'!licit *ursor 226 WCAT .S A *8RSOR (OR LOOPE Ans/ *ursor (or Loo! is shortcut !rocess #or )'!licit *ursors because the *ursor is O!en& Ro%s are #etched once #or each iteration and the cursor is closed automatically %hen all the ro%s ha"e been !rocessed 22M WCAT AR) *8RSOR ATTR.B8T)SE Ans/ P(ound P1ot(ound P.sO!en PRo%*ount are the cursor attributes 22: WCAT .S 8S) O( *8RSOR W.TC J(OR 8PDAT) O(J *LA8S)E Ans/ This *lause sto! accessing o# other users on the !articular columns used by the cursor until the *O44.T is issued 22I WCAT .S A1 )R*)PT.O1E COW .T .S D.(()R)1T (RO4 )RRORE Ans/ Whene"er an error occurs )'ce!tion raises )rror is a bug %hereas the )'ce!tion is a %arning or error condition 22L 1A4) SO4) B8.LT$.1 )R*)PT.O1S Ans/ Too74any7Ro%s 1o7Data7(ound Tero7Di"ide 1ot7Logged7On

128
Storage7)rror =alue7)rror etc

22< COW TO *R)AT) A 8S)R$D)(.1)D )R*)PT.O1E Ans/ 8ser$De#ined )'ce!tion is created as #ollo%s/ D)*LAR) Fe'ce!tion nameG )R*)PT.O1+ $$$$$$$$$+ $ $ $ $ $ $ $ $ $+ B)0.1 $ $ $ $ $ $ $ $ $+ $ $ $ $ $ $ $ $ $+ RA.S) Fe'ce!tion nameG+ )R*)PT.O1 WC)1 Fe'ce!tion nameG TC)1 $ $ $ $ $ $ $ $ $+ $ $ $ $ $ $ $ $ $+ )1D+ 22; WCAT .S JOTC)RSJ )R*)PT.O1E Ans/ .t is used to along %ith one or more e'ce!tion handlers This %ill handle all the errors not already handled in the block 25D WCAT .S S*OP) O( )R*)PT.O1 CA1DL.10 .1 1)ST)D BLO*ASE Ans/ )'ce!tion sco!e %ill be %ith in that block in %hich e'ce!tion handler is %ritten 252 WCAT .S A S8B$PRO0RA4E Ans/ A S8BPRO0RA4 .S A PL/SQL BLO*A& WC.*C W.LL B) .1=OA)D B@ TAA.10 PARA4AT)RS 255 WCAT AR) D.(()R)1T T@P)S O( S8B$PRO0RA4SE Ans/ TC)@ R TWO T@P)S/ 2- PRO*)D8R) 5- (81*.O1 256 COW A PRO*)D8R) .S D.(()R)1T (RO4 A (81*T.O1E Ans/ (unction has return key %ord and returns a "alue %hereas a Procedure doesnNt return any "alue 25M WCAT AR) T@P)S O( PARA4)T)RS TCAT *A1 B) PASS)D TO (81*T.O1 OR PRO*)D8R)E Ans/ .1& .1 O8T& O8T 25: WCAT .S J.1 O8TJ PARA4)T)RE Ans/ A !arameter& %hich gets "alue into the Procedure or (unction and takes the "alue out o# the Procedure or (unction area& is called .1 O8T !arameter 25I DO)S ORA*L) S8PPORTS PRO*)D8R) O=)RLOAD.10E Ans/ 1O 25L WCAT .S A PA*AA0) A1D PA*AA0) BOD@E Ans/ Package is declarati"e !art o# the #unctions and !rocedures stored in that !ackage and !ackage body is the de#inition !art o# the #unctions and !rocedures o# that !ackage 25< WCAT .S AD=A1TA0) O( PA*AA0) O=)R PRO*)D8R) OR (81*T.O1E Ans/ Packages !ro"ides (unctions or Procedures O"erloading #acility and security to those (unctions or Procedures

129
25; .S .T POSS.BL) TO CA=) A PRO*)D8R) A1D A (81*T.O1 W.TC TC) SA4) 1A4)E Ans/ 1O i# it is out side a Package& @)S i# it is %ithin a Package 26D DO)S ORA*L) S8PPORTS R)*8RS.=) (81*T.O1 *ALLSE Ans/ @)S 262 WCAT .S A TR.00)RE COW .T .S D.(()R)1T (RO4 A PRO*)D8R)E Ans/ Trigger/ A Trigger is a stored PL/SQL !rogram unit associated %ith a s!eci#ic database table Procedure/ A Procedure is to be e'!licitly called by the user %hereas Triggers are automatically called im!licitly by Oracle itsel# %hene"er e"ent Occurs 265 WCAT .S D.(()R)1*) B)TW))1 A TR.00)R A1D A *O1STRA.1TE Ans/ *onstraints are al%ays TR8) %hereas Triggers are 1OT al%ays TR8) and *onstraints has some limitations %hereas Trigger has no limitations 266 WCAT AR) D.(()R)1T )=)1TS (OR A TR.00)R A1D TC).R S*OP)SE Ans/ .nsert& 8!date or Delete 26M WCAT .S D.(()R)1*) B)TW))1 TABL) L)=)L A1D ROW L)=)L TR.00)RSE Ans/ Table le"el Triggers e'ecute once #or each table based transaction %hereas Ro% le"el Triggers %ill e'ecute once (OR )A*C ROW 33 26: WCAT AR) A8TO1O4O8S TR.00)RSE Ans/ 26I WCAT .S A1 J.1ST)AD O(J TR.00)RE Ans/ These Triggers are used %ith the *om!le' =ie%s only to make !ossible o# .nsert& 8!date and Delete on those =ie%s 33 26L COW 4A1@ TR.00)RS *A1 B) *O1(.08R)D O1 A TABL) A1D =.)WE Ans/ 26< WCAT .S JTABL) 48TAT.10J )RRORE COW TO SOL=) .TE Ans/ ORA$DMD;2/ Table name is mutating& trigger/#unction may not see it *ause / A trigger or a user$de#ined PL/SQL #unction that is re#erenced in the statement attem!ted to Buery or modi#y a table that %as in the middle o# being modi#ied by the statement that #ired the trigger Action / Re%rite the trigger or #unction so it does not read the table 26; WC)1 TO 8S) J/1)WJ A1D J/OLDJ SP)*.(.)RSE Ans/ The !re#i' /old is used to re#er to "alues already !resent in the table The !re#i' /ne% is a correlation name that re#ers to the ne% "alue that is inserted / u!dated 33 2MD WCAT .S A *O1D.T.O1AL TR.00)RE Ans/ 33 2M2 COW TO *R)AT) A 8S)R$D)(.1)D =AR.ABL) .1 PL/SQLE Ans/ 2M5 COW TO *R)AT) A1 ARRA@ =AR.ABL) .1 PL/SQLE Ans/ 8sing *R)AT) `OR R)PLA*)] T@P) Fty!e nameG AS =ARRA@ ,siQe- O( )L)4)1T7T@P) ,1OT 18LL- *ommand+ 332M6 COW TO 4AA) A 8S)R$D)(.1)D DATA T@P) 0LOBAL .1 PL/SQLE Ans/ 2MM COW TO *R)AT) A1 OBH)*T .1 ORA*L)E Ans/ 8sing *R)AT) `OR R)PLA*)] T@P) Fty!e nameG AS OBH)*T ,ATTR.B8T) 1A4) DATA T@P)& *ommand

13,
2M: WCAT .S A TRA1S.)1T A1D P)RS.ST)1T OBH)*TE Ans/ The Ob>ect created in a table is called Persistent Ob>ect Ob>ect created on e'ecution o# PL/SQL block is called Transient Ob>ect 332MI WCAT .S A *OL841 OBH)*T A1D TABL) OBH)*TE Ans/ A *olumn Ob>ect is only a *olumn o# a table 2ML COW TO 0RA1T P)R4.SS.O1 O1 A1 OBH)*T TO OTC)R 8S)RE Ans/ 0RA1T F!ermissionG O1 Fob>ect nameG TO Fuser nameG 2M< WCAT .S A *OLL)*T.O1 O( ORA*L)E Ans/ =array& 1ested Table is a collection o# Oracle 2M; WCAT .S D.(()R)1*) B)TW))1 =ARRA@ A1D 1)ST)D TABL)E Ans/ =array has a #i'ed siQe 1ested tables can carry any number o# "alues 2:D COW TO 4OD.(@ *O1T)1TS O( A =ARRA@ .1 ORA*L)E Ans/ To modi#y a stored =ARRA@ it has to selected into a PL/SQL "ariable and then inserted back into the table 2:2 WCAT .S 8S) O( JTC)J OP)RATOR (OR 1)ST)D TABL)E Ans/ TC) o!erator allo%s nested tables to be mani!ulated using D4L %hen it is stored in a Table 2:5 WC.*C PA*AA0) .S 8S)D (OR (.L) .1P8T/O8TP8T .1 ORA*L)E Ans/ 8TL7(.L) Package is used #or (ile in!ut/out!ut in Oracle 2:6 1A4) SO4) 4)TCODS A1D PRO*)D8R)S O( (.L) ./O PA*AA0)E Ans/ (OP)1 (*LOS) ((L8SC .S7OP)1 0)T7L.1) P8T7L.1) P8T( 1)W7L.1) 332:M WCAT .S SQLHE COW .T .S D.(()R)1T (RO4 HDB* *O11)*T.=.T@E Ans/ SQLH is basically a Ha"a !rogram containing embedded static SQL statements that are com!atible %ith Ha"a design !hiloso!hy 2:: WCAT .S A1 .T)RATORE 1ame some T@P)S O( .T)RATORSE Ans/ SQLH .terators are basically record grou!s generated during transaction& %hich reBuires mani!ulation o# more than one records #rom one or more tables There are t%o ty!es .terators namely 1amed .terator and Positional .terator 33 2:I WCAT AR) D.(()R)1T ST)PS TO WR.T) A D@1A4.* SQL PRO0RA4E Ans/ )g/ char c7sBlstring`]?aYD)L)T) (RO4 sailors WC)R) ratingG:Zb+ )R)* SQL PR)PAR) readytogo (RO4 /c7sBlstring+ )R)* SQL )R)*8T) readytogo+ 2:L WCAT .S TABL) PART.T.O1.10 A1D .1D)R PART.T.O1.10E Ans/ Oracle< allo%s tables and .nde'es to be !artitioned or broken u! into smaller !arts based on range o# key "alues Partitioning is a Ydi"ide and conBuerZ strategy that im!ro"es administration and !er#ormance in data %arehouse and OLTP systems

131
2:< WCAT .S PARALL)L PRO*)SS.10E Ans/ 2:; WCAT .S PC@S.*AL 4)4OR@ STR8*T8R) O( ORA*L)E Ans/ The basic oracle memory structure associated %ith Oracle includes/ So#t%are *ode Areas The System 0lobal Area ,S0AThe Database Bu##er *ache The shared Pool The Program 0lobal Areas ,P0AStack Areas Data Areas Sort Areas 2ID WCAT .S LO0.*AL 4)4OR@ STR8*T8R) O( ORA*L)E DB7ST0 ST8D)1T S@ST)4 )4P D)PT )4P7.1D _ DATA DATA .1D)R Ans/ Database Tables!ace DB Ob>ect Segment )'tends 2I2 WCAT .S S0AE Ans/ A System 0lobal Area is a grou! o# shared memory allocated by Oracle that contains data and control in#ormation #or one Oracle database instance .( the multi!le users are concurrently connected to the same instance& the data in the instanceNs S0A is YsharedZ among the users *onseBuently& the S0A is o#ten re#erred to as either the Ysystem 0lobal AreaZ or the YShared 0lobal AreaZ 2I5 WCAT .S P0AE Ans/ The Program 0lobal Area is a memory bu##er that contains data and control in#ormation #or a ser"er !rocess A P0A is created by Oracle %hen a ser"er !rocess is started The in#ormation in a P0A de!ends on the con#iguration o# Oracle 2I6 WCAT .S A1 ORA*L) .1STA1*)E Ans/ )"ery time a database is started& an S0A is allocated and Oracle background !rocesses are started The combination o# these !rocesses and memory bu##ers is called an Oracle instance 2IM WCAT AR) D.(()R)1T ORA*L) PRO*)SS)SE Ans/ A !rocess is a Ythread o# controlZ or a mechanism in an o!erating system that can be e'ecute a series o# ste!s Some o!erating systems use terms >obs or task A !rocess normally has its o%n !ri"ate memory area in %hich it runs An Oracle database system has general ty!es o# !rocess/ 8ser Processes and Oracle Processes

132

33 2I: WCAT .S D.(()R)1*) B)TW))1 P4O1 A1D S4O1E Ans/ S4O1 ,System 4onitor- !er#orms instance reco"ery at instance o# startu! .n a multi!le instance system ,one that uses the !arallel ser"er-& S4O1 o# one instance can also !er#orm instance reco"ery other instance that ha"e #ailed %hereas The P4O1 ,Process 4onitor!er#orms !rocess reco"ery %hen a user !rocess #ails 332II WCAT .S D.(()R)1*) B)TW))1 DATABAS) A1D TABL)SPA*)E Ans/ 2IL WCAT .S HOB O( DATABAS) WR.T)R ,DBWR- PRO*)SSE Ans/ The Data Base Writer %rites modi#ied blocks #rom the database bu##er cache to the data #iles 2I< WCAT .S HOB O( LO0 WR.T)R ,L0WR- PRO*3SSE Ans/ The Log Writer %rites redo log #iles to disk Redo log data is generated in the redo log bu##er o# the S0A As transactions commit and log bu##er #ills& L0WR %rites redo entries into an online redo log #ile 2I; WCAT .S R)*O=)R)RE Ans/ The Reco"er ,R)*O- is used to resol"e distributed transactions that are !ending due to net%ork or system #ailure in a distributed database At timed inter"als& the local R)*O attem!ts to conce!t to remote database and automatically com!lete the commit or rollback o# the local !ortion o# any !ending distributed transactions 2LD WCAT .S AR*C.=)RE Ans/ The Archi"er ,AR*C- co!ies the online redo log #iles to archi"al storage %hen they are #ull AR*C is acti"e only %hen a databaseNs redo log is used AR*C.LO0 mode 33 2L2 WCAT .S A STOR)D Q8)R@E Ans/ =.)W 2L5 WCAT .S 8S)R PRO*)SS A1D S)R=)R PRO*)SSE Ans/ A 8ser !rocess is created and maintained to e'ecute the so#t%are code o# an a!!lication !rogram ,such as PRO 3 Program- or an ORA*L) tool ,such as SQL 3 DBA- The 8ser !rocess also manages the communication %ith ser"er !rocesses 8ser !rocesses communication %ith the ser"er !rocesses through the !rogram inter#ace Other !rocesses call ORA*L) !rocesses .n a dedicated ser"er con#iguration& a ser"er Process handles reBuests #or a single user !rocess A multithread ser"er con#iguration allo%s many user !rocesses to share a small number o# ser"er !rocesses& minimiQing the utiliQation o# a"ailable system resources

133
332L6 WCAT .S A S)L( R)()R)1T.AL .1T)0R.T@E Ans/ Table related to itsel# (oreign key o# the table links to !rimary key o# the same table 2LM WCAT .S A JRA.S)J STAT)4)1TE Ans/ .t is used to Raise )'ce!tions 2L: WCAT .S ROW.DE COW .T .S D.(()R)1T (RO4 ROW184E Ans/ Ro%id is the address o# the ro% at %here it is stored in the database Ro%num is count o# records %hereas Ro%id is identi#ication o# the each ro% 2222222222222222222222222222222222222222222222222222222222222222222 2222222222222222222 SQLG .1S)RT .1TO t =AL8)S ,2-+ SQLG .1S)RT .1TO t =AL8)S ,$:-+ SQLG .1S)RT .1TO t =AL8)S ,I-+ SQLG .1S)RT .1TO t =AL8)S ,L-+ SQLG .1S)RT .1TO t =AL8)S ,$<-+ SQLG S)L)*T 4AR,D)*OD),a sign7"al&O2&a !osneg-- !os 5 & 4AR,D)*OD),a sign7"al& D&a !osneg-- Qero 6 & 4AR,D)*OD),a sign7"al&$2&a !osneg-- neg M (RO4 ,S)L)*T t !osneg : & S.01,t !osneg- sign7"al I & ROW7184B)R,L O=)R ,PART.T.O1 B@ S.01,t !osneg< ORD)R B@ ABS,t !osneg-- r ; (RO4 t- a 2D 0RO8P B@ a r 22 / POS T)RO 1)0 $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ 2 $: I $< L or S)L)*T !osneg AS !os& to7number,null- AS neg (RO4 t WC)R) !osneg G? D 81.O1 ALL S)L)*T to7number,null- AS !os& !osneg AS neg (RO4 t WC)R) !osneg F D+

134

SQL3PL8S Q8)ST.O1S (ill in the blanks / 2 1o o# 8ser "ariables in sBl3!lus is <5-2 5 8ser can ha"e <55 many number o# "ariables !er sBl command 6 8ser can ha"e /55 many number o# lines ,assuming <D characters !er line- !er sBl command M The siQe o# PL/SQL bu##er in Oracle L is -@ and in OracleI is /<-@ : 7tart command is used to run the contents o# the s!eci#ied command #ile I The intersect o!erator is used to get only those ro%s that returned by both the Buery L The Brand command is used to set the System !ri"ileges& Ob>ect !ri"ileges < The 7a(e#oint command is used to identi#y the !oint in a transaction to %hich you can later Rollback ; To !er#orm one o# these o!erations on your current transaction/ 3 )stablish your current transaction transaction as either a read only or a read$%rite

3 Assign your current transaction to a s!eci#ied rollback segment The 7et Transaction command is used 2D The to4char #unction is used to con"ert the number dataty!e to a "alue o# "archar5 dataty!e 22 The Truncate command is used to remo"e all ro%s in a Table or *luster instantly 1ote / We can not truncate ro%s #rom a table %hich is !art o# a cluster We cannot truncate ro%s #rom a table %hich has a re#erenced integrity constraint 25 The Cluster is a schema ob>ect that contains one or more tables that ha"e one or more columns in common

135
26 The Create Role command is used to set a set o# !ri"ileges that can be granted to users or to other roles

2M To !er#orm one o# these #unctions on an inde'&table& or cluster/ 3 To collect statistics about the ob>ect used by the o!timiQer and store them in the data dictionary 3 To delete statistics about the ob>ect #rom the data dictionary 3 To "alidate the structure o# the ob>ect 3 To identi#y migrated and chained ro%s o# the table or cluster The Anal'Ve *ommand is used

7elect the Correct AnswerH 2 An inde' can ha"e as many as *olumns

a] 5:: b] 52 c] <G 5 A number o# columns in a table ranges #rom 2 to 7777 a] 5:: b] -/2 c] D6D d] 1one o# the abo"e 6 The ma'imum number o# com!onents in the Decode e'!ression & including searches& results and de#ault is a] 1o limitation b] -// M 77777777777 is an alternati"e name #or a table& "ie%& seBuence& !rocedure& stored #unction& !ackage& sna!shot or another synonym a] 7'non'% b] Data block c] =ie% d] 1one o# the abo"e

136
: The 777777777 o!erator is used in character string com!arisons %ith !attern matching a] Bet%een And b] )Bual o!erator c] Set o!erator d] Like I 7777777777 returns only one co!y o# each set o# du!licate ro%s selected a] 8niBue bW Distinct c] 0rou! By d] 1one o# the abo"e L 7777777777777 is used to lock the selected ro%s a] Lock table b] 9or u#date of c] Ob>ect !ri"ileges d] Ro% share < 7777777777777 *lause restricts the grou!s o# ro%s returned to those grou!s #or the s!eci#ied condition id True a] Where clause bW $a(in& Clause c] Distinct d] )'ists ; The 77777777 o!tion is used to return ro%s in a hierarchial order a] Connect b' start with b] Order by 2D The 77777777 #unction is used to return the number o# bytes in the internal re!resentation o# e'!ression a] Length b] FsiVe c] LengthLB

137

+RAC*E 8 9+RM7 TE7T :A:ER 2 The 7777777 built$in is used to )'its the current #orm and enter the indicated #orm Ans/ NEWN9+RM 5 The 77777777777can"as7"ie% can be used to dis!lay items or boiler!late gra!hics that o!erators need to see only in certain situations Ans/ 7tac@ed 6 The 77777777 !ackage contains constructs that !ro"ides %ays to %rite and read in#ormation to and #rom #iles Ans/ Te6tNI+ M On 4S$Windo%s the looku! !ath #or icon #iles is de#ined by the 7777777 en"ironment "ariable in the ORA*L) .1. #ile Ans/ TK-<NIC+N7 : .# user recei"e an error in the ORA$62DD to ORA$62;; range %hen you try to log on to De"elo!er/5DDD !roduct& there may not be enough real$mode memory to establish a *ommunication bu##er %ith an Oracle ser"er 77777777777777 sol"es this !roblem by reser"ing memory #or ser"er communications Ans/ NETINITA!EXE L The 777777777777 !ro!erty is used When Bueried records ha"e been marked #or inserts & u!dates& s!eci#ies that only columns %hose "alues %ere actually changed %hich should be included in the SQL 8PDAT) statement that is sent to the database during a *O44.T Ans/ U#date Chan&ed Colu%ns! < The 777777777 !ro!erty s!eci#ies %hether Oracle (orms should "alidate the "alue o#

138
the te't item against the "alues in the attached LO= Ans/ *+F for Falidation ; A 7777777777777 is an internal Oracle (orms data structure that has the column/ro% #rame %ork similar to a database Ans/ Record Brou#! 2D There a three ty!es o# Record 0rou! they are777777777777777777777777777 Ans/ 7tatic3 uer' record &rou#3 NonN=uer' record &rou#!

22 The 777777 built$in is used to %rite data in the (orms to the Database& but does not !er#orm a database *ommit Ans/ :ost! 25 T%o ty!es o# Windo%s are 7777777777777777777777777 Ans/ Docu%ent Window and Dialo& Window! 26 The 7777777777777 built$in is used to co!y the "alues o# each item in the record %ith the ne't lo%er seBuence number to the corres!onding item in the current record Ans/ Du#licate record! 2M An 7777777 is a container #or a grou! o# ob>ects that can be used to co!y or re#erence them in another module Ans/ +bUect Brou#! 2: (orm the (iring hierarcial #or the 0i"en triggers a] When$1e%$.tem$.nstance b] When$"alidate$.tem c] Aey$1e't$.tem d] Post$change e] Post$Te't$.tem #] Pre$Te't$.tem 2I (orm the hierarchial #or the 0i"en Triggers a] When$1e%$Record$.nstance b] Pre$Record c] Post$Record d] When$=alidate$.tem

Ans/ 93A3C3D3)3E!

139
e] When$*reate$record Ans/ E3)3A3D3C!

2L 8se an 777777777 Trigger #or the #ollo%ing !ur!oses/ a] To tra! and res!ond to an in#ormati"e message b] To re!lace a standard in#ormati"e message %ith a custom message c] To e'clude an in a!!ro!riate message Ans/ +nNMessa&e! 2< Oracle (orms !er#orms the #ollo%ing ste!s %hen the 777777 trigger #ails a] Sets the error location b] Rolls back to the recently issued Sa"e!oint Ans/ or +nNU#date or +nNInsert or :reNInsert or :reNu#date or :ostNInsert :ostNU#date!

2; The 77777 command is used to )'ecute the indicated O!erating System *ommand Ans/ $ost! 5D The ma'imum 1umber o# Procedures and (unctions in a Package is 77777 Ans/ -//! 52 Oracle uses %ork areas called 777777 to e'ecute SQL Statement and store !rocessing .n#ormation Ans/ :ri(ate 7 * Area! 55 T%o Ty!es o# *ursors are 7777777777777777777777 Ans/ <W I%#licit Cursor3 -W E6#licit Cursor! 56 The "ariables declared in a sub!rogram s!eci#ication and re#erenced in the sub!rogram body are7777 !arameters Ans/ 9or%al! 5M The 7777777777 and 77777777777 are called Assignment Statements Ans/ 2] 7elect !! into !! -W 9etch !! into !! .W HI

14,

+RAC*E

UE7TI+N7 O AN7WER7 Answers A Database can be one o# the t%o de#initions/ A set o# dictionary tables and user tables that are treated as a unit One or more o!erating system #iles in %hich ORA*L) stores the tables&"ie%s&and other ob>ects/also& the set o# database ob>ects used by a gi"en a!!lication A database is a collection o# interrelated data that are to be stored in a single location .t enables sharing o# data among "arious users as and %hen reBuired

uestions What is a Database E

What is a Database system E

A Database system is a combination o# an .nstance and a Database .# the instance is started and connected to an o!en database& then the database is a"ailable #or access by the users A DB4S is a so#t%are system %ith ca!abilities to organise& mani!ulate and manage the data 1ote/$ A DB4S must be able to reliably manage a large amount o# data in a multi$user en"ironment so that many users can concurrently access the same data A DB4S must also be secure #rom unauthorised access and !ro"ides e#icient solutions #or #ailure reco"ery A relational database 4angement System ,RDB4S- is a com!uter !rogram #or general !ur!ose data storage and retrie"al that organiQes data into tables consisting o# one or more units o# in#ormation ,ro%s-& each containing the same set o# data items ,columns- ORA*L) is a relational database management system Cierarchial 1et%orking Relational S Q L $ Structured Query Language SQL is the A1S. industry standard language& used to mani!ulate in#ormation in a relational database and used in ORA*L) and .B4 DB5 relational database management systems SQL is #ormally !ronounced YseBuelZ& although common usage also !ronounces it YS Q L Z

What is an RDB4S E

What are the di##ernt Database models E What is SQL E

141
+RAC*E UE7TI+N7 O AN7WER7 SQL is a set o# commands that all !rogrammers must use to access data %ithin the tables o# Database

What are the bene#its o# SQL E

2 .t is #le'ible& Po%er#ul and easy to learn 5 .t is a non$!rocedural language .t a] Processes set o# records rather than >ust one at a time and b] Pro"ides automatic na"igation to the data 6 .t !ro"ides commands #or a "ariety o# tasks including / a] Querying data b] *reating&8!dating and Re!lacing ob>ects and .nserting& 8!dating and Deleting ro%s M All RDB4S su!!orts SQL Thus one can trans#er the skills gained %ith SQL #rom one RDB4S to another : Programs %ritten in SQL are !ortable& they can o#ten be mo"ed #rom one database to another %ith little modi#ication SQL3PL8S is the ORA*L) database language %hich includes A1S. standard SQL commands !lus additional commands #or accessing data in ORA*L) database SQL3PL8S is a Structured Query Language su!!orted by Oracle Through this only& %e store& retrie"e& edit& enter V run SQL commands and PL/SQL blocks We can !er#orm calculations & list column de#initions& #ormat Buery reults in the #orm o# a Buery .t is a Procedural Language e'tension o# SQL .t can contain any no o# SQL statements integrated %ith #lo% o# control statements Thus it combine the Data 4ani!ulating !o%er o# SQL %ith data !rocessing !o%er o# Procedural language DD* , Data de#inition language DM* , Data mani!ulation language TC* , Transact control language7ession Control 7tate%ents! , ALT)R S)SS.O1& ROL) 7'ste% Control 7tate%ents! , ALT)R S@ST)4 DDL statements are one catagory o# SQL statements DDL statements de#ine ,create- or delete ,dro!- database ob>ects )'am!les are ceate "ie%& create table& create inde'&dro! table and rename tabl The other catagories are D4L statements and D*L statements D4L statements are one catagory o# SQL statements D4L statements& such as select& insert& delete and u!date&

What is SQL3PL8S E

What is PL/SQL E

What are the di##erent ty!es o# 7 * commands E

What is A DDL statementsE

What is a D4L statements E

142
+RAC*E UE7TI+N7 O AN7WER7 Buery and u!date the actual data The other catagories are DDL statements and D*L statements What are D*L D4L statements are one catagory o# SQL statements statements E D*Lstatments such as& connect& grant select&grant u!date and re"oke dba& control access to the data and to the database The other catagories are DDL and D4L statements What is a Transaction E .t can be de#ined as a logical unit o# %ork A transaction is a seBuence o# SQL statements that ORA*L) treats as a single unit The set o# statements is made !ermanent %ith the *O44.T statement Part or all o# a transaction can de undone %ith the ROLLBA*A statement All changes to the database bet%een successi"e *O44.TS and / or ROLLBA*A o!erations are called a transaction What is a *ommit E *O44.T commits any changes made to the database since the last *O44.T %as e'ecuted im!licitly or e'!licitly WORA is o!tional and has no e##ect on usage To *O44.T means to make changes to data ,inserts&u!dates and deletes- !ermanent be#ore changes are stored both the old and ne% data e'ists so that changes can be made& or so that the data can be restored to its !rior state ,YrollbackZ- When a user enters the ORA*L) SQL *ommand *O44.T& all changes #rom that transaction are made !ermanent To end a transaction and make !ermanent all changes !er#ormed in the transaction This command also erases all 7a(e#oints in the transaction and release the transaction loc@s What is a Rollback E A ROLLBA*A discards !art or all o# the %ork you ha"e done in the current transaction& since the last *O44.T or SA=)PO.1T To undo %ork done in current tranaction What is locking E To lock is to tem!orarily restrict other userNs access to data The restriction is !laced on such data is called Ya lockZ The modes are SCAR)& SCAR) 8PDAT)&)R*L8S.=)&ROW SCAR) A1D ROW )R*L8S.=) 1ot all locks can be acBuired in all modes )R*L8S.=) locks !ermit users to Buery the locked table but not to do anything else 1o other user may lock the table SCAR)D locks !ermit concurrent Bueries but no u!dates to the locked table With a ROW SCAR) or SCAR) 8PDAT) lock& no users can lock the %hole table #or e'clusi"e access& allo%ing concurrent access #or all users to the table The t%o ty!es o# locks are synonymous& and SCAR) 8PDAT) e'ists #or com!atibility %ith !re"ious "rsions o# ORA*L) ROW )R*L8S.=) locks are similar to ROW SCAR) but they !rohibit shared locking& so only one user user may access the table at the same time

143
+RAC*E UE7TI+N7 O AN7WER7 What is a Sa"e!oint E The 7a(e#oint is used to identi#y the !oint in a transaction to %hich you can later Rollback What is SCAR) LO*A E A SCAR) lock is one that !ermits other users to Buery data& but not to change it What is SCAR) 8PDAT) A SCAR) 8PDAT) lock is one that !ermits other users to LO*A E both Buery and lock data What is )R*L8S.=) An )R*L8S.=) LO*A is one that !ermits other users to LO*A E Buery data& but not to change it .t di##ers #rom the SCAR) lock because it does not !ermit another user to !lace any ty!e o# lock on the same data+ se(eral users %a' #lace 7$ARE loc@s on the same data at the same time What is a ROW SCAR) With a ROW SCAR) or SCAR) 8PDAT) lock& no users can LO*A E lock the %hole table #or e'clusi"e access& allo%ing concurrent access #or all users to the table What is a ROW )R*L8S.=) ROW )R*L8S.=) locks are similar to ROW SCAR) but they LO*A E !rohibit shared locking& so only one user may access the table at the same time What is a D)AD LO*A E A D)AD lock is a rare situation in %hich t%o or more user !rocesses o# a database cannot com!lete theirtransactions This occurs because each !rocess is holding a resource that the other !rocess reBuires ,such as a ro% in a table- in order to com!lete Although these situations occur rarely& ORA*L) detects and resol"es deadlocks by rolling back the %ork o# one o# the !rocesses What are .1T)0R.T@ .1T)0R.T@ *O1STRA.1T is a rule that restricts the range o# *O1STRA.1TS E "alid "alues #or a column& it is !laced on a column %hen the table is created What is R)()R)1T.AL R)()R)1T.AL .1T)0R.T@ is the !ro!erty that guarantees .1T)0R.T@ E that "alues #rom one column de!end on "alues #rom another column This !ro!erty is en#orced through integrity constraints What is a PR.4AR@ A)@ E The PR.4AR@ A)@ is the column,s- used to uniBuely identi#y each ro% o# a table What is a (OR).01 A)@ E A (OR).01 A)@ is one or more columns %hose "alues are based on the PR.4AR@ or *A1D.TAT) A)@ "alues #rom the database What is a 81.Q8) A)@ E A 81.Q8) A)@ is one or more columns that must be uniBue #or each ro% o# the table What is the di##erence The 81.Q8) A)@ column restricts entry o# du!licate "alues bet%een 81.Q8) and but entry o# 18LL "alue is allo%ed PR.4AR@ A)@ E .n case o# PR.4AR@ A)@ columns entry o# du!licate as %ell as 18LL "alue is restricted What is a S)Q8)1*) E A S)Q8)1*) is a database ob>ect used to generate 81.Q8) .1T)0)RS #or use as PR.4AR@ A)@S What is a =.)W E A =ie% is a database ob>ect that is a logical re!resentation o# a table .t is deri"ed #rom a table but has no storage s!ace o# its o%n and o#ten may be used in the same manner as a table What is a S@1O1@4 E A S@1O1@4 is a name assigned to a table or "ie% that may therea#ter be used to re#er it .# you access to another userNs table& you may create a synonym #or it and re#er to it

144
+RAC*E UE7TI+N7 O AN7WER7 by the synonym alone& %ithout entering the userNs name as a Buali#ier What is a ROW.D E ROW.D is the logical address o# a ro%& and it is uniBue %ithin the database The ROW.D is broken into three sections/ le#t&middle&& and right ,corres!onding to DDDD2(5D&DDD*& A1D DDD2& >ust sho%n- The numbering is in he'adecimal notation The le#t section is the block in the #ile& the middle is the ro% seBuence number %ithin the block,numbering starts %ith D& not 2-& and the right is the #ile number %ithin the database 1ote that the #ile numbers are uniBue %ithin the %hole database The tables!ace they are in is not rele"ant to the ROW.D ROW.D can be selected& or used in a %here clause& but cannot be changed by an insert& u!date& or delete Co%e"er it can change i# the table it is in is e'!orted and im!orted .1D)R is a general term #or an ORA*L) / SQL #eature used !rimarily to s!eed e'ecution an im!ose 81.Q8)1)SS u!on certain data .1D)R !ro"ides a #aster access method to one tableNs data than doing a #ull table scan There are se"eral ty!es o# .nde'es / 81.Q8) .1D)R& *O4PR)SS)D .1D)R& *O1*AT)1AT)D .1D)R An .nde' has an entry #or each "alue #ound in the tableNs .nde'ed #ield,s- , e'ce!t those %ith a 18LL "alue and !ointer,s- to the ro%s ha"ing that "alue An 81.Q8) .1D)R is an inde' that im!oses uniBueness on each "alue in inde'es The inde' may be one column or concatenated columns A *O4PR)SS)D .1D)R is an inde' #or %hich only enough inde' in#ormation is stored to identi#y uniBue entries+ in#ormation that an inde' stores %ith the !re"ious or #ollo%ing key is Ycom!ressedZ ,truncated- and not stored to reduce the storage o"erhead reBuired by an inde' A *O1*AT)1AT)D .1D)R is one that is created on more than one column o# a table .t can be used to guarentee that those columns are uniBue #or e"ery ro% in the table and to s!eed access to ro%s "ia those columns A *L8ST)R is a means o# storing together data #rom multi!le tables& %hen the data in those tables contains in#ormation and is likely to be accessed concurrently A *L8ST)R A)@ is the column or columns that cluster tables ha"e in common& and %hich is chosen as the storage / access key (or e'am!le t%o tables& W+RKER and W+RKER7KI**& might be clustered on the column name A cluster key is the same thing as a cluster column A *L8ST)R .1D)R is one manually created a#ter a cluster has been created and be#ore any D4L , that is S)L)*T& .1S)RT& 8PDAT) A1D D)L)T) -statements can o!erate on the cluster This inde' is created on the *L8ST)R A)@

What is .1D)R E

What is an 81.Q8) .1D)R E What is a *O4PR)SS)D .1D)R E

What is *O1*AT)1AT)D .1D)R or A)@E

What are *L8ST)RS E

What is *L8ST)R A)@ or *L8ST)R *OL841S E

What is *L8ST)R .1D)R E

145
+RAC*E UE7TI+N7 O AN7WER7 columns %ith the SQL statement *R)AT) .1D)R .n ORA*L) L& you can de#ine a hash cluster to inde' on the !rimary key What are )R*)PT.O1S E )'ce!tions are the error handling routines o# PL/SQL The )R*)PT.O1 section o# a PL/SQL block is %here !rogram control is trans#ered %hene"er an e'ce!tion #lag is raised )'ce!tion #lags are either user$de#ined or system e'ce!tions raised automatically by PL/SQL What are *8RSORS E *ursor has t%o de#initions / A cursor is a marker such as a blinking sBuare or line& that marks your current !osition on a *RT screen *ursor is also a synonym #or conte't area $ a %ork area in memory %here ORA*L) stores the current SQL statement (or a Buery & the area in memory also includes column headings and one ro% retrie"ed by the S)L)*T statement What is 18LL E A 18LL "alue is one that is unkno%n& irrele"ant& or not meaning#ul Any ORA*L) data ty!e can be 18LL 18LL in a number data ty!e is not the same as Qero The default (alue for a field in +RAC*E is NU** What is )RPR)SS.O1 E An e'!ression is any #orm o# a column This could be a literal& a "ariable& a mathematical com!utation& a #unction& or "irtually any combination o# #unctions and columns %hose #inal result is a single "alue& such as a string& a number& or a "alue What is a *O1D.T.O1 E A *ondition is an e'!ression %hose "alue e"aluates to either TR8) or (ALS)& such as A0) G 2I What is a PRO(.L) E A PRO(.L) is a collection o# settings on ORA*L)L that limit database resources What are ROL)S E A ROL) is a set o# !ri"ileges that an ORA*L)L user can grant to another user or to a role ORA*L) "ersion I !ri"ileges DBA& *O11)*T& A1D R)SO8R*) ha"e become system$su!!lied roles in ORA*L)L& and there are also t%o ne% roles #or im!orting and e'!orting a database ORA*L) has #i"e system$su!!lied roles / *O11)*T&R)SO8*)&DBA&)RP7(8LL7DATABAS)&.4P7(8LL7 DATABAS) What is a S)04)1T E A S)04)1T is another %ay to classi#y the s!ace allocated to a table& inde'& or cluster A table has one segment that consists o# all o# its e'tents )"ery inde' has one segment similarly de#ined A cluster has atleast t%o segments& one #or its data and one #or its cluster key inde' What is TABL) SPA*) in TABL) SPA*) is a #ile or set or #iles that is used to store ORA*L) E ORA*L) data An ORA*L) database is com!osed o# the S@ST)4 tables!ace and !ossibly other tables!aces What are P*T8S)D and P*T(R)) is a !ortion o# the data block that is not #illed by P*T(R)) !arameters E ro%s as they are inserted into a table but is reser"ed #or #uture u!dates made to the ro%s in that block P*T8S)D is the !ercentage o# s!ace in a data block& %hich ORA*L) attem!ts to #ill be#ore it allocates another block

146
+RAC*E *L.)1T UE7TI+N7 O AN7WER7 A *lient or (ront )nd database a!!lication acts as an inter#ace bet%een the user and the Database .t also checks #or "alidation against the data entered by the user *L.)1T is a general term #or a user & so#t%are a!!lication& or com!uter that reBuires the ser"ices& data& or !rocessing o# another a!!lication or com!uter A Database ser"er or Back )nd is used to manage the Database tables o!timally among multi!le clients %ho concurrently reBuest the ser"er #or the same data .t also en#orces data integrity across all client a!!lications and controls database access and other security reBuirements S)R=)R system is the con#iguration o# the ORA*L) %hen a remoe user accesses ORA*L) "ia SQL31)T A S)SS.O1 is a seBuence o# e"ents that ha!!ens bet%een the time a user connects to SQL and the time he or she disconnects An .1STA1*) is e"erything reBuired #or ORA*L) to run/ backround !rocesses ,!rograms-& memory& and so on An .1STA1*) is the means o# accessing a database A BA*ARO81D !rocess is one o# the !rocesses used by an instance o# multi!le$!rocess ORA*L) to !er#orm and coordinate tasks on behal# o# concurrent users o# the database The base !rocess are named AR*C ,archie"er-&DBWR ,database %riter-& L0WR ,log %riter-& P4O1 ,!rocess monitor-& and S4O1 ,system monitor-& and e'ists as long as an instance does Basic unit o# storage ,!hysical and logical- #or all ORA*L) data The number o# blocks allocated !er ORA*L) table de!ends on the table s!ace in %hich the table is created The ORA*L) block siQe "aries by o!erating system and may di##er #rom the block siQe o# the host o!erating system *ommon block siQes are :25 bytes ,characters- and 5DM< bytes A )loc@ is a logical container #or items .t is also a se!arate ob>ect& %ith its o%n set o# !ro!erties The !ro!erties o# the block determine ho% end users interact %ith the inter#ace items it contains A ROLLBA*A segment is a storage s!ace %ithin a table s!ace that holds transaction in#ormation used to guarantee data integrity during a ROLLBA*A and used to !ro"ide read consistency across multi!le transactions R)AD *O1S.ST)1*@ is a state that guarentees that all data encountered by a statement / transaction is a consistent set throughout the duration o# the statement / transaction S0A is a shared storage area in main or "irtual memory ,de!ending on your o!erating system- that is the center o# ORA*L) acti"ity %hile the database is running The siQe o# the S0A , and !er#omance o# the system - de!ends on the

S)R=)R

What is a S)SS.O1 E

What is an .1STA1*) E

What is a BA*ARO81D PRO*)SS E

What is a BLO*A in ORA*L) E

What is the use o# ROLLBA*A segment E

What is R)AD *O1S.ST)1*@ E What is S0A E

147
+RAC*E UE7TI+N7 O AN7WER7 "alues o# the "ariable init!ora !arameters The S0A !ro"ides communication bet%een the user and the backround !rocesses What is S@ST)4 8S)R.D E S@ST)4 is one o# the DBA users that is created %hen the What does it ha"e E database system is installed and initialiQed , the other is S@S - While 7C7 owns %ost of the data dictionar' tables3 7C7TEM owns the (iews created on those base tables! What is S@S 8S)R.D E S@S is one o# the DBA users that is created %hen the What does it ha"e E database system is installed and initialiQed , the other is S@ST)4 - 7C7 owns %ost of the data dictionar' tables3 7C7TEM owns the (iews created on those base tables! What is a Datadictionar' The DATA D.*T.O1AR@ is a com!rehensi"e set o# tables in ORA*L) E and "ie%s o%ned by the DBA users S@S and S@ST)4& %hich acti"ates %hen ORA*L) is initially installed& and is a cental source o# in#ormation #or the ORA*L) RDB4S itsel# and #or all users o# ORA*L) The tables are automatically maintained by ORA*L)& and holds a set o# "ie%s and tables containing in#ormation about the database ob>ects& users& !ri"ileges& e"ents& and use What is 7=ldba E SQL 3 DBA is an ORA*L) utility used by DBAs %hile !er#orming database maintenance and monitoring What are Database A DATABAS) #ile is sim!ly any #ile used in a database A files E database is made u! o# one or more tables!aces& %hich in turn are made u! o# one or more database #iles What is a Control file E A *O1TROL #ile is a small administrati"e #ile reBuired by What is its signi#icance E e"ery database& necessary to start and run a database system A control #ile is !aired %ith a database& not %ith an instance 4ulti!le identical control #iles are !re#erred to a single #ile& #or reasons o# data security What is an INIT #ile E init!ora is a database system !arameter #ile that contains What is its signi#icance E numerous settings and #ile names used %hen a system is started using the *R)AT) DATABAS) & START 8P& or SC8T DOW1 command What does a .1S)RT .1S)RT adds one or more ne% ro%s to the table or "ie% statement do E What does an 8PDAT) 8!dates ,changes- the "alues in the listed columns in the statement do E s!eci#ied table What does a D)L)T) D)L)T) deletes all ro%s that satis#y condition #rom table statement do E What does a S)L)*T S)L)*T retrie"es ro%s #rom one or more tables , or "ie%s statement do E or sna!shots -& either as a command& or as a subBuery in another SQL command ,%ith limitations-& including S)L)*T&.1S)RT&8PDAT) and D)L)T) ALL means that all ro%s satis#ying the conditions %ill be returned , this is the de#ault - D.ST.1*T means that only ro%s that are uniBue %ill be returned/ any du!licates %ill be %eeded out #irst What is 7tartu# and START8P is the !rocess o# starting an instance& !resumably 7hutdown E %ith the intent o# mounting and o!ening a database in order to make a database system a"ailable #or use

148
+RAC*E UE7TI+N7 O AN7WER7 To SC8TDOW1 is to disconnect an instance #rom the database and terminate the instance To 4O81T a database is to make it a"ailable to the database administrator ORA*L)L manages distributed transactions %ith a s!ecial #eature called TWO PCAS) $ *O44.T TWO PCAS) $ *O44.T guarantees that a transaction is "alid at all sites by the time it commits or roll back All sites either commit or rollback together& no matter %hat errors occur in the net%ork or on the machines tied together by the net%ork @ou donNt need to do anything s!ecial to ha"e your a!!lications use a TWO PCAS) $ *O44.T A S1APSCOT is a means o# creating a local co!y o# remote data A sna!shot can be used to re!licate all or !art o# a single table& or to re!licate the result o# a Buery against multi!le tables The re#reshes o# the re!licated data can be done automatically by the database , at time inter"als you s!eci#y - or manually A DATABAS) TR.00)R is a stored !rocedure associated %ith a table that ORA*L)L automatically e'ecutes on one or more s!eci#ied e"ents ,B)(OR) or A(T)R an .1S)RT&8PDAT) or D)L)T)- a##ecting the table Triggers can e'ecute #or the table as a %hole or #or each a##ected ro% in the table A PA*AA0) is a PL/SQL ob>ect that grou!s PL/SQL ty!es& "ariables& SQL cursors& e'ce!tions&!rocedures& and #unctions )ach !ackage has a s!eci#ication and a body The s!eci#ication sho%s the ob>ect you can access %hen you use the !ackage The body #ully de#ines all the ob>ects and can contain additional ob>ects used only #or the internal %orkings @ou can change the body ,#or e'am!le& by adding !rocedures to the !ackages- %ithout in"alidating any ob>ect that uses the !ackage A PA*AA0)D PRO*)D8R) is a built$in PL/SQL !rocedure that is a"ailable in all #orms )ach !ackaged !rocedure e'ecutes a SQL3(OR4S #unction& such as mo"ing to a #ield or e'ecuting a Buery Any PA*AA0)D PRO*)D8R) that a##ects the basic #unctions o# SQL3(OR4S is a R)SR.*T)D PA*AA0)D PRO*)D8R) @ou should use restricted !ackaged !rocedure only in A)@$TR.00)RS& 8S)R$1A4)D TR.00)RS that are in"oked by A)@$TR.00)RS& and O171)W7(.)LD7.1STA1*) triggers @ou should not use restricted !ackaged !rocedures in any o# the #ollo%ing ty!es o# triggers On$error&On$Database$Record&On$delete&On$insert&On$ Lock& On$4essage&On$1e%$Record&On$Remo"e$record&On$ 8!date& On$=alidate$(ield& and On$"alidate$Record triggers

What is Mountin& o# database E What is Two :hase 4 Co%%it E

What are 7na#shots E

What are Tri&&ers E

What are :ac@a&es E

What are :ac@a&ed :rocedures E

What are Restricted :ac@a&ed :rocedures E

149
+RAC*E UE7TI+N7 O AN7WER7 Post$*hange triggers Pre$ and Post$ (ield& Pre$ and Post$ Record& Pre$ and Post$Block& Pre$ and Post$(orm triggers Pre$ and Post$Query triggers Pre$ and Post$.nsert& Pre$ and Post$8!date& Pre$ and Post$Delete& Pre$ and Post$*ommit triggers 8ser$1amed triggers that are in"oked by any o# the abo"e triggers Any PA*AA0)D PRO*)D8R) that does not inter#ace %ith the basic #unctions o# SQL3(OR4S is an 81$ R)SR.*T)D PA*AA0)D PRO*)D8R) @ou can use unrestricted !ackaged !rocedures in any ty!e o# trigger The #ollo%ing list sho%s the unrestricted !ackaged !rocedures/ Abort7Query& Anchor7=ie%&Bell& Break& *all& *all7Buery& De#ault7=alue& Dis!lay7)rror& Dis!lay7#ield& Dis!lay7!age& )dit7#ield& )rase& )'ecute7Trigger& Cel!& Cide7Page& Cost& Lock7Record& 4essage& 4o"e7=ie%& Pause& Print& Redis!lay& ResiQe7=ie%& Set7(ield& Sho%7keys& Sho%7!age& SynchroniQe A PS)8DO *OL841 is a YcolumnZ that yields a "alue %hen selected& but %hich is not an actual column o# the table An e'am!le is ROW.D or S@SDAT) A S*C)4A is a collection o# ob>ects S*C)4A ob>ects are logical structures that directly re#er to the databaseNs data S*C)4A ob>ects include structures such as tables3 (iews3 s'non'%s3 se=uences3 inde6es3 clusters3 stored #rocedures and data lin@s! The Relational model has three ma>or as!ects/ 7tructures / Structures are %ell$de#ined ob>ects that store the data o# the database Structures and the data contained %ithin them can be mani!ulated by o!erations +#erations / O!erations are clearly de#ined actions that allo% the user to mani!ulate the data and structure o# the database The o!eration on a database must adhere to a !re$de#ined set o# integrity rules Inte&rit' rules / .ntegrity rules are the la%s that go"ern %hich o!erations are allo%ed on the data and structure o# a database .ntegrity rules !rotect the data and the structures o# a database RDB4S o##ers bene#its such as / 2] .nde!endence o# !hysical data storage and logical database structure 5] "ariable and easy access to all data 6] *om!lete #le'ibility in database design M] Reduced data storage and redundancy

What are Unrestricted :ac@a&ed :rocedures E

What are :seudo Colu%ns in ORA*L) E What is a 7che%a E

What are the ma>or as!ects o# the Relational Database Mana&e%ent 7'ste% E

What are the bene#its o# Relational Database Mana&e%ent 7'ste% E

15,
+RAC*E UE7TI+N7 O AN7WER7 What is a Database An ORA*L) database structure has both a !hysical and 7tructure E logical structure :h'sical database structure H An ORA*L) database !hysical structure is determined by the o!erating system #iles that constitute the database )ach ORA*L) database is com!rised o# three ty!es o# #iles/ one or more data #iles& t%o or more redolog #iles& and one or more control #iles The #iles o# a database !ro"ide the actual !hysical storage o# the database in#ormation *o&ical database structureH An ORA*L) databaseNs logical structure is determined by One or more tables!aces The databaseNs schema ob>ects ,e g tables& "ie%s& inde'es& clusters& seBuences&and stored !rocedures The logical storage structures& including tables!aces& segments& and e'tents& dictate ho% the !hysical s!ace o# a database is used the schema ob>ects and the relationshi!s among them #orm the relational design o# the database 2 Tables#acesH A database is di"ided into logical storage units called tables!aces A tables!aces used to grou! related logical structures together (or e'am!le & tables!aces commonly grou! all o# an a!!lications ob>ects sim!li#y certain administrati"e o!erations -! Databases3Tables#aces and DatafilesH )ach database is logically di"ided into one or more tables!aces One or more data#iles are e'!licitly created #or each tables!ace to !hysically store the data o# all logical structures in a tables!ace The combined siQe o# a tables!aceNs data #iles is the total storage ca!acity o# the tables!ace ,7C7TEM has -M) stora&e ca#acit' while data has 2M) The combined storage ca!acity o# a databaseNs tables!aces is the total storage ca!acity o# the database , GM) ) An tables!ace can be On$line or O##$line A tables!ace is normally On$line so that users can access the in#ormation %ithin the tables!ace A tables!ace can be O##$line to make a !ortion o# the database una"ailable %hile allo%ing normal access to the remainder o# the database Cash clusters are also cluster table data in a manner similar to normal clusters Co%e"er& a ro% is stored in a hash cluster based on the result o# a!!lying a hash #unction to the ro%Ns cluster key "alue A database link is a named ob>ect that describes a !ath #rom one database to the other Database links are

What are the *+BICA* 7TRUCTURE7 E

What is +n4line and +ff4 line tables!aces E

What are $ash clusters E

What are Database *in@s E

151
+RAC*E UE7TI+N7 O AN7WER7 im!licitly used %hen a re#erence is made to a global ob>ect name in a distributed database What are Databloc@s E At the #inest le"el o# granularity& an ORA*L) database data is stored in datablocks One datablock corres!onds to a s!eci#ic number o# bytes o# !hysical database s!ace on the disk A datablock siQe is s!eci#ied #or each ORA*L) database %hen the database is created A database uses and allocates #ree database s!ace in ORA*L) datablocks What are E6tents E The ne't le"el o# logical database s!ace is called an e'tent An e'tent is a s!eci#ic number o# contiguous data blocks& obtained in a single allocation& used to store a s!eci#ic ty!e o# in#ormation What are 7e&%ents E The le"el o# logical database storage abo"e an e'tent is called a segment A segment is a set o# e'tents allocated #or a certain logical structure The di##erent ty!es o# segments include / Data se&%ent H )ach non$clustered table has a data segment All o# the tables data is stored in the e'tents o# its data segment )ach cluster has a data segment The data o# e"ery table in the cluster is stored in the clusterNs data segment Inde6 se&%ent H )ach inde' has an inde' segment that stores all o# its data Rollbac@ se&%ent H .n or more rollback segments are created by the database administrator #or a database to tem!orarily store YundoZ in#ormation This in#ormation is used to generate read$consistent database in#ormation& during database reco"ery and to rollback uncommitted transactions #or users Te%#orar' se&%ent H Tem!orary segments are created by ORA*L) %hen a SQL statement needs a tem!orary %ork area to com!lete e'ecution %hen the statement #inishes e'ecution the tem!orary segmentNs e'tents are returned to the system #or #uture use What is A##lication PL/SQL is the language used #or both client$side Oracle :artitionin& E #orms a!!lications and ser"er$side database triggers and stored !rocedures and there is a PL/SQl engine in both Oracle #orms Run#orm and the OracleL Ser"er This means that you can take ad"antage o# a!!lication !atitioning to e'ecute a!!lication code on either the client or the ser"er A!!lication !artitioning allo%s you to o!timiQe !er#ormance and resource usage by storing and e'ecuting !rocedures either locally or at the ser"er& %hich makes the most sense #or your !articular a!!lication and con#iguration )'!lain the :h'sical The !hysical structure o# an ORA*L) database includes structure o# the +racle datafiles3 redolo& files and control files! database E <! DatafilesH

152
+RAC*E UE7TI+N7 O AN7WER7 )"ery ORA*L) database has one or more !hysical data #iles A databaseNs data #iles contains all the database data The data o# logical database structures such as tables and inde'es is !hysically stored in the data #iles allocated #or a database The characteristics o# data #iles are / A data#ile can be associated %ith only one database& once created& a data #ile cannot change in siQe and one or more data #iles #orm a logical unit o# database storage called a tables!ace NoteH 4odi#ied or ne% data is not necessarily %ritten to a data #ile immediately To reduce the amount o# disk out!ut and increase !er#ormance& data is !ooled in memory and %ritten to the a!!ro!riate data #ile all at once& as determined by the DBWR backround !rocess o# ORA*L) -! Redo lo& filesH )"ery ORA*L) database has a set o# t%o or more Redo lo& files The set o# redo log #iles #or a database is collecti"ely kno%n as the DatabaseLs redolo&! The #ri%ar' function of a redo lo& is to record chan&es %ade to data!Should a #ailure !re"ent modi#ied data to be %ritten to the data #iles & the changes can be obtained #rom the redo log and the %ork is ne"er lost Thus redo log #iles are critical in !rotecting a database against #ailures The !rocess o# a!!lying the redo log during a reco"ery o!eration is called Rollin& forward! To !rotect against #ailures o# the redo log itsel#& ORA*L) allo%s a mirrored redo log so that t%o or more co!ies o# the redo log can be maintained on di##erent disks .! Control filesH )"ery ORA*L) database has a Control file! A control #ile records the !hysical structure o# the database (or e'am!le& it contains the #ollo%ing in#ormation / Database na%e3 na%es and locations of a databaseLs data files and redolo& files and the ti%e sta%# of database creation! )"ery time an instance o# an ORA*L) is started& its control #ile is used to identi#y database and the redo log #iles that must be o!ened #or database o!eration to !roceed .# the !hysical makeu! o# the database is altered , #or e'am!le& i# a ne% data #ile or redo log #ile is created -&

153
+RAC*E UE7TI+N7 O AN7WER7 the databaseNs control #ile is automatically modi#ied by the ORA*L) to re#lect the change NoteH A databaseLs control file is also used if database reco(er' is necessar'! +racle creates and uses memeory sructures to com!lete se"eral >obs (or e'am!le& memory is used to store !rogram code being e'ecuted and data that is shared among users Se"eral basic memory structures are associated %ith Oracle+ the system global area , %hich includes the database and redolog bu##ers& and the shared !ool - and the !rogram global areas a) 7'ste% &lobal areaH The S0A is a shared memory region allocated by Oracle that data and in#ormation #or one Oracle instance An S0A and the Oracle backround !rocesses constitute an Oracle .nstance The S0A is allocated %hen an instance starts and deallocated %hen the instance shuts do%n )ach instance that is started has its o%n S0A The data in the S0A is shared among the users currently connected to the database (or o!timal !er#ormance & the entire S0A should be as large as !ossible to store as much data as !ossible in memory and minimise disk ./O The in#ormation stored %ithin the S0A is di"ided into se"eral ty!es o# memory structures& including the database bu##ers& redo log bu##ers and the shared !ool These area ha"e #i'ed siQe and are created during instance startu! <! Database )uffer Cache H Database buffers of the 7BA store the %ost recentl' used bloc@s of database data+ the set o# database bu##ers in an instance is the database bu##er cache These bu##ers can contain modi#ied data that has not yet been %ritten to disk )ecause the %ost recentl' used data is @e#t in %e%or'3 less dis@ IE+ is necessar' and #erfor%ance is increased! -! Redo lo& bufferH The redo lo& buffer of the 7BA stores redo entries 4 a lo& of chan&es %ade to the database! The redo entries stored in the redo log bu##ers are %ritten to an online redo log #ile& %hich is used i# database reco"ery is necessary Its siVe is static!

)'!lain the Me%or' 7tructures o# the Oracle database E

154
+RAC*E UE7TI+N7 O AN7WER7 .! 7hared :oolH The shared #ool is a #ortion of the 7BA that contains shared 7 * constructs such as shared 7 * areas! A shared SQL area is reBuired to !rocess e"ery uniBue SQL statement submitted in a database A shared 7 * area contains infor%ation such as the #arse tree and e6ecution #lan for the coress#ondin& state%ent! A single shared SQL area is used by multi!le a!!lication that issue the same statement lea"ing more control o"er cursors 2! CursorsH A cursor is a handle , a na%e or #ointer ) for the %e%or' associated with a s#ecific state%ent Although most Oracle 8sers rely on the automatic handling o# the Oracle 8tilities& the !rogrammatic inter#aces o##er a!!lication designers more control o"er cursors b) :ro&ra% Blobal AreaH The P0A is a memory bu##er that contains data and control in#ormation #or a ser"er !rocess A P0A is created by Oracle %hen a ser"er !rocess is started The in#ormation in a P0A de!ends on the con#iguration o# Oracle What is a :rocess ? A :rocess is a Xthread of controlY or a %echanis% in a o#eratin& s'ste% that can e6ecute a series of ste#s! Some o!erating system use the term Uob as tas@! An Oracle database system has t%o ty!es o# !rocesses / <) User :rocess! -) +racle :rocess! User :rocess H A user !rocess is created and maintained to e'ecute the so#t%are code o# an a!!lication !rogram , such as a Pro3* !rogram - or an Oracle tool , such as SQL3 DBA - The user !rocesses also manages the communication %ith the ser"er !rocesses through the !rogram inter#ace +racle :rocessesH +racle #rocesses are called b' other #rocesses to #erfor% functions on behalf of the in(o@in& #rocess! The di##erent ty!es o# Oracle !rocesses and their s!eci#ic

)'!lain the t'#es of :rocesses used b' +racle E

155
+RAC*E UE7TI+N7 O AN7WER7 #unctions are as #ollo%s / 7er(er :rocessH Oracle creates ser"er !rocesses to handle reBuests #rom connected user !rocesses A ser"er !rocess is in charge o# communicating %ith the user !rocess and interacting %ith the Oracle to carry out reBuests o# the associated user !rocess Oracle can be con#igured to "ary the number o# users !rocesses !er ser"er !rocess .n a dedicated ser"er con#iguration& a ser"er !rocess handles reBuests #or a single user !rocess A multi$ threaded ser"er con#iguration allo%s many users !rocesses to share a small number o# ser"er !rocesses and ma'imiQing the utiliQation o# a"ailable system resources )ac@round :rocessesH Oracle creates a set o# backround !rocesses #or each Oracle .nstance They consolidate #unctions that %ould other%ise be handled by multi!le Oracle !rograms running #or each user !rocesses The backround !rocesses asynchronously !er#orm ./O and monitor other Oracle !rocesses to !ro"ide increased !arallelism #or better !er#ormance and reliability An 7BA and the +racle bac@round #rocesses constitute an +racle Instance! )ach Oracle instance may use se"eral backround !rocesses They are D)WR3*BWR3CK:T37M+N3:M+N3 ARC$3REC+3Dnnn3 AND *c@n! The D)WR writes %odified bloc@s fro% the database buffer cache to the datafiles! Because o# the %ay Oracle !er#orms logging& DBWR does not need to %rite blocks %hen a transaction commits .nstead& DBWR is o!timiQed to minimiQe disk %rites .n general& DBWR %rites only %hen more data needs to be read into the S0A and too #e% database bu##ers are #ree The least recently used data is %ritten to the data#ile #irst The lo& writer writes redo lo& entries to dis@! Redo log data is generated in the redo log bu##er o# the S0A As transactions commit and the log bu##er #ills& L0WR %rites redo log entries into an on$line redo log #ile At s#ecific ti%es3 all %odified database buffers in the 7BA are written to the data files b' D)WR; this e(ent is called a Chec@#oint! The check!oint !rocess is res!onsible #or signaling DBWR at check!oints and u!dating all the data #iles and control #iles o# the database to indicate the most recent check!oint *APT is o!tional+ i# *APT is not !resent& L0WR assumes the res!onsibilities o# *APT

What is a Database Writer ?

What is a *o& Writer?

What is a Chec@#oint ?

156
+RAC*E UE7TI+N7 O AN7WER7 What is a 7'ste% The 7'ste% %onitor #erfor%s instance reco(er' at Monitor ? instance startu#! S4O1 cleans u! tem!orary segments that are no longer in use and reco"ers dead transactions ski!!ed during crash and instance reco"ery because o# #ile read or o##$line errors These transactions are e"entually reco"ered by S4O1 %hen the tables!ace or #ile is brought back S4O1 also coalesces #ree e'tents %ithin the database& to make #ree s!ace contiguous and easier to allocate What is a :rocess The #rocess %onitor #erfor%s #rocess reco(er' when %onitor ? a user #rocess fails! P4O1 is res!onsible #or cleaning u! the cache and #reeing resources that the !rocess %as using P4O1 also checks on the Dis!atcher and ser"er !rocesses and restarts them i# they ha"e #ailed The Archie(er co#ies the on4line redo lo& files to archi(al stora&e when the' are full! AR*C is acti"e only %hen a databaseNs redo log is used in AR*C.)=)LO0 mode The reco(erer is used to resol(e distributed transactions that are #endin& due to a NETW+RK or s'ste% failure in a distributed database! Dis#atcher are o#tional bac@round #rocesses3 #resent onl' when a Multi4threaded ser(er confi&uration is used! Atleast one dis!atcher !rocess is created #or e"ery communication !rotocol in use ,DDDD& Dnnnn)ach dis!atcher !rocess is res!onsible #or routing reBuests #rom connected user !rocesses to a"ailable shared ser"er !rocesses and returning the res!onse back to the a!!ro!riate user !rocesses U#to ten loc@ #rocesses ,*CK5!!*CK0) are used for inter4 instance loc@in& when the +racle #arallel ser(er is used!

What is an Archie(er ?

What is a Reco(erer ?

What is a Dis#atcher ?

What is a *+CK ,*CKn)?

157

158
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

159
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

16,
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

161
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

162
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

163
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

164
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

165
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

166
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

167
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

168
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

169
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

17,
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

171
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

172
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

173
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

174
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

175
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

176
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

177
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

178
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

179
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

18,
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

181
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

182
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

183
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

184
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

185
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

186
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

187
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

188
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

189
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

19,
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

191
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

192
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

193
No 2 5 Oracle Questions & nswers What are the di##erent modules o# (OR4S M : E (orm& 4enu and Library modules What are the di##erences bet%een (OR4S 6 D and (OR4S M : E (OR4S 6 D (OR4S M : 2] 4ode *haracter 08. 5] System =ariables 5D M5 6] Session Single 4ulti!le M] Blocks& *an"as 5:: 1o limit :] Triggers L: 252 I] .tems ty!es $ 2D L] Relation Design Time Run Time , 8sing S)T7R)LAT.O17PROP)RT@ <] .nheritance 1ot A"ailable A"ailable ;] Pro!erty *lass $ DO $ $ DO $ 2D] Ob>ect 0rou!s $ DO $ $ DO $ 22] Library $ DO $ $ DO $ 25] Attached Libraries $ DO $ $ DO $ 26] =isual Attributes $ DO $ $ DO $ What is the ma'imum limit #or creating BLO*AS and *A1=AS in (OR4S M : E 1O L.4.T .n a 48LT. R)*ORD BLO*A can %e ha"e an item dis!layed once E @es& By setting the .T)4S D.SPLA@)D !ro!erty #or the res!ecti"e item in the Pro!erties Windo% A#ter creation o# the block can %e create a B8TTO1 PAL)TT) E 1o What are the di##erent ty!es o# triggers that %ill be created #or 4AST)R D)L)T)S !ro!erties such as a] .SOLAT)D& b] 1O1 $ .SOLAT)D& c] *AS*AD.10 E 4aster Deletes Pro!erty 1O1 $ .SOLAT)D Resulting Triggers On$*heck$Delete$4aster On$*lear$Details On$Po!ulate$Details On$*lear$Details On$Po!ulate$Details Pre$Delete

6 M

: I

*AS*AD.10

<

On$*lear$Details On$Po!ulate$Details What is the di##erence bet%een creating a 4AST)R$D)TA.L relationshi! in 1)W BLO*A %indo% and creating relations a#ter creation o# the blocks E When you create the relation in the 1)W BLO*A %indo%& Oracle #orms also alters the !ro!erties o# the (OR).01 A)@ items,s- in the D)TA.L BLO*A by doing the #ollo%ing/ Setting the *A1=AS !ro!erty to 18LL to make the item a 18LL *A1=AS item Setting the #ollo%ing !ro!erties to (ALS) D.SPLA@)D& )1ABL)D& 1A=.0ABL)& Q8)R@ ALLOW)D A1D 8PDAT) ALLOW)D SeBuencing items in the 1a"igator such that the (OR).01 A)@.T)4S are last in the blockNs na"igation seBuence Boiler !late te't label #or the (OR).01 A)@ .T)4 is not created Co% to set R)LAT.O1 !ro!erties Dynamically E

.SOLAT)D

194

2 What is a =ie% E Why is it reBuired to de#ine a =ie% E A =ie% is a database ob>ect that is a logical re!resentation o# a table .t is deri"ed #rom a table but has no storage s!ace o# its o%n and o#ten may be used in the same manner as a table Ad"antage/ 2 Security 5 *om!le' Buery can be re!laced 5 *an %e create a =ie% %ithout a table E @es& 8sing the (OR*) o!tion in the *R)AT) =.)W synta' )'/ *R)AT) (OR*) =.)W "ie%7name as S)L)*T column name&columnname (RO4 table7name+ 6 What is the di##erence bet%een a S@1O1@4 and a =.)W E A S@1O1@4 is a name assigned to a table or "ie% that may therea#ter be used to re#er it .# you access to another userNs table& you may create a synonym #or it and re#er to it by the synonym alone& %ithout entering the userNs name as a Buali#ier A =ie% is a database ob>ect that is a logical re!resentation o# a table .t is deri"ed #rom a table but has no storage s!ace o# its o%n and o#ten may be used in the same manner as a table Di##erence/ A =ie% can be based on 48LT.PL) Tables %hereas a S@1O1@4 is based on a single ob>ect only M What is S1APSCOT E What is a S1APSCOT LO0 E A S1APSCOT is a means o# creating a local co!y o# remote data A sna!shot can be used to re!licate all or !art o# a single table& or to re!licate the result o# a Buery against multi!le tables The re#reshes o# the re!licated data can be done automatically by the database , at time inter"als you s!eci#y - or manually Sna!shot Log is the table associated %ith the 4aster Table o# the Sna! shot : What is a DATABAS) trigger E What is a DATABAS) Procedure E A DATABAS) TR.00)R is a stored !rocedure associated %ith a table that ORA*L)L automatically e'ecutes on one or more s!eci#ied e"ents ,B)(OR) or A(T)R an .1S)RT&8PDAT) or D)L)T)- a##ecting the table Triggers can e'ecute #or the table as a %hole or #or each a##ected ro% in the table A PA*AA0)D PRO*)D8R) is a built$in PL/SQL !rocedure that is a"ailable in all #orms )ach !ackaged !rocedure e'ecutes a SQL3(OR4S #unction& such as mo"ing to a #ield or e'ecuting a Buery I Co% to sho% 4)SSA0)S in PRO*)D8R)S #or debugging !ur!oses E DB4S7O8TP8T7PA*AA0) allo%s you to use 6 debugging #unctions %ithin your !ackage @ou must use YS)T S)R=)R O8TP8T O1Z be#ore e'ecuting the !rocedure ob>ect you %ill be debugging P8T $ Puts multi!le O/PNs on same line P8T7L.1) Puts each O/P on a se!arate line 1)W7L.1) 8sed %ith P8T+ Signals the end o# current O/P line

195
L What is the di##erence bet%een DATABAS) trigger and DATABAS) !rocedure E DATABAS) triggers are e'ecuted automatically in res!onse to s!eci#ic e"ents But the DATABAS) !rocedures are to be e'!licitly in"oked to e'ecute the code contained in them < What is a *8RSOR E A %ork area in memory %here ORA*L) stores the current SQL statement (or a Buery & the area in memory also includes column headings and one ro% retrie"ed by the S)L)*T statement ; What are the attributes o# .4PL.*.T *8RSOR E P.SOP)1& PROW*O81T& P(O81D and P1OT(O81D Attribute R)T8R1S ROW P.SOP)1 PROW*O81T , T)RO P(O81D P1OT(O81D (ALS) TR8) TR8) (ALS) (ALS) TR8) D4L STAT)4)1T R)T8R1S 1O ROW (ALS) (ALS)

2D *an %e !ass a PARA4)T)R to *8RSOR E What is SQLPROW*O81T E We can !ass !arameter to *8RSOR )g/ OP)1 *8SOR,[=ASA1NSQLPROW*O81T is used to count the number o# ro%s returned by an SQL D4L statement .t %ill return Qero i# the D4L statement doesnNt return any ro% 22 Co% to %rite a SQL statement that should ha"e a best R)SPO1S) T.4) E 8se the 7777777777777777777 in the o!timiQer hint inorder to obtain a best res!onse time 8se Y(.RST7ROWZ $ *ost based O!timiQer Cint 25 What are OPT.4.T)R C.1TS E S!eci#ies a hint string that Oracle (orms !asses on to the RDB4S o!timiQer %hen constructing Bueries 8sing the o!timiQer can im!ro"e the !er#ormance o# database transactions 26 What is the di##erence bet%een PT@P) and Pro%ty!e E PT@P) !ro"ides the dataty!e o# a "arible&constant or column .t is use#ul %hen you declare a "ariable that re#ers to a database column in the table PROWT@P) attribute is based on a record "ariable that has the same structure as a ro% in a table or "ie% or as a ro% #etched #rom a cursor 2M *an %e de#ine structure like ob>ects in PL/SQL E ` .# the structure is %hat %e de#ine in [*N then %e can create ob>ects o# ty!e structure using R)*ORD "ariable a"ailable in PL/SQL ] @es& 8sing the PL/SQL tables PL/SQL tables are tem!orary array like ob>ects used in a PL/SQL block PL/SQL tables can ha"e one column and a !rimary key The column data ty!e can belong to any scalar data ty!e& but the !rimary key must only belong to the ty!e binary7integer SiQe $ 81L.4.T)D

196

2: *an %e use a #untion inside an .1S)RT statement E @es )g/ .1S)RT .1TO )4P,*O44 - =AL8)S , SAL3D D: - WC)R) D)PT1O ? 5D+ 2I What is TR81*AT) table E TR81*AT) table is a DDL command used to remo"e all the ro%s #rom the s!eci#ied table or cluster instantly )g/ TR81*AT) TABL) table7name+ Ad"antage o"er D)L)T.10/ a] .t is a DDL statement and generates 1O ROLLBA*A in#ormation b] DoesnNt #ire the tables D)L)T) TR.00)R c] Truncating the master table o# a sna!shot doesnNt record any changes in the tables sna!shot log d] .tNs more con"inient than dro!!ing and recreating the table e] D/R in"alidates the tableNs de!endent ob>ects than truncating the ob>ect #] D/R reBuires you to R)0RA1T the !ri"ileges on the table %hile truncating doesnNt g] D/R reBuires you to R)*R)AT) the .1D)R)S& .1T)0R.T@ *O1STRA.1TS& TR.00)RS and STORA0) PARA4)T)R %hile truncating doesnNt 2L What is ROW.D E What are its com!onents E ROW.D is the logical address o# a ro%& and it is uniBue %ithin the database The ROW.D is broken into three sections/ le#t&middle&& and right ,corres!onding to DDDD2(5D&DDD*& A1D DDD2& >ust sho%n- The numbering is in he'adecimal notation The le#t section is the block in the #ile& the middle is the ro% seBuence number %ithin the block,numbering starts %ith D& not 2-& and the right is the #ile number %ithin the database 1ote that the #ile numbers are uniBue%ithin the %hole database The tables!ace they are in is not rele"ant to the ROW.D ROW.D can be selected& or used in a %here clause& but cannot be changed by an insert& u!date& or delete Co%e"er it can changei# the table it is in is e'!orted and im!orted 2< What is the di##ernce bet%een R)PLA*) and TRASLAT) E Synta' / R)PLA*),string&i#&thenR)PLA*) re!laces a character or characters in a string %ith D or more characters& i! is a character or characters )"erytime it a!!ears in a string& it is by the contents o# t"en )g/ R)PLA*),[ADACN&NAN&NBLACN- $ BLACDBLACC ,ResultSynta'/ TRA1SLAT),string&i#&thenTRA1SLAT) looks at each character in string& and then checks i! to see i# that character is there& i# it is& TRA1SLAT) notes the !osition in i! %here it #ound the character& and then looks the same !osition in t"en# Whate"er character it #inds there it substitutes the character in string )g/ TRA1SLAT),[RA4)SCN&NRA4N&NS8RN- $ S8R)SC,Result-

197
2; What is a L)=)L E L)=)L is a !seudo column& used %ith *O11)*T B@ .t is eBual to 2 #or a root& 5 #or a child o# root& 6 #or a child o# a child o# a root and so on 5D What is anonymous block in PL/SQL E The te't o# an Oracle (orms trigger is an anonymous PL/SQL block .t consists o# three sections / A declaration o# "ariables& constants&cursors and e'ce!tions %hich is o!tional A section o# e'ecutable statements A section o# e'ce!tion handlers& %hich is o!tional Synta'/ D)*LAR) $$$ declararti"e statements , o!tional B)0.1 $$$ e'ecutable statements , reBuired )R*)PT.O1 $$$ e'ce!tion handlers , o!tional )1D+ 52 1ame any ORA*L) de#ined )R*)PT.O1 E *8RSOR7ALR)AD@7OP)1& 1O7DATA7(O81D& .1=AL.D7184B)R 55 *an %e de#ine our OW1 )R*)PT.O1 E Co% to raise it E .n the D)*LARAT.O1 !art de#ine a "ariable o# ty!e exception .n the e'cecution !art call the e'ce!tion using RA.S) exception_name .n the e'ce!tion !art handle the e'ce!tion using WC)1 exception_name 56 What is a PRA04A E .t is a directi"e to the *O4P.L)R& rather than a !iece o# e'ecutable code )"enthough it a!!ears in the !rogram& it is not e'ecutable .t gi"es instructions to the com!iler 5M Di##erence bet%een *CAR and =AR*CAR5 E *CAR,si$e- $ .t is a #i'ed length character data& si$e characters long .t is !added %ith BLA1AS O1 R.0CT to the #ull length o# si$e D)(A8LT $ 2 bytes& 4AR.484 $ 5:: bytes =AR*CAR5,si$e- $ .t is a "arable length char string ha"ing a ma'imum o# si$e bytes 4AR.484 $ 5DDD bytes 5: What is a *8RSOR (OR LOOP E The *8RSOR (OR LOOP lets you im!licitly OP)1 a cursor& ()T*C each ro% returned by the Buery associated %ith the cursor and *LOS) the cursor %hen all ro%s ha"e been !rocessed 5I What are the !ossible *O1STRA.1TS de#ined on a TABL) E 1OT 18LL& 81.Q8) A)@& PR.4AR@ A)@& (OR).01 A)@ and constraints *C)*A

198
5L What is APPL.*AT.O1 PART.T.O1.10 E PL/SQL is the language used #or both client$side Oracle #orms a!!lications and ser"er$side database triggers and stored !rocedures and there is a PL/SQl engine in both Oracle #orms Run#orm and the OracleL Ser"er This means that you can take ad"antage o# a!!lication !atitioning to e'ecute a!!lication code on either the client or the ser"er A!!lication !artitioning allo%s you to o!timiQe !er#ormance and resource usage by storing and e'ecuting !rocedures either locally or at the ser"er& %hich makes the most sense #or your !articular a!!lication and con#iguration 5< Di##erence bet%een a STOR)D PRO*)D8R) and a STOR)D (81*T.O1 E 8nlike !rocedures& (81*T.O1S returns a =AL8) to the caller This "alue is returned throN the R)T8R1 command%&eyword %ithin the #unction (unctions donNt use the .1& O8T K .1 O8T arguments& %hich are a"ailable #or PRO*)D8R)S 5; Co% to R81 PRO*)D8R)S #rom SQL PRO4PT E 8se )R)*8T) 'rocedure_name command 6D Co% to TRAP )RRORS in !rocedures E 8se SCOW7)RRORS this %ill dis!lay all the errors associated %ith the most recently created !rocedural ob>ect This command %ill check the =.)W7)RRORS data dictionary #or the )RRORS associated %ith the most recent com!ilation attem!t #or that !rocedural ob>ect SCOW7)RRORS %ill dis!lay the L.1) and *OL841 1O #or each error& as %ell as the te't o# the error message )g/ S)L)*T L.1)& POS.T.O1&T)RT (RO4 8S)R7)RRORS WC)R) 1A4) ? [balance7checkN A1D T@P) ? PRO*)D8R)/(81*T.O1/PA*AA0) ORD)R B@ S)Q8)1*)+ 1OT)/ We can use ALL7)RRORS V DBA7)RRORS to "ie% errors TRAPP.10 )RORS/ DB4S7O8TP8T !ackage allo%s you to use 6 debugging #unctions %ithin your !ackage @ou must set [S)R=)R O8TP8T O1N be#ore e'ecuting the !rocedure ob>ect you %ill be debugging P8T $ Puts multi!le o/!Ns on same line P8T7L.1) $ Puts each o/! on a se!arate line 1)W7L.1) $ 8sed %ith P8T+ Signals the )1D o# current o/! line 62 When do %e get a 48TAT.10 )RROR E This ha!!ens %ith TR.00)RS .t occurs because the trigger is trying to u!date a ro% it is currently using The usual #i' in"ol"es either use o# =.)WS or T)4PORAR@ TABL)S so the database is selecting #rom one %hile u!dating the other 65 Co% to D.SABL) R)()R)1T.AL .1T)0R.T@ E 8se the D.ABL) o!tion in *R)AT) TABL) or ALT)R TABL) or using D.SABL) a a 81.Q8) ,column- ,columnPR.4AR@ A)@ K *O1STRA.1T b `*AS*AD)] K ALL TR.00)RS+ 1OT) / (or diabling R)()R)1T.AL .1T)0R.T@ %e ha"e to include *AS*AD) o!tion

199

66 Co% to kno% %hat all *O1STRA.1TS are !resent in a table E 8sing the 8S)R7*O1STRA.1TS "ie% %e can get the ty!e o# constaints declared on a table 8se ALL7*O1STRA.1TS to list the constraints on all o# the tables that the user ha"e access DBA7*O1STRA.1TS lists all o# the constraints in the database 6M What is 4AST)R $ D)TA.L relationshi! E *an %e %rite a master$detail relationshi! !rograms %ithout using the setings at design time .# so ho% E .t is an association bet%een TWO BAS) TABL) blocks $ a 4AST)R block and a D)TA.L block The relationshi! bet%een the blocks re#lects a PR.4AR@ A)@ $ (OR).01 A)@ relationshi! bet%een the tables on %hich the blocks are based @es 8sing the S)T7R)LAT.O1 !ro!erty 6: What does B8(()R R)*ORDS o!tion and ARRA@ S.T) !arameter E ARRA@ S.T) $ S!eci#ies the minimum no o# records that get #etched each time #orms goes to the database B8(()R R)*ORDS $ S!eci#ies the minimum no o# records that should be !laced in memory %hen records are #etched #rom the database )"en i# you s!eci#y a lo% "alue o# 6& the minimum !er #orm is slightly o"er 6DD 6I During =AL.DAT.O1 WCAT *C)*AS are done %ith res!ecti"e to (.)LDS / .T)4S E 2] Data ty!e& 5] 4a'imum length& 6] (i'ed length& M] ReBuired and :] Range Lo% "alue / Range Cigh "alue 6L What is the di##erence bet%een PR.4AR@ A)@ and 81.Q8) A)@ E The 81.Q8) A)@ column restricts entry o# du!licate "alues but entry o# 18LL "alue is allo%ed .n case o# PR.4AR@ A)@ columns entry o# du!licate as %ell as 18LL "alue is restricted 6< What is the D.(()R)1*) bet%een PR)$Q8)R@ and POST$Q8)R@ E PR)$Q8)R@ #ires O1L@ O1*) during )R)*8T)$Q8)R@ or *O81T$Q8)R@ !rocessing& >ust be#ore Oracle (orms constructs and issues the S)L)*T statement to identi#y ro%s that match the Buery criteria POST$Q8)R@ #ires each time #or records !laced on the blocks list o# records 6; When do you use O1$DATABAS)$R)*ORD triigger E 8se an O1$DATABAS)$R)*ORD to !er#orm an action e"ery time a record is #irst marked as an .1S)RT or 8PDAT) This trigger #ires& as soon as Oracle (orms determines throN "alidation that the record should be !rocessed by the ne't !ost or commit as an .1S)RT or 8PDAT)

2,,
MD What are R)STR.*T)D PA*AA0)D PRO*)D8R)S E Why are they restricted #rom using E Any PA*AA0)D PRO*)D8R) that a##ects the basic #unctions o# SQL3(OR4S is a R)SR.*T)D PA*AA0)D PRO*)D8R) @ou should use restricted !ackaged !rocedure only in A)@$TR.00)RS& 8S)R$1A4)D TR.00)RS that are in"oked by A)@$ TR.00)RS& and O171)W7(.)LD7.1STA1*) triggers @ou should not use restricted !ackaged !rocedures in any o# the #ollo%ing ty!es o# triggers On$error&On$Database$Record&On$delete&On$insert&On$Lock& On$4essage&On$1e%$Record&On$Remo"e$record&On$8!date& On$=alidate$(ield& and On$"alidate$Record triggers Post$*hange triggers Pre$ and Post$ (ield& Pre$ and Post$ Record& Pre$ and Post$Block& Pre$ and Post$(orm triggers Pre$ and Post$Query triggers Pre$ and Post$.nsert& Pre$ and Post$8!date& Pre$ and Post$Delete& Pre$ and Post$*ommit triggers 8ser$1amed triggers that are in"oked by any o# the abo"e triggers M2 What is the D.(()R)1*) bet%een )RPL.*.T *8RSOR V .4PL.*.T *8RSOR E .4PL.*.T *8RSORS are automatically o!ened by issuing a S)L)*T statement But the )RPL.*.T cursors are to be o!ened using OP)1& #etching is done using ()T*C and closing using *LOS) M5 What is the di##erence bet%een ROW.D and ROW184 E ROW.D is the logical address o# the ro%& %hereas ROW184 returns the seBuence no in %hich the ro% %as retrie"ed %hen #irst #eched #rom a table M6 What is the R)S8LT o# the statement E S)L)*T )4P1O& 1A4)&SAL (RO4 )4P WC)R) ROW184 G5+ Result / D& 1o ro%s %ill be selected MM Co% do you e"aluate !er#ormance E 8sing SQL TRA*) .t is an utility that can monitor and re!ort on database !er#ormance %hen one or more Bueries are run against the database .t is used to gather statistics %hen running the Buery ,i e- re!orts on *P8 time s!ent on the Buery& the total no o# ro%s !rocessed and statistics related to !arsing and cache !er#ormance M: What %ill )RPLA.1 PLA1 gi"e E .t is an utility that sho%s ho% Oracle %ill access data #or a gi"en Buery 8se )RPLA.1 PLA1 to determine the e##ecti"e %ay to %rite Bueries and decide %hether to .1D)R *)RTA.1 *OL841S or TO 8S) *L8ST)RS .t sho%s / 2] The ty!e o# Buery !rocessed+ S)L)*T& .1S)RT&8PDAT) or D)L)T) 5] The cost assigned by the *OST BAS)D OPT.4.T)R i# it is in use 6] The ste!s that are necessary to return the data M] The internal o!erations that %ere !er#ormed #or each ste! :] The ob>ect accessed #or each ste! MI Co% do you analyse TAPRO( E

2,1
TAPRO( #ilename tra O/P #ile )RPLA.1 ? 8SR/PWDD ML %hat !arameter "ariables to be set to use TAPRO( E SQL PRO( M< Co% many ty!es o# lockings are there E : ty!es o# locks To lock is to tem!orarily restrict other userNs access to data The restriction is !laced on such data is called Ya lockZ The modes are SCAR)& SCAR) 8PDAT)&)R*L8S.=)&ROW SCAR) A1D ROW )R*L8S.=) 1ot all locks can be acBuired in all modes M; What is a SCAR) LO*A E A SCAR) lock is one that !ermits other users to Buery data& but not to change it :D What is a SCAR) 8PDAT) LO*A E A SCAR) 8PDAT) lock is one that !ermits other users to both Buery and lock data :2 What is an )R*L8S.=) LO*A E An )R*L8S.=) LO*A is one that !ermits other users to Buery data& but not to change it .t di##ers #rom the SCAR) lock because it does not !ermit another user to !lace any ty!e o# lock on the same data+ se"eral users may !lace SCAR) locks on the same data at the same time :5 What is ROWSCAR)& SCAR)8PDAT) and ROW )R*L8S.=) locks E With a ROW SCAR) or SCAR) 8PDAT) lock& no users can lock the %hole table #or e'clusi"e access& allo%ing concurrent access #or all users to the table The t%o ty!es o# locks are synonymous& and SCAR) 8PDAT) e'ists #or com!atibility %ith !re"ious "ersions o# ORA*L) ROW )R*L8S.=) locks are similar to ROW SCAR) but they !rohibit shared locking& so only one user user may access the table at the same time :6 What is a D)AD LO*A E A D)AD lock is a rare situation in %hich t%o or more user !rocesses o# a database cannot com!lete their tansactions This occurs because each !rocess is holding a resource that the other !rocess reBuires ,such as a ro% in a table- in order to com!lete Although these situations occur rarely& ORA*L) detects and resol"es deadlocks by rolling back the %ork o# one o# the !rocesses :M Co% do you analyse %hich resources has locked #or %hat E 8se 4O1.TOR S)SS.O1 :: Co% to kill a S)SS.O1 E ALT)R S)SS.O1 A.LL .D& 184B)R (RO4 SQLDBA+ :I What are 8S)R7)R.TS E .t is an utility in SQL3(OR4S #or making use o# COST 6 0L languages #or the !ur!ose like O1L.1) PR.1T.10 etc

2,2

:L When %ill you use the trigger WC)1$1)W$(OR4$.1STA1*) E At (OR4S START8P Oracle na"igates to the #irst na"igable item in the #irst na"igable block This trigger #ires a#ter success#ul com!letion o# any 1a"igational trigger ,i e- .t %ill not #ire i# the control retuns to the *ALL.10 (OR4 #rom the *ALL)D (OR4 8sage/ (or initialiQation at (OR4S START8P :< What is an .1D)R E Why are inde'es used in a table E .1D)R is a general term #or an ORA*L) / SQL #eature used !rimarily to s!eed e'ecution an im!ose 81.Q8)1)SS u!on certain data .1D)R !ro"ides a #aster access method to one tableNs data than doing a #ull table scan There are se"eral ty!es o# .nde'es / 81.Q8) .1D)R& *O4PR)SS)D .1D)R& *O1*AT)1AT)D .1D)R An .nde' has an entry #or each "alue #ound in the tableNs .nde'ed #ield,s- , e'ce!t those %ith a 18LL "alue - and !ointer,s- to the ro%s ha"ing that "alue :; What is an 81.Q8) .1D)R E An 81.Q8) .1D)R ia an inde' that im!oses uniBueness on each "alue in inde'es The inde' may be one column or concatenated columns ID What is an *O4PR)SS)D .1D)R E A *O4PR)SS)D .1D)R is an inde' #or %hich only enough inde' in#ormation is stored to identi#y uniBue enrties+ in#ormation that an inde' stores %ith the !re"ious or #ollo%ing key is Ycom!ressedZ ,truncated- and not stored to reduce the storage o"erhead reBuired by an inde' I2 What is an *O1*AT)1AT)D .1D)R E A *O1*AT)1AT)D .1D)R is one that is created on more than one column o# a table .t can be used to guarentee that those columns are uniBue #or e"ery ro% in the table and to s!eed access to ro%s "ia those columns I5 What is a 81.O1& 81.O1 ALL&.1T)RS)*T.O1 and 4.18S o!erator E The 81.O1 o!erator returns ALL D.ST.1*T ROWS selected by either Buery The 81.O1 ALL o!erator returns ALL ROWS selected by either Buery including du!licates The .1T)RS)*T.O1 o!erator returns O1L@ ROWS that are *O44O1 to both the Bueries The 4.18S o!erator returns ALL D.ST.1*T ROWS selected only by the #irst Buery and not by the second I6 What does [0RO8P B@N statement do E 0RO8P B@ statement causes a S)L)*T statement to !roduce O1) S844AR@ ROW #or all selected ro%s that ha"e identical "alues in one or more s!eci#ied column or e'!ressions )ach e'!e\ressionin the S)L)*T clause must be one o# the #ollo%ing / 2] A *O1SA1T 5] A (unction %ithout !arameters 6] A 0RO8P #unction like S84 & A=0 M] 4atched .D)1T.*ALL@ to a e'!ression in the [0RO8P B@N clause

2,3
IM .n 5 S)L)*T statements S)L)*T A (RO4 D8AL+ and S)L)*T B (RO4 D8AL+ What %ill be the di##erence in using [81.O1N and [81.O1 ALLN E 81.O1 returns all distinct ro%s selected by either o# the Buery& %hereas 81.O1 ALL returns ALL ROWS selected by either Buery including du!licates IM 0i"e one e'am!le %here you %ill use DATABAS) TR.00)RS E (or A8D.T.10 !ur!oses %e use database triggers I: Do you ha"e any idea about ROW$*CA.1.10 E Co% %ill you resol"e the issue i# there is ro%$ chaining in a table E When a ro% 1O LO10)R (.TS W.TC.1 TC) DATABLO*A& it is stored in more than one database block& and that there#ore ha"e se"eral ro% !ieces Resol"ing/ 8se A1AL@T) to identi#y chained ro%s and also !ro"ides statistics on the chained ro%s )g/ A1AL@T) ledger L.ST *CA.1)D ROWS .1TO *CA.1)D7ROWS/ ,*CA.1)D7ROWS is a user de#ined table(or creating chained7ro%s run the 8TL*CA.1 SQL scri!t II What is an OPT..4.T)R E OPT.4.T)R is an utility used to determine ho% to access data reBuested in the Buery by the 8S)R or APPL.*AT.O1 PRO0RA4 The out!ut o# an o!timiQer is )R)*8T.O1 PLA1 IL Co% OPT.4.TAT.O1 is done by the Oracle in case o# a Buery E 2] R8L) based& and 5] *OST based I< What is a] R8L) based o!timiQation& b] *OST based o!timiQation E R8L) based o!timiQation 8S)S A (.R)D S)T O( R8L)S to determine ho% to access the data *OST based o!timiQation 8S)S STAST.ST.*S STOR)D .1 TC) DATA D.*T.O1AR@ W.TC *)RTA.1 R8L)S to determine ho% to access the data T%o modes $ a] ALL7ROWS& B] (.RST7ROW With the hel! o# ALT)R S)SS.O1 S)T OPT.4.T)R70OAL ? ALL7ROWS / (.RST7ROW& We can alter the modes o# cost based o!timiQer I; The A)@WORD comes into the mind immediately %hen %e talk about security EEEEEE in ORA*L) L D E 0RA1T Synta' 0RA1T !ri"ileges, S)L)*T&.1S)RT&8PDAT)&D)L)T)&ALT)R&.1D)R- O1 ob>ect TO user W.TC 0RA1T OPT.O1+ LD What A)WORD is used to %ithdra% the PR.=.L)0) you ha"e granted to other user E R)=OA) Synta'/ R)=OA) !ri"ileges O1 ob>ect (RO4 users+ L2 What is S.10L) .1STA1*) E A single instance can run on a single machine

2,4
L5 What is 48LT.PL) .1STA1*)S E A S.10L) 4A*C.1) can run more than one instance at a time )ach instance is connected to its o%n database

L6 What is D.STR.B8T)D PRO*)SS.10 E Di##erent instances on di##erent machines can communicate %ith each other using DATABAS) L.1AS and the D.STR.B8T)D o!tion Oracle su!!orts #ull t%o$!hase commits %hich means that inserts& u!dates and deletes can occur on R)4OT) database "ia a net%ork running SQL31et LM What is PARALL)L PRO*)SS.10 E The Oracle !arallel ser"er allo%s muli!le instances to share a single database on a shared disk system The instance can run on a !arallel com!uter or on di##erent com!uters in a cluster L: Di##erence bet%een SQL and PL/SQL E SQL is the A1S. industry standard language& used to mani!ulate in#ormation in a relational database PL/SQL is the !rocedural language e'tension to OracleNs SQL language SQL PL/SQL 2 .t is #le'ible& Po%er#ul and easy to 2 PL/SQL block can contain any no o# learn SQL statements combined %ith the #ollo%ing / 5 .t is a non$!rocedural language .t a] (lo% o# control statements such as a] Processes set o# records rather than .( TC)1& )LS)& )R.T and 0OTO >ust one at a time and b] Re!etition statements such as (OR b] Pro"ides automatic na"igation to LOOP and WC.L) LOOP the data c] Assignment statements such as R /? @ OT 6 .t !ro"ides commands #or a"ariety o# tasks including / 5 PL/SQL allo%s you to logically grou! a a] Querying data set o# statements and send them to the b] *reating&8!dating and Re!lacing RDB4S as a single block ob>ects and .nserting& 8!dating and Deleting ro%s 6 Procedural ca!abilities M] All RDB4S su!!orts SQL Thus one can trans#er the skills gained %ith SQL #rom one RDB4S to another Programs %ritten in SQL are !ortable& they can o#ten be mo"ed #rom one database to another %ith little modi#ication M .m!ro"ed !er#ormance : )nhanced !roducti"ity I Portability L .ntegration %ith the RDB4S

LI Co% to #etch descri!tion o# a code in the base table block %here code is a base table #ield and the descri!tion is a non$base table #ield E 8se S)L)*T %ith .1TO clause to #etch the decri!tion "alue into the 1O1$BAS) table #ield

2,5

LL What is the !ur!ose o# O8T)R HO.1 E An O8T)R HO.1 returns all the ro%s returned by sim!le >oin as %ell as those ro%s #rom one table that do not match any ro% #rom the other table The symbol ,Ore!resents the outer >oin L< Di##erence bet%een )Q8. HO.1 and O8T)R HO.1 E )Q8. HO.1 returns ro%s #rom both the tables !ro"ided they both ha"e the same column_name in the %here clause The symbol ,?- re!resents the )Q8. HO.1 (or O8T)R HO.1 see !re"ious ans%er L; De#ine 1OR4AL.TAT.O1 E 1OR4AL.TAT.O1 is the !rocess o# !utting things right& making them normal .t is a !art o# analysis necessary to understand a business& and build a use#ul a!!lication The normaliQation o# data ensures a] 4inimiQation o# du!lication o# data b] Pro"iding #le'ibility to su!!ort di##erent #untional reBuirements c] )nabling the model to be translated to database design ST)PS .1=OL=)D .1 1OR4AL.TAT.O1 2] )nsure that all the )1T.T.)S are uniBuely identi#ied by a combination o# attributes 5] Remo"e re!eated attributes or grou! o# attributes& to !lace the entities in the #irst normal #orm 6] Remo"e attributes that are de!endent on only !art o# the identi#ier M] Remo"e attributes that are de!endent on attributes %hich are not !art o# the identi#ier <D De#ine R)()R)1T.AL .1T)0R.T@ E R)()R)1T.AL .1T)0R.T@ is the !ro!erty that guarantees that "alues #rom one column de!end on "alues #rom another column This !ro!erty is en#orced through integruty constraints Re#erential integrity is the automatic en#orcement o# re#erential constraints that e'ists bet%een a re#erence table and a re#erencing table When re#erential integrity is en#orced & the "alue o# a #oreign key e'ists as a !rimary key "alue in the re#erence table <2 )'!lain O8T)R HO.1 %ith e'am!le E S)L)*T D)PT D)PT1O&D1A4)&HOB&)1A4) (RO4 D)PT&)4P WC)R) D)PT D)PT1O ? )4P D)PT1O,O- A1D D)PT1O .1 ,6D&MDORD)R B@ D)PT D)PT1O+

2,6
<5 )'!lain %ith e'am!le ho% to use a select statement %ith 0RO8P B@ CA=.10 clause E ,orWhere and %hen is the CA=.10 clause used and %hat does it ha"e E The CA=.10 clause is coded a#ter the 0RO8P B@ clause in the Buery that is summariQing results by one or more grou!ing columns The CA=.10 clause beha"es the same as the WC)R) clause e'ce!t that it is used to s!eci#y the conditions each returned grou! must satis#y .# one ro% in the grou! #ails the condition o# the CA=10 clause& the entire grou! is not returned as !art o# the result )'/ S)L)*T 4AR,*8ST.D-& R)P.D (RO4 *8STO4)R 0RO8P B@ R)P.D CA=.10 *O81T,3- G 5+ <6 Co% do you T81) SQL statements E 8se OPT.4.T)R C.1TS #or tuning SBl statements <M What is the ad"antage o# )1(OR*) A)@ E )1(OR*) A)@ #ield characterstic indicates the source o# the "alue that SQL3(OR4S uses to !o!ulate the #ield <: What is the Pur!ose o# )RAS) command E )RAS) remo"es an indicated 0lobal "ariable V releases the memory associated %ith it

2,7

:mportant Queries

1. 1etrie/in( the speci ied rows in a ta"le 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& ca*Gl%adGti&e .here r%.id in FSelect &a/ Fr%.id) 'r%& ca*Gl%adGti&e .here r%.nu&SRBa ;ni%n Select &a/ Fr%.id) 'r%& ca*Gl%adGti&e .here r%.nu&SRB ) 2. 1etrie/in( the speci ied row o a ta"le 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0\$eth%d 1: 0 Ans. select M 'r%& ca*Gl%adGti&e .here r%.id in FSelect &a/ Fr%.id) 'r%& ca*Gl%adGti&e .here r%.nu&SRBc) 9 \$eth%d 2: 0 i' there are n% du*licates Ans. select M 'r%& ca*Gl%adGti&e .here r%.nu&SRBa $inus Select M 'r%& ca*Gl%adGti&e .here r%.nu&SBa +. Selectin( duplicate rows o a ta"le! 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& :$8 r .here r%.id in Fselect &in Fr%.id) 'r%& :$8 s .here -.e&*n%Rs.e&*n%) =. #eletin( duplicate /alues o a ta"le! 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. delete 'r%& :$8 r .here r%.id in Fselect &in Fr%.id) 'r%& :$8 s .here -.e&*n%Rs.e&*n%) Delete from EM) 'here ro'id</select e(ro'id from emp e26 emp e7 'here e(empno<e7(empno and e2(ro'idKe7(ro'id3B C. Selectin( ma9imum rows o two ta"les! 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 \$eth%d 1:

2,8

Ans. select Fselect c%unt FM) 'r%& ta le1)6 Fselect c%unt FM) 'r%& ta le2) 'r%& ?ual \$eth%d 2: 0 Ans. select a. M6 . M 'r%& Fselect c%unt FM) 'r%& e&*) a6 Fselect c%unt FM) 'r%& ?e*t) ;. Selectin( ma9imum three salaries o a ta"le! 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M '%r& Fselect M '%r& e&* %rder y sal desc) .here r%.nu&S3 >. Selectin( last two rows o a ta"le 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& :$8 &inus Fselect M 'r%& e&* .here r%.nu&SRFselect c%unt FM)0Ba 'r%& e&*)) ?. 2 Th ma9imum salar. o a compan. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0Ans. select distinct salary 'r%& e&* e .here BaRFselect c%untFM) 'r%& e&* ' 5here e.salS'.sal) B. To (et the particular row rom the ta"le 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& Fselect r%.nu& s6 a. M 'r%& e&* a %rder y r%.nu&) .here sR84 1D. To (et the an. ,second) ma9imum salar. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select &in Fsal) 'r%& Fselect M 'r%& e&* %rder y sal desc) .here r%.nu&S34 11. To (et the rows rom C to 1D 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& :$8 .here r%.nu&S11&inus Select M 'r%& :$8 .here r%.nu&S64 12. To (et the last inserted row in a ta"le 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& e&* .here r%.id in Fselect &a/ Fr%.id) 'r%& e&*)4 1+. To (et the last inserted rows

2,9 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select M 'r%& :$8 .here r%.id in FSelect r%.id 'r%& :$8 &inus Select r%.id 'r%& :$8 5here r%.nu&SFselect c%unt FM)01 'r%& :$8)) 1=. To (et the alternati/e rows 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 Ans. select r%.nu&6 e&*n% 'r%& :$8 gr%u* y r%.nu&6 e&*n% ha"ing &%d Fr%.nu&6 2)R14F%dd) Ans. select r%.nu&6 e&*n% 'r%& :$8 gr%u* y r%.nu&6 e&*n% ha"ing &%d Fr%.nu&6 2)R,4Fe"en)4

IN'() 28 Query for retrievin+ ) hi+hest paid employees @'O- each "epartment. # 18 Query that will display the total no. of employees, and of that total the number who were hired
in 098D, 0980, 0983, and 098H.

## 68 Query for listin+ "eptno, ename, sal, .(-2sal in that dept). ### 38 -atri6 query to display the 8ob, the salary for that 8ob based on department number, and the
total salary for that 8ob for all departments.

#' B8 )th %op .alary of all the employees. ' 78 'etrievin+ the )th row @'O- a table. '# 48 %ree Query. '## 58 #liminate duplicates rows in a table. '### A8 "isplayin+ #,#'7 )th row in a table. #; 2?8 %op ) rows @'O- a table. ; 228 *O()%&.(- '!)C#. of data values in a column. ;# 218 @or equal siIe ran+es it mi+ht be easier to calculate it with "#*O"#2%'()*2value&ran+e),
rateFD, 0, rateF0, ...).

D,

;## 268 *ount different data values in a column. ;###

21,
238 Query to +et the product of all the values of a column. ;#' 2B8 Query to display only the duplicate records in a table. ;' 278 Query for +ettin+ the followin+ output as many number of rows in the table. ;'# 248 @unction for +ettin+ the :alance ,alue. ;'## 258 @unction for +ettin+ the #lement ,alue. ;'### 2A8 .#$#*% Query for countin+ )o of words. ;#; 1?8 @unction to chec9 for a leap year. ;; 128 Query for removin+ all non>numeric. ;;# 118 Query for translatin+ a column values to I)I%*!=. ;;## 168 @unction for displayin+ 'upees in Words. 138 Query for deletin+ alternate even rows @'O- a table. ;;#' 1B8 Query for deletin+ alternate odd rows @'O- a table. ;;' 178 =rocedure for sendin+ #mail. ;;'# 148 !lternate Query for "#*O"# function. ;;'## 158 *reate table addin+ *onstraint to a date field to .7."!%# or H months later. 1A8 Query to list all the suppliers who r supplyin+ all the parts supplied by supplier G.3G. 6?8 Query to +et the last .unday of any month. ;;; 628 Query to +et all those who have no children themselves. ;;;# 618 Query to .#$#*% last ) rows @'O- a table. 668 .#$#*% with variables. ;;;### 638 Query to +et the ": )ame. ;;;#' 6B8 Cettin+ the current default schema. ;;;' 678 Query to +et all the column names of a particular table. ;;;'# 648 .pool only the query result to a file in .Q$=$(.. ;;;'## 658 Query for +ettin+ the current .essionI". ;;;'### 6A8 Query to display rows @'O- m to n. ;;;#; 3?8 Query to count no. Of columns in a table. ;;;; 328 =rocedure to increase the buffer len+th. ;;;;# 318 Insertin+ an M symbol in a ,archar3 column. ;;;;##

;;###

;;'### ;;#;

;;;##

211
368 *reate Query to restrict the user to a sin+le row. ;;;;### 338 Query to +et the first inserted record @'O- a table. ;;;;#' 3B8 *oncatenate a column value with multiple rows. ;;;;' 378 Query to delete all the tables at once. ;;;;'# 348 .Q$ Query for +ettin+ Orphan 'ecords. ;;;;'## 358 'emovin+ %railin+ blan9s in a spooled file. 3A8 .amples for e6ecutin+ "ynamic .Q$ .tatements. ;;;;#; B?8 "ifferences between .Q$ and -.>!ccess. B28 Query to display all the children, sub children of a parent. B18 =rocedure to read&write data from&to a te6t file. B68 Query to display random number between any two +iven numbers. B38 %ime difference between two date columns.

;;;;'### ;;;;; ;;;;;# ;;;;;## ;;;;;### ;;;;;#'

I. *T e #ollo+in$ query retrie%es ,-, .R/0 ea& 'epartment 1

i$ est paid employees

S!L!9. deptno$ empno$ sal G,F< emp e HI!,! 1 J ( S!L!9. 9FUN.(e28sal) G,F< emp e2 HI!,! e8deptno D e28deptno "ND e8sal K e28sal ) F,D!, +Y 2$6 D!S9;
,nde=

II. 2uery t at +ill display t e total no. o# employees" and o# t at total t e number + o +ere ired in 3456" 3453" 345-" and 3457. 8i%e appropriate &olumn eadin$s. # am looLing at t&e follo%ing output8 He need to sticL to t&is format8 .otal 00000000000 23 2A5? 000000000000 2 2A52 000000000000 2? 2A51 0000000000000 1 2A56 00000000000 2

S!L!9. 9FUN. (M)$ 9FUN.(D!9FD!(.F-9I", (&iredate$ NYYYYN)$N2A5?N$ empno)) "2A5?"$ 9FUN. (D!9FD! (.F-9I", (&iredate$ NYYYYN)$ N2A52N$ empno)) "2A52"$

212 9FUN. (D!9FD! (.F-9I", (&iredate$ NYYYYN)$ N2A51N$ empno)) "2A51"$ 9FUN. (D!9FD! (.F-9I", (&iredate$ NYYYYN)$ N2A56N$ empno)) "2A56" G,F< emp;
,nde=

III. 2uery #or listin$ 'eptno" ename" sal" 9:0*sal in t at dept; 1 S!L!9. a8deptno$ ename$ sal$ (S!L!9. SU<(sal) G,F< emp b HI!,! a8deptno D b8deptno) G,F< emp a F,D!, +Y a8deptno; FU.(U. C DDDDDDD D!(.NF DDDDDDDDD 2? 6? 2? 2? 6? 6? 6? 6? 6? 1? 1? 1?
,nde=

!N"<! S"L DDDDDDD DDDD @#N/ B??? +L"@! 15B? 9L",@ 13B? >FN!S 1A4B <",.#N 21B? "LL!N 27?? .U,N!, 2B?? >"<!S AB? H",D 14B? S<#.I 5??? S9F.. 6??? <#LL!, 1????

SU< (S"L) DDDDDDDDD 2241B 2?A?? 2241B 2241B 2?A?? 2?A?? 2?A?? 2?A?? 2?A?? 66??? 66??? 66???

IV. Create a matrix query to display t e !ob" t e salary #or t at !ob based on department number" and t e total salary #or t at !ob #or all departments" $i%in$ ea& &olumn an appropriate eadin$. .&e output is as follo%s 0 %e need to sticL to t&is format C >ob Dept 2? .otal 0000000000 000000000000000 000000000 Dept 1? 0000000000000 Dept 6? 0000000000000

213 "N"LYS. 7??? 9L!,@ 7??? 2A?? 1A4B 15B? AB?

26?? 32B? <"N"/!, 13B? 514B (,!S#D!N. B??? B??? S"L!S<"N B7??

B7??

S!L!9. Eob ">ob"$ SU< (D!9FD! (deptno$ 2?$ sal)) "Dept 2?"$ SU< (D!9FD! (deptno$ 1?$ sal)) "Dept 1?"$ SU< (D!9FD! (deptno$ 6?$ sal)) "Dept 6?"$ SU< (sal) ".otal" G,F< emp /,FU( +Y Eob ;
,nde=

V. <t

Top 9alary o# all t e employees 1

S!L!9. D!(.NF$ !N"<!$ S"L G,F< !<( " HI!,! 6 D (S!L!9. 9FUN.(+8S"L) G,F< !<( + HI!,! "8S"L K +8S"L) F,D!, +Y S"L D!S9;
,nde=

VI. Retrie%in$ t e 5t

ro+ .R/0 a table 1

S!L!9. D!(.NF$ !N"<!$ S"L G,F< !<( HI!,! ,FH#D D (S!L!9. ,FH#D G,F< !<( HI!,! ,FHNU< KD B <#NUS S!L!9. ,FH#D G,F< !<( HI!,! ,FHNU< K B)
,nde=

VII. Tree 2uery 1 Name Null? .ype 0000000000000000000000000000000000000000000000000000000000000000000 SU+ NF. NULL '",9I",1(3)

214 SU(!, (,#9! '",9I",1(3) NU<+!,(7$1)

S!L!9. sub$ super G,F< parts 9FNN!9. +Y (,#F, sub D super S.",. H#.I sub D Np2N;
,nde=

VIII. (liminate dupli&ates ro+s in a table 1 D!L!.! G,F< table-name " HI!,! ,FH#D J ( S!L!9. min(,FH#D) G,F< table-name + HI!,! "8col D +8col);
,nde=

I). 'isplayin$ (V(RY <t ro+ in a table 1 *I# a table ro+s" <"5"3- ro+s +ill be sele&ted; S!L!9. M G,F< emp HI!,! (,FH#D$?) #N (S!L!9. ,FH#D$ <FD(,FHNU<$3) G,F< emp);
,nde=

as 3<

). Top N ro+s .R/0 a table 1 *'isplays top 4 salaried people; S!L!9. ename$ deptno$ sal G,F< (S!L!9. M G,F< emp F,D!, +Y sal D!S9) HI!,! ,FHNU< K 2?;
,nde=

)I. =o+ does one &ount>sum RAN8(9 o# data %alues in a &olumn? A %alue x +ill be bet+een %alues y and @ i# 8R(AT(9T*x" y; A B(A9T*x" @;. S!L!9. f1$ 9FUN.(D!9FD!(greatest(f2$BA)$ least(f2$2??)$ 2$ ?)) ",ange 7?02??"$

215 9FUN.(D!9FD!(greatest(f2$6?)$ least(f2$ BA)$ 2$ ?)) ",ange 6?0BA"$ 9FUN.(D!9FD!(greatest(f2$1A)$ least(f2$ ?)$ 2$ ?)) ",ange ??01A" G,F< my-table /,FU( +Y f1;
,nde=

)II. .or equal si@e ran$es it mi$t be easier to &al&ulate it +it '(C/'(*TR:NC*%alue>ran$e;" 6" rateC6" 3" rateC3" ...;. S!L!9. ename "Name"$ sal "Salary"$ D!9FD!( .,UN9(sal)2???$ ?)$ ?$ ?8?$ 2$ ?82$ 1$ ?81$ 6$ ?86) ".a: rate" G,F< emp; )III. =o+ does one &ount di##erent data %alues in a &olumn? 9FL N"<! D".".Y(! 0000000000000000000000000000000000000000 DNF NU<+!, S!; 9I", S!L!9. dno$ SU<(D!9FD!(se:$N<N$2$?)) <"L!$ SU<(D!9FD!(se:$NGN$2$?)) G!<"L!$ 9FUN.(D!9FD!(se:$N<N$2$NGN$2)) .F."L G,F< t2 /,FU( +Y dno;
,nde=

)IV. 2uery to $et t e produ&t o# all t e %alues o# a &olumn 1 S!L!9. !;((SU<(LN(col2))) G,F< srinu;
,nde=

)V. 2uery to display only t e dupli&ate re&ords in a table1 S!L!9. num G,F< satyam /,FU( +Y num I"'#N/ 9FUN.(M) J 2;

216
,nde=

)VI. 2uery #or $ettin$ t e #ollo+in$ output as many number o# ro+s in t e table 1 M MM MMM MMMM MMMMM S!L!9. ,("D(D!9FD!(temp$temp$NMN)$,FHNU<$NMN) G,F< srinu2;
,nde=

)VII. .un&tion #or $ettin$ t e Balan&e Value 1 GUN9.#FN G-+"L"N9!-'"LU! (p-business-group-id number$ p-payroll-action-id number$ p-balance-name *arc&ar1$ p-dimension-name *arc&ar1) ,!.U,N NU<+!, #S l-bal number; l-defined-bal-id number; l-assignment-action-id number; +!/#N S!L!9. assignment-action-id #N.F l-assignment-action-id G,F< pay-assignment-actions HI!,! assignment-id D Cp-assignment-id "ND payroll-action-id D p-payroll-action-id; S!L!9. defined-balance-id #N.F l-defined-bal-id G,F< pay-balance-types pbt$ pay-defined-balances pdb$ pay-balance-dimensions pbd HI!,! pbt8business-group-id D p-business-group-id "ND U((!,(pbt8balance-name) D U((!,(p-balance-name)

217 "ND "ND "ND "ND pbt8business-group-id D pdb8business-group-id pbt8balance-type-id D pdb8balance-type-id U((!,(pbd8dimension-name) D U((!,(p-dimension-name) pdb8balance-dimension-id D pbd8balance-dimension-id;

l-bal CD pay-balance-pLg8get-*alue(l-defined-bal-id$l-assignment-action-id); ,!.U,N (l-bal); e:ception HI!N no-data-found .I!N ,!.U,N ?; !ND;
,nde=

)VIII. .un&tion #or $ettin$ t e (lement Value 1 GUN9.#FN f-element-*alue( p-classification-name in *arc&ar1$ p-element-name in *arc&ar1$ p-business-group-id in number$ p-input-*alue-name in *arc&ar1$ p-payroll-action-id in number$ p-assignment-id in number ) ,!.U,N number #S l-element-*alue number(23$1) default ?; l-input-*alue-id pay-input-*alues-f8input-*alue-idOtype; l-element-type-id pay-element-types-f8element-type-idOtype; +!/#N S!L!9. D#S.#N9. element-type-id #N.F l-element-type-id G,F< pay-element-types-f pet$ pay-element-classifications pec HI!,! pet8classification-id D pec8classification-id "ND upper(classification-name) D upper(p-classification-name) "ND upper(element-name) D upper(p-element-name) "ND pet8business-group-id D p-business-group-id; S!L!9. input-*alue-id #N.F l-input-*alue-id G,F< pay-input-*alues-f

218 HI!,! upper(name) D upper(p-input-*alue-name) "ND element-type-id D l-element-type-id; S!L!9. N'L(prr*8result-*alue$?) #N.F l-element-*alue G,F< pay-run-result-*alues prr*$ pay-run-results prr$ pay-assignment-actions paa HI!,! prr*8run-result-id D prr8run-result-id "ND prr8assignment-"9.#FN-#D D paa8assignment-action-id "ND paa8assignment-id D p-assignment-id "ND input-*alue-id D l-input-*alue-id "ND paa8payroll-action-id D p-payroll-action-id; ,!.U,N (l-element-*alue); e:ception HI!N no-data-found .I!N ,!.U,N ?; !ND;
,nde=

)I). 9(B(CT 2uery #or &ountin$ No o# +ords 1 S!L!9. ename$ N'L(L!N/.I(,!(L"9!(.,"NSL".!(U((!,(,.,#<(ename))$N"+9D!G/I# >@L<NF(Q,S.U'H;YPNN N$N QN)$N N$NN))R2$2) %ord-lengt& G,F< emp; (xplanation C .,"NSL".!(U((!,(,.,#<(ename))$N"+9D!G/I#>@L<NF(Q,S.U'H;YP NN N$N QN) 00 .&is %ill translate all t&e c&aracters G,F< AD including a sin$le quote to a spa&e8 #t %ill also translate a spa&e to a E8 ,!(L"9!(.,"NSL".!(U((!,(,.,#<(ename))$N"+9D!G/I#>@L<NF(Q,S .U'H;YPNN N$N QN)$N N$NN) 00 .&is %ill replace e%ery spa&e %it& not in$ in t&e abo*e result8 L!N/.I(,!(L"9!(.,"NSL".!(U((!,(,.,#<(ename))$N"+9D!G/I#>@L< NF(Q,S.U'H;YPNN N$N QN)$N N$NN))R2 00 .&is %ill gi*e u t&e count of E c&aracters in t&e abo*e result8
,nde=

219

)). .un&tion to & e&F #or a leap year 1 9,!".! F, ,!(L"9! GUN9.#FN is-leap-year (p-date #N D".!) ,!.U,N '",9I",1 "S *-test D".!; +!/#N *-test CD .F-D".! (N1A0Geb0N SS .F-9I", (p-date$NYYYYN)$NDD0 <on0YYYYN); ,!.U,N NYN; !;9!(.#FN HI!N F.I!,S .I!N ,!.U,N NNN; !ND is-leap-year; SQLJ S!L!9. &iredate$ .F-9I", (&iredate$ NDayN) %eeLday G,F< emp HI!,! is-leap-year (&iredate) D NYN;
,nde=

))I. 2uery #or remo%in$ all non-numeri& 1 S!L!9. .,"NSL".!(LFH!,(ssn)$Nabcdefg&iELlmnop=rstu*%:y 0 N$NN) G,F< DU"L;
,nde=

))II. 2uery #or translatin$ a &olumn %alues to INITCAG 1 S!L!9. .,"NSL".!(#N#.9"((temp)$ SU+S.,(temp$ #NS.,(temp$NNNN)R2$2)$ LFH!,(SU+S.,(temp$ #NS.,(temp$NNNN)R2))) G,F< srinu2;
,nde=

))III. .un&tion #or displayin$ Rupees in Hords 1 9,!".! F, ,!(L"9! GUN9.#FN to-%ord-i (amount #N NU<+!,) ,!.U,N '",9I",1 "S

22, *-lengt& #N.!/!, CD ?; *-num1 '",9I",1 (B?) CD NULL; *-amount '",9I",1 (B?) CD .F-9I", (.,UN9 (amount)); *-%ord '",9I",1 (3???) CD NULL; *-%ord2 '",9I",1 (3???) CD NULL; .Y(! myarray #S ."+L! FG '",9I",1 (1BB); *-str myarray CD myarray (N .&ousand N$ N LaL& N$ N 9rore N); +!/#N #G ((amount D ?) F, (amount #S NULL)) .I!N *-%ord CD N eroN; !LS#G (.F-9I", (amount) L#@! NO8ON) .I!N #G (SU+S., (amount$ #NS., (amount$ N8N) R 2) J ?) .I!N *-num1 CD SU+S., (amount$ #NS., (amount$ N8N) R 2); #G (L!N/.I (*-num1) K 1) .I!N *-num1 CD *-num1 M 2?; !ND #G; *-%ord2 CD N "ND N SS (.F-9I", (.F-D".! (SU+S., (*-num1$ L!N/.I (*-num1) 0 2$1)$ N>N)$ N>S(N ))SS N paise N; *-amount CD SU+S.,(amount$2$#NS., (amount$ N8N)02); *-%ord CD .F-9I", (.F-D".! (SU+S., (*-amount$ L!N/.I (*-amount) 0 1$6)$ N>N)$ N>spN ) SS *-%ord; *-amount CD SU+S., (*-amount$ 2$ L!N/.I (*-amount) 0 6); GF, i in 2 88 *-str89FUN. LFF( !;#. HI!N (*-amount #S NULL); *-%ord CD .F-9I", (.F-D".! (SU+S., (*-amount$ L!N/.I (*-amount) 0 2$1)$ N>N)$ N>spN ) SS *-str (i) SS *-%ord; *-amount CD SU+S., (*-amount$ 2$ L!N/.I (*-amount) 0 1); !ND LFF(; !ND #G; !LS! *-%ord CD .F-9I", ( .F-D".! ( .F-9I", ( amount$ NAAAAAAAAAN) $ N>N)$ N>S(N); !ND #G; *-%ord CD *-%ord SS N N SS *-%ord2 SS N only N; *-%ord CD ,!(L"9! (,.,#< (*-%ord)$ N N$ N N); *-%ord CD ,!(L"9! (,.,#< (*-%ord)$ N0N$ N N); ,!.U,N #N#.9"( (*-%ord); !ND to-%ord-i;

221
,nde=

))IV. 2uery #or deletin$ alternate e%en ro+s .R/0 a table 1 D!L!.! G,F< srinu HI!,! (,FH#D$?) #N (S!L!9. ,FH#D$ <FD(,FHNU<$1) G,F< srinu);
,nde=

))V. 2uery #or deletin$ alternate odd ro+s .R/0 a table 1 D!L!.! G,F< srinu HI!,! (,FH#D$2) #N (S!L!9. ,FH#D$ <FD(,FHNU<$1) G,F< srinu);
,nde=

))VI. Gro&edure #or sendin$ (mail 1 9,!".! F, ,!(L"9! (,F9!DU,! Send-<ail #S sender '",9I",1(B?) CD NsenderQsomet&ing8comN; recipient '",9I",1(B?) CD NrecipientQsomet&ing8comN; subEect '",9I",1(2??) CD N.est <essageN; message '",9I",1(2???) CD N.&is is a sample mail 8888N; l*-mail&ost '",9I",1(6?) CD NIF.N.??1N; l-mail-conn utl-smtp8connection; l*-crlf '",9I",1(1)CD 9I,( 26 ) SS 9I,( 2? ); +!/#N l-mail-conn CD utl-smtp8open-connection (l*-mail&ost$ 5?); utl-smtp8&elo ( l-mail-conn$ l*-mail&ost); utl-smtp8mail ( l-mail-conn$ sender); utl-smtp8rcpt ( l-mail-conn$ recipient); utl-smtp8open-data (l-mail-conn); utl-smtp8%rite-data ( l-mail-conn$ NG,F<C N SS sender SS l*-crlf); utl-smtp8%rite-data ( l-mail-conn$ N.oC N SS recipient SS l*-crlf); utl-smtp8%rite-data ( l-mail-conn$ NSubEectCN SS subEect SS l*-crlf); utl-smtp8%rite-data ( l-mail-conn$ l*-crlf SS message); utl-smtp8close-data(l-mail-conn); utl-smtp8=uit(l-mail-conn); !;9!(.#FN HI!N F.I!,S .I!N D+<S-FU.(U.8(U.-L#N!(N!rrorN);

222 !ND; )
,nde=

))VII. Alternate 2uery #or '(C/'( #un&tion 1 S!L!9. case HI!N se: D NmN .I!N NmaleN HI!N se: D NfN .I!N NfemaleN !LS! NunLno%nN !ND G,F< mytable;
,nde=

))VIII. Create table addin$ Constraint to a date #ield to 9Y9'AT( or 7 mont s later1 9,!".! ."+L! srinu(dt2 date D!G"UL. SYSD".!$ dt1 date$ 9FNS.,"#N. c&ecL-dt1 9I!9@ ((dt1 JD dt2) "ND (dt1 KD "DD-<FN.IS(SYSD".!$6)));
,nde=

))I). 2uery to list all t e suppliers + o supply all t e parts supplied by supplier I9-I 1 S!L!9. D#S.#N9. a8SU(( G,F< F,D!,S a HI!,! a8supp TD NS1N "ND a8parts #N (S!L!9. D#S.#N9. (",.S G,F< F,D!,S HI!,! supp D NS1N) /,FU( +Y a8SU(( I"'#N/ 9FUN.(D#S.#N9. a8(",.S) JD (S!L!9. 9FUN.(D#S.#N9. (",.S) G,F< F,D!,S HI!,! supp D NS1N); .able C orders SU(( (",.S 00000000000000000000 0000000 S2 (2 S2 (1 S2 (6 S2 (3 S2 (B

223 S2 S1 S1 S6 S3 S3 S3
,nde=

(7 (2 (1 (1 (1 (3 (B

))). 2uery to $et t e last 9unday o# any mont

S!L!9. N!;.-D"Y(L"S.-D"Y(.F-D".!(N1702?01??2N$NDD0<<0YYYYN)) 0 4$NsundayN) G,F< DU"L;


,nde=

)))I. 2uery to $et all t ose + o table data C id name parent-id 0000000000000000000000000000000 2 a NULL 0 t&e top le*el entry 1 b 2 0 a c&ild of 2 6 c 2 3 d 1 0 a c&ild of 1 B e 1 7 f 6 4 g 6 5 & 3 A i 5 2? E A S!L!9. #D G,F< <Y-."+l! HI!,! (",!N.-#D #S NF. NULL <#NUS S!L!9. (",!N.-#D G,F< <Y-."+l!;
,nde=

a%e no & ildren t emsel%es 1

)))II. 2uery to 9(B(CT last N ro+s .R/0 a table 1 S!L!9. empno G,F< emp HI!,! ,FH#D in (S!L!9. ,FH#D G,F< emp

224 <#NUS S!L!9. ,FH#D G,F< emp HI!,! ,FHNU< KD (S!L!9. 9FUN.(M)0B G,F< emp));
,nde=

)))III. 9(B(CT +it

%ariables1

9,!".! F, ,!(L"9! (,F9!DU,! disp "S :.ableName *arc&ar1(1B)CDNempN; :GieldName *arc&ar1(1B)CDNenameN; :'alue NU<+!,; :Query *arc&ar1(2??); name *arc&ar1(2?) CD N9L",@N; +!/#N :Query CD NS!L!9. S"L G,F< N SS :.ableName SS N HI!,! N SS :GieldName SS N D NNN SS name SS NNNN; D+<S-FU.(U.8(U.-L#N!(:Query); !;!9U.! #<<!D#".! :Query #N.F :'alue; D+<S-FU.(U.8(U.-L#N!(:'alue); !ND;
,nde=

)))IV. 2uery to $et t e 'B Name1 S!L!9. name G,F< *Udatabase;


,nde=

)))V. 8ettin$ t e &urrent de#ault s& ema 1 S!L!9. SYS-9FN.!;.(NUS!,!N'N$N9U,,!N.-S9I!<"N) G,F< DU"L;
,nde=

)))VI. 2uery to $et all t e &olumn names o# a parti&ular table 1 S!L!9. column-name G,F< all-tab-columns HI!,! ."+L!-N"<! D NF,D!,SN;

225
,nde=

)))VII. =o+ do I spool only t e query result to a #ile in 92BGB:9 1 (lace t&e follo%ing lines of code in a file and e:ecute t&e file in SQL(LUS C set &eading off set feedbacL off set colsep N N set termout off set *erify off spool cCVsrini8t:t S!L!9. empno$ename G,F< emp; )M Hrite your Query &ere M) spool off )
,nde=

)))VIII. 2uery #or $ettin$ t e &urrent 9essionI' 1 S!L!9. SYS-9FN.!;.(NUS!,!N'N$NS!SS#FN#DN) Session-#D G,F< DU"L;
,nde=

)))I). 2uery to display ro+s .R/0 m to n 1 To display ro+s 5 to J 1 S!L!9. D!(.NF$ !N"<!$ S"L G,F< !<( HI!,! ,FH#D #N (S!L!9. ,FH#D G,F< !<( HI!,! ,FHNU< KD 4 <#NUS S!L!9. ,FH#D G,F< !<( HI!,! ,FHNU< K B); /R S!L!9. ename G,F< emp /,FU( +Y ,FHNU<$ ename I"'#N/ ,FHNU< J 2 and ,FHNU< K 6;
,nde=

226

)))). 2uery to &ount no. /# &olumns in a table1 S!L!9. 9FUN.(column-name) G,F< user-tab-columns HI!,! table-name D N<Y."+L!N;
,nde=

))))I. Gro&edure to in&rease t e bu##er len$t

dbmsCoutput.enable*<666;K )Mallo%s t&e output buffer to be increased to t&e specified number of bytes M) D!9L",! +!/#N dbmsCoutput.enable*<666;K GF, i #N 2883?? LFF( D+<S-FU.(U.8(U.-L#N!(i); !ND LFF(; !ND; )
,nde=

))))II. Insertin$ an L symbol in a Var& ar- &olumn 1 Set t&e follo%ing to some ot&er c&aracter8 +y default it is W8 set define NXN
,nde=

))))III. Create 2uery to restri&t t e user to a sin$le ro+ 1


,nde=

))))IV. 2uery to $et t e #irst inserted re&ord .R/0 a table 1


,nde=

))))V. =o+ to &on&atenate a &olumn %alue +it ro+s 1


,nde=

multiple

227

))))VI. 2uery to delete all t e tables at on&e 1


,nde=

))))VII. 92B 2uery #or $ettin$ /rp an Re&ords 1


,nde=

))))VIII. =o+ do you remo%e Trailin( "lan-s in a spooled ile * C an$e t e (n%ironment /ptions BiFe t is 1 set trimspool on set trimout on
,nde=

))))I). 9amples #or exe&utin$ 'ynami& 92B 9tatements 1 9ample 13 9,!".! F, ,!(L"9! (,F9!DU,! 9N.((-."+L!-N"<! #N '",9I",1) "S S=lString '",9I",1(1??); tot number; +!/#N S=lStringCDNS!L!9. 9FUN.(M) G,F< NSS (-."+L!-N"<!; !;!9U.! #<<!D#".! S=lString #N.F tot; D+<S-FU.(U.8(U.-L#N!(N.otal No8Ff ,ecords #n N SS (-."+L!-N"<! SS N ",!DN SS tot); !ND; 9ample 1D!9L",! s=l-stmt '",9I",1(1??); pls=l-blocL '",9I",1(B??); emp-id NU<+!,(3) CD 4B77; salary NU<+!,(4$1); dept-id NU<+!,(1) CD B?; dept-name '",9I",1(23) CD Y(!,SFNN!LY; location '",9I",1(26) CD YD"LL"SY; emp-rec empO,FH.Y(!; +!/#N !;!9U.! #<<!D#".! N9,!".! ."+L! bonus (id NU<+!,$ amt NU<+!,)N; s=l-stmt CD N#NS!,. #N.F dept '"LU!S (C2$ C1$ C6)N; !;!9U.! #<<!D#".! s=l-stmt US#N/ dept-id$ dept-name$ location;

228

s=l-stmt CD NS!L!9. M G,F< emp HI!,! empno D CidN; !;!9U.! #<<!D#".! s=l-stmt #N.F emp-rec US#N/ emp-id; pls=l-blocL CD N+!/#N emp-pLg8raise-salary(Cid$ Camt); !ND;N; !;!9U.! #<<!D#".! pls=l-blocL US#N/ 4455$ B??; s=l-stmt CD NU(D".! emp S!. sal D 1??? HI!,! empno D C2 ,!.U,N#N/ sal #N.F C1N; !;!9U.! #<<!D#".! s=l-stmt US#N/ emp-id ,!.U,N#N/ #N.F salary; !;!9U.! #<<!D#".! ND!L!.! G,F< dept HI!,! deptno D CnumN US#N/ dept-id; !;!9U.! #<<!D#".! Y"L.!, S!SS#FN S!. SQL-.,"9! .,U!Y; !ND; 9ample 7 9,!".! F, ,!(L"9! (,F9!DU,! D!(",.<!N.S(NF #N D!(.8D!(.NF O.Y(!) "S *-cursor integer; *-dname c&ar(1?); *-ro%s integer; +!/#N *-cursor CD D+<S-SQL8F(!N-9U,SF,; D+<S-SQL8(",S!(*-cursor$ Nselect dname from dept %&ere deptno J C:N$ D+<S-SQL8'4); D+<S-SQL8+#ND-'",#"+L!(*-cursor$ NC:N$ no); D+<S-SQL8D!G#N!-9FLU<N-9I",(*-cursor$ 2$ *-dname$ 1?); *-ro%s CD D+<S-SQL8!;!9U.!(*-cursor); LFF( #G D+<S-SQL8G!.9I-,FHS(*-cursor) D ? .I!N !;#.; !ND #G; D+<S-SQL89FLU<N-'"LU!-9I",(*-cursor$ 2$ *-dname); D+<S-FU.(U.8(U.-L#N!(NDeptartment nameC NSS*-dname); !ND LFF(; D+<S-SQL89LFS!-9U,SF,(*-cursor); !;9!(.#FN HI!N F.I!,S .I!N D+<S-SQL89LFS!-9U,SF,(*-cursor); raise-application-error(01????$ NUnLno%n !:ception ,aisedC NSSs=lcodeSSN NSSs=lerrm); !ND;

229

,nde=

))))). 'i##eren&es bet+een 92B and 09-A&&ess 1 'i##eren&e 31 Fracle C select name from table2 %&ere name liLe NLON; "ccessC select name from table2 %&ere name liLe NLMN; 'i##eren&e -1 "ccessC S!L!9. .F( 1 name G,F< .able2; Fracle C %ill not %orL t&ere is no suc& .F( Ley %ord8
,nde=

)))))I. 2uery to display all t e & ildren" sub & ildren o# a parent 1 S!L!9. organi ation-id$name G,F< &r-all-organi ation-units HI!,! organi ation-id in ( S!L!9. F,/"N#P".#FN-#D-9I#LD G,F< (!,-F,/-S.,U9.U,!-!L!<!N.S 9FNN!9. +Y (,#F, F,/"N#P".#FN-#D-9I#LD D F,/"N#P".#FN-#D-(",!N. S.",. H#.I F,/"N#P".#FN-#D-9I#LD D (S!L!9. organi ation-id G,F< &r-all-organi ation-units HI!,! name D N!+/ 9orporate /roupN));
,nde=

)))))II. Gro&edure to read>+rite data #rom a text #ile 1 9,!".! F, ,!(L"9! (,F9!DU,! read-data "S c-pat& *arc&ar1(2??) CD N)usr)tmpN; c-file-name *arc&ar1(1?) CD N!@/S!(?289S'N; *-file-id utl-file8file-type; *-buffer *arc&ar1(2?11) CD .&is is a sample te:tY; +!/#N *-file-id CD U.L-G#L!8GF(!N(c-pat&$c-file-name$N%N); U.L-G#L!8(U.-L#N!(*-file-id$ *-buffer); U.L-G#L!8G9LFS!(*-file-id); *-file-id CD U.L-G#L!8GF(!N(c-pat&$c-file-name$NrN); U.L-G#L!8/!.-L#N!(*-file-id$ *-buffer);

23, D+<S-FU.(U.8(U.-L#N!(*-buffer); U.L-G#L!8G9LFS!(*-file-id); !ND; )


,nde=

)))))III. 2uery to display random number bet+een any t+o $i%en numbers 1 S!L!9. D+<S-,"NDF<8'"LU! (2$1) G,F< DU"L;
,nde=

)))))IV. =o+ &an I $et t e time di##eren&e bet+een t+o date &olumns 1 S!L!9. GLFF,((date20date1)M13M7?M7?))67??) SS N IFU,S N SS GLFF,((((date20date1)M13M7?M7?) 0 GLFF,(((date20date1)M13M7?M7?))67??)M67??))7?) SS N <#NU.!S N SS ,FUND((((date20date1)M13M7?M7?) 0 GLFF,(((date20date1)M13M7?M7?))67??)M67?? 0 (GLFF,((((date20date1)M13M7?M7?) 0 GLFF,(((date20date1)M13M7?M7?))67??)M67??))7?)M7?))) SS N S!9S N time-difference G,F< my-table;

SQL <!Which is the subset of 7 * co%%ands used to %ani#ulate +racle Database structures3 includin& tables? Data De#inition Language ,DDL-! What o#erator #erfor%s #attern %atchin&? L.A) o!erator .! What o#erator tests colu%n for the absence of data? .S 18LL o!erator 2! Which co%%and e6ecutes the contents of a s#ecified file? START F#ilenameG or XF#ilenameG

231
/! What is the #ara%eter substitution s'%bol used with IN7ERT INT+ co%%and? V G! Which co%%and dis#la's the 7 * co%%and in the 7 * buffer3 and then e6ecutes it? R81 A! What are the wildcards used for #attern %atchin&? 7 #or single character substitution and P #or multi$character substitution 1! 7tate true or false! EXI7T73 7+ME3 ANC are o#erators in 7 *! True 0! 7tate true or false! QI3 RS3 TI all denote the sa%e o#eration! True <5! What are the #ri(ile&es that can be &ranted on a table b' a user to others? .nsert& u!date& delete& select& re#erences& inde'& e'ecute& alter& all <<! What co%%and is used to &et bac@ the #ri(ile&es offered b' the BRANT co%%and? R)=OA) <-! Which s'ste% tables contain infor%ation on #ri(ile&es &ranted and #ri(ile&es obtained? 8S)R7TAB7PR.=S74AD)& 8S)R7TAB7PR.=S7R)*D

<.! Which s'ste% table contains infor%ation on constraints on all the tables created? 8S)R7*O1STRA.1TS <2! TRUNCATE TA)*E EM:; DE*ETE 9R+M EM:; Will the out#uts of the abo(e two co%%ands differ? Both %ill result in deleting all the ro%s in the table )4P </! What is the difference between TRUNCATE and DE*ETE co%%ands? TR81*AT) is a DDL command %hereas D)L)T) is a D4L command Cence D)L)T) o!eration can be rolled back& but TR81*AT) o!eration cannot be rolled back WC)R) clause can be used %ith D)L)T) and not %ith TR81*AT) <G! What co%%and is used to create a table b' co#'in& the structure of another table? Ans%er / *R)AT) TABL) AS S)L)*T command )'!lanation / To co!y only the structure& the WC)R) clause o# the S)L)*T command should contain a (ALS) statement as in the #ollo%ing *R)AT) TABL) 1)WTABL) AS S)L)*T 3 (RO4 )R.ST.10TABL) WC)R) 2?5+

232
.# the WC)R) condition is true& then all the ro%s or ro%s satis#ying the condition %ill be co!ied to the ne% table <A! What will be the out#ut of the followin& =uer'? S)L)*T R)PLA*),TRA1SLAT),LTR.4,RTR.4,9UU ATC)1 UU9&9U9-& 9U9-& 9A19& 9339-&939&9TRO8BL)9- (RO4 D8AL+ TRO8BL)TC)TRO8BL) <1! What will be the out#ut of the followin& =uer'? S)L)*T D)*OD),TRA1SLAT),9A9&9256M:IL<;D9&922222222229-& 929&9@)S9& 91O9 -+ Ans%er / 1O )'!lanation / The Buery checks %hether a gi"en string is a numerical digit <0! What does the followin& =uer' do? S)L)*T SAL O 1=L,*O44&D- (RO4 )4P+ This dis!lays the total salary o# all em!loyees The null "alues in the commission column %ill be re!laced by D and added to salary -5! Which date function is used to find the difference between two dates? 4O1TCS7B)TW))1 -<! Wh' does the followin& co%%and &i(e a co%#ilation error? DROP TABL) VTABL)71A4)+ =ariable names should start %ith an al!habet Cere the table name starts %ith an 9V9 symbol

--! What is the ad(anta&e of s#ecif'in& WIT$ BRANT +:TI+N in the BRANT co%%and? The !ri"ilege recei"er can #urther grant the !ri"ileges he/she has obtained #rom the o%ner to any other user -.! What is the use of the DR+: o#tion in the A*TER TA)*E co%%and? .t is used to dro! constraints s!eci#ied on the table -2! What is the (alue of Jco%%L and JsalL after e6ecutin& the followin& =uer' if the initial (alue of JsalL is <5555? 8PDAT) )4P S)T SAL ? SAL O 2DDD& *O44 ? SAL3D 2+ sal ? 22DDD& comm ? 2DDD -/! What is the use of DE7C in 7 *? Ans%er / D)S* has t%o !ur!oses .t is used to describe a schema as %ell as to retrie"e ro%s #rom table in descending order )'!lanation / The Buery S)L)*T 3 (RO4 )4P ORD)R B@ )1A4) D)S* %ill dis!lay the out!ut sorted on )1A4) in descending order -G! What is the use of CA7CADE C+N7TRAINT7?

233
When this clause is used %ith the DROP command& a !arent table can be dro!!ed e"en %hen a child table e'ists -A! Which function is used to find the lar&est inte&er less than or e=ual to a s#ecific (alue? (LOOR -1! What is the out#ut of the followin& =uer'? S)L)*T TR81*,256M :IL<&$5- (RO4 D8AL+ 25DD 7 *? UERIE7

. S*C)4AS Table 2 / ST8D.)S P1A4) ,=AR*CAR-& SPLA*) ,=AR*CAR-& *O8RS) ,=AR*CAR-& **OST ,184B)RTable 5 / SO(TWAR) P1A4) ,=AR*CAR-& T.TL) ,=AR*CAR-& D)=.1 ,=AR*CAR-& S*OST ,184B)R-& D*OST ,184B)R-& SOLD ,184B)RTable 6 / PRO0RA44)R P1A4) ,=AR*CAR-& DOB ,DAT)-& DOH ,DAT)-& S)R ,*CAR-& PRO(2 ,=AR*CAR-& PRO(5 ,=AR*CAR-& SAL ,184B)RL)0)1D / P1A4) W Programmer 1ame& SPLA*) W Study Place& **OST W *ourse *ost& D)=.1 W De"elo!ed in& S*OST W So#t%are *ost& D*OST W De"elo!ment *ost& PRO(2 W Pro#iciency 2 UERIE7 H 2 5 6 M : I L < (ind out the selling cost a"erage #or !ackages de"elo!ed in Oracle Dis!lay the names& ages and e'!erience o# all !rogrammers Dis!lay the names o# those %ho ha"e done the P0D*A course What is the highest number o# co!ies sold by a !ackageE Dis!lay the names and date o# birth o# all !rogrammers born in A!ril Dis!lay the lo%est course #ee Co% many !rogrammers ha"e done the D*A course Co% much re"enue has been earned through the sale o# !ackages de"elo!ed in *

; Dis!lay the details o# so#t%are de"elo!ed by Rakesh 2D Co% many !rogrammers studied at Penta#our 22 Dis!lay the details o# !ackages %hose sales crossed the :DDD mark 25 (ind out the number o# co!ies %hich should be sold in order to reco"er the de"elo!ment cost o# each !ackage 26 Dis!lay the details o# !ackages #or %hich the de"elo!ment cost has been reco"ered

234
2M What is the !rice o# costliest so#t%are de"elo!ed in =BE 2: Co% many !ackages %ere de"elo!ed in Oracle E 2I Co% many !rogrammers studied at PRA0ATC.E 2L Co% many !rogrammers !aid 2DDDD to 2:DDD #or the courseE 2< What is the a"erage course #eeE 2; Dis!lay the details o# !rogrammers kno%ing * 5D Co% many !rogrammers kno% either * or PascalE 52 Co% many !rogrammers donNt kno% * and *OOE 55 Co% old is the oldest male !rogrammerE 56 What is the a"erage age o# #emale !rogrammersE 5M *alculate the e'!erience in years #or each !rogrammer and dis!lay along %ith their names in descending order 5: Who are the !rogrammers %ho celebrate their birthdays during the current monthE 5I 5L 5< 5; 6D 62 65 Co% many #emale !rogrammers are thereE What are the languages kno%n by the male !rogrammersE What is the a"erage salaryE Co% many !eo!le dra% :DDD to L:DDE Dis!lay the details o# those %ho donNt kno% *& *OO or Pascal Dis!lay the costliest !ackage de"elo!ed by each !rogrammer Produce the #ollo%ing out!ut #or all the male !rogrammers

KEC7H 2 S)L)*T A=0,S*OST- (RO4 SO(TWAR) WC)R) D)=.1 ? 9ORA*L)9+ 5 S)L)*T P1A4)&TR81*,4O1TCS7B)TW))1,S@SDAT)&DOB-/25- JA0)J& TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- J)RP)R.)1*)J (RO4 PRO0RA44)R+ 6 S)L)*T P1A4) (RO4 ST8D.)S WC)R) *O8RS) ? 9P0D*A9+ M S)L)*T 4AR,SOLD- (RO4 SO(TWAR)+ : S)L)*T P1A4)& DOB (RO4 PRO0RA44)R WC)R) DOB L.A) 9PAPRP9+ I S)L)*T 4.1,**OST- (RO4 ST8D.)S+ L S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) *O8RS) ? 9D*A9+ < S)L)*T S84,S*OST3SOLD$D*OST- (RO4 SO(TWAR) 0RO8P B@ D)=.1 CA=.10 D)=.1 ? 9*9+ ; S)L)*T 3 (RO4 SO(TWAR) WC)R) P1A4) ? 9RAA)SC9+ 2D S)L)*T 3 (RO4 ST8D.)S WC)R) SPLA*) ? 9P)1TA(O8R9+ 22 S)L)*T 3 (RO4 SO(TWAR) WC)R) S*OST3SOLD$D*OST G :DDD+ 25 S)L)*T *).L,D*OST/S*OST- (RO4 SO(TWAR)+ 26 S)L)*T 3 (RO4 SO(TWAR) WC)R) S*OST3SOLD G? D*OST+ 2M S)L)*T 4AR,S*OST- (RO4 SO(TWAR) 0RO8P B@ D)=.1 CA=.10 D)=.1 ? 9=B9+ 2: S)L)*T *O81T,3- (RO4 SO(TWAR) WC)R) D)=.1 ? 9ORA*L)9+ 2I S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) SPLA*) ? 9PRA0ATC.9+ 2L S)L)*T *O81T,3- (RO4 ST8D.)S WC)R) **OST B)TW))1 2DDDD A1D 2:DDD+ 2< S)L)*T A=0,**OST- (RO4 ST8D.)S+ 2; S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 ? 9*9 OR PRO(5 ? 9*9+ 5D S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 .1 ,9*9&9PAS*AL9- OR PRO(5 .1 ,9*9&9PAS*AL9-+ 52 S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 1OT .1 ,9*9&9*OO9- A1D PRO(5 1OT .1 ,9*9&9*OO9-+

235
55 S)L)*T TR81*,4AR,4O1TCS7B)TW))1,S@SDAT)&DOB-/25-- (RO4 PRO0RA44)R WC)R) S)R ? 949+ 56 S)L)*T TR81*,A=0,4O1TCS7B)TW))1,S@SDAT)&DOB-/25-- (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ 5M S)L)*T P1A4)& TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- (RO4 PRO0RA44)R ORD)R B@ P1A4) D)S*+ 5: S)L)*T P1A4) (RO4 PRO0RA44)R WC)R) TO7*CAR,DOB&94O19- ? TO7*CAR,S@SDAT)&94O19-+ 5I S)L)*T *O81T,3- (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ 5L S)L)*T D.ST.1*T,PRO(2- (RO4 PRO0RA44)R WC)R) S)R ? 949+ 5< S)L)*T A=0,SAL- (RO4 PRO0RA44)R+ 5; S)L)*T *O81T,3- (RO4 PRO0RA44)R WC)R) SAL B)TW))1 :DDD A1D L:DD+ 6D S)L)*T 3 (RO4 PRO0RA44)R WC)R) PRO(2 1OT .1 ,9*9&9*OO9&9PAS*AL9- A1D PRO(5 1OT .1 ,9*9&9*OO9&9PAS*AL9-+ 62 S)L)*T P1A4)&T.TL)&S*OST (RO4 SO(TWAR) WC)R) S*OST .1 ,S)L)*T 4AR,S*OST- (RO4 SO(TWAR) 0RO8P B@ P1A4)-+ 65 S)L)*T 94r 9 KK P1A4) KK 9 $ has 9 KK TR81*,4O1TCS7B)TW))1,S@SDAT)&DOH-/25- KK 9 years o# e'!erience9 YProgrammerZ (RO4 PRO0RA44)R WC)R) S)R ? 949 81.O1 S)L)*T 94s 9 KK P1A4) KK 9 $ has 9 KK TR81* ,4O1TCS7B)TW))1 ,S@SDAT)&DOH-/25- KK 9 years o# e'!erience9 YProgrammerZ (RO4 PRO0RA44)R WC)R) S)R ? 9(9+ .. S*C)4A / Table 2 / D)PT D)PT1O ,1OT 18LL & 184B)R,5--& D1A4) ,=AR*CAR5,2M--& LO* ,=AR*CAR5,26Table 5 / )4P )4P1O ,1OT 18LL & 184B)R,M--& )1A4) ,=AR*CAR5,2D--& HOB ,=AR*CAR5,;--& 40R ,184B)R,M--& C.R)DAT) ,DAT)-& SAL ,184B)R,L&5--& *O44 ,184B)R,L&5--& D)PT1O ,184B)R,5-40R is the em!no o# the em!loyee %hom the em!loyee re!orts to D)PT1O is a #oreign key UERIE7 2 List all the em!loyees %ho ha"e at least one !erson re!orting to them 5 List the em!loyee details i# and only i# more than 2D em!loyees are !resent in de!artment no 2D 6 List the name o# the em!loyees %ith their immediate higher authority M List all the em!loyees %ho do not manage any one : List the em!loyee details %hose salary is greater than the lo%est salary o# an em!loyee belonging to de!tno 5D I List the details o# the em!loyee earning more than the highest !aid manager L List the highest salary !aid #or each >ob < (ind the most recently hired em!loyee in each de!artment ; .n %hich year did most !eo!le >oin the com!anyE Dis!lay the year and the number o# em!loyees 2D Which de!artment has the highest annual remuneration billE 22 Write a Buery to dis!lay a [3N against the ro% o# the most recently hired em!loyee

236
25 Write a correlated sub$Buery to list out the em!loyees %ho earn more than the a"erage salary o# their de!artment 26 (ind the nth ma'imum salary 2M Select the du!licate records ,Records& %hich are inserted& that already e'ist- in the )4P table 2: Write a Buery to list the length o# ser"ice o# the em!loyees ,o# the #orm n years and m monthsKEC7H 2 S)L)*T D.ST.1*T,A )1A4)- (RO4 )4P A& )4P B WC)R) A )4P1O ? B 40R+ or S)L)*T )1A4) (RO4 )4P WC)R) )4P1O .1 ,S)L)*T 40R (RO4 )4P-+ 5 S)L)*T 3 (RO4 )4P WC)R) D)PT1O .1 ,S)L)*T D)PT1O (RO4 )4P 0RO8P B@ D)PT1O CA=.10 *O81T,)4P1O-G2D A1D D)PT1O?2D-+ 6 S)L)*T A )1A4) J)4PLO@))J& B )1A4) JR)PORTS TOJ (RO4 )4P A& )4P B WC)R) A 40R?B )4P1O+ M S)L)*T 3 (RO4 )4P WC)R) )4P1O .1 , S)L)*T )4P1O (RO4 )4P 4.18S S)L)*T 40R (RO4 )4P-+ : S)L)*T 3 (RO4 )4P WC)R) SAL G , S)L)*T 4.1,SAL- (RO4 )4P 0RO8P B@ D)PT1O CA=.10 D)PT1O?5D-+ I S)L)*T 3 (RO4 )4P WC)R) SAL G , S)L)*T 4AR,SAL- (RO4 )4P 0RO8P B@ HOB CA=.10 HOB ? 94A1A0)R9 -+ L S)L)*T HOB& 4AR,SAL- (RO4 )4P 0RO8P B@ HOB+ < S)L)*T 3 (RO4 )4P WC)R) ,D)PT1O& C.R)DAT)- .1 ,S)L)*T D)PT1O& 4AR,C.R)DAT)- (RO4 )4P 0RO8P B@ D)PT1O-+ ; S)L)*T TO7*CAR,C.R)DAT)&9@@@@9- J@)ARJ& *O81T,)4P1O- J1O O( )4PLO@))SJ (RO4 )4P 0RO8P B@ TO7*CAR,C.R)DAT)&9@@@@9- CA=.10 *O81T,)4P1O- ? ,S)L)*T 4AR,*O81T,)4P1O-- (RO4 )4P 0RO8P B@ TO7*CAR,C.R)DAT)&9@@@@9--+ 2D S)L)*T D)PT1O& LPAD,S84,253,SALO1=L,*O44&D---&2:- J*O4P)1SAT.O1J (RO4 )4P 0RO8P B@ D)PT1O CA=.10 S84, 253,SALO1=L,*O44&D--- ? ,S)L)*T 4AR,S84,253,SALO1=L,*O44&D---- (RO4 )4P 0RO8P B@ D)PT1O-+ 22 S)L)*T )1A4)& C.R)DAT)& LPAD,939& JR)*)1TL@ C.R)DJ (RO4 )4P WC)R) C.R)DAT) ? ,S)L)*T 4AR,C.R)DAT)- (RO4 )4P- 81.O1 S)L)*T )1A4) 1A4)& C.R)DAT)& LPAD,9 9&2:- JR)*)1TL@ C.R)DJ (RO4 )4P WC)R) C.R)DAT) U? ,S)L)*T 4AR,C.R)DAT)- (RO4 )4P-+ 25 S)L)*T )1A4)&SAL (RO4 )4P ) WC)R) SAL G ,S)L)*T A=0,SAL- (RO4 )4P ( WC)R) ) D)PT1O ? ( D)PT1O-+ 26 S)L)*T )1A4)& SAL (RO4 )4P A WC)R) V1 ? ,S)L)*T *O81T ,D.ST.1*T,SAL-- (RO4 )4P B WC)R) A SALF?B SAL-+ 2M S)L)*T 3 (RO4 )4P A WC)R) A )4P1O .1 ,S)L)*T )4P1O (RO4 )4P 0RO8P B@ )4P1O CA=.10 *O81T,)4P1O-G2- A1D A ROW.DU?4.1 ,ROW.D--+ 2: S)L)*T )1A4) J)4PLO@))J&TO7*CAR,TR81*,4O1TCS7B)TW))1,S@SDAT)&C.R)DAT)-/25--KK9 @)ARS 9KK TO7*CAR,TR81*,4OD,4O1TCS7B)TW))1 ,S@SDAT)& C.R)DAT)-&25---KK9 4O1TCS 9 JL)10TC O( S)R=.*)J (RO4 )4P+

237

!= I),OI*# Q(#'7K SELE " A,A(,NE%, E9NCM N,n#oice NumN 6 A,A(,NE%, E9DA"E N,n#oice DateN 6 A,A(,NE%, E9AM%CN" N,n#oice AmountN 6 A,A(,NE%, E9 CRREN D9 %DE N,n#oice odeN 6 A,A(DES R,)",%N NDescN 6 )E(SEGMEN"2 NEendor NumN 6 )E(EEND%R9NAME NEendor NameN 6 A,A(A""R,+C"E7 N,mage ,dN 6 L (D,S)LADED9:,ELD N,n#oice "ypeN 6 L (L%%LC)9"D)E 6 A,A(,NE%, E9"D)E9L%%LC)9 %DE :R%M A)9,NE%, ES A,A 6 )%9EEND%RS )E 6 A)9L%%LC)9 %DES L W;ERE A,A(EEND%R9,D<)E(EEND%R9,D AND L (L%%LC)9 %DE/S3<A,A(,NE%, E9"D)E9L%%LC)9 %DE AND L (L%%LC)9"D)E<0,NE%, E "D)E0 AND A,A(,NE%, E9"D)E9L%%LC)9 %DE<NEL/.)9,NE%, E9"D)E6 A,A(,NE%, E9"D)E9L%%LC)9 %DE3 AND A,A(,NE%, E9AM%CN"J<.)9,NE%, E9AMM%CN" AND A,A(,NE%, E9DA"EJ<.)9,NE%, E9DA"E != I),OI*# =!7-#)% Q(#'7K select ac( ;E L9NCM+ER NDocument9numberN 6 ac( ;E L9DA"E N)ayment9dateN 6 ac(AM%CN" N)ayment9ammountN 6 ac( CRREN D9 %DE N urrencyN 6 p#(EEND%R9,D NSupplier9numN 6 p#(EEND%R9NAME NSupplier9nameN 6 p#c(EEND%R9S,"E9 %DE NSupplier9sitecodeN

238
6 aba(+ANL9A %CN"9NAME N+an-9accountN 6 aba( CRREN D9 %DE NAccount9 urrencyN 6 AL 2(D,S)LADED9:,ELD N"ypeN 6 AL 7(D,S)LADED9:,ELD N)ayment9methodN 6 AL G(D,S)LADED9:,ELD Nchec-9statusN 6 abb(+ANL9NAME N+an-9nameN 6 aip(AM%CN" N,n#oice9ammountN 6 ai(,NE%, E9NCM N,n#oice9numberN from ap9chec-s ac 6 A)9+ANL9A %CN"S A+A 6 A)9L%%LC)9 %DES AL 2 6 A)9+ANL9+RAN ;ES A++ 6 A)9L%%LC)9 %DES AL 7 6 A)9L%%LC)9 %DES AL G 6 po9#endors p# 6 po9#endor9sites p#c 6 ap9in#oice9payments aip 6 ap9in#oices ai 'here A (EEND%R9,D < )E(EEND%R9,D and ac(EEND%R9S,"E9,D<p#c(EEND%R9S,"E9,D and A (+ANL9A %CN"9,D < A+A(+ANL9A %CN"9,D and abb(+ANL9+RAN ;9,D<aba(+ANL9+RAN ;9,D and AL 2(L%%LC)9"D)E < 0)ADMEN" "D)E0 and AL 2(L%%LC)9 %DE < A ()ADMEN"9"D)E9:LAG and AL 7(L%%LC)9"D)E < 0)ADMEN" ME";%D0 and AL 7(L%%LC)9 %DE < A ()ADMEN"9ME";%D9L%%LC)9 %DE and AL G(L%%LC)9"D)E /S3 < 0 ;E L S"A"E0 and AL G(L%%LC)9 %DE /S3 < A (S"A"CS9L%%LC)9 %DE ***and ac( ;E L9NCM+ER<2111 and aip( ;E L9,D<ac( ;E L9,D and ai(,NE%, E9,D<aip(,NE%, E9,D
C$ I)%#'@!*# ='O*#"('#K

REA"E %R RE)LA E )R% EDCRE Ge9)ro/Errbuf %C" EAR ;AR76 Retcode %C" EAR ;AR73 ,S ** cursor declaration CRS%R gl9cur ,S SELE " status 6 set9of9boo-s9id 6 accounting9date 6 currency 6 date9created 6 created9by 6 actual9flag 6 category 6 source 6 curr9con#ersion 6 segment2 6 segment7 6 segmentG 6 segment@ 6 segmentH 6 entered9dr 6 entered9cr 6 accounted9dr 6

239
accounted9cr 6 group9id :R%M FF9GL9"A+LEB l9currencycode EAR ;AR7/7H3B l9set9of9boo-s9id NCM+ER/G3B l9flag EAR ;AR7/73B l9error9msg EAR ;AR7/2113B l9err9flag EAR ;AR7/213B l9category EAR ;AR7/2113B L9CSER,D NCM+ER/213B +EG,N DELE"E :R%M gl9interfaceB %MM,"B :%R rec9cur ,N gl9cur L%%) l9flag.<0A0B l9err9flag.<0A0B **"his )LMSQL +loc- 'ill do the currency #alidation **end of the currency #alidation ** ategory olumn Ealidation +EG,N SELE " CSER9$E9 A"EG%RD9NAME ,N"% l9 A"EG%RD :R%M GL9$E9 A"EG%R,ES W;ERE CSER9$E9 A"EG%RD9NAME < RE 9 CR( ategoryB EF E)",%N W;EN %";ERS ";EN l9category.<NCLLB l9flag.<0E0B l9error9msg.<0 ategory does not e=ist 0B ENDB :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE0TTL9:LAG3B **End ategory olumn Ealidation **Cser ,D column #alidation +EG,N SELE " CSER9,D ,N"% L9CSER,D :R%M :ND9CSER W;ERE CSER9,D < RE 9 CR(created9byB EF E)",%N W;EN %";ERS ";EN L9userid.<NCLLB l9flag.<0E0B l9error9msg.<0Cser ,D does not e=ist 0B ENDB :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE0TTL9:LAG3B **End of reated9by %R Cser,D column Ealidation **Set of boo-s Ealidation +EG,N SELE " set9of9boo-s9id ,N"% l9set9of9boo-s9id :R%M GL9SE"S9%:9+%%LS W;ERE set9of9boo-s9id<rec9cur(set9of9boo-s9idB EF E)",%N W;EN %";ERS ";EN l9set9of9boo-s9id.<NCLLB l9flag.<0E0B

24,
l9error9msg.<0set of +oo-s ,D does not e=ist 0B ENDB :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE0TTL9:LAG3B ** End Set of boo-s Ealidation **Status olumn #alidation MO +EG,N ,: rec9cur(status < 0NEW0 ";EN l9flag.< 0A0B ELSE l9flag.< 0E0B :nd9:ile(put9line /:nd9:ile(L%G60Status column has got in#alid data03B END ,:B ENDBOM +EG,N SELE " currency9code ,N"% l9currencycode :R%M fnd9currencies W;ERE currency9code<rec9cur(currency AND currency9code<0CSD0B EF E)",%N W;EN %";ERS ";EN l9currencycode.<NCLLB l9flag.<0E0B l9error9msg.<0currency code does not e=ists0B ENDB :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE0TTL9:LAG3B :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE0TTL9:LAG3B **End of Actual :lag olumn #alidation ,: l9flagQ<0E0 ";EN :nd9:ile(put9line /:nd9:ile(L%G60,nserting data into the ,nterface "A+LE03B ,NSER" ,N"% gl9interface/status6 set9of9boo-s9id6 accounting9date6 currency9code6 date9created6 created9by6 actual9flag6 user9?e9category9name6 user9?e9source9name6 user9currency9con#ersion9type6 segment26 segment76 segmentG6 segment@6 segmentH6 entered9dr6 entered9cr6 accounted9dr6 accounted9cr6 group9id3 EALCES /rec9cur(status 6 rec9cur(set9of9boo-s9id 6 rec9cur(accounting9date 6 rec9cur(currency 6 rec9cur(date9created 6

241
rec9cur(created9by 6 rec9cur(actual9flag 6 rec9cur(category 6 rec9cur(source 6 rec9cur(curr9con#ersion rec9cur(segment2 6 rec9cur(segment7 6 rec9cur(segmentG 6 rec9cur(segment@ 6 rec9cur(segmentH 6 rec9cur(entered9dr 6 rec9cur(entered9cr 6 rec9cur(accounted9dr 6 rec9cur(accounted9cr 6 rec9cur(group9id3B END ,:B l9flag.<NCLLB l9error9msg.<NCLLB END L%%)B %MM,"B

:=? K:G8r%4

You might also like