<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7239803792145195288</id><updated>2026-10-03T03:18:51.575-04:00</updated><category term="FAQ"/><category term="ORACLE"/><category term="PL SQL"/><category term="PL-SQL"/><category term="PL/SQL"/><category term="PLSQL"/><category term="SQL"/><category term="database"/><category term="interview question and answer"/><category term="1NF"/><category term="2NF"/><category term="3NF"/><category term="4NF"/><category term="5NF"/><category term="AFTER Triggers"/><category term="BCNF"/><category term="BEFORE Triggers"/><category term="Cascading Triggers"/><category term="DCL"/><category term="DDL"/><category term="DKNF"/><category term="DML"/><category term="Database Trigger"/><category term="Database view"/><category term="De-normalization"/><category term="Materialized view"/><category term="Normlization"/><category term="ONF"/><category term="PLSQL function"/><category term="Row Triggers"/><category term="Statement Triggers"/><category term="TCL"/><category term="Types of Triggers"/><category term="advantage of view"/><category term="clustered index"/><category term="data control language"/><category term="data definition language"/><category term="database index"/><category term="difference between function and procedure"/><category term="disadvantage of procedure"/><category term="non clustered index"/><category term="plsql procedure"/><category term="plsql subprogram"/><category term="read only view"/><category term="triggering event"/><category term="types of oracle index"/><category term="updatable view"/><title type='text'>SQL and PL/SQL Interview Questions and Answers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-2485476790880773358</id><published>2011-10-02T23:57:00.002-04:00</published><updated>2011-10-03T00:00:29.183-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AFTER Triggers"/><category scheme="http://www.blogger.com/atom/ns#" term="BEFORE Triggers"/><category scheme="http://www.blogger.com/atom/ns#" term="Cascading Triggers"/><category scheme="http://www.blogger.com/atom/ns#" term="Database Trigger"/><category scheme="http://www.blogger.com/atom/ns#" term="Row Triggers"/><category scheme="http://www.blogger.com/atom/ns#" term="Statement Triggers"/><category scheme="http://www.blogger.com/atom/ns#" term="triggering event"/><category scheme="http://www.blogger.com/atom/ns#" term="Types of Triggers"/><title type='text'>Database Trigger</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: black; font-family: Verdana,sans-serif;&quot;&gt;
&lt;style&gt;
&lt;!--
 /* Font Definitions */
@font-face
	{font-family:Times;
	panose-1:2 0 5 0 0 0 0 0 0 0;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 0 0 0 1 0;}
@font-face
	{font-family:&quot;ＭＳ 明朝&quot;;
	mso-font-charset:78;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:1 134676480 16 0 131072 0;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 0 0 0 1 0;}
@font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 0 0 0 1 0;}
@font-face
	{font-family:Cambria;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:-536870145 1073743103 0 0 415 0;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:Cambria;
	mso-ascii-font-family:Cambria;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:&quot;ＭＳ 明朝&quot;;
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Cambria;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
h2
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:&quot;Heading 2 Char&quot;;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:2;
	font-size:18.0pt;
	font-family:Times;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;
	font-weight:bold;}
h3
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:&quot;Heading 3 Char&quot;;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:3;
	font-size:13.5pt;
	font-family:Times;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;
	font-weight:bold;}
h4
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:&quot;Heading 4 Char&quot;;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:4;
	font-size:12.0pt;
	font-family:Times;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;
	font-weight:bold;}
p
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:Times;
	mso-fareast-font-family:&quot;ＭＳ 明朝&quot;;
	mso-fareast-theme-font:minor-fareast;
	mso-bidi-font-family:&quot;Times New Roman&quot;;}
span.Heading2Char
	{mso-style-name:&quot;Heading 2 Char&quot;;
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:&quot;Heading 2&quot;;
	mso-ansi-font-size:18.0pt;
	mso-bidi-font-size:18.0pt;
	font-family:Times;
	mso-ascii-font-family:Times;
	mso-hansi-font-family:Times;
	font-weight:bold;}
span.Heading3Char
	{mso-style-name:&quot;Heading 3 Char&quot;;
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:&quot;Heading 3&quot;;
	mso-ansi-font-size:13.5pt;
	mso-bidi-font-size:13.5pt;
	font-family:Times;
	mso-ascii-font-family:Times;
	mso-hansi-font-family:Times;
	font-weight:bold;}
span.Heading4Char
	{mso-style-name:&quot;Heading 4 Char&quot;;
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:&quot;Heading 4&quot;;
	font-family:Times;
	mso-ascii-font-family:Times;
	mso-hansi-font-family:Times;
	font-weight:bold;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-family:Cambria;
	mso-ascii-font-family:Cambria;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:&quot;ＭＳ 明朝&quot;;
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Cambria;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.WordSection1
	{page:WordSection1;}
--&gt;
&lt;/style&gt;&lt;span style=&quot;font-size: small;&quot;&gt;




&lt;/span&gt;

&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Oracle allows you to
define procedures that are implicitly executed when an INSERT, UPDATE, or
DELETE statement is issued against the associated table. These procedures are
called database triggers.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Triggers can be
defined only on tables, not on views. However, triggers on the base table(s) of
a view are fired if an INSERT, UPDATE, or DELETE statement is issued against a
view.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Triggers are commonly
used to&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1)automatically
generate derived column values&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2)prevent invalid
transactions &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3)enforce complex
security authorizations&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4)enforce referential
integrity across nodes in a distributed database&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;5)enforce complex
business rules &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;6)provide transparent
event logging&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;7)provide
sophisticated auditing&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;8)maintain synchronous
table replicates &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;9)gather statistics on
table access&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Cascading Triggers:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;When a statement in a
trigger body causes another trigger to be fired, the triggers are said to be
cascading.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A trigger has three
basic parts:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A)a triggering event
or statement:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A triggering event or
statement is the SQL statement that causes a trigger to be fired. A triggering
event can be an INSERT, UPDATE, or DELETE statement on a table.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;B)a trigger
restriction:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1855&quot;&gt;&lt;/a&gt;A trigger restriction
specifies a Boolean (logical) expression that must be TRUE for the trigger to
fire. The trigger action is not executed if the trigger restriction evaluates
to FALSE or UNKNOWN.&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;C)a trigger action :-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A trigger action is
the procedure (PL/SQL block) that contains the SQL statements and PL/SQL code
to be executed when a triggering statement is issued and the trigger
restriction evaluates to TRUE.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;Types of Triggers:-&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;There
are two types of triggers:-&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;Row Triggers:&lt;span style=&quot;font-weight: normal;&quot;&gt; &lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1864&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1865&quot;&gt;&lt;/a&gt;A row trigger is fired each time the
table is affected by the triggering statement. For example, if an UPDATE
statement updates multiple rows of a table, a row trigger is fired once for
each row affected by the UPDATE statement. If a triggering statement affects no
rows, a row trigger is not executed at all. &lt;/span&gt;&amp;nbsp;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;Row triggers are useful if
the code in the trigger action depends on data provided by the triggering
statement or rows that are affected.&amp;nbsp;&lt;span style=&quot;font-weight: normal;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Statement Triggers: &lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1867&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1868&quot;&gt;&lt;/a&gt;A statement trigger is fired once on behalf of
the triggering statement, regardless of the number of rows in the table that
the triggering statement affects (even if no rows are affected). For example,
if a DELETE statement deletes several rows from a table, a statement-level
DELETE trigger is fired only once, regardless of how many rows are deleted from
the table.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Statement triggers are
useful if the code in the trigger action does not depend on the data provided
by the triggering statement or the rows affected.&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;BEFORE vs. AFTER Triggers&lt;/span&gt;&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;BEFORE Triggers &lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1871&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1872&quot;&gt;&lt;/a&gt;BEFORE triggers execute the trigger action
before the triggering statement. These triggers are used to derive specific
column values before completing a triggering INSERT or UPDATE statement.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AFTER Triggers &lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1874&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; name=&quot;index1875&quot;&gt;&lt;/a&gt;AFTER triggers execute the trigger action
after the triggering statement is executed.These triggers are used when you
want the triggering statement to complete before executing the trigger
action.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;You can create 4 types
of triggers by combinations in the following execution order:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;BEFORE statement
trigger&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;BEFORE row
trigger&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AFTER statement
trigger&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AFTER row trigger&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;B)Trigger Execution:-&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;A trigger
can be in either of two distinct modes:&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;



&lt;span style=&quot;font-size: small;&quot;&gt;enabled &lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;An enabled trigger executes its trigger action if a
triggering statement is issued and the trigger restriction (if any) evaluates
to TRUE.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;disabled &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A disabled trigger does not execute its trigger action,
even if a triggering statement is issued and the trigger restriction (if any)
would evaluate to TRUE. &lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/2485476790880773358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/10/database-trigger_02.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/2485476790880773358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/2485476790880773358'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/10/database-trigger_02.html' title='Database Trigger'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-4472000422903192985</id><published>2011-10-02T16:14:00.000-04:00</published><updated>2011-10-02T16:14:53.549-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="advantage of view"/><category scheme="http://www.blogger.com/atom/ns#" term="Database view"/><category scheme="http://www.blogger.com/atom/ns#" term="Materialized view"/><category scheme="http://www.blogger.com/atom/ns#" term="read only view"/><category scheme="http://www.blogger.com/atom/ns#" term="updatable view"/><title type='text'>Database View</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Database view:-&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;A Database View is a subset of the database sorted and displayed in a particular way. For each view, you can control which columns are 
displayed, what order they are displayed in, how wide each column is, 
how the data is sorted, and what types of records to display.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Unlike base tables in a relational database, a view does not form part of the physical schema: it is a dynamic, virtual table computed or collated from data in the database. Changing the data in a table alters the data shown&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Views can provide advantages over tables:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1)Views can represent a subset of the data contained in a table.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2)Views can join and simplify multiple tables into a single virtual table.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3)Views can act as aggregated tables, where the database engine aggregates data (sum, average etc.) and presents the calculated results as part of the data.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4)Views can hide the complexity of data; for example a view could appear as Sales2000 or Sales2001, transparently partitioning the actual underlying table.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;5)Views take very little space to store; the database contains only 
the definition of a view, not a copy of all the data it presents.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;6)Depending on the SQL engine used, views can provide extra security.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;7)Views can limit the degree of exposure of a table or tables to the outer world in subsequent invocations of the view.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Read-only_vs._updatable_views&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Read-only_vs._updatable_views&quot;&gt;Read-only vs. updatable views:-&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;Normal&quot; style=&quot;font-family: Verdana,sans-serif; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;View can be defined as read-only
 or updatable. If the database system can determine the reverse mapping 
from the view schema to the schema of the underlying base tables, then 
the view is updatable. INSERT, UPDATE, and DELETE
 operations can be performed on updatable views. Read-only views do not 
support such operations because the DBMS cannot map the changes to the 
underlying base tables. A view update is done by key preservation.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Materialized view&lt;/b&gt; :-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;The Oracle database introduced the concept of materialized views: 
pre-executed, non-virtual views commonly used in data warehousing.&quot;It is a database object that contains the results of a query. They are local copies of data located remotely, or are used to create summary tables
 based on aggregations of a table&#39;s data.&quot; Materialized views, which 
store data based on remote tables, are also known as snapshots. A snapshot can be redefined as a materialized view. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/4472000422903192985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/10/database-view.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/4472000422903192985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/4472000422903192985'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/10/database-view.html' title='Database View'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-9032677702339102232</id><published>2011-10-02T14:19:00.001-04:00</published><updated>2011-10-02T14:20:18.852-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="1NF"/><category scheme="http://www.blogger.com/atom/ns#" term="2NF"/><category scheme="http://www.blogger.com/atom/ns#" term="3NF"/><category scheme="http://www.blogger.com/atom/ns#" term="4NF"/><category scheme="http://www.blogger.com/atom/ns#" term="5NF"/><category scheme="http://www.blogger.com/atom/ns#" term="BCNF"/><category scheme="http://www.blogger.com/atom/ns#" term="De-normalization"/><category scheme="http://www.blogger.com/atom/ns#" term="DKNF"/><category scheme="http://www.blogger.com/atom/ns#" term="Normlization"/><category scheme="http://www.blogger.com/atom/ns#" term="ONF"/><title type='text'>Normalization</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt; Normalization:&lt;/span&gt;-&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Database normalization is a data design and organization process applied
 to data structures based on rules that help build relational databases.
 In relational database design, the process of organizing data to 
minimize redundancy. Normalization usually involves dividing a database 
into two or more tables and defining relationships between the tables. 
The objective is to isolate data so that additions, deletions, and 
modifications of a field can be made in just one table and then 
propagated through the rest of the database via the defined 
relationships.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Below are the different normal forms:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;1NF: Eliminate Repeating Groups&lt;/span&gt;&lt;br /&gt;
A database is said to be in First Normal Form when all entities have a unique identifier or key(primary key), and when every column in every table contains only a single value and doesn&#39;t contain a repeating group or composite field. &quot;All columns (fields) must be atomic&quot;.&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2NF: Eliminate Redundant Data&lt;/span&gt;&lt;br /&gt;
A database table is in 2NF when it is in 1NF and if all its non-prime attributes are functionally dependent on the whole of every candidate key. (A non-prime attribute is one that does not belong to any candidate key.&lt;b&gt; &lt;/b&gt;that means &quot;table should be in1NF and every non-key column is fully dependent on the (entire) primary key&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;As the First Normal
 Form deals with redundancy of data across a horizontal row, Second 
Normal Form (or 2NF) deals with redundancy of data in vertical columns.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3NF: Eliminate Columns Not Dependent On Key&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
A database is in Third Normal Form when it is in Second Normal Form and each column that isn&#39;t part of the primary key doesn&#39;t depend on another column that isn&#39;t part of the primary key.All attributes must be directly dependent on the primary key.&quot;In 2NF and every non-key column is mutually independent.&quot;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;BCNF: Boyce-Codd Normal Form&lt;/span&gt;&lt;br /&gt;
If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;4NF: Isolate Independent Multiple Relationships&lt;/span&gt;&lt;br /&gt;
No table may contain two or more 1:n or n:m relationships that are not directly related. &quot;Remove the multivalued dependency.&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;5NF: Isolate Semantically Related Multiple Relationships &lt;/span&gt;&lt;br /&gt;
There may be practical constrains on information that justify separating logically related many-to-many relationships.&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=7239803792145195288&quot; style=&quot;color: black;&quot;&gt; A &lt;/a&gt;table is said to be in the 5NF if and only if every join dependency in it is implied by the candidate keys&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;ONF: Optimal Normal Form&lt;/span&gt;&lt;br /&gt;
A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;DKNF: Domain-Key Normal Form&lt;/span&gt;&lt;br /&gt;
A model free from all modification anomalies.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;De-normalization:-&lt;/b&gt;&lt;br /&gt;
It is the reverse process of 
normalization. It is the controlled introduction of redundancy in to the database 
design. It helps improve the query performance as the number of joins could be 
reduced.&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;When not to normalize:-&lt;/b&gt;&lt;br /&gt;
1)Want to keep tables simple so user can make their own queries&lt;br /&gt;
2)Avoid processing multiple tables&lt;br /&gt;
3)whenever performance issues.Testing shows Normalization has poorer performance&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/9032677702339102232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/10/normalization.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/9032677702339102232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/9032677702339102232'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/10/normalization.html' title='Normalization'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-9167665546853673778</id><published>2011-09-28T16:19:00.000-04:00</published><updated>2011-09-28T22:11:20.698-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data control language"/><category scheme="http://www.blogger.com/atom/ns#" term="data definition language"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="DCL"/><category scheme="http://www.blogger.com/atom/ns#" term="DDL"/><category scheme="http://www.blogger.com/atom/ns#" term="DML"/><category scheme="http://www.blogger.com/atom/ns#" term="FAQ"/><category scheme="http://www.blogger.com/atom/ns#" term="interview question and answer"/><category scheme="http://www.blogger.com/atom/ns#" term="ORACLE"/><category scheme="http://www.blogger.com/atom/ns#" term="PL SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL-SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL/SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PLSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="TCL"/><title type='text'></title><content type='html'>&lt;h3 class=&quot;post-title entry-title&quot;&gt;



SQL DDL, DML, DCL and TCL Commands
&lt;/h3&gt;
&lt;div class=&quot;post-header&quot;&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;


&lt;a href=&quot;http://venu-oracleapps.blogspot.com/2011/03/ddl-dml-dcl-and-tcl-commands.html&quot; name=&quot;DDL&quot;&gt;DDL&lt;/a&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Data Definition Language&lt;/span&gt; (DDL) statements are used to define the database structure or schema. Some examples:  &lt;/div&gt;
&lt;ul class=&quot;bb-list&quot; style=&quot;list-style-type: circle; text-align: left;&quot;&gt;
&lt;li&gt;CREATE - to create objects in the database&lt;/li&gt;
&lt;li&gt;ALTER - alters the structure of the database&lt;/li&gt;
&lt;li&gt;DROP - delete objects from the database&lt;/li&gt;
&lt;li&gt;TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed&lt;/li&gt;
&lt;li&gt;COMMENT - add comments to the data dictionary&lt;/li&gt;
&lt;li&gt;RENAME - rename an object&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;


&lt;a href=&quot;http://venu-oracleapps.blogspot.com/2011/03/ddl-dml-dcl-and-tcl-commands.html&quot; name=&quot;DML&quot;&gt;DML&lt;/a&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Data Manipulation Language&lt;/span&gt; (DML) statements are used for managing data within schema objects. Some examples:  &lt;/div&gt;
&lt;ul class=&quot;bb-list&quot; style=&quot;list-style-type: circle; text-align: left;&quot;&gt;
&lt;li&gt;SELECT - retrieve data from the a database&lt;/li&gt;
&lt;li&gt;INSERT - insert data into a table&lt;/li&gt;
&lt;li&gt;UPDATE - updates existing data within a table&lt;/li&gt;
&lt;li&gt;DELETE - deletes all records from a table, the space for the records remain&lt;/li&gt;
&lt;li&gt;MERGE - UPSERT operation (insert or update)&lt;/li&gt;
&lt;li&gt;CALL - call a PL/SQL or Java subprogram&lt;/li&gt;
&lt;li&gt;EXPLAIN PLAN - explain access path to data&lt;/li&gt;
&lt;li&gt;LOCK TABLE - control concurrency&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;


&lt;a href=&quot;http://venu-oracleapps.blogspot.com/2011/03/ddl-dml-dcl-and-tcl-commands.html&quot; name=&quot;DCL&quot;&gt;DCL&lt;/a&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Data Control Language&lt;/span&gt; (DCL) statements. Some examples:  &lt;/div&gt;
&lt;ul class=&quot;bb-list&quot; style=&quot;list-style-type: circle; text-align: left;&quot;&gt;
&lt;li&gt;GRANT - gives user&#39;s access privileges to database&lt;/li&gt;
&lt;li&gt;REVOKE - withdraw access privileges given with the GRANT command&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;


&lt;a href=&quot;http://venu-oracleapps.blogspot.com/2011/03/ddl-dml-dcl-and-tcl-commands.html&quot; name=&quot;TCL&quot;&gt;TCL&lt;/a&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Transaction Control&lt;/span&gt;
 (TCL) statements are used to manage the changes made by DML statements.
 It allows statements to be grouped together into logical transactions. &lt;/div&gt;
&lt;ul class=&quot;bb-list&quot; style=&quot;list-style-type: circle; text-align: left;&quot;&gt;
&lt;li&gt;COMMIT - save work done&lt;/li&gt;
&lt;li&gt;SAVEPOINT -  identify a point in a transaction to which you can later roll back&lt;/li&gt;
&lt;li&gt;ROLLBACK - restore database to original since the last COMMIT&lt;/li&gt;
&lt;li&gt;SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/9167665546853673778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/09/sql-ddl-dml-dcl-and-tcl-commands-ddl.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/9167665546853673778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/9167665546853673778'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/09/sql-ddl-dml-dcl-and-tcl-commands-ddl.html' title=''/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-7408860055975952186</id><published>2011-09-28T14:46:00.000-04:00</published><updated>2011-09-28T22:11:40.626-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="clustered index"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="database index"/><category scheme="http://www.blogger.com/atom/ns#" term="FAQ"/><category scheme="http://www.blogger.com/atom/ns#" term="interview question and answer"/><category scheme="http://www.blogger.com/atom/ns#" term="non clustered index"/><category scheme="http://www.blogger.com/atom/ns#" term="ORACLE"/><category scheme="http://www.blogger.com/atom/ns#" term="PL SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL-SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL/SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PLSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="types of oracle index"/><title type='text'>Database Indexes</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
A &lt;b&gt;database index&lt;/b&gt; is a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space.By default, Oracle creates B-tree indexes.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
Types of Index&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
A)Clustered Index&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
B)Non Clustered Index &lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Clustered Index:-&lt;/b&gt; Clustering alters the data block into a certain distinct order to match 
the index, resulting in the row data being stored in order. Therefore, 
only one clustered index can be created on a given database table. &lt;/div&gt;
&lt;ul style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;li&gt;Typically created on primary key column. &lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Non Clustered Index:-&lt;/b&gt;The data is present in random order, but the logical ordering is 
specified by the index. The data rows may be randomly spread throughout 
the table. The non-clustered index tree contains the index keys in 
sorted order, with the leaf level of the index containing the pointer to
 the page and the row number in the data page&lt;/div&gt;
&lt;ul style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;li&gt;The physical order of the rows is not the same as the index order.&lt;/li&gt;
&lt;li&gt;Typically created on column used in JOIN, WHERE, and ORDER BY clauses. &lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Difference between Clustered and non Clustered Index:-&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
1)Clustered indices can greatly increase overall speed of retrieval, but 
usually only where the data is accessed sequentially in the same or 
reverse order of the clustered index, or when a range of items is 
selected.Non Clustered index is Good for tables whose values may be modified frequently. &lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
2) Clustered index usually saved in side the table however non Clustered Index saved in separate tables in database.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
There are multiple ways to implement Index:-&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;1)Bitmap Index:-&lt;/b&gt;A bitmap index is a special kind of index that stores the bulk of its data as bitmaps and answers most queries by performing bitwise logical operations on these bitmaps. The most commonly used index, such as B+tree are most efficient if the values it indexes do not repeat or repeat a smaller number of times&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;2)B-tree Index:-&lt;/b&gt;By default, the Oracle creates a b_tree index.&amp;nbsp; In 
          a b-tree, you walk the branches until you get to the node that has the 
          data you want to use.&amp;nbsp; In the classic b-tree structure, there are 
          branches from the top that lead to leaf nodes that contain the data.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;3)Dense Index:-&lt;/b&gt; A dense index in database is a file with pairs of keys and pointers for every record&amp;nbsp; in the data file. Every key in this file is associated with a particular pointer to &lt;i&gt;a record&lt;/i&gt; in the sorted data file. In clustered indices with duplicate keys, the dense index points &lt;i&gt;to the first record&lt;/i&gt; with that key.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;4)Sparse Index:-&lt;/b&gt;A sparse index in databases is a file with pairs of keys and pointers for every block in the data file. Every key in this file is associated with a particular pointer &lt;i&gt;to the block&lt;/i&gt; in the sorted data file. In clustered indices with duplicate keys, the sparse index points &lt;i&gt;to the lowest search key&lt;/i&gt; in each block. primary key is a sparse index.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;5)Reverse Index:- &lt;/b&gt;reverse key index reverses the key value before entering it in the 
index. E.g., the value 24538 becomes 83542 in the index. Reversing the 
key value is particularly useful for indexing data such as sequence 
numbers, where new key values monotonically increase.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;6)Function based Index:- &lt;/b&gt;An index is defined
   on the result of a function applied to one or more columns of a
   single table.  Functional indexes can be used to obtain fast access
   to data based on the result of function calls.
   &lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
Ex:-This query can use an index, if one has been
   defined on the result of the &lt;b&gt;lower(coll) &lt;/b&gt;operation:&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;PROGRAMLISTING&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt;CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));&lt;/pre&gt;
&lt;pre class=&quot;PROGRAMLISTING&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt; &lt;/pre&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
The function in the index definition can take more than one
   argument, but they must be table columns, not constants.
   Functional indexes are always single-column (namely, the function
   result) even if the function uses more than one input field; there
   cannot be multi column indexes that contain function calls.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Advantage of Index:-&amp;nbsp;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;ol style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;li&gt;Faster retrieval of data. Increased performance.There is no need to access a row in 
the database from an index structure, so you can reduce the total
              number of I/O operations needed to retrieve data.&lt;br /&gt;
            &lt;/li&gt;
&lt;li&gt;
              Presorted data-The data in the leaf nodes is already sorted by the value of the primary key.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Disadvantages of Index:-&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;ol style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;li&gt;
              You must have a primary key on the table with a unique value.
            &lt;/li&gt;
&lt;li&gt;
              You cannot have any other indexes on the data.
            &lt;/li&gt;
&lt;li&gt;
              You cannot partition an index-organized table.
            &lt;/li&gt;
&lt;li&gt;
              An index-organized table cannot be a part of a cluster.
            &lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;font-family: Verdana,sans-serif;&quot;&gt;




&lt;span class=&quot;mw-headline&quot; id=&quot;Types_of_Indexes&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/7408860055975952186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/09/database-indexes.html#comment-form' title='51 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/7408860055975952186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/7408860055975952186'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/09/database-indexes.html' title='Database Indexes'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>51</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239803792145195288.post-6926510712606259140</id><published>2011-09-28T00:53:00.001-04:00</published><updated>2011-09-28T22:11:49.763-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="difference between function and procedure"/><category scheme="http://www.blogger.com/atom/ns#" term="disadvantage of procedure"/><category scheme="http://www.blogger.com/atom/ns#" term="FAQ"/><category scheme="http://www.blogger.com/atom/ns#" term="interview question and answer"/><category scheme="http://www.blogger.com/atom/ns#" term="ORACLE"/><category scheme="http://www.blogger.com/atom/ns#" term="PL SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL-SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PL/SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PLSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PLSQL function"/><category scheme="http://www.blogger.com/atom/ns#" term="plsql procedure"/><category scheme="http://www.blogger.com/atom/ns#" term="plsql subprogram"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>PL/SQL Function and Procedure</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Stored Procedure:-&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
A
 Stored procedure is named PL/SQL block which perform one or more 
specific task.A procedure has a header and a body. The header consists 
of the name 
of the procedure and the parameters or variables passed to the 
procedure. The body consists or declaration section, execution section 
and exception section similar to a general PL/SQL Block.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
We can pass parameters to procedures in three ways. &lt;br /&gt;
1) IN-parameters&lt;br /&gt;
2) OUT-parameters&lt;br /&gt;
3) IN OUT-parameters&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Function:- &lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
A
 function is a named PL/SQL Block which is similar to a procedure.The 
major difference between a procedure and a function is, a function 
must always return a value, but a procedure may or may not return a 
value.&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
You can call your function in multiple ways like following:-&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
1)  Since a function returns a value we can assign it to a variable.&lt;/div&gt;
&lt;pre class=&quot;style1&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt;   employee_name :=  employer_details_func;&lt;/pre&gt;
&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;2) As a part of a SELECT statement
              &lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;style1&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt;  SELECT employer_details_func FROM dual; &lt;/pre&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
3) In  a PL/SQL Statements like,&lt;/div&gt;
&lt;pre class=&quot;style1&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt;  dbms_output.put_line(employer_details_func);&lt;/pre&gt;
&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                This line displays the value returned by the function.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;u&gt;Difference between function and procedure&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
1. Function is mainly used in the case where it must return a value. 
Where as a procedure may or may not return a value or may return more 
than one value using the OUT parameter.&lt;br /&gt;
&lt;br /&gt;
2. Function can be called from SQL statements where as procedure can not be called from the sql statements &lt;br /&gt;
&lt;br /&gt;
3. Functions are normally used for computations where as procedures are normally used for executing business logic. &lt;br /&gt;
&lt;br /&gt;
4. You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query.&lt;br /&gt;
&lt;br /&gt;
5.&amp;nbsp;Function returns 1 value only. Procedure can return multiple values (max 1024). &lt;br /&gt;
&lt;br /&gt;
6.Stored
 Procedure: supports deferred name resolution. Example while writing a 
stored procedure that uses table named table1 and table2 etc..but actually
 not exists in database is allowed only in during creation but runtime 
throws error Function wont support deferred name resolution. &lt;br /&gt;
&lt;br /&gt;
7.Stored
 procedure returns always integer value by default zero. where as 
function return type could be scalar or table or table values&lt;br /&gt;
&lt;br /&gt;
8. Stored procedure is precompiled execution plan where as functions are not.&lt;br /&gt;
&lt;br /&gt;
9.A
 procedure may modify an object where a function can only return a value
 The RETURN statement immediately completes the execution of a 
subprogram and returns control to the caller&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Advantages and Comparison of Stored Procedure/Function with normal SQL:-&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Overhead:&lt;/b&gt; Stored procedure statements are stored directly in the database, they &lt;i&gt;may&lt;/i&gt;
 remove all or part of the compilation overhead that is typically 
required in situations where software applications send inline (dynamic)
 SQL queries to a database.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&amp;nbsp;In addition, while they avoid some overhead, pre-compiled SQL 
statements add to the complexity of creating an optimal execution plan 
because not all arguments of the SQL statement are supplied at compile 
time. Depending on the specific database implementation and 
configuration, mixed performance results will be seen from stored 
procedures versus generic queries or user defined functions.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Avoidance of network traffic:&lt;/b&gt; A major advantage with stored 
procedures is that they can run directly within the database engine. The benefit here is that network communication 
costs can be avoided completely. This becomes particularly important for
 complex series of SQL statements.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Encapsulation of business logic:&lt;/b&gt; Stored procedures allow programmers to embed business logic an API in the database, which can simplify data management and 
reduce the need to encode the logic elsewhere in client programs. The database system can ensure data integrity and consistency 
with the help of stored procedures.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Delegation of access-rights:&lt;/b&gt; In many systems, stored 
procedures can be granted access rights to the database that users who 
execute those procedures do not directly have.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Some protection from SQL injection attacks:&lt;/b&gt; Stored procedures 
can be used to protect against injection attacks. Stored procedure 
parameters will be treated as data even if an attacker inserts SQL 
commands. Also, some DBMSs will check the parameter&#39;s type.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;u&gt;&lt;b&gt;Disadvantage of procedure/functions:-&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Vender Specific:-&lt;/b&gt;Stored procedure languages are quite often vendor-specific. Switching to
 use another vendor&#39;s database most likely requires rewriting any 
existing stored procedures.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Restricted Overloading Functionality:-&lt;/b&gt; &lt;span class=&quot;DNNAlignleft&quot; id=&quot;dnn_ctr1652_ContentPane&quot;&gt;&lt;span class=&quot;Normal&quot;&gt;Procedure
 and function overloading is available only within database packages or 
as PL/SQL sub-blocks. Database stored procedures cannot be overloaded. 
If you try to add a second overloaded stored procedure with the same 
procedure identifier, an error will result.&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;Disabled Procedure:-&lt;/b&gt;&lt;span class=&quot;DNNAlignleft&quot; id=&quot;dnn_ctr1652_ContentPane&quot;&gt;&lt;span class=&quot;Normal&quot;&gt;Database
 procedures can be accidentally dropped by a person with sufficient 
privilege. This is nothing new, except that there is no practical way of
 writing application code to detect inoperable procedure(s). Since SQL 
and PL/SQL are interpreted languages, an invalid or missing stored 
procedure is not detectable until module run-time. When the error is 
encountered, a confusing, cryptic database error results that is of very
 little help to the average application user.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;DNNAlignleft&quot; id=&quot;dnn_ctr1652_ContentPane&quot;&gt;&lt;span class=&quot;Normal&quot;&gt;Automatic dependency tracking:-&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;DNNAlignleft&quot; id=&quot;dnn_ctr1652_ContentPane&quot; style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;Normal&quot;&gt;When
 a simple DDL operation, such as adding a new column to an existing 
table, is performed, many stored procedures are marked as needing 
recompilation. What is not provided is the ability to recompile all 
these dependencies in a single action or to ascertain which procedures 
are, in fact, invalid. Other than compiling each object one at a time 
and checking its results, we have no way of determining the effect of a 
DDL modification.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://database-explained.blogspot.com/feeds/6926510712606259140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://database-explained.blogspot.com/2011/09/plsql-function-and-procedure.html#comment-form' title='48 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/6926510712606259140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239803792145195288/posts/default/6926510712606259140'/><link rel='alternate' type='text/html' href='http://database-explained.blogspot.com/2011/09/plsql-function-and-procedure.html' title='PL/SQL Function and Procedure'/><author><name>jksolutions</name><uri>http://www.blogger.com/profile/01556365883008986930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>48</thr:total></entry></feed>