You are on page 1of 11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)

Like

Share

search...

ArithmeticAptitudeDataInterpretation
LogicalReasoningVerbalReasoningNonVerbalReasoning
GeneralKnowledge
SudokuNumberpuzzlesMissingletterspuzzlesLogicalpuzzlesPlayingcardspuzzlesClockpuzzles
CProgrammingC++ProgrammingC#ProgrammingJavaProgramming
MicrobiologyBiochemistry
BiotechnologyBiochemical
Engineering
Electronicsand
Communication
EngineeringCivil
EngineeringMechanical
EngineeringChemical
EngineeringNetworking
DatabaseQuestions
ComputerScienceBasic
ElectronicsDigital
ElectronicsElectronic
DevicesCircuitSimulation
ElectricalEnigneering
EngineeringMechanics
TechnicalDrawing
PlacementPapersGroupDisucssionHRInterviewTechnicalInterviewBodyLanguage
AptitudeTestVerbalAbilityTestVerbalReasoningTestLogicalReasoningTestCProgrammingTestJavaProgrammingTestDataInterpretation
TestGeneralKnowledgeTest
DataStructuresOperatingSystemsNetworkingDATABASEDatabaseBasicsSQLServerBasicsSQLServerAdvancedSQLServer2008JAVA
CoreJavaJavaBasicsAdvancedJavaUNIXUnixFileManagementUnixMemoryManagementUnixProcessManagemntCInterviewQuestions
TheCLanguageBasics.NETInterviewQuestions.NETFrameworkADO.NETASP.NETSoftwareTesting
Home
Aptitude
LogicalReasoning
VerbalAbility
GK
Puzzles
Engineering
Interview
OnlineTest

PlacementPapers::ORACLE
@:Home>PlacementPapers>ORACLE>ViewPaper
OracleInterviewQuestionsAndAnswersSet7
Rated:+62,6

OracleInterview
QuestionsAndAnswersSet7

WhatarethedifferenttypesofPL/SQLprogramunitsthatcanbedefinedandstoredinORACLEdatabase?
ProceduresandFunctions,PackagesandDatabaseTriggers.
WhataretheadvantagesofhavingaPackage?
Increasedfunctionality(forexample,globalpackagevariablescanbedeclaredandusedbyanyproecdureinthepackage)andperformance
(forexampleallobjectsofthepackageareparsedcompiled,andloadedintomemoryonce)
WhataretheusesofDatabaseTrigger?
Databasetriggerscanbeusedtoautomaticdatageneration,auditdatamodifications,enforcecomplexIntegrityconstraints,andcustomize
complexsecurityauthorizations.
WhatisaProcedure?
AProcedureconsistofasetofSQLandPL/SQLstatementsthataregroupedtogetherasaunittosolveaspecificproblemorperforma
setofrelatedtasks.

http://www.indiabix.com/placementpapers/oracle/4083

1/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
WhatisaPackage?
APackageisacollectionofrelatedprocedures,functions,variablesandotherpackageconstructstogetherasaunitinthedatabase.
WhatisdifferencebetweenProceduresandFunctions?
AFunctionreturnsavaluetothecallerwhereasaProceduredoesnot.
WhatisDatabaseTrigger?
ADatabaseTriggerisprocedure(setofSQLandPL/SQLstatements)thatisautomaticallyexecutedasaresultofaninsertin,updateto,
ordeletefromatable.
Canthedefaultvaluesbeassignedtoactualparameters?
Yes

Canaprimarykeycontainmorethanonecolumns?
Yes
WhatisanUTL_FILE.Whataredifferentproceduresandfunctionsassociatedwithit?
UTL_FILE is a package that adds the ability to read and write to operating system files. Procedures associated with it are FCLOSE,
FCLOSE_ALL and 5 procedures to output data to a file PUT, PUT_LINE, NEW_LINE, PUTF, FFLUSH.PUT,
FFLUSH.PUT_LINE,FFLUSH.NEW_LINE.FunctionsassociatedwithitareFOPEN,ISOPEN.
WhatareORACLEPRECOMPILERS?
Using ORACLE PRECOMPILERS, SQL statements and PL/SQL blocks can be contained inside 3GL programs written in
C,C++,COBOL,PASCAL,FORTRAN,PL/1ANDADA.ThePrecompilersareknownasPro*C,Pro*Cobol,...ThisformofPL/SQLis
known as embedded pl/sql,the language in which pl/sql is embedded is known as the host language. The prcompiler translates the
embedded SQL and pl/sql statements into calls to the precompiler runtime library. The output must be compiled and linked with this
librarytocreatoranexecutable.
DifferentiatebetweenTRUNCATEandDELETE?
TRUNCATEdeletesmuchfasterthanDELETE
TRUNCATE
DELETE
ItisaDDLstatement
ItisaDMLstatement
Itisaonewaytrip,cannotROLLBACK
OnecanRollback
Doesn'thaveselectivefeatures(whereclause)
Has
Doesn'tfiredatabasetriggers
Does
Itrequiresdisablingofreferentialconstraints.
Whatisdifferencebetweenaformalandanactualparameter?
Thevariablesdeclaredintheprocedureandwhicharepassed,asargumentsarecalledactual,theparametersintheproceduredeclaration.
Actual parameters contain the values that are passed to a procedure and receive results. Formal parameters are the placeholders for the
valuesofactualparameters
Whatshouldbethereturntypeforacursorvariable.Canweuseascalardatatypeasreturntype?
Thereturntypeforacursormustbearecordtype.Itcanbedeclaredexplicitlyasauserdefinedor%ROWTYPEcanbeused.egTYPE
t_studentsrefISREFCURSORRETURNstudents%ROWTYPE
WhataredifferentOracledatabaseobjects?
TABLES
VIEWS
INDEXES
SYNONYMS
SEQUENCES
TABLESPACESetc

WhatisdifferencebetweenSUBSTRandINSTR?
SUBSTRreturnsaspecifiedportionofastringegSUBSTR('BCDEF',4)outputBCDEINSTRprovidescharacterpositioninwhicha
patternisfoundinastring.egINSTR('ABCDCF','',2)output7(2ndoccurenceof'')
DisplaythenumbervalueinWords?
SQL>selectsal,(to_char(to_date(sal,'j'),'jsp'))
fromemp
theoutputlike,
SAL(TO_CHAR(TO_DATE(SAL,'J'),'JSP'))

800eighthundred
1600onethousandsixhundred
1250onethousandtwohundredfifty

http://www.indiabix.com/placementpapers/oracle/4083

2/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
Ifyouwanttoaddsometextlike,Rs.ThreeThousandonly.
SQL>selectsal"Salary",
('Rs.'||(to_char(to_date(sal,'j'),'Jsp'))||'only.'))
"SalinWords"fromemp
/
SalarySalinWords

800Rs.EightHundredonly.
1600Rs.OneThousandSixHundredonly.
1250Rs.OneThousandTwoHundredFiftyonly.
WhatisdifferencebetweenSQLandSQL*PLUS?
SQL*PLUSisacommandlinetoolwhereasSQLandPL/SQLlanguageinterfaceandreportingtool.Itsacommandlinetoolthatallows
user to type SQL commands to be executed directly against an Oracle database. SQL is a language used to query the relational
database(DML,DCL,DDL).SQL*PLUScommandsareusedtoformatqueryresult,Setoptions,EditSQLcommandsandPL/SQL.
WhatarevariousjoinsusedwhilewritingSUBQUERIES?
SelfjoinItsajoinforeignkeyofatablereferencesthesametable.OuterJoinItsajoinconditionusedwhereOnecanqueryalltherows
ofoneofthetablesinthejoinconditioneventhoughtheydon'tsatisfythejoincondition.
EquijoinItsajoinconditionthatretrievesrowsfromoneormoretablesinwhichoneormorecolumnsinonetableareequaltooneor
morecolumnsinthesecondtable.
WhataSELECTFORUPDATEcursorrepresent.?
SELECT......FROM......FOR......UPDATE[OFcolumnreference][NOWAIT]
Theprocessingdoneinafetchloopmodifiestherowsthathavebeenretrievedbythecursor.Aconvenientwayofmodifyingtherowsis
done by a method with two parts: the FOR UPDATE clause in the cursor declaration, WHERE CURRENT OF CLAUSE in an
UPDATEordeclarationstatement.
Whatarevariousprivilegesthatausercangranttoanotheruser?
SELECT
CONNECT
RESOURCES
Displaytherecordsbetweentworange?
selectrownum,empno,enamefromempwhererowidin(selectrowidfromempwhererownum<=&uptominusselectrowidfromemp
whererownum<&Start)
minvalue.sqlSelecttheNthlowestvaluefromatable?
selectlevel,min('col_name')frommy_tablewherelevel='&n'connectbyprior('col_name')<'col_name')
groupbylevel
Example:
Givenatablecalledempwiththefollowingcolumns:
idnumber
namevarchar2(20)
salnumber

Forthesecondlowestsalary:
selectlevel,min(sal)fromemp
wherelevel=2
connectbypriorsal<sal
groupbylevel
WhatisdifferencebetweenRenameandAlias?
RenameisapermanentnamegiventoatableorcolumnwhereasAliasisatemporarynamegiventoatableorcolumnwhichdonotexist
oncetheSQLstatementisexecuted.
Differencebetweenanimplicit&anexplicitcursor.?
only one row. However,queries that return more than one row you must declare an explicit cursor or use a cursor FOR loop. Explicit
cursorisacursorinwhichthecursornameisexplicitlyassignedtoaSELECTstatementviatheCURSOR...ISstatement.Animplicit
cursorisusedforallSQLstatementsDeclare,Open,Fetch,Close.AnexplicitcursorsareusedtoprocessmultirowSELECTstatements
AnimplicitcursorisusedtoprocessINSERT,UPDATE,DELETEandsinglerowSELECT..INTOstatements.
WhatisaOUTERJOIN?
OuterJoinItsajoinconditionusedwhereyoucanqueryalltherowsofoneofthetablesinthejoinconditioneventhoughtheydon?t
satisfythejoincondition.
Whatisacursor?
Oracle uses work area to execute SQL statements and store processing information PL/SQL construct called a cursor lets you name a
workareaandaccessitsstoredinformationAcursorisamechanismusedtofetchmorethanonerowinaPl/SQlblock.
Whatisthepurposeofacluster?
Oracledoesnotallowausertospecificallylocatetables,sincethatisapartofthefunctionoftheRDBMS.However,forthepurposeof
increasingperformance,oracleallowsadevelopertocreateaCLUSTER.ACLUSTERprovidesameansforstoringdatafromdifferent
tablestogetherforfasterretrievalthanifthetableplacementwerelefttotheRDBMS.

http://www.indiabix.com/placementpapers/oracle/4083

3/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)

WhatisOCI.Whatareitsuses?
Oracle Call Interface is a method of accesing database from a 3GL program. UsesNo precompiler is required,PL/SQL blocks are
executedlikeotherDMLstatements.
TheOCIlibraryprovides
functionstoparseSQLstatemets
bindinputvariables
bindoutputvariables
executestatements
fetchtheresults
Howyouopenandcloseacursorvariable.Whyitisrequired?
OPENcursorvariableFORSELECT...Statement
CLOSEcursorvariableInordertoassociateacursorvariablewithaparticularSELECTstatementOPENsyntaxisused.Inordertofree
theresourcesusedforthequeryCLOSEstatementisused.

DisplayOdd/Evennumberofrecords?
Oddnumberofrecords:
select*fromempwhere(rowid,1)in(selectrowid,mod(rownum,2)fromemp)
Output:
1
3
5
Evennumberofrecords:
select*fromempwhere(rowid,0)in(selectrowid,mod(rownum,2)fromemp)
Output:
2
4
6
WhatarevariousconstraintsusedinSQL?
NULL
NOTNULL
CHECK
DEFAULT
CancursorvariablesbestoredinPL/SQLtables.Ifyeshow.Ifnotwhy?
No,acursorvariablepointsarowwhichcannotbestoredinatwodimensionalPL/SQLtable.
DifferencebetweenNODATAFOUNDand%NOTFOUND?
NODATAFOUNDisanexceptionraisedonlyfortheSELECT....INTOstatementswhenthewhereclauseofthequerydoesnotmatch
anyrows.Whenthewhereclauseoftheexplicitcursordoesnotmatchanyrowsthe%NOTFOUNDattributeissettoTRUEinstead.
Canyouuseacommitstatementwithinadatabasetrigger?
No
WhatWHERECURRENTOFclausedoesinacursor?
LOOP
SELECTnum_creditsINTOv_numcreditsFROMclasses
WHEREdept=123andcourse=101
UPDATEstudents
FHKOSETcurrent_credits=current_credits+v_numcredits
WHERECURRENTOFX
Thereisastring120000120.125,howyouwillfindthepositionofthedecimalplace?
INSTR('120000120.125',1,'.')
output13
Whataredifferentmodesofparametersusedinfunctionsandprocedures?
INOUTINOUT
HowyouwerepassingcursorvariablesinPL/SQL2.2?
InPL/SQL2.2cursorvariablescannotbedeclaredinapackage.Thisisbecausethestorageforacursorvariablehastobeallocatedusing
Pro*C or OCI with version 2.2, the only means of passing a cursor variable to a PL/SQL block is via bind variable or a procedure
parameter.
WhendoyouuseWHEREclauseandwhendoyouuseHAVINGclause?
HAVING clause is used when you want to specify a condition for a group function and it is written after GROUP BY clause. The
WHEREclauseisusedwhenyouwanttospecifyaconditionforcolumns,singlerowfunctionsexceptgroupfunctionsanditiswritten
beforeGROUPBYclauseifitisused.
Differencebetweenprocedureandfunction.?

http://www.indiabix.com/placementpapers/oracle/4083

4/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
FunctionsarenamedPL/SQLblocksthatreturnavalueandcanbecalledwithargumentsprocedureanamedblockthatcanbecalledwith
parameter.AprocedureallisaPL/SQLstatementbyitself,whileaFunctioncalliscalledaspartofanexpression.

Companies
3iInfotech
AAI
ABACUS
ABB
Accel
Frontline
Accenture
Aditi
Adobe
ADP
Agreeya
Akamai
Alcatel
Lucent
Allfon
Alumnus
Amazon
Amdocs
AMI
Andhra
Bank
AppLabs
Apps
Associates
Aricent
Ashok
Leyland
Aspire
AtosOrigin
Axes
Bajaj
Bankof
Maharashtra
BEL
BEML
BHEL
BirlaSoft
BlueDart
BlueStar
BOB
BPCL
BPL
Brakes
BSNL
CDOT
Cadence
Calsoft
Canara
Bank
Canarys
Capgemini
Caritor
Caterpillar
CDAC
CGI
Changepond
Ciena
Cisco
Citicorp
CMC
Consagous
Convergys
CORDYS
Crompton
CSC

WhichismorefasterINorEXISTS?
EXISTSismorefasterthanINbecauseEXISTSreturnsaBooleanvaluewhereasINreturnsavalue.
Whatissyntaxfordroppingaprocedureandafunction.Aretheseoperationspossible?
DropProcedureprocedure_name
DropFunctionfunction_name
Howwillyoudeleteduplicatingrowsfromabasetable?
delete from table_name where rowid not in (select max(rowid) from table group by duplicate_values_field_name) or delete
duplicate_values_field_namedvfromtable_nametawhererowid<(selectmin(rowid)fromtable_nametbwhereta.dv=tb.dv)
Differencebetweendatabasetriggersandformtriggers?
Databasetrigger(DBT)fireswhenaDMLoperationisperformedonadatabasetable.Formtrigger(FT)Fireswhenuserpressesakey
ornavigatesbetweenfieldsonthescreen
CanberowlevelorstatementlevelNodistinctionbetweenrowlevelandstatementlevel.
CanmanipulatedatastoredinOracletablesviaSQLCanmanipulatedatainOracletablesaswellasvariablesinforms.
CanbefiredfromanysessionexecutingthetriggeringDMLstatements.Canbefiredonlyfromtheformthatdefinethetrigger.
Cancauseotherdatabasetriggerstofire.Cancauseotherdatabasetriggerstofire,butnototherformtriggers.
Whatisacursorforloop?
Cursor For Loop is a loop where oracle implicitly declares a loop variable, the loop index that of the same record type as the cursor's
record.
Howyouwillavoidduplicatingrecordsinaquery?
ByusingDISTINCT
Whatisaview?
Aviewisstoredprocedurebasedononeormoretables,it?savirtualtable.
WhatisdifferencebetweenUNIQUEandPRIMARYKEYconstraints?
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PK are
automatically define NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also
specifythecolumnisNOTNULL.
Whatisuseofacursorvariable?Howitisdefined?
Acursorvariableisassociatedwithdifferentstatementsatruntime,whichcanholddifferentvaluesatruntime.Staticcursorscanonlybe
associatedwithoneruntimequery.Acursorvariableisreferencetype(likeapointerinC).
Declaringacursorvariable:
TYPE type_name IS REF CURSOR RETURN return_type type_name is the name of the reference type,return_type is a record type
indicatingthetypesoftheselectlistthatwilleventuallybereturnedbythecursorvariable.
HowdoyoufindthenumbertofrowsinaTable?
Abadansweriscountthem(SELECTCOUNT(*)FROMtable_name)
Agoodansweris:
'By generating SQL to ANALYZE TABLE table_name COUNT STATISTICS by querying Oracle System Catalogues (e.g.
USER_TABLESorALL_TABLES).
The best answer is to refer to the utility which Oracle released which makes it unnecessary to do ANALYZE TABLE for each Table
individually.

WhatisthemaximumbuffersizethatcanbespecifiedusingtheDBMS_OUTPUT.ENABLEfunction?
1,000,00

PlacementPapers
OraclePLSQL
OracleDeveloper

Whatarecursorattributes?
%ROWCOUNT
%NOTFOUND
%FOUND
%ISOPEN
Thereisa%signinonefieldofacolumn.Whatwillbethequerytofindit?
''Shouldbeusedbefore'%'.
WhatisONDELETECASCADE?
WhenONDELETECASCADEisspecifiedORACLEmaintainsreferentialintegritybyautomaticallyremovingdependentforeignkey
valuesifareferencedprimaryoruniquekeyvalueisremoved.
Whatisthefastestwayofaccessingarowinatable?
UsingROWID.CONSTRAINTS
WhatisdifferencebetweenTRUNCATE&DELETE?
TRUNCATEcommitsafterdeletingentiretablei.e.,cannotberolledback.DatabasetriggersdonotfireonTRUNCATEDELETEallows

http://www.indiabix.com/placementpapers/oracle/4083

5/11

12/15/2014

CTS
Cummins
Dell
Deloitte
DelphiTVS
DeShaw
Deutsche
Dotcom
DRDO
EDS
EIL
ELGI
ELICO
ERICSSON
Essar
Fidelity
Flextronics
Freescale
FXLabs
GAIL
GE
Genpact
Geodesic
Geometric
Globaledge
GlobalLogic
Godrej
Google
Grapecity
HAL
HCL
Hexaware
Honeywell
HP
HPCL
HSBC
Huawei
Hughes
IBM
IBS
ICICI
iGate
Impetus
iNautix
Indian
Airforce
Indian
Airlines
Infosys
Infotech
Intec
Integra
Intergraph
IOCL
iSOFT
ISRO
Ittiam
JSW
Keane
Kenexa
L&T
L&T
Infotech
LGSoft
Lifetree
LionBridge
Mahindra
Satyam
Mastek
Maveric

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
thefiltereddeletion.Deletedrecordscanberolledbackorcommitted.DatabasetriggersfireonDELETE.
Whatisatransaction?
Transactionislogicalunitbetweentwocommitsandcommitandrollback.
WhataretheadvantagesofVIEW?
Toprotectsomeofthecolumnsofatablefromotherusers.Tohidecomplexityofaquery.Tohidecomplexityofcalculations.
Howwillyouaactivate/deactivateintegrityconstraints?
TheintegrityconstraintscanbeenabledordisabledbyALTERTABLEENABLEconstraint/DISABLEconstraint.
WheretheintegrityconstraintsarestoredinDataDictionary?
TheintegrityconstraintsarestoredinUSER_CONSTRAINTS.
WhatistheSubquery?
Subqueryisaquerywhosereturnvaluesareusedinfilteringconditionsofthemainquery.
Howtoaccessthecurrentvalueandnextvaluefromasequence?Isitpossibletoaccessthecurrentvalueinasessionbeforeaccessing
nextvalue?
SequencenameCURRVAL,SequencenameNEXTVAL.Itisnotpossible.Onlyifyouaccessnextvalueinthesession,currentvaluecan
beaccessed.
WhataretheusageofSAVEPOINTS?valueinasessionbeforeaccessingnextvalue?
SAVEPOINTSareusedtosubdivideatransactionintosmallerparts.Itenablesrollingbackpartofatransaction.Maximumoffivesave
pointsareallowed.
WhatisROWID?inasessionbeforeaccessingnextvalue?
ROWIDisapseudocolumnattachedtoeachrowofatable.Itis18characterlong,blockno,rownumberarethecomponentsofROWID.
ExplainConnectbyPrior?inasessionbeforeaccessingnextvalue?
Retrievesrowsinhierarchicalorder.e.g.selectempno,enamefromempwhere.
HowmanyLONGcolumnsareallowedinatable?IsitpossibletouseLONGcolumnsinWHEREclauseorORDERBY?
OnlyoneLONGcolumnsisallowed.ItisnotpossibletouseLONGcolumninWHEREorORDERBYclause.
WhatisReferentialIntegrity?
Maintainingdataintegritythroughasetofrulesthatrestrictthevaluesofoneormorecolumnsofthetablesbasedonthevaluesofprimary
keyoruniquekeyofthereferencedtable.
Whatisajoin?Explainthedifferenttypesofjoins?
Joinisaquerywhichretrievesrelatedcolumnsorrowsfrommultipletables.SelfJoinJoiningthetablewithitself.EquiJoinJoining
twotablesbyequatingtwocommoncolumns.NonEquiJoinJoiningtwotablesbyequatingtwocommoncolumns.OuterJoinJoining
twotablesinsuchawaythatquerycanalsoretrieverowsthatdonothavecorrespondingjoinvalueintheothertable.
IfanuniquekeyconstraintonDATEcolumniscreated,willitvalidatetherowsthatareinsertedwithSYSDATE?
Itwon't,BecauseSYSDATEformatcontainstimeattachedwithit.
WhatareProcedure,functionsandPackages?
ProceduresandfunctionsconsistofsetofPL/SQLstatementsthataregroupedtogetherasaunittosolveaspecificproblemorperform
setofrelatedtasks.
Procedures do not Return values while Functions return one One Value Packages :: Packages Provide a method of encapsulating and
storingrelatedprocedures,functions,variablesandotherPackageContents
WhatareDatabaseTriggersandStoredProcedures
DatabaseTriggers::DatabaseTriggersareProceduresthatareautomaticallyexecutedasaresultofinsertin,updateto,ordeletefrom
table.
Databasetriggershavethevaluesoldandnewtodenotetheoldvalueinthetablebeforeitisdeletedandthenewindicatedthenewvalue
thatwillbeused.DTareusefulforimplementingcomplexbusinessruleswhichcannotbeenforcedusingtheintegrityrules.Wecanhave
thetriggerasBeforetriggerorAfterTriggerandatStatementorRowlevel.e.g::operationsinsert,update,delete3before,after3*2Atotal
of6combinatons
Atstatmentlevel(onceforthetrigger)orrowlevel(foreveryexecution)6*2Atotalof12.Thusatotalof12combinationsarethereand
therestrictionofusageof12triggershasbeenliftedfromOracle7.3Onwards.
StoredProcedures::StoredProceduresareProceduresthatarestoredinCompiledforminthedatabase.Theadvantageofusingthestored
proceduresisthatmanyuserscanusethesameprocedureincompiledandreadytouseformat.
HowmanyIntegrityRulesarethereandwhatarethey
ThereareThreeIntegrityRules.Theyareasfollows::
a)EntityIntegrityRule::TheEntityIntegrityRuleenforcesthatthePrimarykeycannotbeNull
b) Foreign Key Integrity Rule :: The FKIR denotes that the relationship between the foreign key and the primary key has to be
enforced.WhenthereisdatainChildTablestheMastertablescannotbedeleted.
c)BusinessIntegrityRules::TheThirdIntigrityruleisaboutthecomplexbusinessprocesseswhichcannotbeimplementedbytheabove
2rules.
WhataretheVariousMasterandDetailRelationships.

http://www.indiabix.com/placementpapers/oracle/4083

6/11

12/15/2014

McAfee
MECON
Microsoft
MindTree
Miraclesoft
Mistral
Motorola
Mphasis
MTNL
NIC
Nokia
Siemens
Novell
NTPC
Nucleus
ORACLE
Patni
Perot
Polaris
Ramco
Robert
Bosch
Samsung
SAP
Sapient
Sasken
SBI
Sierra
Atlantic
Sonata
SonyIndia
Sutherland
Syntel
TCS
Tech
Mahindra
VeriFone
Virtusa
Wipro
Zensar

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
ThevariousMasterandDetailRelationshipare
a)NonIsolated::TheMastercannotbedeletedwhenachildisexisiting
b)Isolated::TheMastercanbedeletedwhenthechildisexisiting
c)Cascading::ThechildgetsdeletedwhentheMasterisdeleted.
WhataretheVariousBlockCoordinationProperties
ThevariousBlockCoordinationPropertiesare
a)ImmediateDefaultSetting.TheDetailrecordsareshownwhentheMasterRecordareshown.
b)DefferedwithAutoQueryOracleFormsdeferfetchingthedetailrecordsuntiltheoperatornavigatestothedetailblock.
c)DefferedwithNoAutoQueryTheoperatormustnavigatetothedetailblockandexplicitlyexecuteaquery
WhataretheDifferentOptimizationTechniques
TheVariousOptimisationtechniquesare
a)ExecutePlan::wecanseetheplanofthequeryandchangeitaccordinglybasedontheindexes
b)Optimizer_hint::
set_item_property('DeptBlock',OPTIMIZER_HINT,'FIRST_ROWS')
Select/*+First_Rows*/Deptno,Dname,Loc,Rowidfromdept
where(Deptno>25)
c)Optimize_Sql::
BysettingtheOptimize_Sql=No,OracleFormsassignsasinglecursorforallSQLstatements.Thisslowdownstheprocessingbecause
forevertimetheSQLmustbeparsedwhenvertheyareexecuted.
f45runmodule=my_firstformuserid=scott/tigeroptimize_sql=No
d)Optimize_Tp::
BysettingtheOptimize_Tp=No,OracleFormsassignsseperatecursoronlyforeachquerySELECTstatement.AllotherSQLstatements
reusethecursor.
f45runmodule=my_firstformuserid=scott/tigeroptimize_Tp=No
HowdoesonechangeanOracleuser'spassword?(forDBA)
IssuethefollowingSQLcommand:
ALTERUSER<username>IDENTIFIEDBY<new_password>
From Oracle8 you can just type "password" from SQL*Plus, or if you need to change another user's password, type "password
user_name".Lookatthisexample:
SQL>password
ChangingpasswordforSCOTT
Oldpassword:
Newpassword:
Retypenewpassword:
Howdoesonecreateanddropdatabaseusers?
Lookattheseexamples:
CREATEUSERscott
IDENTIFIEDBYtigerAssignpassword
DEFAULTTABLESACEtoolsAssignspacefortableandindexsegments
TEMPORARYTABLESPACEtempAssignsortspace
DROPUSERscottCASCADERemoveuser
Aftercreatinganewuser,assigntherequiredprivileges:
GRANTCONNECT,RESOURCETOscott
GRANTDBATOscottMakeuseraDBAdministrator
Remembertogivetheusersomespacequotaonitstablespaces:
ALTERUSERscottQUOTAUNLIMITEDONtools
Whocreatedalltheseusersinmydatabase?/CanIdropthisuser?(forDBA)
Oraclecreatesanumberofdefaultdatabaseusersorschemaswhenanewdatabaseiscreated.Belowareafewofthem:
SYS/CHANGE_ON_INSTALLorINTERNAL
OracleDataDictionary/Catalog
Createdby:?/rdbms/admin/sql.bsqandvariouscat*.sqlscripts
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
SYSTEM/MANAGER
ThedefaultDBAusername(pleasedonotuseSYS)
Createdby:?/rdbms/admin/sql.bsq
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
OUTLN/OUTLN
Storedoutlinesforoptimizerplanstability
Createdby:?/rdbms/admin/sql.bsq
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
SCOTT/TIGER,ADAMS/WOOD,JONES/STEEL,CLARK/CLOTHandBLAKE/PAPER.
Training/demonstrationuserscontainingthepopularEMPandDEPTtables
Createdby:?/rdbms/admin/utlsampl.sql
Canpasswordbechanged:Yes
Canuserbedropped:YESDropuserscascadefromallproductionenvironments
HR/HR(HumanResources),OE/OE(OrderEntry),SH/SH(SalesHistory).

http://www.indiabix.com/placementpapers/oracle/4083

7/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
Training/demonstrationuserscontainingthepopularEMPLOYEESandDEPARTMENTStables
Createdby:?/demo/schema/mksample.sql
Canpasswordbechanged:Yes
Canuserbedropped:YESDropuserscascadefromallproductionenvironments
CTXSYS/CTXSYS
OracleinterMedia(ConTextCartridge)administratoruser
Createdby:?/ctx/admin/dr0csys.sql
TRACESVR/TRACE
OracleTraceserver
Createdby:?/rdbms/admin/otrcsvr.sql
DBSNMP/DBSNMP
OracleIntelligentagent
Createdby:?/rdbms/admin/catsnmp.sql,calledfromcatalog.sql
Canpasswordbechanged:Yesputthenewpasswordinsnmp_rw.orafile
Canuserbedropped:YESOnlyifyoudonotusetheIntelligentAgents
ORDPLUGINS/ORDPLUGINS
ObjectRelationalData(ORD)UserusedbyTimeSeries,etc.
Createdby:?/ord/admin/ordinst.sql
ORDSYS/ORDSYS
ObjectRelationalData(ORD)UserusedbyTimeSeries,etc
Createdby:?/ord/admin/ordinst.sql
DSSYS/DSSYS
OracleDynamicServicesandSyndicationServer
Createdby:?/ds/sql/dssys_init.sql
MDSYS/MDSYS
OracleSpatialadministratoruser
Createdby:?/ord/admin/ordinst.sql
AURORA$ORB$UNAUTHENTICATED/INVALID
UsedforuserswhodonotauthenticateinAurora/ORB
Createdby:?/javavm/install/init_orb.sqlcalledfrom?/javavm/install/initjvm.sql
PERFSTAT/PERFSTAT
OracleStatisticsPackage(STATSPACK)thatsupersedesUTLBSTAT/UTLESTAT
Createdby:?/rdbms/admin/statscre.sql
RemembertochangethepasswordsfortheSYSandSYSTEMusersimmediatelyafterinstallation!
ExceptfortheuserSYS,thereshouldbenoproblemalteringtheseuserstouseadifferentdefaultandtemporarytablespace.
Howdoesoneenforcestrictpasswordcontrol?(forDBA)
By default Oracle's security is not extremely good. For example, Oracle will allow users to choose single character passwords and
passwords that match their names and userids. Also, passwords don't ever expire. This means that one can hack an account for years
withouteverlockingtheuser.
FromOracle8onecanmanagepasswordsthroughprofiles.Someofthethingsthatonecanrestrict:
.FAILED_LOGIN_ATTEMPTSfailedloginattemptsbeforetheaccountislocked
.PASSWORD_LIFE_TIMElimitsthenumberofdaysthesamepasswordcanbeusedforauthentication
.PASSWORD_REUSE_TIMEnumberofdaysbeforeapasswordcanbereused
.PASSWORD_REUSE_MAXnumberofpasswordchangesrequiredbeforethecurrentpasswordcanbereused
.PASSWORD_LOCK_TIMEnumberofdaysanaccountwillbelockedaftermaximumfailedloginattempts
.PASSWORD_GRACE_TIMEnumberofdaysafterthegraceperiodbeginsduringwhichawarningisissuedandloginisallowed
.PASSWORD_VERIFY_FUNCTIONpasswordcomplexityverificationscript
Lookatthissimpleexample:
CREATEPROFILEmy_profileLIMIT
PASSWORD_LIFE_TIME30
ALTERUSERscottPROFILEmy_profile
HowdoesoneswitchtoanotheruserinOracle?(forDBA)
Usersnormallyusethe"connect"statementtoconnectfromonedatabaseusertoanother.However,DBAscanswitchfromoneuserto
anotherwithoutapassword.OfcourseitisnotadvisabletobridgeOracle'ssecurity,butlookatthisexample:SQL>selectpasswordfrom
dba_userswhereusername='SCOTT'
PASSWORD
F894844C34402B67
SQL>alteruserscottidentifiedbylion
Useraltered.
SQL>connectscott/lion
Connected.
REMDowhateveryoulike...
SQL>connectsystem/manager
Connected.
SQL>alteruserscottidentifiedbyvalues'F894844C34402B67'
Useraltered.
SQL>connectscott/tiger
Connected.
Note:Alsoseethesu.sqlscriptintheUsefulScriptsandSampleProgramsPage.

http://www.indiabix.com/placementpapers/oracle/4083

8/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
Whataresnapshotsandviews
Snapshots are mirror or replicas of tables. Views are built using the columns from one or more tables. The Single Table View can be
updatedbuttheviewwithmultitablecannotbeupdated
WhataretheOOPSconceptsinOracle.
Oracle does implement the OOPS concepts. The best example is the Property Classes. We can categorize the properties by setting the
visual attributes and then attach the property classes for the objects. OOPS supports the concepts of objects and classes and we can
considerthepropertyclassesasclassesandtheitemsasobjects
Whatisthedifferencebetweencandidatekey,uniquekeyandprimarykey
Candidatekeysarethecolumnsinthetablethatcouldbetheprimarykeysandtheprimarykeyisthekeythathasbeenselectedtoidentify
therows.Uniquekeyisalsousefulforidentifyingthedistinctrowsinthetable.)
Whatisconcurrency
Concurrencyisallowingsimultaneousaccessofsamedatabydifferentusers.Locksusefulforaccesingthedatabaseare
a)Exclusive
Theexclusivelockisusefulforlockingtherowwhenaninsert,updateordeleteisbeingdone.Thislockshouldnotbeappliedwhenwedo
onlyselectfromtherow.
b)Sharelock
WecandothetableasShare_Lockasmanyshare_lockscanbeputonthesameresource.
PrevilegesandGrants
PrevilegesaretherighttoexecuteaparticularetypeofSQLstatements.e.g::RighttoConnect,Righttocreate,RighttoresourceGrants
aregiventotheobjectssothattheobjectmightbeaccessedaccordingly.Thegranthastobegivenbytheowneroftheobject
TableSpace,DataFiles,ParameterFile,ControlFiles
TableSpace::Thetablespaceisusefulforstoringthedatainthedatabase.Whenadatabaseiscreatedtwotablespacesarecreated.
a)SystemTablespace::Thisdatafilestoresallthetablesrelatedtothesystemanddbatables
b)UserTablespace::Thisdatafilestoresalltheuserrelatedtables
Weshouldhaveseperatetablespacesforstoringthetablesandindexessothattheaccessisfast.
DataFiles::EveryOracleDataBasehasoneormorephysicaldatafiles.Theystorethedataforthedatabase.Everydatafileisassociated
withonlyonedatabase.OncetheDatafileiscreatedthesizecannotchange.Toincreasethesizeofthedatabasetostoremoredatawehave
toadddatafile.
ParameterFiles::Parameterfileisneededtostartaninstance.Aparameterfilecontainsthelistofinstanceconfigurationparameterse.g.::
db_block_buffers=500
db_name=ORA7
db_domain=u.s.acmelang
ControlFiles::Controlfilesrecordthephysicalstructureofthedatafilesandredologfiles
TheycontaintheDbname,nameandlocationofdbs,datafiles,redologfilesandtimestamp.
PhysicalStorageoftheData
Thefinestlevelofgranularityofthedatabasearethedatablocks.
DataBlock::OneDataBlockcorrespondtospecificnumberofphysicaldatabasespace
Extent::Extentisthenumberofspecificnumberofcontigiousdatablocks.
Segments::SetofExtentsallocatedforExtents.TherearethreetypesofSegments
a)DataSegment::NonClusteredTablehasdatasegmentdataofeverytableisstoredinclusterdatasegment
b)IndexSegment::EachIndexhasindexsegmentthatstoresdata
c)RollBackSegment::Temporarilystore'undo'information

WhatarethePctFreeandPctUsed
PctFreeisusedtodenotethepercentageofthefreespacethatistobeleftwhencreatingatable.SimilarlyPctUsedisusedtodenotethe
percentageoftheusedspacethatistobeusedwhencreatingatable
eg.::Pctfree20,Pctused40
WhatisRowChaining
Thedataofarowinatablemaynotbeabletofitthesamedatablock.Dataforrowisstoredinachainofdatablocks.
Whatisa2PhaseCommit
TwoPhasecommitisusedindistributeddatabasesystems.Thisisusefultomaintaintheintegrityofthedatabasesothatalltheuserssee
thesamevalues.ItcontainsDMLstatementsorRemoteProceduralcallsthatreferencearemoteobject.Therearebasically2phasesina2
phasecommit.
a)PreparePhase::Globalcoordinatorasksparticipantstoprepare
b)CommitPhase::CommitallparticipantstocoordinatortoPrepared,ReadonlyorabortReply
Whatisthedifferencebetweendeletingandtruncatingoftables
DeletingatablewillnotremovetherowsfromthetablebutentryisthereinthedatabasedictionaryanditcanberetrievedButtruncatinga
tabledeletesitcompletelyanditcannotberetrieved.
Whataremutatingtables
Whenatableisinstateoftransitionitissaidtobemutating.eg::Ifarowhasbeendeletedthenthetableissaidtobemutatingandno
operationscanbedoneonthetableexceptselect.

http://www.indiabix.com/placementpapers/oracle/4083

9/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)
WhatareCoddRules
CoddRulesdescribetheidealnatureofaRDBMS.NoRDBMSsatisfiesallthe12coddrulesandOracleSatisfies11ofthe12rulesand
istheonlyRdbmstosatisfythemaximumnumberofrules.
WhatisNormalisation
Normalisationistheprocessoforganisingthetablestoremovetheredundancy.Therearemainly5Normalisationrules.
a)1NormalForm::Atableissaidtobein1stNormalFormwhentheattributesareatomic
b)2NormalForm::Atableissaidtobein2ndNormalFormwhenallthecandidatekeysaredependantontheprimarykey
c)3rdNormalForm::AtableissaidtobethirdNormalformwhenitisnotdependanttransitively
Likethis?+62

CognizantHiring
Nov'14
562+NewJobsForExp:5
15YearsApplyNow&get
MultipleInterviews

Readmore:
Oraclefinancialsoftwareservicesltd(ofss)Mumbai,12/11/2014
OracleFinancialServicesSoftwarePvt.Ltd.Mumbai,14thSeptember2014.
OracleFinancialServicesSoftwareKolkata,03/09/2014
OracleInterviewExperienceOFSSCoimbatore,June2014
OracleFinancialServicesSoftware(OFSS)Bangalore&14thFEB2014
OracleFinancialServicesSoftware(OFSS)Nov.2013
OracleFinancialServicesSoftwareLtd.(OFSS)Hyderabad,August17,2012
OracleFinancialServicesLtd[OFSS]Mumbai,November23,2011
ORACLEFinancialServiceInterviewExperienceCoimbatore,January23,2012
OraclefinanceInterview,Mumbai19Nov2011
OracleFinancialServicesInterviewBangalore,November1,2011
OraclefinancialservicesOct4th,2011
ORACLEFINANCIALSERVICESLTD.,CHENNAI,FEB27,2011
ORACLEPATTERN&INTERVIEW07AUG2010
ORACLEPAPER30NOV2008
ORACLEPAPER28NOV2008
ORACLEPAPER26NOV2008
ORACLEPAPER24NOV2008
ORACLEPAPER22NOV2008
ORACLEPAPER30JUL2008ANDHRAPRADESH
ORACLEPATTERN15SEP2007
ORACLEINTERVIEW2007
ORACLEINTERVIEW02AUG2007
ORACLEPAPER15SEP2007DELHI
ORACLEPAPER
ORACLEPATTERNMAY2003
ORACLEPAPER21JUN2003BANGALORE
ORACLEPATTERN12APR2003CHENNAI
ORACLEPAPER21JUN2003
ORACLEPATTERN21JUN2003
ORACLEPAPER2002WARANGAL
ORACLEPAPER21JUN2003
ORACLEPAPERJUL2003
ORACLEPAPER11JUL2003SURATHKAL
ORACLEPAPER13JUL2003CHENNAI
ORACLEPAPERAUG2003
ORACLEINTERVIEW29AUG2003

http://www.indiabix.com/placementpapers/oracle/4083

10/11

12/15/2014

ORACLEPlacementPapersOracleInterviewQuestionsAndAnswersSet7(ID4083)

20082014byIndiaBIXTechnologies.AllRightsReserved|Copyright|TermsofUse&PrivacyPolicy
Contactus:info@indiabix.com
Bookmarkto:

http://www.indiabix.com/placementpapers/oracle/4083

Followusontwitter!

11/11