<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Techno Oracle &#187; Oracle PL/SQL</title>
	<atom:link href="http://www.technooracle.com/oracle-tutorials/category/oracle-plsql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.technooracle.com</link>
	<description>Oracle information centre</description>
	<lastBuildDate>Tue, 17 Apr 2012 12:07:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ROWID in Oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/rowid-in-oracle-database/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/rowid-in-oracle-database/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 16:24:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[oracle ROW ID]]></category>
		<category><![CDATA[oracle sql ROWID]]></category>
		<category><![CDATA[ROW ID in oracle]]></category>
		<category><![CDATA[ROWID in Oracle]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=363</guid>
		<description><![CDATA[A ROWID is a system-generated unique identifier that is created for every record in the database. This binary value is the address, or location of the data in the system.A ROWID can be physical, as is the case with records in a standard database table.ROWIDs can be logical as well, as is the case with [...]]]></description>
			<content:encoded><![CDATA[<p>A ROWID is a system-generated unique identifier that is created for every record in the database. This binary value is the address, or location of the data in the system.A ROWID can be physical, as is the case with records in a standard database table.ROWIDs can be logical as well, as is the case with rows in an index-organized table.<br />
Eg:<br />
SELECT rowid<br />
FROM employees<br />
WHERE emp_name = &#8216;Peter&#8217;;</p>
<p>This returns the following result:<br />
ROWID<br />
–––––––––<br />
AAAMZzAAEAAAAB/Aau</p>
<p>The rowid will be different in different systems . It is a system generated number and cannot be predicted. That is the physical location for the record containing emp_name of employee &#8216;Peter&#8217; in the EMPLOYEES table. It is unique to that record in the database.<br />
ROWIDs use base-64 encoding and return the ten-byte value as a string when selected from SQL*Plus. The structure of the ROWID is easy to understand.</p>
<p><a href="http://www.technooracle.com/wp-content/uploads/2010/10/ROWID.jpg"><img class="aligncenter size-full wp-image-364" title="ROWID" src="http://www.technooracle.com/wp-content/uploads/2010/10/ROWID.jpg" alt="" width="425" height="286" /></a></p>
<p>One of the biggest benefits of ROWID is the performance improvement it provides when using it to reference a record. No index is necessary, no determination needs to be made whether a full scan of the table is better, and there is no question of cardinality. ROWID provides the address to the record, so no interpretation is required at all. The following example illustrates how ROWID can be used in an UPDATE.</p>
<p>SET SERVEROUTPUT ON</p>
<p>DECLARE</p>
<p>/* Retrieve the rowid of the employees into the cursor */</p>
<p>CURSOR emp_rowid_cur</p>
<p>IS</p>
<p>SELECT <strong>a.rowid</strong></p>
<p>FROM company a,employees b</p>
<p>Where a.company_name = &#8216;technoOracle&#8217;</p>
<p>AND (</p>
<p>a.id = b.employee</p>
<p>OR</p>
<p>a.id = b.manager</p>
<p>OR</p>
<p>a.id = b.progammer);</p>
<p>BEGIN</p>
<p>/* Loop through the records retrieved by the cursor and convert</p>
<p>the first and last names to uppercase */</p>
<p>FOR y IN emp_rowid_cur</p>
<p>LOOP</p>
<p>UPDATE employees</p>
<p>SET emp_first_name = UPPER(emp_first_name),</p>
<p>emp_last_name = UPPER(emp_last_name)</p>
<p>WHERE rowid = <strong>y.rowid</strong>;</p>
<p>END LOOP;</p>
<p>COMMIT;</p>
<p>EXCEPTION</p>
<p>WHEN OTHERS</p>
<p>THEN</p>
<p>DBMS_OUTPUT.PUT_LINE(sqlerrm);</p>
<p>END;</p>
<p>/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/rowid-in-oracle-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuning Initialization Parameters</title>
		<link>http://www.technooracle.com/oracle-tutorials/tuning-initialization-parameters/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/tuning-initialization-parameters/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:06:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Oracle Tuning]]></category>
		<category><![CDATA[COMPATIBLE]]></category>
		<category><![CDATA[DB_BLOCK_SIZE]]></category>
		<category><![CDATA[Initialization Parameters]]></category>
		<category><![CDATA[PGA_AGGREGATE_TARGET]]></category>
		<category><![CDATA[PROCESSES]]></category>
		<category><![CDATA[SESSIONS]]></category>
		<category><![CDATA[SGA_TARGET]]></category>
		<category><![CDATA[UNDO_MANAGEMENT]]></category>
		<category><![CDATA[UNDO_TABLESPACE]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=353</guid>
		<description><![CDATA[A working Oracle database instance is organized using initialization parameters,which are set in the initialization parameter file. These parameters influence the behavior of the running instance, including influencing performance. In general, a simple initialization file with applicable settings covers most situations, and the initialization file should be the first place you expect to do performance [...]]]></description>
			<content:encoded><![CDATA[<p>A working Oracle database instance is organized using initialization parameters,which are set in the initialization parameter file. These parameters influence the behavior of the running instance, including influencing performance. In general, a simple initialization file with applicable settings covers most situations, and the initialization file should  be the first place you expect to do performance tuning.</p>
<p>The following Table includes the most important parameters to set with performance implications:</p>
<table style="height: 734px;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td width="30 px" valign="top"><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> COMPATIBLE</strong></td>
<td width="30 px" valign="top">Specifies the release with which the Oracle database must maintain   compatibility. It lets you take advantage of the maintenance improvements of   a new release immediately in your production systems without testing the new   functionality in your environment. If your application was designed for a   specific release of Oracle Database, and you are actually installing a later release,   then you might want to set this parameter to the version of the previous   release.</td>
</tr>
<tr>
<td width="295" valign="top"><strong> </strong><br />
<strong> DB_BLOCK_SIZE</strong></td>
<td width="295" valign="top">Sets   the size of the Oracle database blocks stored in the database files and   cached in the SGA. The range of values depends on the operating system, but   it is typically 8192 for transaction processing systems and higher values for   database warehouse systems.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> SGA_TARGET</strong></td>
<td width="295" valign="top">Specifies   the total size of all SGA components. If SGA_TARGET is specified,   then the buffer cache (DB_CACHE_SIZE), Java pool(JAVA_POOL_SIZE),   large pool (LARGE_POOL_SIZE), and shared   pool (SHARED_POOL_SIZE)   memory pools are automatically sized.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong> </strong></p>
<p><strong> PGA_AGGREGATE_TARGET</strong></td>
<td width="295" valign="top">Specifies   the target aggregate PGA memory available to all server processes attached to   the instance.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> PROCESSES</strong></td>
<td width="295" valign="top">Sets   the maximum number of processes that can be started by that instance. This is   the most important primary parameter to set,</p>
<p>because many other parameter values are deduced from this.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong> SESSIONS</strong></td>
<td width="295" valign="top">This   is set by default from the value of processes. However, if you are   using the shared server, then the deduced value is likely to be insufficient.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong> UNDO_MANAGEMENT</strong></td>
<td width="295" valign="top">Specifies   the undo space management mode used by the database. The default is AUTO. If unspecified, the database uses AUTO.</td>
</tr>
<tr>
<td width="30 px" valign="top"><strong>UNDO_TABLESPACE</strong></td>
<td width="295" valign="top">Specifies the undo tablespace to be used when an instance   starts.</td>
</tr>
</tbody>
</table>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">Specifies the release with which the Oracle database must maintain    compatibility. It lets you take advantage of the maintenance  improvements of   a new release immediately in your production systems  without testing the new   functionality in your environment. If your  application was designed for a   specific release of Oracle Database,  and you are actually installing a later release,   then you might want  to set this parameter to the version of the previous   release.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/tuning-initialization-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Records With Cursor</title>
		<link>http://www.technooracle.com/oracle-tutorials/using-records-with-cursor/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/using-records-with-cursor/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 06:53:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Records in Oracle]]></category>
		<category><![CDATA[Declaring a Record to Match a Cursor]]></category>
		<category><![CDATA[Using Records With Cursor]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=299</guid>
		<description><![CDATA[Just as you can base a record on a table, you can also base a record definition on a cursor.Records that are based on an Oracle cursor draw their structure from the SELECT statement used for the cursor. This type of record has the same number of columns, with the same names and datatypes, as [...]]]></description>
			<content:encoded><![CDATA[<p>Just as you can base a record on a table, you can also base a record definition on a cursor.Records that are based on an Oracle cursor draw their structure from the <strong>SELECT</strong> statement used for the cursor. This type of record has the same number of columns, with the same names and datatypes, as those in the cursor. The <strong>%ROWTYPE</strong> keyword is used to declare the record that is based on a cursor.</p>
<p>Following Example shows a cursor named <strong>all_depts</strong>, and a record named dept that is based on that cursor.</p>
<h3><span style="color: #000080;">Declaring a Record to Match a Cursor</span></h3>
<p>1: DECLARE<br />
2: CURSOR all_depts is<br />
3: SELECT dept_id, dept_name<br />
4: FROM department<br />
5: ORDER BY dept_name;<br />
6:<br />
7: dept all_depts%ROWTYPE;<br />
8: BEGIN<br />
9: OPEN all_depts;<br />
10:<br />
11: LOOP<br />
12: EXIT WHEN all_depts%NOTFOUND;<br />
13: FETCH all_depts INTO dept;<br />
14: DBMS_OUTPUT.PUT_LINE(dept.dept_name);<br />
15: END LOOP;<br />
16:<br />
17: CLOSE all_depts;<br />
18: END;<br />
19: /</p>
<p>The cursor all_depts is declared in lines 2–5. In line 7, a record variable named<br />
dept is declared based on the definition of the cursor. Because the variable dept<br />
matches the cursor exactly, the FETCH statement in line 13 can fetch the results of the SELECT statement directly into the record. If at some point in the future you need to add columns to the select list, that change will automatically ripple through to the record definition,and the FETCH statement will continue to operate.</p>
<p><span style="color: #000080;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/using-records-with-cursor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Record with SELECT Statements</title>
		<link>http://www.technooracle.com/oracle-tutorials/using-record-with-select-statements/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/using-record-with-select-statements/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 13:47:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Records in Oracle]]></category>
		<category><![CDATA[Records With SELECT tatements]]></category>
		<category><![CDATA[Selecting a Specific Fields into a Record]]></category>
		<category><![CDATA[Selecting Directly into a Record]]></category>
		<category><![CDATA[Using Record with SELECT Statements]]></category>
		<category><![CDATA[using Records with SELECT statements]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=297</guid>
		<description><![CDATA[If you have a record where all the fields in the record correspond exactly to the fields being returned from a SELECT statement, you can retrieve the values directly into that record. Here’s an example: DECLARE dept department%ROWTYPE; BEGIN SELECT * INTO dept FROM department WHERE dept_id = 502; &#8230; END; / You don’t have [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a record where all the fields in the record correspond exactly to the fields being returned from a SELECT statement, you can retrieve the values directly into that record.</p>
<p>Here’s an example:</p>
<p>DECLARE<br />
dept department%ROWTYPE;<br />
BEGIN<br />
SELECT * INTO dept<br />
FROM department<br />
WHERE dept_id = 502;<br />
&#8230;<br />
END;<br />
/<br />
You don’t have to use %ROWTYPE when you do this, and you don’t have to use SELECT * either. The Following Example  shows the dept record being declared without the use of %ROWTYPE,<br />
<span id="more-297"></span><br />
Example</p>
<p>selects for department 452. If you don’t have that department,replace 452 with a valid number for your database.</p>
<h3><span style="color: #000080;">Selecting Directly into a Record</span></h3>
<p>1: DECLARE<br />
2: TYPE dept_type IS RECORD<br />
3: (<br />
4: dept_id department.dept_id%type,<br />
5: dept_name department.dept_name%type,<br />
6: no_of_emps department.no_of_emps%type<br />
7: );<br />
8:<br />
9: dept dept_type;<br />
10: BEGIN<br />
11: SELECT * INTO dept<br />
12: FROM department<br />
13: WHERE dept_id = 452;<br />
14: END;<br />
15: /</p>
<p>A record type named dept_type is defined in lines 2–7. The declaration in line 9<br />
declares a variable named dept to be of type dept_type. Because the fields in the<br />
dept_type record match exactly the fields in the Department table, the SELECT statement in lines 11–13 will work.</p>
<p>The Following example shows a SELECT statement other than SELECT *.<span style="color: #000080;"> </span></p>
<h3><span style="color: #000080;"> Selecting a Specific List of Fields into a Record</span></h3>
<p>1: DECLARE<br />
2: TYPE dept_type IS RECORD<br />
3: (<br />
4: dept_id department.dept_id%type,<br />
5: dept_name department.dept_name%type,<br />
6: no_of_emps department.no_of_emps%type<br />
7: );<br />
8:<br />
9: dept dept_type;<br />
10: BEGIN<br />
11: SELECT dept_id, dept_name, no_of_emps INTO dept<br />
12: FROM department<br />
13: WHERE dept_id = 452;<br />
14: END;<br />
15: /<br />
The three fields in the Department table are enumerated in the SELECT list.<br />
Because the number of fields (and their datatypes) corresponds with the definition of the dept_type record, you are able to retrieve the data directly into a variable of  <strong>type dept_type.</strong></p>
<p>The key thing to keep in mind when selecting data directly into a record is that the columns and datatypes represented in the SELECT list must correspond exactly to the fields and datatypes in the record definition. The column names and field names do not need to match, as Oracle assigns column values to fields in a record based on position,but the datatypes must match.</p>
<p>If you are using SELECT * to retrieve values from a table,you are safest using %ROWTYPE when declaring the record.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/using-record-with-select-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Records on Tables in Oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/using-records-on-tables-in-oracle/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/using-records-on-tables-in-oracle/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 13:30:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Records in Oracle]]></category>
		<category><![CDATA[Using Records on tables]]></category>
		<category><![CDATA[Using Records on Tables in Oracle]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=295</guid>
		<description><![CDATA[If a record type variable is based on a table, it means that the fields in the record have the exact same name and data type as the columns in the specified table. You use the %ROWTYPE attribute to declare a record based on a table. To declare a record variable that exactly matches the [...]]]></description>
			<content:encoded><![CDATA[<p>If a record type variable is based on a table, it means that the fields in the record have the exact same name and data type as the columns in the specified table. You use the <strong>%ROWTYPE</strong> attribute to declare a record based on a table.<br />
To declare a record variable that exactly matches the definition of a table—that is, that contains one field for each column in the table—use the following syntax for the record<br />
type:</p>
<p><strong>table_name%ROWTYPE;</strong></p>
<p>where table_name is the name of the table. %ROWTYPE is a keyword that tells Oracle that the record should have one field for each column in the table, and that the datatypes of the fields should exactly match the datatypes of the columns.</p>
<p><span id="more-295"></span></p>
<p>The following example declares the variable dept so that it matches the definition of the Department table:</p>
<p><strong>DECLARE<br />
dept department%ROWTYPE;<br />
</strong>&#8230;</p>
<p>The beauty of this is that a change to the table definition automatically ripples through to your PL/SQL code. You don’t need to manually hunt down and change record definitions.</p>
<p>Adding a column to a table would be transparent to your PL/SQL code, as<br />
would certain types of datatype changes. However, if you drop a table column<br />
that your code is using, you need to visit that code and make some<br />
changes.</p>
<p>As with any other record, you use dot notation to reference a specific field. As far as PL/SQL is concerned, using department%ROWTYPE has the same effect as if you had declared the record like this:</p>
<p><strong> DECLARE<br />
TYPE dept_type IS RECORD<br />
(<br />
dept_id department.dept_id%type,<br />
dept_name department.dept_name%type,<br />
no_of_emps department.no_of_emps%type<br />
);<br />
</strong></p>
<p><strong>dept dept_type;</strong></p>
<p>If you’re working with all or most of the fields in a table, use %ROWTYPE to declare your records. You’ll save typing, and you’ll insulate your code somewhat from changes to the table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/using-records-on-tables-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle PL SQL:Records</title>
		<link>http://www.technooracle.com/oracle-tutorials/records-in-oracle-plsql/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/records-in-oracle-plsql/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 07:54:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Records in Oracle]]></category>
		<category><![CDATA[Records in PL SQL]]></category>
		<category><![CDATA[Records in PL/SQL]]></category>
		<category><![CDATA[Records in SQL]]></category>
		<category><![CDATA[Using the %TYPE Attribute in Records]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=293</guid>
		<description><![CDATA[Records are a PL/SQL composite datatype.A record is a collection of individual values that are related somehow. Most often, records are used to represent a row in a table, and thus the relationship is based on all the values being from the same row. Each field in a record is unique and has its own [...]]]></description>
			<content:encoded><![CDATA[<p>Records are a PL/SQL composite datatype.A record is a collection of individual values that are related somehow. Most often, records are used to represent a row in a table, and thus the relationship is based on all the values being from the same row. Each field in a record is unique and has its own values.A record as a whole does not have a value.</p>
<p>By using records, you can group like data into one structure and then manipulate this structure as one entity or logical unit. This helps reduce coding and keeps the code easier to maintain and understand.</p>
<h2><span style="color: #000080;">Declaring a Record Variable</span></h2>
<p>In order to use a record, you must define the record by declaring a record type. Then,you must declare one or more PL/SQL variables to be of that type.</p>
<p>You declare a record type in the declaration portion of a PL/SQL block, subprogram, or package.<br />
<span id="more-293"></span><br />
The following example declares a record type named emp_pay_salary:</p>
<p><strong>TYPE emp_pay_salary IS RECORD &#8211;record declaration<br />
(emp_id INTEGER(10),<br />
emp_name VARCHAR2(32),<br />
emp_sal NUMBER(9,2),<br />
sal_type CHAR(1)<br />
);</strong></p>
<p>With the record type defined, you can then declare variables of that type, as in the following</p>
<p>example:<br />
DECLARE<br />
&#8230;<br />
emp emp_pay_info;<br />
&#8230;<br />
BEGIN<br />
&#8230;<br />
After you have a record variable declared, you can use dot notation to reference the individual fields within the record. In the following example, the pay_type field in the emp record is referenced in an IF statement:</p>
<p>IF emp.sal_type = ‘S’ THEN&#8230;</p>
<p>Having related fields grouped together in a record allows you to more easily keep things together when you are passing those values as parameters to other program units.</p>
<p>This example shows the declaration for a procedure that takes a record of type emp_pay_info as a parameter:</p>
<p>procedure calculate_check (emp IN emp_pay_info) IS<br />
&#8230;<br />
Passing related values as a record not only makes your code more readable, but it makes it more maintainable as well. If you need to add another field to the emp_pay_info record, you only need to change the record definition, and that new value will be passed around everywhere that the record goes. If you were dealing with separate variables, you would have to change the header for every procedure and function that used the record.</p>
<h2><span style="color: #000080;">Using the %TYPE Attribute in Records<br />
</span></h2>
<p>If you’re declaring a record, and you want some of the field definitions to match definitions of columns in a database table, you can use the %TYPE attribute.To declare a variable to match a column definition, place an entry such as this in the declaration section of the PL/SQL block:</p>
<p><strong>variable_name table_name.column_name%TYPE;</strong></p>
<p>The %TYPE following the table and column name tells Oracle that you want the variable being declared to inherit its datatype and length from the definition of the named column.</p>
<p>The following example shows another way to define the emp_pay_info record<br />
shown in the previous section:</p>
<p>TYPE emp_pay_salary IS RECORD<br />
(emp_id employee.emp_id%TYPE,<br />
emp_name employee.emp_name%TYPE,<br />
sal_rate employee.pay_rate%TYPE,<br />
sal_type employee.pay_type%TYPE<br />
);</p>
<p>Using %TYPE like this helps insulate your PL/SQL code from changes in the underlying database columns. In the next section you’ll learn an even easier technique, using %ROWTYPE, that you can use when you want the record to contain fields for all columns in a table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/records-in-oracle-plsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropping Triggers in Oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/dropping-triggers-in-oracle/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/dropping-triggers-in-oracle/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 18:05:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Triggers in oracle]]></category>
		<category><![CDATA[DROP ANY TRIGGER privilage]]></category>
		<category><![CDATA[DROP TRIGGER]]></category>
		<category><![CDATA[DROP TRIGGER Example]]></category>
		<category><![CDATA[Dropping trigger]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=290</guid>
		<description><![CDATA[Triggers may be dropped via the drop trigger command. In order to drop a trigger, you must either own the trigger or have the DROP ANY TRIGGER system privilege. Syntax: DROP TRIGGER trigger_name; Example: CREATE OR REPLACE TRIGGER EMP_MONDAY BEFORE INSERT OR UPDATE OR DELETE ON EMP BEGIN IF RTRIM(UPPER(TO_CHAR(SYSDATE,'DAY')))='MONDAY' THEN RAISE_APPLICATION_ERROR (-20022,'NO OPERARTION CAN [...]]]></description>
			<content:encoded><![CDATA[<p>Triggers may be dropped via the drop trigger command. In order to drop a trigger, you must either own the trigger or have the <strong>DROP ANY TRIGGER </strong>system privilege.</p>
<p><strong>Syntax:</strong></p>
<p>DROP TRIGGER trigger_name;</p>
<p><strong>Example:</strong></p>
<pre>CREATE OR REPLACE TRIGGER EMP_MONDAY</pre>
<pre>BEFORE INSERT OR UPDATE OR DELETE ON EMP</pre>
<pre>BEGIN</pre>
<pre style="padding-left: 30px;">IF RTRIM(UPPER(TO_CHAR(SYSDATE,'DAY')))='MONDAY' THEN</pre>
<pre style="padding-left: 60px;">RAISE_APPLICATION_ERROR
(-20022,'NO OPERARTION CAN BE PERFORMED ON MONDAY');</pre>
<pre style="padding-left: 30px;">END IF;</pre>
<pre>END;</pre>
<h3><span style="color: #000080;">Dropping Trigger</span></h3>
<pre>DROP TRIGGER REC_CHECK;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/dropping-triggers-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling and Disabling Triggers</title>
		<link>http://www.technooracle.com/oracle-tutorials/enabling-and-disabling-triggers/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/enabling-and-disabling-triggers/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 17:51:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Triggers in oracle]]></category>
		<category><![CDATA[disable trigger]]></category>
		<category><![CDATA[disabling Trigger]]></category>
		<category><![CDATA[Enable trigger]]></category>
		<category><![CDATA[enabling Trigger]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=288</guid>
		<description><![CDATA[When a trigger is created it is automatically enabled and is triggered whenever the triggering command and the execution command is true.An enabled trigger executes the trigger body if the triggering statement is issued. To disable the execution use the ALTER TRIGGER command with the DISABLE clause. A disable trigger does not execute the trigger [...]]]></description>
			<content:encoded><![CDATA[<p>When a trigger is created it is automatically enabled and is triggered whenever the triggering command and the execution command is true.An enabled trigger executes the trigger body if the triggering statement is issued. To disable the execution use the <strong>ALTER TRIGGER</strong> command with the <strong>DISABLE</strong> clause. A disable trigger does not execute the trigger body even if the triggering statement is issued.</p>
<p>We can disable / enable the trigger by the following syntax:</p>
<p><strong>ALTER TRIGGER &lt;trigger name&gt; DISABLE / ENABLE</strong></p>
<p><strong>Example</strong></p>
<pre>CREATE OR REPLACE TRIGGER UPDATE_CHECK BEFORE UPDATE ON EMP
FOR EACH ROW
</pre>
<pre>BEGIN
</pre>
<pre style="padding-left: 30px;">IF :NEW.SAL&lt;:OLD.SAL THEN
</pre>
<pre style="padding-left: 60px;">RAISE_APPLICATION_ERROR(-20000,'NEW SALARY
CANNOT BE LESS THAN OLD SALARY');</pre>
<pre style="padding-left: 30px;">END IF;</pre>
<pre>END;
</pre>
<h3><span style="color: #000080;">Enabling Trigger</span></h3>
<pre>SQL&gt;ALTER TRIGGER <strong>UPDATE_CHECK DISABLE;

Trigger Disabled;

</strong>
<h3><span style="color: #000080;">Disabling Trigger</span></h3>
</pre>
<pre>SQL&gt;ALTER TRIGGER <strong></strong><strong>UPDATE_CHECK ENABLE;

Trigger Enabled;

</strong></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/enabling-and-disabling-triggers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Handling in Triggers</title>
		<link>http://www.technooracle.com/oracle-tutorials/error-handling-in-trigger/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/error-handling-in-trigger/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 17:40:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Triggers in oracle]]></category>
		<category><![CDATA[error handling in trigger]]></category>
		<category><![CDATA[RAISE_APPLICATION_ERROR]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=287</guid>
		<description><![CDATA[The Oracle engine provides a procedure named raise_appliation_error that allows programmers to issue user-defined error messages. Syntax: RAISE_APPLICATION_ERROR (error_number, message); Here: error_number It is a negative integer in the range-20000 to –20999 Message It is a character string up to 2048 bytes in length This procedure terminates procedure execution, rolls back any effects of the [...]]]></description>
			<content:encoded><![CDATA[<p>The Oracle engine provides a procedure named raise_appliation_error that allows programmers to issue user-defined error messages.</p>
<p>Syntax:<br />
<strong>RAISE_APPLICATION_ERROR (error_number, message);</strong></p>
<p>Here:<br />
<strong>error_number</strong><br />
It is a negative integer in the range-20000 to –20999</p>
<p><strong>Message</strong><br />
It is a character string up to 2048 bytes in length</p>
<p>This procedure terminates procedure execution, rolls back any effects of the procedure, and returns a user-specified error number and message. Following example makes use of the <strong>RAISE_APPLICAION_ERROR</strong>.</p>
<p>To Create a trigger so that no operation can be performed on emp table<br />
on Monday.</p>
<p>Solution:</p>
<pre>CREATE OR REPLACE TRIGGER EMP_MONDAY</pre>
<pre>BEFORE INSERT OR UPDATE OR DELETE ON EMP</pre>
<pre>BEGIN</pre>
<pre style="padding-left: 30px;">IF RTRIM(UPPER(TO_CHAR(SYSDATE,'DAY')))='MONDAY' THEN</pre>
<pre style="padding-left: 90px;">RAISE_APPLICATION_ERROR
(-20022,'NO OPERARTION CAN BE PERFORMED ON MONDAY');</pre>
<pre style="padding-left: 30px;">END IF;</pre>
<pre>END;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/error-handling-in-trigger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Types of Triggers</title>
		<link>http://www.technooracle.com/oracle-tutorials/types-of-triggers-in-oracle-plsql/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/types-of-triggers-in-oracle-plsql/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 14:12:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle PL/SQL]]></category>
		<category><![CDATA[Triggers in oracle]]></category>
		<category><![CDATA[After Triggers]]></category>
		<category><![CDATA[Before Triggers]]></category>
		<category><![CDATA[INSTEAD OF trigger]]></category>
		<category><![CDATA[Row Level Triggers]]></category>
		<category><![CDATA[Statement Level Triggers]]></category>
		<category><![CDATA[triggers in oracle]]></category>
		<category><![CDATA[Types of Triggers]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=282</guid>
		<description><![CDATA[A trigger’s type is defined by the type of triggering transaction and by the level at which the trigger is executed. Oracle has the following types of triggers depending on the different applications: Row Level Triggers Statement Level Triggers Before Triggers After Triggers Here is a brief description about above triggers: Row Level Triggers Row [...]]]></description>
			<content:encoded><![CDATA[<p>A trigger’s type is defined by the type of triggering transaction and by the level at which the trigger is executed. Oracle has the following types of triggers depending on the different applications:</p>
<ul>
<li><strong><span style="color: #000080;"> Row Level Triggers</span></strong></li>
<li><strong><span style="color: #000080;"> Statement Level Triggers<br />
</span></strong></li>
<li><strong><span style="color: #000080;"> Before Triggers<br />
</span></strong></li>
<li><strong><span style="color: #000080;"> After Triggers</span></strong></li>
</ul>
<p>Here is a brief description about above triggers:</p>
<h2><span style="color: #000080;">Row Level Triggers</span></h2>
<p>Row level triggers execute once for each row in a transaction. The commands of row level triggers are executed on all rows that are affected by the command that enables the trigger. 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 the triggering statement affects no rows, the trigger is not executed at all. Row level triggers are created using the FOR EACH ROW clause in the CREATE TRIGGER command.<br />
<span id="more-282"></span></p>
<h2><span style="color: #000080;">Statement Level Triggers</span></h2>
<p>Statement level triggers are triggered only once for each transaction. For example when an UPDATE command update 15 rows, the commands contained in the trigger are executed only once, and not with every processed row. Statement level trigger are the default types of trigger created via the CREATE TRIGGER command.</p>
<h2><span style="color: #000080;">Before  Trigger</span></h2>
<p>Since triggers are executed by events, they may be set to occur immediately before or after those events. When a trigger is defined, you can specify whether the trigger must occur before or after the triggering event i.e. INSERT, UPDATE, or DELETE commands.</p>
<p>BEFORE trigger execute the trigger action before the triggering statement. These types of triggers are commonly used in the following situation:</p>
<ul>
<li> BEFORE triggers are used when the trigger action should determine whether or not the triggering statement should be allowed to complete. By using a BEFORE trigger, you can eliminate unnecessary processing of the triggering statement. For example: To prevent deletion on Sunday, for this we have to use Statement level before trigger on DELETE statement.</li>
<li> BEFORE triggers are used to derive specific column values before completing a triggering INSERT or UPDATE statement.</li>
</ul>
<h2><span style="color: #000080;">After Trigger</span></h2>
<p>AFTER trigger executes the trigger action after the triggering statement is executed. AFTER triggers are used when you want the triggering statement to complete before executing the trigger action.</p>
<p>For example: To perform cascade delete operation, it means that user delete the record fro one table, but the corresponding records in other tables are delete automatically by a trigger which fired after the execution of delete statement issued by the user.</p>
<p>When combining the different types of triggering actions, there are mainly 12 possible valid trigger types available to us. The possible configurations are:</p>
<ul>
<li><strong><span style="color: #000080;">BEFORE INSERT row</span></strong></li>
<li><strong><span style="color: #000080;"> BEFORE INSERT statement</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER INSERT row</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER INSERT statement</span></strong></li>
<li><strong><span style="color: #000080;"> BEFORE UPDATE row</span></strong></li>
<li><strong><span style="color: #000080;"> BEFORE UPDATE statement</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER UPDATE Row</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER UPDATE statement</span></strong></li>
<li><strong><span style="color: #000080;"> BEFORE DELETE row</span></strong></li>
<li><strong><span style="color: #000080;"> BEFORE DELETE statement</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER DELETE row</span></strong></li>
<li><strong><span style="color: #000080;"> AFTER DELETE statement</span></strong></li>
</ul>
<table style="height: 134px;" border="1" cellspacing="0" cellpadding="0" width="494">
<tbody>
<tr>
<td width="213" valign="top"><strong>Name</strong></td>
<td width="213" valign="top"><strong>Statement Level</strong></td>
<td width="213" valign="top"><strong>Row Level</strong></td>
</tr>
<tr>
<td width="213" valign="top"><strong>BEFORE option</strong></td>
<td width="213" valign="top"><strong>Oracle fires trigger only once   before executing the triggering statement</strong></td>
<td width="213" valign="top"><strong>Oracle fires trigger before   modifying each row affected by the triggering statement</strong></td>
</tr>
<tr>
<td width="213" valign="top"><strong>AFTER option</strong></td>
<td width="213" valign="top"><strong>Oracle fires trigger only once   before executing the triggering statement</strong></td>
<td width="213" valign="top"><strong>Oracle fires trigger before   modifying each row affected by the triggering statement</strong></td>
</tr>
</tbody>
</table>
<h2><span style="color: #000080;">Instead of Trigger</span></h2>
<p>These Triggers are Defined on a View rather than a table.You can use <strong>INSTEAD OF TRIGGER </strong>to tell oracle what to do instead of  performing actions that invoked the  trigger.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/types-of-triggers-in-oracle-plsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

