<?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-9172542891636300390</id><updated>2024-09-13T20:26:25.544+01:00</updated><title type='text'>Online Oracle PL SQL Tutorials</title><subtitle type='html'>Complete Oracle PL/SQL tutorials for beginners</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-8296115948089579310</id><published>2011-08-29T11:24:00.000+01:00</published><updated>2011-08-29T11:24:58.891+01:00</updated><title type='text'>PL/SQL Identifiers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Identifiers are names for PL/SQL objects such as constants,variables, exceptions, procedures, cursors, and reserved words.&lt;br /&gt;
&lt;br /&gt;
Identifiers have the following characteristics:&lt;br /&gt;
• Can be up to 30 characters in length&lt;br /&gt;
• Cannot include whitespace (space, tab, carriage return)&lt;br /&gt;
• Must start with a letter&lt;br /&gt;
• Can include a dollar sign ($), an underscore (_), and a&lt;br /&gt;
pound sign (#)&lt;br /&gt;
• Are not case-sensitive&lt;br /&gt;
&lt;br /&gt;
You shouln&#39;t use the&amp;nbsp; PL/SQL’s reserved words as identifiers in your programs as this can result in compilation or runtime errors that are difficult to troubleshoot.&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/8296115948089579310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/plsql-identifiers.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/8296115948089579310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/8296115948089579310'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/plsql-identifiers.html' title='PL/SQL Identifiers'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-1263138722375469149</id><published>2011-08-28T15:15:00.000+01:00</published><updated>2011-08-28T15:15:52.480+01:00</updated><title type='text'>Predefined Exceptions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;We discussed in the previous article (&lt;a href=&quot;http://online-plsql-tutorials.blogspot.com/2011/08/exception-handling.html&quot;&gt;Expection Handling&lt;/a&gt;) that the exceptions can be either System pre-defined exceptions or User defined excpetions. Lets have a look on commonly used pre-defined exceptions with there error numbers:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 343px;&quot;&gt;&lt;colgroup&gt;&lt;col style=&quot;mso-width-alt: 9179; mso-width-source: userset; width: 188pt;&quot; width=&quot;251&quot;&gt;&lt;/col&gt;  &lt;col style=&quot;mso-width-alt: 3364; mso-width-source: userset; width: 69pt;&quot; width=&quot;92&quot;&gt;&lt;/col&gt;  &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl63&quot; height=&quot;20&quot; style=&quot;height: 15.0pt; width: 188pt;&quot; width=&quot;251&quot;&gt;&lt;b&gt;Named   Exception&lt;/b&gt;&lt;/td&gt;   &lt;td class=&quot;xl63&quot; style=&quot;border-left: none; width: 69pt;&quot; width=&quot;92&quot;&gt;&lt;b&gt;Error Number&lt;/b&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;DUP_VAL_ON_INDEX&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-00001&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;TIMEOUT_ON_RESOURCE&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-00051&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;TRANSACTION_BACKED_OUT&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-00061&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;INVALID_CURSOR&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01001&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;NOT_LOGGED_ON&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01012&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;LOGIN_DENIED&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01017&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;NO_DATA_FOUND&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01403&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;SYS_INVALID_ROWID&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01410&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;TOO_MANY_ROWS&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01422&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;ZERO_DIVIDE&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01476&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;USERENV_COMMMITSCN_ERROR&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01725&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;INVALID_NUMBER&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-01722&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;STORAGE_ERROR&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06500&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;PROGRAM_ERROR&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06501&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;VALUE_ERROR&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06502&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;ROWTYPE_MISMATCH&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06504&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;CURSOR_ALREADY_OPEN&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06511&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;ACCESS_INTO_NULL&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06530&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;COLLECTION_IS_NULL&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06531&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;SUBSCRIPT_OUTSIDE_LIMIT&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06532&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;SUBSCRIPT_BEYOND_COUNT&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06533&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;NO_DATA_NEEDED&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06548&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;CASE_NOT_FOUND&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-06592&lt;/td&gt;  &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;   &lt;td class=&quot;xl64&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;SELF_IS_NULL&lt;/td&gt;   &lt;td class=&quot;xl64&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;ORA-30625&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&amp;nbsp;One type of exception can be defined once in a block but different type of exceptions can be raised in the same block. And nested blocks can be used to specify same exception to handle in different ways.&lt;br /&gt;
For Ex:&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;DECLARE&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Declaration section;&lt;br /&gt;
BEGIN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Executable statements ;&lt;br /&gt;
EXCEPTION&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN ex_name1 THEN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error handling statements;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN ex_name2 THEN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error handling statements ;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN Others THEN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error handling statements ;&lt;br /&gt;
END;&lt;/i&gt;&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/1263138722375469149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/predefined-exceptions.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1263138722375469149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1263138722375469149'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/predefined-exceptions.html' title='Predefined Exceptions'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-2776904105425363877</id><published>2011-08-25T20:12:00.001+01:00</published><updated>2011-08-25T20:14:00.450+01:00</updated><title type='text'>Exception handling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
An Exception is an error or warning situation, which occurs during program Execution. Ideally these situations should not occur in program.&lt;br /&gt;
&lt;br /&gt;
The exceptions can be defined as follows:&lt;br /&gt;
•System-defined or pre-defined exception&lt;br /&gt;
•User-defined exception&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;DECLARE&lt;br /&gt;
Declaration section;&lt;br /&gt;
BEGIN&lt;br /&gt;
Executable statements ;&lt;br /&gt;
EXCEPTION&lt;br /&gt;
WHEN ex_name1 THEN&lt;br /&gt;
Error handling statements;&lt;br /&gt;
WHEN ex_name2 THEN&lt;br /&gt;
Error handling statements ;&lt;br /&gt;
WHEN Others THEN&lt;br /&gt;
Error handling statements ;&lt;br /&gt;
END;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
•System-defined or pre-defined exception raised automatically by the oracle runtime engine whenever it detects an error condition , also known as NAMED SYSTEM EXCEPTION &lt;br /&gt;
•Unexpected Oracle errors can be Handled using OTHERS handler,also known as UNNAMED SYSTEM EXCEPTION&lt;br /&gt;
•Predefined exception handlers are declared globally in package STANDARD.&lt;br /&gt;
•Some of the pre-defined Exceptions are as follows:&lt;br /&gt;
1.CURSOR_ALREADY_OPEN&lt;br /&gt;
2.INVALID_CURSOR&lt;br /&gt;
3.TOO_MANY_ROWS&lt;br /&gt;
4.DUP_VAL_ON_INDEX&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Handling Un-named Exception&lt;/b&gt;&lt;br /&gt;
•There are two ways to handle unnamed system exceptions:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.WHEN OTHERS clause&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.Associate the System exception code to a name and use it as a named exception&lt;br /&gt;
•We can assign a name to unnamed system exceptions using a Pragma called EXCEPTION_INIT.&lt;br /&gt;
•EXCEPTION_INIT will associate a predefined Oracle error number to a programmer defined exception name&lt;br /&gt;
&lt;br /&gt;
Steps to be followed to use unnamed system exceptions are&lt;br /&gt;
1.They are raised implicitly.&lt;br /&gt;
2.If it is not handled in WHEN Others, it must be handled explicitly.&lt;br /&gt;
3.To handle the exception explicitly, Pragma EXCEPTION_INIT must be used.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Uses of EXCEPTION_INIT&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
•Giving Names to otherwise system anonymous exceptions.&lt;br /&gt;
•Assigning names to the application specific errors you raise using RAISE_APPLICATION_ERROR, this allows you to handle such errors by name, rather than simply by number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Raising Exceptions:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are 3 ways that an Exception may be raised in Your Application:&lt;br /&gt;
1.Implicitly by Oracle&lt;br /&gt;
2.By Using RAISE Statement&lt;br /&gt;
3.Using RAISE_APPLICATION_ERROR built-in procedure&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;RAISE statement&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Following are the forms of RAISE Statement:&lt;br /&gt;
1.RAISE exception_name;&lt;br /&gt;
2.RAISE package_name.exception_name;&lt;br /&gt;
3.RAISE;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Scope of Exception Handling&lt;/b&gt;&lt;br /&gt;
–Once an exception is raised in a block, that block&#39;s executable section closes. But you get to decide what constitutes a block&lt;br /&gt;
- If an exception propagates out of the outermost block, then that exception goes un handled&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/2776904105425363877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/exception-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2776904105425363877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2776904105425363877'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/exception-handling.html' title='Exception handling'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-1775190444471374127</id><published>2011-08-24T22:36:00.000+01:00</published><updated>2011-08-24T22:36:14.576+01:00</updated><title type='text'>PL/SQL Introduction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;PL/SQL- PLSQL stands for &quot;Procedural Language/Structured Query Language&quot;. PL SQL is closely integrated into the SQL language, yet it adds programming constructs that are not native to SQL. PL/SQL also implements basic exception handling. It supports variables, conditions, loops and arrays.Each PL/SQL program like procedures,functions, packages consists of SQL and PL/SQL statements which form a PL/SQL block.&lt;br /&gt;
&lt;br /&gt;
A PL/SQL Block consists of three sections: &lt;br /&gt;
The Declaration section . &lt;br /&gt;
The Execution section . &lt;br /&gt;
The Exception Handling section .&lt;br /&gt;
&lt;br /&gt;
These blocks are mainly bounded by 4 keyword:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;DECLARE: DECLARE is the keyword that will specify declaration section.This is section where we will declare the data type definitions, variables, embedded functions, and procedures. &lt;/li&gt;
&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;BEGIN: BEGIN  is the keyword that marks the start of executable section. We must have at least one line of executable code, even if it’s the keyword NULL, which means no operation.&lt;/li&gt;
&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;EXCEPTION:is the keyword where exception-handling section starts.This is where we will catch any database or PL/SQL errors orexceptions&lt;/li&gt;
&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;END: is the keyword to mark the end of the PL/SQL block. &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/1775190444471374127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/plsql-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1775190444471374127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1775190444471374127'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/plsql-introduction.html' title='PL/SQL Introduction'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-7693325931699637792</id><published>2011-08-21T20:41:00.000+01:00</published><updated>2011-08-21T20:41:05.522+01:00</updated><title type='text'>Sequences (Identity)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Most of the tables consist of an ID or identity column to identify the rows into the table. Microsoft SQL has an defined property IDENTITY column that increment the value automatically when the data is inserted into the table.&lt;br /&gt;
But Oracle don&#39;t have any similar property defined but not to worry this can be achived by the help of SEQUENCES.&lt;br /&gt;
&lt;br /&gt;
Lets consider the table&amp;nbsp; Employee (&lt;br /&gt;
ID,&lt;br /&gt;
Name,&lt;br /&gt;
Department)&lt;br /&gt;
&lt;br /&gt;
Now this table cointains ID and if want to always insert the next value after the maximum value present in table we can achieve this with the help of sequences.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
CREATE SEQUENCE &amp;lt;sequence_name&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MINVALUE &amp;lt;value&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXVALUE &amp;lt;value&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; START WITH &amp;lt;value&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; INCREMENT BY &amp;lt;value&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CACHE &amp;lt;value&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&amp;lt;sequence_name&amp;gt; : is name for the sequence&lt;br /&gt;
MINVALUE : is the minimum value for the column&lt;br /&gt;
MAXVALUE: is the maximum value for the column by default it will be 999999999999999999999999999&lt;br /&gt;
START WITH: is the starting value&lt;br /&gt;
INCREMENT BY: is the value by the which the current value will be inceremented to get the next value&lt;br /&gt;
CACHE : is number of records that should stay in cache for perfomance&lt;br /&gt;
&lt;br /&gt;
For ex:&lt;br /&gt;
CREATE SEQUENCE Employee_seq_id&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MINVALUE 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXVALUE 99999999&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; START WITH 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; INCREMENT BY 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CACHE 100 ;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO EMPLOYEE&lt;br /&gt;
VALUES(Employee_seq_id.nextval, &#39;John&#39;,&#39;Sales&#39;)&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
nextval will return the next value that should be inserted into the ID column&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/7693325931699637792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/sequences-identity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7693325931699637792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7693325931699637792'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/sequences-identity.html' title='Sequences (Identity)'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-4536404011934334822</id><published>2011-08-21T17:56:00.001+01:00</published><updated>2011-08-21T17:58:49.180+01:00</updated><title type='text'>Comments</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Comments can be inserted in the plsql scripts in three ways:&lt;br /&gt;
&lt;br /&gt;
1. REM[ARK] command: REM Command can be ued in the PL*SQL to comment a single line&lt;br /&gt;
For ex:&lt;br /&gt;
REM This is PL*SQL comment for reports &lt;br /&gt;
&lt;br /&gt;
2. -- : The symbol -- can also be used to comment a single line&lt;br /&gt;
For ex:&lt;br /&gt;
-- This is PL*SQL comment for reports &lt;br /&gt;
&lt;br /&gt;
3. /*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */ : For mulitple line comments /*&amp;nbsp; &amp;lt;multiple line comments&amp;gt; */ can be used&lt;br /&gt;
For ex:&lt;br /&gt;
/* This is PL*SQL comment for reports&lt;br /&gt;
We can put multiple lines in it */ &lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/4536404011934334822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/comments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/4536404011934334822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/4536404011934334822'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/comments.html' title='Comments'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-774526677592815203</id><published>2011-08-21T00:16:00.000+01:00</published><updated>2011-08-21T00:16:05.887+01:00</updated><title type='text'>Views</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;View is a representation of collection of data from one or more tables. It usually consist of SQL select statement to select data from combination of related tables but can also be used to update , insert &amp;nbsp; and delete data from the tables.&lt;br /&gt;
Now the question is when we are using the SQL statements only why we need Views? Answer is:&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt; Security :&amp;nbsp; With the help of views you can restrict and manage what data and fields from a single or multiple tables the users should be able to see. &lt;/li&gt;
&lt;li&gt;Repetitive code:&amp;nbsp; If some code needs to be used mutiple times its better to save as views so that every time the same need not to written again.&lt;/li&gt;
&lt;li&gt;Code Manageability : Views help in managing the code in structured and consistent way.&lt;/li&gt;
&lt;/ol&gt;Syntax:&lt;br /&gt;
CREATE [OR REPLACE] VIEW &amp;lt;view_name&amp;gt; AS&lt;br /&gt;
&amp;lt;sql_select_statement&amp;gt;;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;/ol&gt;Here:&lt;br /&gt;
&amp;nbsp;&amp;lt;view_name&amp;gt;: is the name of the view&lt;br /&gt;
&amp;lt;sql_select_statement&amp;gt;:&amp;nbsp; SQL SELECT statement against one or more tables in the database. &lt;br /&gt;
&lt;br /&gt;
For Ex:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Create or replace view employee_department&lt;br /&gt;
AS&lt;br /&gt;
SELECT emp.name,&lt;br /&gt;
emp.empID,&lt;br /&gt;
dept.name&lt;br /&gt;
FROM EMPLOYEE emp,&lt;br /&gt;
DEPARTMENT dept&lt;br /&gt;
Where emp.deptid = dept.id&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/774526677592815203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/views.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/774526677592815203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/774526677592815203'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/views.html' title='Views'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-6146444087599189330</id><published>2011-08-14T21:53:00.000+01:00</published><updated>2011-08-14T21:53:15.833+01:00</updated><title type='text'>Delete &amp; Rollback</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Lets delete for some unwanted data from the table&lt;br /&gt;
&lt;br /&gt;
Syntax: &lt;br /&gt;
&lt;i&gt;DELETE FROM &amp;lt;table_name&amp;gt;&lt;br /&gt;
WHERE &amp;lt;column_name_N&amp;gt; = &amp;lt;column_value_N&amp;gt;...;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&amp;lt;table name&amp;gt; is the table from where the date needs to be deleted&lt;br /&gt;
&lt;i&gt;&amp;lt;column_name_N&amp;gt; is the condition for which the data needs to be deleted&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Now what if you delete data by mistake. Don&#39;t worry until you do the COMMIT we can still undo the delte by the&amp;nbsp; ROLLBACK command.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
ROLLBACK;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/6146444087599189330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/delete-rollback.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/6146444087599189330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/6146444087599189330'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/delete-rollback.html' title='Delete &amp; Rollback'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-7715105315271231104</id><published>2011-08-14T20:40:00.002+01:00</published><updated>2011-08-14T20:47:46.826+01:00</updated><title type='text'>Update</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;We learned how to insert and select data, now lets discuss how to update the existing data in the table. Having learned the select statement it easy top use the Update statement as there is just a slight change in the syntax.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
UPDATE &amp;lt;table_name&amp;gt;&lt;br /&gt;
SET &amp;lt;column_name_1&amp;gt; = &amp;lt;column_value_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt; = &amp;lt;column_value_2&amp;gt;,...&lt;br /&gt;
&amp;lt;column_name_N&amp;gt; = &amp;lt;column_value_N&amp;gt;&lt;br /&gt;
WHERE &amp;lt;column_name_M&amp;gt; = &amp;lt;value&amp;gt; ;&lt;br /&gt;
COMMIT; &lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
UPDATE: is commend for updating the data&lt;br /&gt;
SET: is the keyword for setting the value for the column&lt;br /&gt;
&lt;br /&gt;
Update is used quite similar to the Select statement and joins (discussed in joins) can also be used with the update statement as with select.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/7715105315271231104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/update.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7715105315271231104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7715105315271231104'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/update.html' title='Update'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-4428561550229609526</id><published>2011-08-14T13:31:00.000+01:00</published><updated>2011-08-14T13:31:30.449+01:00</updated><title type='text'>Joins</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;text-align: left;&quot;&gt;We discussed earlier how to select data from a single table. Now what if we want to select data from multiple related tables. For ex lets say we have below 2 tables:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt; &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt; Table 1: Employee&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table 2 :&amp;nbsp; Department&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Columns&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Columns&amp;nbsp; &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;EmpID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DepartmentID&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt; EmpName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DepartmentName&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;DepartmentId &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Now if we want to see the Employee&#39;s name the department name which he belongs to, this can be accomplished by using the joins with the select statement.&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;INNER or Simple joins&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Syntax: &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;SELECT &amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;table_name_1&amp;gt; ,&lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;WHERE&amp;nbsp; &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_1&amp;gt;.&amp;lt;column_name&amp;gt; = &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;.&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt; [ORDER BY &amp;lt;order_by_column_name_N&amp;gt;]; &lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;OR&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;SELECT &amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;table_name_1&amp;gt;&amp;nbsp; JOIN &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;ON&amp;nbsp; &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_1&amp;gt;.&amp;lt;column_name&amp;gt; = &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;.&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;i&gt;[ORDER BY &amp;lt;order_by_column_name_N&amp;gt;]; &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Both the above queries will return the similar results&lt;/i&gt;&lt;br /&gt;
&lt;i&gt; &lt;/i&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;OUTER JOINS: &lt;/b&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
Now if we want all the records from one of the tables in join and only matching values from another table this can be accomplished by Outer joins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Syntax: &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;SELECT &amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;table_name_1&amp;gt; ,&lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;&lt;/i&gt; (+)&lt;br /&gt;
&lt;i&gt;WHERE&amp;nbsp; &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_1&amp;gt;.&amp;lt;column_name&amp;gt; = &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;.&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt; [ORDER BY &amp;lt;order_by_column_name_N&amp;gt;]; &lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;OR&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;SELECT &amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;table_name_1&amp;gt; [Left , Right] JOIN &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;ON&amp;nbsp; &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_1&amp;gt;.&amp;lt;column_name&amp;gt; = &lt;/i&gt;&lt;i&gt;&amp;lt;table_name_2&amp;gt;.&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;i&gt;[ORDER BY &amp;lt;order_by_column_name_N&amp;gt;];&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Here:&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;We have introduced 2 new commands:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;(+) for tradional joins : represents all the values will be selected from the table&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;[Left , Right] : Use Left if you want to select all the value from the left hand side table&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;and use RIGHT if you want to select all the value from the right hand side table.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Only one of them can be used in a single join&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/4428561550229609526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/joins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/4428561550229609526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/4428561550229609526'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/joins.html' title='Joins'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-2312614000013832476</id><published>2011-08-13T20:55:00.002+01:00</published><updated>2011-08-13T20:58:21.758+01:00</updated><title type='text'>Select</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
We have inserted data into the table, now the question is how to read this data. Select statement is the answer.&amp;nbsp; Select is one of the most usefull and powerfull command in SQL and a whole book can be written about it, lets discuss few commonly used features of Select:&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;SELECT &amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;table_name&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;[WHERE &amp;lt;select_condition &amp;gt;]&lt;br /&gt;
[ORDER BY &amp;lt;order_by_column_name_N&amp;gt;]; &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&lt;i&gt;SELECT&lt;/i&gt;: Command for selecting the data&lt;br /&gt;
&lt;i&gt;&amp;lt;column_name&amp;gt; :&lt;/i&gt; table column name to be fetched&lt;br /&gt;
FROM : Command for specifying from which table data is required&lt;br /&gt;
&amp;nbsp;&lt;i&gt;&amp;lt;table_name&amp;gt;: Table name from which data is required&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;WHERE : Optional Command for specfying the filter criteria&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Order BY : Optional command to sort the data&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;order_by_column_name_N&amp;gt;: column names on which needs to be sorted&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;For ex:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;SELECT&amp;nbsp;&amp;nbsp; EmpNo,Name , department&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;FROM Employee&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;WHERE department = &#39;sales&#39;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;ORDER BY EmpNo ;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/2312614000013832476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/select.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2312614000013832476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2312614000013832476'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/select.html' title='Select'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-8017611021329954945</id><published>2011-08-10T22:49:00.000+01:00</published><updated>2011-09-03T10:47:42.713+01:00</updated><title type='text'>Insert</title><content type='html'>
&lt;meta content=&#39;complete PL SQL tutorials and notes for beginners - Insert&#39; name=&#39;description&#39;/&gt;
&lt;meta content=&#39;SQL insert, PL SQL tutorials, PLSQL tutorials, PL SQL notes, PL SQL interview questions, PL SQL study material&#39; name=&#39;keywords&#39;/&gt;

&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Now as we have create the table lets insert some data into it, thats whats tables are for - storing data.&lt;br /&gt;
There are several methods by which data can be inserted into the table:&lt;br /&gt;
&lt;br /&gt;
1. By Values&lt;br /&gt;
2. By Select (from another table)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Insertion by Value:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;INSERT INTO &amp;lt;table_name&amp;gt; (&lt;br /&gt;
&amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;, …&lt;br /&gt;
&amp;lt;column_name_N&amp;gt; )&lt;br /&gt;
VALUES (&lt;br /&gt;
&amp;lt;column_value_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_value_2&amp;gt;,…&lt;br /&gt;
&amp;lt;column_value_N&amp;gt; );&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Commit;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Here: &lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;table_name&amp;gt; : &lt;/i&gt;is the table name where data needs to be inserted&lt;br /&gt;
&lt;i&gt;&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;i&gt; :&lt;/i&gt; is the column names in the table&lt;br /&gt;
&lt;i&gt;&amp;lt;column_value&amp;gt;: &lt;/i&gt;is the corresponding column value that needs to be inserted&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Insertion by Select&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;INSERT INTO &amp;lt;table_name&amp;gt; (&lt;br /&gt;
&amp;lt;column_name_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_name_2&amp;gt;, …&lt;br /&gt;
&amp;lt;column_name_N&amp;gt; )&lt;br /&gt;
SELECT &amp;lt;column_value_1&amp;gt;,&lt;br /&gt;
&amp;lt;column_value_2&amp;gt;,…&lt;br /&gt;
&amp;lt;column_value_N&amp;gt;&lt;br /&gt;
FROM &amp;lt;from_table_name&amp;gt; ...;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Commit;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&lt;i&gt;&amp;lt;table_name&amp;gt; : &lt;/i&gt;is the table name where data needs to be inserted&lt;br /&gt;
&lt;i&gt;&amp;lt;column_name&amp;gt;&lt;/i&gt;&lt;i&gt; :&lt;/i&gt; is the column names in the table&lt;br /&gt;
&lt;i&gt;&amp;lt;column_value&amp;gt;: &lt;/i&gt;is the corresponding column value that needs to be inserted&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;from_table_name&amp;gt;: &lt;/i&gt;is the table from where the date needs to be selected&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;We will discuss the select statement in detail soon in the coming notes.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/8017611021329954945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/insert.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/8017611021329954945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/8017611021329954945'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/insert.html' title='Insert'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-3449517246263422231</id><published>2011-08-09T23:55:00.000+01:00</published><updated>2011-08-10T17:19:10.498+01:00</updated><title type='text'>Triggers</title><content type='html'>Triggers are procedures that are stored in the database that gets executed implictly on operations like INSERT, UPDATE and DELETE. Triggers can be DML triggers, INSTEAD OF triggers and Database and schema triggers. The events can take place BEFORE, AFTER and INSTEAD OF the INSERT, UPDATE and DELETE.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Events:&lt;/b&gt;&lt;br /&gt;BEFORE triggers: Executes the specified events before writting the data onto the disk.&lt;br /&gt;AFTER trigger:&amp;nbsp; Executes the specified events after writting the data onto the disk.&lt;br /&gt;INSTEAD OF triggers: Executes the specified events instead of the original operation.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;CREATE [OR REPLACE] TRIGGER &amp;lt;trigger_name&amp;gt;&lt;br /&gt;BEFORE INSERT ON &amp;lt;table_name&amp;gt;&lt;br /&gt;FOR EACH ROW&lt;br /&gt;BEGIN&lt;br /&gt;&amp;lt;pl/sql statement&amp;gt;&lt;br /&gt;END;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Here:&lt;br /&gt;&lt;i&gt;&amp;lt;trigger_name&amp;gt;&lt;/i&gt; is the trigger name,&lt;br /&gt;&lt;i&gt;BEFORE&lt;/i&gt; is the keyword as discussed earlier and can be interchenged with AFTER and INSTEAD OF according to requirement,&lt;br /&gt;&lt;i&gt;INSERT&lt;/i&gt; is the event and can be replaced with DELTE and UPDATE , &lt;br /&gt;&lt;i&gt;&amp;lt;table_name&amp;gt;&lt;/i&gt; is the table name on which trigger is defined,&lt;br /&gt;&lt;i&gt;FOR EACH ROW&lt;/i&gt; is an optional keyword that is used when trigger operation is required for each row in the table,&lt;br /&gt;&lt;i&gt;&amp;lt;pl/sql statement&amp;gt;&lt;/i&gt; is the pl/sql queries required as trigger operation&amp;nbsp; &lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/3449517246263422231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/triggers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/3449517246263422231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/3449517246263422231'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/triggers.html' title='Triggers'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-1272397795905755888</id><published>2011-08-04T23:02:00.000+01:00</published><updated>2011-08-10T17:19:10.498+01:00</updated><title type='text'>Constraints</title><content type='html'>&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Constraints as name suggest are rules for a table and columns that define what kind of data can be stored in the table. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Primay Key&amp;nbsp;Constraint&lt;/span&gt;:&lt;/b&gt; Primary key is the most widely used constriant that is usually required in every table. A primary key consists of one or more columns of a table, combination of which will be unique in the table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Syntax:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;ALTER TABLE &amp;lt;table_name&amp;gt; ADD&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;CONSTRAINT &amp;lt;constraint_name&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;PRIMARY KEY (&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_1&amp;gt;,&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_2&amp;gt;,...&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_N&amp;gt; );&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;For ex:&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;ALTER TABLE&amp;nbsp;Employee ADD&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;nbsp;CONSTRAINT Employee_pk&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;primary key (&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;nbsp;Emp_id );&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;table_name&amp;gt; &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&amp;lt;constraint_name&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;is the name of the primary key &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;constraint, and &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&amp;lt;column_name&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is a column to use in the constraint.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is the name of the table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Foreign Key Constraint: &lt;/b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Foreign key constraints is the SQL way to maintain referential integrity. It helps in defining the parent- child relationship be&lt;/span&gt;&lt;/span&gt;tween the tables. Once a parent table column value is used in the child table it can&#39;t be deleted fron the parent table without deleting from the child table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;Syntax:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;ALTER TABLE &amp;lt;table_name&amp;gt; ADD&lt;br /&gt;CONSTRAINT &amp;lt;constraint_name&amp;gt;&lt;br /&gt;FOREIGN KEY (&lt;br /&gt;&amp;lt;column_name_1&amp;gt;,&lt;br /&gt;&amp;lt;column_name_2&amp;gt;,…&lt;br /&gt;&amp;lt;column_name_N&amp;gt; )&lt;br /&gt;REFERENCES &amp;lt;referenced_table_name&amp;gt; (&lt;br /&gt;&amp;lt;column_name_1&amp;gt;,&lt;br /&gt;&amp;lt;column_name_2&amp;gt;,…&lt;br /&gt;&amp;lt;column_name_N&amp;gt; );&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;For ex:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;ALTER TABLE&amp;nbsp; Employee ADD&lt;br /&gt;CONSTRAINT employee_fk1&lt;br /&gt;FOREIGN KEY (branch)&lt;br /&gt;REFERENCES Department(branch);&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Here: &amp;lt;table_name&amp;gt; is the name of the table to be constrained,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;lt;constraint_name&amp;gt; is the name of the foreign key constraint,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;lt;referenced_table_name&amp;gt; is the name of the table to be referenced,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;lt;column_name&amp;gt; is a column that is being referenced&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/1272397795905755888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/constraints.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1272397795905755888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/1272397795905755888'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/constraints.html' title='Constraints'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-7902539363258880012</id><published>2011-08-04T21:13:00.000+01:00</published><updated>2011-08-10T17:19:10.498+01:00</updated><title type='text'>Indexes</title><content type='html'>Indexes in the database&amp;nbsp;has the same function as&amp;nbsp;of index page in&amp;nbsp;the directory means its makes searching easy and fast. But&amp;nbsp;in the database indexes&amp;nbsp;should be&amp;nbsp;implement carefully as bad indexes may increase the insertion, updation and deletion&amp;nbsp;time.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Indexes: Syntax&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;CREATE [UNIQUE] INDEX &amp;lt;index_name&amp;gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;on &amp;lt;table_name&amp;gt; (&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;&amp;lt;column_name_1&amp;gt;,&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;&amp;lt;column_name_2&amp;gt;,&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;&amp;lt;column_name_N&amp;gt; );&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;strong&gt;For ex:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;CREATE UNIQUE INDEX&amp;nbsp;&amp;nbsp;Employee_uk1&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt; &lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;on&amp;nbsp;Employee (&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;name,&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;birth_date,&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;em&gt;gender );&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular; font-size: xx-small;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;here &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&amp;lt;table_name&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is the name of the table, and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;column_name&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;UNIQUE &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is an optional keyword that is used for ensuring unique values in the table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is the name of a column.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight;&quot;&gt;&amp;lt;index_name&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;&lt;span style=&quot;font-family: Utopia-Regular;&quot;&gt;is the name of the index, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/7902539363258880012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/indexes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7902539363258880012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/7902539363258880012'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/indexes.html' title='Indexes'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9172542891636300390.post-2451453439171623570</id><published>2011-08-02T22:45:00.001+01:00</published><updated>2011-08-25T21:12:55.574+01:00</updated><title type='text'>Getting started - Table Creation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&quot;Table&quot; is basic structure that is used&amp;nbsp;by SQL to&amp;nbsp;store and represent data.&amp;nbsp;It&amp;nbsp;is similar to 2- dimensional array&amp;nbsp;and consists of rows and columns.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Table: Structure&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Column1&amp;nbsp; Column2&amp;nbsp; Column3&lt;/b&gt;.................................&lt;br /&gt;
&lt;b&gt;Row1&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;Row2&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;Row3&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data&lt;/i&gt;&amp;nbsp; &lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to create table: Syntax&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;CREATE TABLE &amp;lt;table_name&amp;gt; (&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_1&amp;gt; &amp;lt;data_type_1&amp;gt;,&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_2&amp;gt; &amp;lt;data_type_2&amp;gt;,&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;lt;column_name_N&amp;gt; &amp;lt;data_type_N&amp;gt; );&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;For Ex:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: TheSansMonoConSemiLight; font-size: xx-small;&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CREATE TABLE employee(&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Empid number,&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Name varchar2(100),&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Birth_date date,&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Gender varchar2(15) );&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 var _adynamo_client = &quot;e048d7ea-f4be-4b87-8984-c11ea29fd3b5&quot;;
 var _adynamo_width = 728;
 var _adynamo_height = 90;
 //--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://static.addynamo.net/ad/js/deliverAds.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://online-plsql-tutorials.blogspot.com/feeds/2451453439171623570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/table-creation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2451453439171623570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9172542891636300390/posts/default/2451453439171623570'/><link rel='alternate' type='text/html' href='http://online-plsql-tutorials.blogspot.com/2011/08/table-creation.html' title='Getting started - Table Creation'/><author><name>Ricky Garg</name><uri>http://www.blogger.com/profile/17025580964745863467</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>0</thr:total></entry></feed>