<?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-2481774504428540064</id><updated>2024-11-01T05:21:18.020-07:00</updated><title type='text'>Oracle Certificación Blog 1Z-051</title><subtitle type='html'>Santiago de la Cruz de los Santos&#xa;Distrito Federal, México.&#xa;ujat55@yahoo.com.mx</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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>224</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2481774504428540064.post-1951313498128131041</id><published>2017-04-07T03:37:00.001-07:00</published><updated>2017-04-07T03:37:38.799-07:00</updated><title type='text'>BETWEEN</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Comparaciones de Rango mediante
el operador BETWEEN. El operador BETWEEN prueba si el valor de una columna o
expresión cae dentro de un rango de valores limites. El valor debe ser igual al
límite inferior o al límite superior o caer dentro del rango de valor para que
la condición sea verdadera. &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;El operador también los podemos
utilizar con valores carácter, fecha y numéricos como ya se ha explicado. Una
condición BETWEEN es equivalente a escribir dos condiciones de desigualdad.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;tab-stops: 120.75pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Ejemplos:&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; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;tab-stops: 120.75pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;--
BETWEEN CON VALORES NUMERICOS. PARA QUE LA CONDICION SEA VERDADERA EL VALOR DE
LA COLUMNA DEBE SER IGUAL AL LIMITE INFERIOR,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;--
O AL LIMITE SUPERIOR O CAER DENTRO DEL RANGO DE VALORES.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT
product_id, product_name, list_price &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM&amp;nbsp;&amp;nbsp; product_information &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE&amp;nbsp; list_price BETWEEN 100 AND 110;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT
order_id, order_mode, customer_id, order_total &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM&amp;nbsp;&amp;nbsp; orders &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE&amp;nbsp; order_total BETWEEN 20000 AND 25000;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;--
PRIMERO DEBE IR EL LIMITE INFERIOR Y POR ULTIMO EL LIMITE SUPERIOR&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT
order_id, order_mode, customer_id, order_total &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM&amp;nbsp;&amp;nbsp; orders &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE&amp;nbsp; order_total BETWEEN 25000 AND 20000;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;--
EL BETWEEN ES EQUIVALENTE A UTILIZAR OPERADORES DE COMPARACION.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT
product_id, product_name, list_price &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM&amp;nbsp;&amp;nbsp; product_information &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE&amp;nbsp; list_price &amp;gt;= 100 AND list_price &amp;lt;=110;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT
order_id, order_mode, customer_id, order_total &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM&amp;nbsp;&amp;nbsp; orders &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE&amp;nbsp; order_total &amp;gt;= 20000 AND order_total &amp;lt;=
25000;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- REGIONS LOCATIONS DEPARTMENTS JOBS EMPLOYEES
JOB_HISTORY COUNTRIES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT region_id, region_name FROM regions WHERE
region_id BETWEEN 2 AND 3;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT region_id, region_name FROM regions WHERE
region_id &amp;gt;= 2 AND region_id &amp;lt;= 3;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- PRIMERO SE DEBE ESPECIFICAR EL LIMITE INFERIOR Y
POSTERIORMENTE EL LIMITE SUPERIOR.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- PARA QUE LA CONDICION SEA VERDADERA EL VALOR DE LA
COLUMNA DEBE SER IGUAL AL LIMITE INFERIOR&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- O IGUAL AL LIMITE SUPERIOR O CAER EN EL RANGO DE
VALORES DEFINIDOS EN EL BETWEEN.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT region_id, region_name FROM regions WHERE
region_id BETWEEN 3 AND 2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- EJEMPLOS CON VALORES CARACTER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT * FROM locations WHERE country_id BETWEEN &#39;AA&#39; AND
&#39;AZ&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT * FROM locations WHERE country_id BETWEEN &#39;AA&#39; AND
&#39;BZ&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT * FROM locations WHERE country_id BETWEEN &#39;AA&#39; AND
&#39;CH&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT * FROM locations WHERE (&#39;c&#39; BETWEEN (&#39;A&#39; AND &#39;Z&#39;))
OR (&#39;c&#39; BETWEEN (&#39;a&#39; AND &#39;b&#39;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-- REGIONS LOCATIONS DEPARTMENTS JOBS EMPLOYEES
JOB_HISTORY COUNTRIES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT * FROM job_history WHERE start_date BETWEEN
&#39;17-09-1995&#39; AND &#39;28-10-2001&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 137.25pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;El
funcionamiento del operador BETWEEN es el mismo con valores carácter y fechas.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/1951313498128131041/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2015/08/between-ok.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1951313498128131041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1951313498128131041'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2015/08/between-ok.html' title='BETWEEN'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-2704355202146251278</id><published>2017-04-07T03:37:00.000-07:00</published><updated>2017-04-07T03:37:19.445-07:00</updated><title type='text'>Definiendo una Función</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Una función es un programa escrito que opcionalmente acepta&amp;nbsp;parámetros&amp;nbsp;de entrada, desarrolla una operación y retorna un solo valor. una función retorna un solo valor por ejecución&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/2704355202146251278/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2015/08/definiendo-una-funcion-ok.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2704355202146251278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2704355202146251278'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2015/08/definiendo-una-funcion-ok.html' title='Definiendo una Función'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-3960546840252614789</id><published>2013-10-18T22:42:00.001-07:00</published><updated>2017-04-06T21:11:05.334-07:00</updated><title type='text'>Resumen</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
Vistas son sentencias SELECT, almacenadas en el Diccionario de Datos.
Pueden ser Consultados como si fueran tablas, y en algunos casos
pueden ser objeto de sentencias DML. A simple vista son columnas de
una tabla,  sin agregaciones o funciones; una Vista compleja puede
unir tablas, agregados, y usar funciones. Como regla general, es
posible hacer DML&#39;S a través de una vista sencilla pero no a través
de una Vista Compleja, pero hay excepciones.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
sinónimos son alias que se pueden utilizar para acceder a las vistas
y tablas. Sinónimos pueden simplificar el código por lo que no es
necesario especificar los calificadores de esquema o los nombres de
enlace de base de datos: permite ejecutar código sin necesidad de
saber sobre la propiedad de los datos o la ubicación. Las tablas,
vistas y sinónimos comparten el mismo espacio de nombres: dentro de
un esquema, todos ellos deben tener nombres diferentes y se pueden
utilizar indistintamente.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Secuencias
generar números únicos, general para su uso como valores de clave
principal. Índices tienen un doble propósito: hacer cumplir las
restricciones y aumentar el rendimiento. Si un índice está
disponible cuando se define una restricción, Oracle lo usara, de lo
contrario, se crea implícitamente un índice. Cuando creamos índices
para rendimiento, considere en columnas que utilizan para unir tablas
o en cláusulas WHERE y crear índices de árbol B * en columnas con
alta cardinalidad y los índices de mapa de bits en las columnas con
relativamente pocos valores distintos.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
Vista Simple tiene solo una tabla detalle no utiliza funciones ni
agregaciones.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
Vista Compleja puede estar basada de cualquier consulta SELECT, no
importando que tan compleja sea.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
vistas son objetos de esquema.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
vista se puede consultar exactamente como si fuera una tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
vistas se pueden unir a otras vistas o tablas, pueden ser agregados,
y en algunos casos se pueden aceptar instrucciones DML.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Vistas
existen sólo como construcciones en el diccionario de datos. Cuando
se consulta una vista, se debe ejecutar la instrucción SELECT
subyacente.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
sinónimo es un nombre alternativo para una vista o una tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Sinónimos
privadas son objetos de esquema , existen sinónimos públicos fuera
de los esquemas de usuario y se pueden utilizar sin especificar un
nombre de esquema como calificador .&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Sinónimos
comparten el mismo espacio de nombres que vistas y tablas, por lo que
se pueden utilizar indistintamente.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
secuencia genera valores únicos - a menos que sea MAXVALUE o
MINVALUE y el CYCLE se han especificado.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Incrementar
una secuencia no tiene por qué ser Confirmada y no puede ser
revertido.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Cualquier
sesión puede incrementar la secuencia mediante la lectura de su
valor siguiente. Es posible obtener el último valor publicado de la
sesión, pero no el último valor publicado.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Índices
son necesarios para hacer cumplir las restricciones de clave única y
primaria. NULL no se incluyen en los índices de árbol B *, pero se
incluyen en los índices de mapa de bits.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;B
* índices de árbol puede ser único o no único, que determina si
pueden aceptar valores de clave duplicados.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;B
* Tree índices son adecuados para altas columnas de cardinalidad,
índices de mapa de bits de las columnas bajas de cardinalidad.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
índices compuestos tienen una clave que consiste en varias columnas,
que pueden ser de diferentes tipos de datos.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/3960546840252614789/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/resumen_1788.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3960546840252614789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3960546840252614789'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/resumen_1788.html' title='Resumen'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-1656141125544514639</id><published>2013-10-18T21:16:00.001-07:00</published><updated>2017-04-06T21:11:05.273-07:00</updated><title type='text'>RESUMEN</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
tablas son estructuras de dos dimensiones que consta de filas de
columnas con un tipo de dato definido para cada columna. La base de
datos Oracle permite definir tipos de datos definidos por el usuario,
pero en su mayor parte se van a utilizar los tipos de datos
predefinidos.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
tablas pueden ser creadas a partir de cero: la definición de cada
columna y luego insertar filas. Como alternativa, las tablas pueden
ser creadas usando la salida de una consulta. Esta última técnica
se puede definir lla tabla e insertar las filas en un solo comando,
pero hay limitaciones: será necesario añadir PRIMARY KEY y las
CONSTRAINT UNQUE más tarde, mientras que se pueden definir en el
momento de creación de la tabla utilizando la antigua técnica. Para
ayudar en la aplicación de las reglas de negocio, los CONSTRAINT
pueden ser definidos para las columnas. Estos mantendrán la
integridad de los datos por lo que es absolutamente imposible
insertar datos que rompan las reglas.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Algunos
 objetos contienen datos.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Objetos
 Programáticos tales como store procedure y funciones son código
 ejecutable.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Vistas
 y sinónimos son objetos que dan acceso a otros objetos.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
 tablas son estructuras de dos dimensiones que almacenan filas con
 columnas definidas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
 tablas existen dentro de un esquema. El nombre del esquema con el
 nombre de la tabla hacen un identificador único.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
 tipos de dato mas comunes son: VARCHAR2, DATE e INTEGER.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Las
 tablas pueden ser creadas de nada o partir de una consulta.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Después
 de la creación de una tabla columnas pueden ser agregadas,
 eliminadas o modificadas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;La
 definición de una tabla puede incluir valores default para las
 columnas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
 constraint pueden ser definidos en tiempo de creación de la tabla o
 posteriormente.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
 Constraint puede ser definido en la columna  o después de todas las
 columnas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
 Constraint definidos después de las columnas pueden ser definidos
 con mas complejidad.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
 tabla sólo puede tener una clave primaria, pero puede tener varias
 claves únicas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
 clave principal es funcionalmente equivalente a la clave única
 ventaja pero esta ultima no acepta nulos.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Una
 Constraint UNIQUE permite la inserción de valores NULL.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Constraint
 Foreign Key definen las relaciones entre las tablas.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/1656141125544514639/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/resumen_18.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1656141125544514639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1656141125544514639'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/resumen_18.html' title='RESUMEN'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-7041860884047941604</id><published>2013-10-18T14:22:00.002-07:00</published><updated>2017-04-06T21:11:05.485-07:00</updated><title type='text'>CREANDO y UTILIZANDO INDICES.</title><content type='html'>&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Los índices son creados implícitamente cuando Constraints Primary Key y unique son definidos. Si un índice sobre la columna relevante no existe. La sintaxis básica para crear un índice explícitamente es.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;CREATE [UNIQUE | BITMAP] INDEX [ schema.]indexname&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;ON [schema.]tablename (column [, column...] ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El tipo por defecto de un índice es un non-unique, non-compressed, non-reverse key, índice B*TREE. &amp;nbsp;No es posible crear un índice Bitmap Unique (y usted no le gustaría si pudiera-pensar la cuestión de cardinalidad). Los índices son objetos de esquema, y es posible crear un índice en un esquema sobre una tabla que está en otro esquema. Pero la mayoría de las personas encontrara esto como confuso. Un índice Composite es un índice sobre varias columnas. Índices Composite puede ser sobre columnas de diferentes tipos, y las columnas no tienes que ser adyacentes en la tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;EN EL TRABAJO&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Muchos administradores de bases de datos no consideran buena práctica confiarse sobre la creación implícita de índices. Si el índice es creado explícitamente, el creador tiene control completo sobre las características del índice, que puede ser más fácil para el DBA su gestión posterior.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Considera este ejemplo de creación de tabla e índices, y luego la definición de Constraints:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create table dept(deptno number,dname varchar2(10));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create table emp(empno number, surname varchar2(10),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;forename varchar2(10), dob date, deptno number);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create unique index dept_i1 on dept(deptno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create unique index emp_i1 on emp(empno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create index emp_i2 on emp(surname,forename);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create bitmap index emp_i3 on emp(deptno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;alter table dept add constraint dept_pk primary key (deptno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;alter table emp add constraint emp_pk primary key (empno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;alter table emp add constraint emp_fk&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;foreign key (deptno) references dept(deptno);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Los primeros índices creados están marcados como UNIQUE, esto significa que no será posible insertar valores duplicados. Esto no es definido como un Constraint en este punto pero es cierto, sin embargo. El tercer índice no está definió como UNIQUE y por lo tanto, aceptar valores duplicados; este es un índice Composite sobre dos columnas. El cuarto índice es definido como un Índice Bitmap, porque la cardinalidad de la columna es probable que sea baja en proporción a el numero de filas en la tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Cuando los dos primero Constraints Primary Key son definidos, &amp;nbsp;Oracle detectara los índices pre creados y los utilizaran para hacer cumplir las restricciones. Tenga en cuenta que el índice sobre DEPT.DEPTNO no tiene propósito para rendimiento porque la tabla con toda probabilidad &amp;nbsp;sea tan pequeño que el índice nunca será utilizado para recuperar filas (una exploración será más rápida), pero es todavía esencial tener un índice para hacer cumplir el Constraints Primary key.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Una vez que se crean, el uso de índice es completamente transparente y automático. Antes de ejecutar una declaración SQL, el servidor Oracle evaluara &amp;nbsp;todas las formas posibles de ejecutarlo. Algunas de estas formas pueden implicar el uso cualquiera que sea &amp;nbsp;índices que están disponibles; otros no pueden. Oracle hará uso de la información recolectada sobre las tablas y el entorno para tomar la decisión acerca &amp;nbsp;de los índices a usar.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;EN EL TRABAJO&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El servidor Oracle debe hacer la mejor decisión acerca del uso de índices, pero si está obteniendo errores, es posible para un programador embeber instrucciones, conocido como sugerencias de optimizador, en el código que obligara a utilizar &amp;nbsp;de ciertos índices.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;MODIFICANDO Y ELIMINADO INDICES.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Hay un comando ALTER INDEX…, &amp;nbsp;pero no puede ser utilizados para cambiar cualquier de las características descritas en este capítulo: el Tipo (B*TREE o Bitmap) de índice, las columnas, o si es unique o non-unique. El comando ALTER INDEX se encuentra (miente) &amp;nbsp;en el dominio de la administración de la Base de datos y por lo general se utiliza para ajustar las propiedades físicas del índice, no las propiedades lógicas que son de interés para los desarrolladores. Si es necesario cambiar alguna de estas propiedades, el índice debe ser eliminado y crearlo nuevamente. &amp;nbsp;Continuando con el ejemplo en el sección anterior, para cambiar el índice EMP_12 para incluir los cumpleaños de los empleados,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;drop index emp_i2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create index emp_i2 on emp(surname,forename,dob);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Este Índice Composite (compuesto) &amp;nbsp;ahora incluye columnas con diferentes tipos de datos. Las columnas pasaran a ser enumeradas en el mismo orden que son definidas en la tabla, pero esto es de ninguna manera necesaria.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Cuando una tabla es eliminada, todos los índices y Constraints &amp;nbsp;definidos para la tabla se eliminan también. Si un índice &amp;nbsp;fue creado implícitamente mediante la creación de un Constraints, entonces Eliminar el Constraints también eliminara el índice. Si el índice se había creado explícitamente y el Constraint creado posteriormente, entonces si el Constraint fuera eliminado el índice sobrevivirá.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;EJERCICIO 9-3&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;CREAR INDICES.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;En este ejercicio, agregara algunos índices a la tabla EX_EMPS, y modificar el índice creado cuando el Constraints Primary Key fue agregado.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;1.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Conectarse a su base de datos con SQL*PLUS como usuario HR.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;2.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Determine el nombre y algunas otras características del Índice Primary Key ejecutando esta cosulta:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;select index_name,column_name,index_type,uniqueness&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;from user_indexes natural join user_ind_columns&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;where table_name=&#39;EX_EMPS&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;3.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Crear un indice compuesto B*TREE sobre el nombre de empleados:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create index ex_name_i on ex_emps (last_name,first_name);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;4.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Crear indices Bitmap en algunas columnas de baja cardinalidad:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create bitmap index ex_dept_i on ex_emps(department_id);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;create bitmap index ex_mgr_i on ex_emps (manager_id);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;5.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Con el Database Control, mire los índices. La ruta de navegación desde la pagina principal del Database Control tome la ficha Esquema, y entonces dar clic en el link Índices sobre la sección Database Objects. &amp;nbsp;Ingresar HR como el nombre del esquema y EX_EMPS como el nombre del objeto, y dar clic en Go. Los índices serán (cuatro, incluyendo los índices Primary Key creados automáticamente) mostrados.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/7041860884047941604/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/creando-y-utilizando-indices.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7041860884047941604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7041860884047941604'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/creando-y-utilizando-indices.html' title='CREANDO y UTILIZANDO INDICES.'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-6105005326234951868</id><published>2013-10-18T14:21:00.002-07:00</published><updated>2017-04-06T21:11:05.416-07:00</updated><title type='text'>TIPOS DE OPCIONES DEL INDICE</title><content type='html'>&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Existen seis opciones utilizadas comúnmente que pueden ser aplicadas cuando creamos un índice.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Unique o Non-Unique.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Reserve Key.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Compressed.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Composite.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Function Based.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Ascending o Descending.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Todas estas seis variaciones aplican a los índices B*TREE, pero solo las últimas tres pueden ser aplicadas a los índices Bitmaps.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un Índice Unique no permitirá valores duplicados. Non-unique es el default. El atributo unique del índice opera independientemente de &amp;nbsp;un Constraint Unique o Primary Key: la presencia de un Índice Unique no permitirá inserción de valores duplicados incluso si no hay tal Constraint definido. Un Constraint Unique o Primary Key puede utilizar índice Non-Unique; solo sucederá no tener valores duplicados. Esto es, de hecho un requerimiento para un Constraint que es Deferrable (impostergable), ya que puede haber un periodo (antes que las transacciones son confirmadas) cuando los valores duplicados existen.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un índice reverse key es construido sobre una versión de la columna llave con sus bytes invertidos: en lugar que indexé “John,” indexara “nhoj” cuando un SELECT es hecho. Oracle invertirá automáticamente el valor de la cadena de búsqueda. Esto es una técnica muy útil &amp;nbsp;para evitar la contención de sistemas multiusuario. Por ejemplo, si muchos usuarios están insertando concurrentemente filas con llaves primarias basadas en un numero de incremento secuencial, todos sus índices insertados se concentraran en lo alto (final) del índice. Mediante las llaves invertidas, la llave índice consecutiva insertada tendera a extenderse a lo largo de todo el rango del índice. Incluso aunque “John” y “Jules” están muy juntas, “nhoj” and “seluj” serán muy muy distantes.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un índice compressed (comprimido) almacena &amp;nbsp;valores llaves repetidos solo una vez. El valor por defecto es no compress, lo que significa que su un valor llave no es único, será almacenado una vez por cada ocurrencia, cada uno tiene un único puntero ROWID. Un índice Compressed almacenara la llave una vez, seguido por una cadena de todos los ROWID coincidentes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un índice Composite (compuesto) &amp;nbsp;está basado en la concatenación de dos o más columnas. No hay restricciones sobre los tipos de datos que se mezclan. Si un cadena de búsqueda no incluye todas las columnas, el índice puede todavía ser utilizado-pero si no incluye la extrema columna izquierda, oracle tendrá que utilizar un método &amp;nbsp;skip-scanning que es mucho menos eficiente que si la columnas mas a la izquierda es incluida.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un índice function-based &amp;nbsp;está basado sobre el resultado de una función aplicado a una o mas columnas, tales como UPPER (last_name) o to_char(startdate,’ccyy-m-dd’). Una consulta tendrá que aplicar la misma función a la cadena de búsqueda, o oracle no puede ser capaz de utilizar el índice.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Por defecto, un índice es ascending, significa que la llave es almacenada en orden de menor a mayor valor. Un índice descending invierte esto. De hecho, la diferencia no suele ser importante: las entradas en un índice son almacenadas como una lista doblemente ligada por lo que es posible ir de arriba abajo con igual rapidez, pero esto afectara el orden en el cual las filas son regresadas si son recuperadas con un rango de exploración de índice.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/6105005326234951868/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-opciones-del-indice.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6105005326234951868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6105005326234951868'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-opciones-del-indice.html' title='TIPOS DE OPCIONES DEL INDICE'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-5019794432395410322</id><published>2013-10-18T14:21:00.000-07:00</published><updated>2017-04-06T21:11:05.383-07:00</updated><title type='text'>INDICE BIPMAP </title><content type='html'>&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;En muchas aplicaciones de negocio, la naturaleza de los datos y las consultas es tal que índices B*TREE no son de mucha utilidad. Considere la tabla de ventas para una cadena de supermercados. Almacena un año de datos históricos, que pueden ser analizados en varias dimensiones. La figura 9-6 muestra un simple diagrama entidad relación, que solo cuatro de las dimensiones.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Suponiendo una distribución uniforme de los datos, solo dos de las dimensiones (producto y fecha) tiene una selectividad que es mejor que el criterio de uso general &amp;nbsp;de 2 por ciento a 4 por ciento, que hace un índice que vale la pena. Pero si consultas utilizan predicados de rango (tales como cantidad de ventas en el mes o de una clase de productos &amp;nbsp;de diez o más), entonces ni siquiera estos se clasificaran. Esto es un simple hecho: los índices B*TREE a menudo son inútiles en una entorno Data Warehouse. Una consulta típica podría ser que desee comparar las ventas entre dos tiendas para atender a clientes de una determinada clase de producto en un mes. Podrían bien haber índices B*TREE en las columnas relevantes, pero Oracle ignora como insuficiente selectivo. Esto es que los índices Bitmap están diseñados para.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Un índice Bitmap almacena los ROWIDS asociado con cada valor llave como un Bitmap. El Bitmap para el índice CHANNEL podría tener este aspecto:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;WALKIN 11010111000101011101011101.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;DELIVERY 00101000111010100010100010.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Esto indica que las dos primeras filas fueron ventas a entrega a los clientes, la tercera venta era una entrega, la cuarta venta fue entrega, y asi sucesivamente.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Los Bitmaps para índices de SHOP podrían ser.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;LONDON 11001001001001101001010000.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;OXFORD 00100010011000010001001000.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;READING 00010001000100000100100010.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;GLASGOW 00000100100010000010000101.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Esto indica que las dos primeras ventas fueron en la Tienda de London, la tercera fue en Oxford, la cuarta en Reading, y así sucesivamente. Ahora si esta consulta es recibida;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;select count(*) from sales where channel=&#39;WALKIN&#39; and shop=&#39;OXFORD&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Oracle puede recuperar los dos Bitmaps pertinentes y agregarlas junto con una operación booleana AND:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;WALKIN 11010111000101011101011101.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;OXFORD 00100010011000010001001100.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;WALKIN &amp;amp; OXFORD 00000010000000010000000000.....&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El resultado de la operación AND muestra que solo el séptima y decima séptima filas califican para la selección. &amp;nbsp;Esta combinación de Bitmaps es muy rápida y puede ser utilizada para implementar &amp;nbsp;complejas operaciones Booleanas con muchas condiciones en muchas columnas utilizando cualquier combinación de operaciones AND, OR y NOT. Una ventaja especial que los índices Bitmaps tienen por arriba que los índices B*TREE es que incluyen valores NULL. En cuanto al índice Bitmap se refiere, &amp;nbsp;NULL es solo otro valor distinto, que tendrá su propio Bitmaps.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;En general, Índices Bitmaps deben ser utilizados si:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;La Cardinalidad (el numero de valores distintos) en la columna es baja.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El numero de filas en la tabla es alto, y&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;La columna es utilizada en operaciones de algebra Booleana.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;EN EL TRABAJO&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Si usted supiera por adelantado cual serian las consultas, entonces usted puede construir Índices B*TREE que trabajarían, tales como un índice compuesto en SHOP y CHANNEL. Pero por lo general no sabe, que es donde la combinación dinámica de Bitmaps da gran flexibilidad&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/5019794432395410322/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/indice-bipmap.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5019794432395410322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5019794432395410322'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/indice-bipmap.html' title='INDICE BIPMAP '/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-2997210756670945672</id><published>2013-10-18T14:19:00.000-07:00</published><updated>2017-04-06T21:11:05.311-07:00</updated><title type='text'>B*TREE INDEXES</title><content type='html'>&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Un índice B*TREE (la B significa “Balanceado”) es una estructura de árbol. El nodo raíz de del árbol punto de muchos nodos en el segundo nivel, que puede apuntar a muchos nodos en el tercer nivel y así sucesivamente. La profundidad necesaria &amp;nbsp;del árbol será determinado en gran medida por el numero de filas en la tabla y la longitud de los valores de llaves del índice.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;EN EL TRABAJO&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;La estructura B*TREE es muy eficiente. Si la profundidad es mayor a tres o cuatro, a continuación, o las llaves índices son muy largos o la tabla tiene billones de filas. Si ninguno de estos es el caso, entonces el índice está en la necesidad de una reconstrucción.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Las hojas nodo del árbol del índice &amp;nbsp;almacenan las llaves de las filas, en orden, cada uno con un puntero que identifica la localización física del registro. Así para recuperar una fila con un índice de búsqueda, si la clausula WHERE se utiliza predicado de igualdad en la columna indexada, Oracle navega abajo del árbol al nodo de hoja que contiene el valor llave deseado, y después utiliza el apuntador para encontrar la fila. Si la clausula WHERE se utiliza un predicado noneequality (como cualquiera de los operadores LIKE, BETWEEN, &amp;gt;, o, &amp;lt;) entonces Oracle puede navegar abajo del árbol para encontrar la primera llave coincidente y luego navegar atraves de los nodos hojas del índice para encontrar el resto de valores que emparejan. Como lo hace, recuperara las filas de la tabla en orden.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El puntero a la fila es el ROWID. El ROWID es una pseudo-columna propiedad de Oracle, que cada fila en cada tabla tiene. Cifrada dentro de la dirección física de la fila. Como ROWID no es parte del estándar SQL, nunca son visibles a una declaración SQL, pero usted puede ver y usar si lo desea. Esto es una muestra en la figura 9-5.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Una fila ROWID es globalmente única. Cada fila en cada tabla en la base de datos completa tendrán ROWID diferentes. El cifrado ROWID da la dirección física de la fila. De ella, Oracle puede calcular que archivo del sistema operativo, y donde en el archivo esta la fila, e ir directamente a ella.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Los índices B*Tree son una forma muy eficiente &amp;nbsp;de recuperar filas si el numero de filas necesarias es bajo en proporción &amp;nbsp;al número total de filas en la tabla y si la tabla es grande. &amp;nbsp;Considere esta declaración:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;select count(*) from employees where last_name between &#39;A%&#39; and &#39;Z%&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Esta clausula WHERE es lo suficientemente amplia que incluirá todas las filas en la tabla. Sería mucha más lenta para buscar en el índice para encontrar los ROWIDS y luego utilizar los ROWIDS para buscar las filas que explorar la tabla completa. Después de todo. Es la tabla entera que es necesaria. Otro ejemplo seria si la tabla fuera muy pequeña que una lectura de disco podría analizarla completamente; no habría punto &amp;nbsp;en la lectura del primer índice.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Se dice a menudo que si la consulta va a recuperar &amp;nbsp;más de 2 o 4 por ciento de las filas, entonces una exploración completa de tabla &amp;nbsp;será más rápida. Una importante excepción a esto es si el valor especificado en la clausula WHERE es nulo. NULL no van en el índice B*TREE, asi que una consulta tal como esta:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;select * from employees where last_name is null;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Siempre resultara una exploración complete de la tabla. Hay poco valor crear un índice B*TREE en una columna con pocos valores únicos, no será lo suficiente selectiva: la proporción de la tabla que será recuperada para cada llave distinta será demasiado alto. En general, índices B*TREE debe ser utilizados si:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;La cardinalidad (el numero de valores distintos) en la columna es alta.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;El numero de filas de la tabla es alta, y&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/2997210756670945672/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/btree-indexes.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2997210756670945672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2997210756670945672'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/btree-indexes.html' title='B*TREE INDEXES'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-5504648198847719001</id><published>2013-10-18T14:15:00.000-07:00</published><updated>2017-04-06T21:11:05.393-07:00</updated><title type='text'>TIPOS DE INDICES</title><content type='html'>&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;Oracle soporta varios tipos de índices, que tienen algunas variaciones. Los dos tipos de índices de interés aquí son el Índice B*Tree, que es el tipo de índice por defecto y el índice Bitmap. Como una regla general, los índices mejoran el rendimiento para la recuperación pero reduce el rendimiento de las operaciones DML. Esto se debe a que los índices deben ser mantenidos. Cada vez que una fila es insertada a la tabla, una nueva llave debe ser insertada &amp;nbsp;en todos los índices sobre la tabla, que coloca una tensión adicional sobre la Base de Datos. Por esta razón, en los sistemas de procesamiento de transacciones &amp;nbsp;se acostumbra a mantener el numero de índices lo más bajo posible (quizás nomas que esos necesarios para los Constraints) y en los sistemas de consultas intensivas tales como un Data Warehouse para crear &amp;nbsp;tantos como podría ser útil.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/5504648198847719001/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-indices.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5504648198847719001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5504648198847719001'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-indices.html' title='TIPOS DE INDICES'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-3979077122163972866</id><published>2013-10-18T14:13:00.001-07:00</published><updated>2017-04-06T21:11:05.337-07:00</updated><title type='text'>Los Indices</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;Los índices tienen dos funciones: hacer cumplir los Constraint Primary Key y Unique, y mejorar el rendimiento. Una estrategia de aplicación de indexación es crítica para el rendimiento. No hay delimitación clara de cuyo dominio de índices se encuentra dentro de administración de índices. Cuando los analistas de negocios especifican reglas de negocio que serán implementadas como restricciones, son en efecto especificaciones de índices. Los administradores de la Base de datos monitorearan la ejecución &amp;nbsp;de código que corre en la Base de datos, y harán recomendación de índices. El desarrollador, que debe tener la mejor idea de lo que está pasando en el código y la naturaleza de los datos, también participará en el desarrollo de la estrategia de indexación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;Un Constraint Unique también requiere un índice. La diferencia de un Constraint Primary Key es que la columna &amp;nbsp;del Constraint Unique puede permitir nulos, tal vez en muchas filas. &amp;nbsp;Esto no afecta a la creación y uso del índice: nulos no van en los índices B*Tree, como es descrito en la siguiente sección tipos de índices.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;Constraint Foreign Key son forzados por medio de índices, pero el índice debe existir en la tabla padre, no necesariamente en la tabla para el cuela se define el Constraints. Un Constraint Foreign Key se refiere a una columna en la tabla hija con la llave principal o una Llave Unique en la tabla padre. Cuando una fila es insertado en la tabla hijo, oracle va ha hacer una búsqueda en el índice en la tabla padre para confirmar que hay una fila coincidente antes de permitir insertar. Sin embargo, usted debería siempre crear índices &amp;nbsp;en las columnas Foreign Key en la tabla hijo por razones de rendimiento: un DELETE en la tabla padre será mucho más rápido si Oracle puede utilizar un índice para determinar si hay alguna referencia a las filas en la tabla hijo de la fila que está siendo eliminada.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Constraint Foreign Key son forzados por medio de índices, pero el índice debe existir en la tabla padre, no necesariamente en la tabla para el cuela se define el Constraints. Un Constraint Foreign Key se refiere a una columna en la tabla hija con la llave principal o una Llave Unique en la tabla padre. Cuando una fila es insertado en la tabla hijo, oracle va ha hacer una búsqueda en el índice en la tabla padre para confirmar que hay una fila coincidente antes de permitir insertar. Sin embargo, usted debería siempre crear índices &amp;nbsp;en las columnas Foreign Key en la tabla hijo por razones de rendimiento: un DELETE en la tabla padre será mucho más rápido si Oracle puede utilizar un índice para determinar si hay alguna referencia a las filas en la tabla hijo de la fila que está siendo eliminada.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Los índices son críticos para el rendimiento. Cuando ejecutamos cualquier sentencia SQL que incluye una clausula WHERE, Oracle tiene que identificar que filas de la tabla deben ser seleccionadas o modificadas. Si no hay un índice en la columna referenciada en la clausula WHERE, la única manera de hacer esto es con una exploración completa de la tabla. Una Exploración completa de tabla lee cada registro de la tabla, con el fin de encontrar las filas correspondientes. Si la tabla tiene billones de filas, esto puede tomar horas. Si hay un índice en la columna correspondiente, oracle puede buscar en el índice en su lugar. Un índice es una lista ordenada de valores claves, estructurada de una manera que hacer la búsqueda más eficiente. Con cada valor clave es un puntero a la fila en la tabla. La localización de filas relevantes por medio de un índice de búsqueda es mucho más rápido que usar exploración completa de tabla, si la tabla esta sobre cierto tamaño y la proporción de filas a ser recuperadas es por debajo de un cierto valor.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px;&quot;&gt;Para tablas pequeñas, o para una clausula WHERE que recuperara una gran fracción de las filas de la tabla, una exploración completa será más rápido: usted puede (generalmente) confiar en Oracle para tomar la decisión correcta con respecto a utilizar un índice, basada en la información que recolecta de la base de datos sobre las tablas y las filas dentro de ellas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 10px; line-height: 13px; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Una segunda circunstancia donde los índices pueden ser utilizados es para clasificación y ordenamiento. Una sentencia SELECT que incluye palabras como ORDER BY, GROUP BY o UNION (y algunos otros) debe ordenar las filas en orden, a menos que haya un índice, que puede devolver las filas en el orden correcto sin necesidad de ordenar primero.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;Una tercera circunstancia cuando los índices pueden mejorar el rendimiento es &amp;nbsp;cuando las tablas se unen (join), pero de nuevo Oracle tiene una opción: dependiendo &amp;nbsp;del tamaño de las tablas y los recursos disponibles de memoria, puede ser más rápido escanear las tablas en memoria y unirlas ahí, en lugar del uso de índices. La técnica Nested Loop Join (Bluce Anidado) pasa atraves de una tabla utilizando un índice &amp;nbsp;en la otra tabla para localizar las filas que coincidan: esto es usualmente una operación intensiva de disco. Un técnica hash join (unión de comprobación) &amp;nbsp;lee toda la tabla en memoria, convierte esta en una tabla hash, y utiliza un algoritmo hasging para localizar &amp;nbsp;filas coincidentes; esto es mas memoria y CPU intensivo. Un sort merge joins ordena las tablas sobre la columna JOIN y luego y luego las combina entre si: esto es a menudo en compromiso entre disco, memoria y recursos de CPU. Si no hay índices, a continuación, Oracle es muy limitada en la combinación de técnicas disponibles.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Los índices ayudaran a declaraciones SELECT, y también UPDATE, DELETE o MERGER que utilicen clausula WHERE, pero retrasaran a declaraciones INSERT.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/3979077122163972866/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/los-indices.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3979077122163972866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3979077122163972866'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/los-indices.html' title='Los Indices'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-7846367049566489251</id><published>2013-10-18T14:07:00.001-07:00</published><updated>2017-04-06T21:11:05.509-07:00</updated><title type='text'>CREAR INDICES</title><content type='html'>&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: xx-small; line-height: 14px; text-align: justify;&quot;&gt;Los índices tienen dos funciones: hacer cumplir los Constraint Primary Key y Unique, y mejorar el rendimiento. Una estrategia de aplicación de indexación es crítica para el rendimiento. No hay delimitación clara de cuyo dominio de índices se encuentra dentro de administración de índices. Cuando los analistas de negocios especifican reglas de negocio que serán implementadas como restricciones, son en efecto especificaciones de índices. Los administradores de la Base de datos monitorearan la ejecución &amp;nbsp;de código que corre en la Base de datos, y harán recomendación de índices. El desarrollador, que debe tener la mejor idea de lo que está pasando en el código y la naturaleza de los datos, también participará en el desarrollo de la estrategia de indexación&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/7846367049566489251/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-indices.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7846367049566489251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7846367049566489251'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-indices.html' title='CREAR INDICES'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-1854524737309991536</id><published>2013-10-18T14:04:00.001-07:00</published><updated>2017-04-06T21:11:05.283-07:00</updated><title type='text'>Utilizando Secuencias</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Para utilizar una secuencia, una sesión puede seleccionar el siguiente
valor de la columna con NEXTVAL, lo que obliga a la secuencia a incrementar, o
el último valor emitido a la sesión con la pseudo columna CURRVAL. El NEXTVAL
será único a nivel global: cada sesión que selecciona conseguirá un incremento,
un valor para cada SELECT. El CURRVAL será constante durante una sesión hasta
que se selecciona NEXTVAL de nuevo. No hay manera de saber cuál es el último
valor publicado por una secuencia: siempre se puede obtener el siguiente valor
incrementando con NEXTVAL, y siempre se puede recuperar el último valor emitido
a su sesión con CURRVAL, pero no se puede encontrar el último valor emitido.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
El CURRVAL de una secuencia es el último valor publicado para la
sesión actual, no necesariamente el último valor publicado. No se puede
seleccionar el CURRVAL hasta después de seleccionar el NEXTVAL.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Un uso típico de secuencias es para valores de clave primaria. En este
ejemplo se utiliza una secuencia order_seq para generar números de referencia
únicos y LINE_SEQ para generar números de líneas únicas para los elementos de
línea de la orden. En primer lugar crear las secuencias, que es una operación
excepcional:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;create sequence order_seq start with 10;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;create sequence
line_seq start with 10;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;insert into orders (order_number,order_date,customer_number)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;values (order_seq.nextval,sysdate,&#39;1000&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;insert into order_lines
(order_number,line_number,item_number,quantity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;values (order_seq.currval,line_seq.nextval,&#39;A111&#39;,1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;insert into order_lines (order_number,line_number,item_number,quantity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 8.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;values (order_seq.currval,line_seq.nextval,&#39;B111&#39;,1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier; font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Courier;&quot;&gt;commit;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
La primera instrucción INSERT genera un pedido con un número de
referencia único extraído de la secuencia order_seq &amp;nbsp;para el cliente 1000. La segunda y tercera
instrucciones INSERT, utilizando el número de pedido emitido previamente
order_seq como clave externa para conectar las líneas de la orden, y los
siguientes valores de LINE_SEQ para generar un identificador único para cada
línea. Por último, se confirma la transacción.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Una secuencia no está ligado a ninguna tabla. En el ejemplo anterior,
no habría ninguna razón técnica para no utilizar una secuencia para generar
valores para las claves primarias de la orden y de las líneas.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Un COMMIT no es necesario para hacer que el incremento de una
secuencia permanente, es permanente y hecho visible para el resto del mundo el
momento en que sucede. No se puede hacer Rollback. Por esta razón, siempre
habrá lagunas en la serie. Las diferencias serán mayores si la base de datos se
ha reiniciado y se ha utilizado la cláusula CACHE. Todos los números que se han
generado y almacenado en caché y pendientes de emisión se perderán cuando la
base de datos se cierra. En el siguiente reinicio, el valor actual de la secuencia
será el último número generado, no será la última emisión. Así, con la caché
por defecto de 20, cada inicio de apagado / perderá hasta 20 números.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;!--[if gte vml 1]&gt;&lt;v:shapetype
 id=&quot;_x0000_t75&quot; coordsize=&quot;21600,21600&quot; o:spt=&quot;75&quot; o:preferrelative=&quot;t&quot;
 path=&quot;m@4@5l@4@11@9@11@9@5xe&quot; filled=&quot;f&quot; stroked=&quot;f&quot;&gt;
 &lt;v:stroke joinstyle=&quot;miter&quot;/&gt;
 &lt;v:formulas&gt;
  &lt;v:f eqn=&quot;if lineDrawn pixelLineWidth 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 1 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum 0 0 @1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @2 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 0 1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @6 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;sum @8 21600 0&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @10 21600 0&quot;/&gt;
 &lt;/v:formulas&gt;
 &lt;v:path o:extrusionok=&quot;f&quot; gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot;/&gt;
 &lt;o:lock v:ext=&quot;edit&quot; aspectratio=&quot;t&quot;/&gt;
&lt;/v:shapetype&gt;&lt;v:shape id=&quot;Imagen_x0020_1&quot; o:spid=&quot;_x0000_i1025&quot; type=&quot;#_x0000_t75&quot;
 style=&#39;width:441.75pt;height:260.25pt;visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\MHSALG~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img height=&quot;347&quot; src=&quot;file:///C:/Users/MHSALG~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg&quot; v:shapes=&quot;Imagen_x0020_1&quot; width=&quot;589&quot; /&gt;&lt;!--[endif]--&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Si los analistas de negocios han declarado que no debe haber lagunas
en una secuencia, entonces se debe utilizar otro medio de generar números
únicos. Para el ejemplo anterior de levantar pedidos, el número de pedido
actual podría ser almacenada en esta tabla y se inicializa a 10:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;create table current_on(order_number number);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;insert into current_on values(10);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;commit;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;update current_on set order_number=order_number + 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;insert into orders
(order_number,order_date,customer_number)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;values ((select
order_number from current_on),sysdate,&#39;1000&#39;);&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-bidi-font-family: Courier;&quot;&gt;commit;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Modificar una Secuencia&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Goudy; font-size: 10.5pt; mso-bidi-font-family: Goudy;&quot;&gt;ALTER SEQUENCE &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-bidi-font-family: Goudy-Italic;&quot;&gt;sequencename&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[INCREMENT BY &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[START WITH &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[MAXVALUE &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number &lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;| NOMAXVALUE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[MINVALUE &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number &lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;| NOMINVALUE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[CYCLE | NOCYCLE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[CACHE &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number &lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;| NOCACHE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Goudy; font-size: 10.5pt; line-height: 115%; mso-bidi-font-family: Goudy;&quot;&gt;[ORDER | NOORDER] ;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Este comando ALTER es el mismo que el comando CREATE, con una
excepción: no hay manera de establecer el valor inicial. Si desea reiniciar la
secuencia, la única manera es caer y volver a crearlo.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;alter sequence
order_seq cache 1000;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-bidi-font-family: Courier;&quot;&gt;drop sequence order_seq;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/1854524737309991536/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/utilizando-secuencias.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1854524737309991536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1854524737309991536'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/utilizando-secuencias.html' title='Utilizando Secuencias'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-7760956118009131774</id><published>2013-10-15T13:29:00.001-07:00</published><updated>2017-04-06T21:11:05.503-07:00</updated><title type='text'>Crear, Mantener y Utilizar Secuencias</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Una secuencia es una estructura para la generación de valores enteros
únicos. Sólo una sesión puede leer el siguiente valor y así obligarla a
incrementar. Este es un punto de la serialización, por lo que cada valor
generado será único.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Las secuencias son una valiosa herramienta para la generación de Llaves
Primarias. Muchas aplicaciones necesitan valores de Llave Primaria generadas
automáticamente. El mecanismo de secuencia es independiente de las tablas, y el
procesamiento de Commit y Rollback. Esto significa que una secuencia puede
emitir miles de valores únicos de un minuto, mucho más rápido que cualquier
otro método que implica la selección de una columna de una tabla,
actualización, y confirmación de un cambio. El numero se incrementa
consecutivamente en orden cada vez que una selección es realizada y el
numero&amp;nbsp; incrementa globalmente no solo
dentro de una sesión.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Crear Secuencias&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
La sintaxis completa para crear una secuencia es la siguiente:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;CREATE SEQUENCE [&lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;schema&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;.]&lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;sequencename&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[INCREMENT BY &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[START WITH &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[MAXVALUE &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number &lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;| NOMAXVALUE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[MINVALUE &lt;/span&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number &lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;| NOMINVALUE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Goudy; font-size: 10.5pt; mso-ansi-language: EN-US; mso-bidi-font-family: Goudy;&quot;&gt;[CYCLE | NOCYCLE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Goudy; font-size: 10.5pt; mso-bidi-font-family: Goudy;&quot;&gt;[CACHE &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: Goudy-Italic; font-size: 10.5pt; mso-bidi-font-family: Goudy-Italic;&quot;&gt;number
&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Goudy; font-size: 10.5pt; mso-bidi-font-family: Goudy;&quot;&gt;| NOCACHE]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Goudy; font-size: 10.5pt; line-height: 115%; mso-bidi-font-family: Goudy;&quot;&gt;[ORDER | NOORDER] ;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Para crear una secuencia es muy simple:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Opciones de Sequence&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
INCREMENT BY&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
¿Cuánto mayor (o menor) que el último número
  emitido debe ser el siguiente número? El valor predeterminado es +1, pero
  puede ser cualquier número positivo (o número negativo para una secuencia
  descendente).&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
START WITH&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
El punto de inicio de la secuencia: el número
  emitido por la primera selección. El valor predeterminado es 1, pero puede
  ser cualquier otro.&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
MAX VALUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
El número más alto de una secuencia ascendente antes
  de generar un error o volver a su valor START WITH. El valor predeterminado
  es sin límite máximo.&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
MIN VALUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
El número más bajo de una secuencia descendente antes
  de generar un error o volver a su valor START WITH. El valor predeterminado
  es sin mínimo.&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
CYCLE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
Controla el comportamiento al alcanzar a MAXVALUE
  o MINVALUE. El comportamiento predeterminado es dar un error, pero si se
  especifica CYCLO la secuencia volverá a su posición inicial y repetirse.&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
CACHE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
Para rendimiento, Oracle puede pre emitir valores
  de la secuencia y cachearlos o guardarlos y luego emitir los valores a los
  usuarios. El comportamiento por defecto es generar 20 y guardarlos&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 97.55pt;&quot; valign=&quot;top&quot; width=&quot;130&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
ORDER&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 351.35pt;&quot; valign=&quot;top&quot; width=&quot;468&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
Relevante para una Base de Datos en Cluster:
  ORDER forza a las instancias &amp;nbsp;para
  coordinar el incremente.&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Ajustes apropiados para INCREMENT BY, START WITH, MAXVALUE o MINVALUE
vendrán de los analistas de negocio. Es muy raro y vuelva a ser utilizada una
secuencia, ya que permite la edición secuencia de valores duplicados. Si se
está utilizando la secuencia para generar valores de clave principal, CYCLE
sólo tiene sentido si hay una rutina en la base de datos que va a eliminar
filas. &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Almacenamiento en caché los valores de secuencia es vital para el
rendimiento. Selección de una secuencia es un punto de serialización en el
código de la aplicación: sólo una sesión puede hacer esto a la vez. El
mecanismo es muy eficiente: es mucho más rápido que el bloqueo de una fila, la
actualización de la fila, y luego abrir con un COMMIT. Pero aún así, la
selección de una secuencia puede ser una causa de la discordia entre las
sesiones. La palabra clave CACHE ordena a Oracle que Pregenere números de
secuencia por lotes. Esto significa que se pueden emitir más rápido que si
tuvieran que ser generada bajo demanda.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/7760956118009131774/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-mantener-y-utilizar-secuencias.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7760956118009131774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/7760956118009131774'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-mantener-y-utilizar-secuencias.html' title='Crear, Mantener y Utilizar Secuencias'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-6748488032400343557</id><published>2013-10-15T12:54:00.001-07:00</published><updated>2017-04-06T21:11:05.466-07:00</updated><title type='text'>Crear Sinónimos Públicos y Privados</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&amp;nbsp;Un sinónimo es un nombre
alternativo para un objeto. Si existieran sinónimos para los objetos, entonces
cualquier sentencia SQL puede dirigirse al objeto, ya sea por su nombre real, o
su sinónimo. Esto puede parecer trivial. No lo es. El uso de sinónimos
significa que una aplicación puede funcionar para cualquier usuario,
independientemente del esquema propietario, las vistas y tablas o incluso en
qué base de datos las tablas residen. Ejemplo:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;select * from
hr.employees@prod;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
El usuario que emite la sentencia debe conocer que la tabla Employees
pertence al esquema HR en la base de datos identificada por el Database Link.
Si un sinónimo ha sido creado con esta sentencia:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-font-family: Courier;&quot;&gt;create public
synonym emp for hr.employees@prod;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Entonces todos los usuarios solo necesitan escribir lo siguiente:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier; font-size: 9.0pt; line-height: 115%; mso-bidi-font-family: Courier;&quot;&gt;select * from emp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Esto da Independencia de datos y Transparencia en la localización. Tablas
y Vistas pueden ser renombrados y reubicados si tener que cambiar nada de
código. Solo los sinónimos tienen que ser reajustados. &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Además de sentencias SELECT, instrucciones DML pueden dirigirse a los
sinónimos como si se trataran de los objetos al que se refieren.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Sinónimos Privados son Objetos de Esquema. Estos deben estar en su
propio esquema, o deben ser cualificados con su nombre de esquema. Sinónimos
Públicos existen independientemente del Esquema. &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Un sinónimo público puede ser referido por cualquier usuario al que se
le ha concedido permiso para verlo sin la necesidad de cualificarlo con el nombre
de esquema. Sinónimos Privados debe ser un nombre único dentro de su esquema.
Sinónimos Públicos pueden tener el mismo nombre como un objeto de esquema.
Cuando ejecutamos sentencias que van dirigidos a objetos sin cualificar un
esquema, Oracle buscara al objeto en el esquema local, y solo si no es
encontrado, lo buscara como un Sinónimo Publico.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
La sintaxis para crear un Sinónimo es la siguiente:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;CREATE [PUBLIC]
SYNONYM synonym FOR object;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Un usuario necesitara tener asignado permisos para crear sinónimos
privados y permisos para crear sinónimos públicos. Usualmente. Solo el
administrador de bases de datos puede crear y eliminar sinónimos públicos. Esto
es porque su presencia o ausencia afectara a todos los usuarios.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
El “public” en “public synonym” significa que no es un objeto de
esquema y no puede por lo tanto se cualificado con un nombre de esquema. Esto
no significa que todo mundo tiene permisos para utilizarlo.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Para eliminar un sinónimo:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
DROP [PUBLIC] SYNONYM synonym;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Si el objeto al cual el sinónimo se refiere es eliminado, el sinónimo continua
existiendo. Cualquier intento de uso devuelve un error. En este aspecto, los sinónimos
comparte el mismo compartimiento como las vistas. Si el objeto es nuevamente
creado, el sinónimo debe ser recompilado para su uso. Esto sucederá automáticamente
cuando se utilizado nuevamente o lo podemos realizar explícitamente:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
ALTER SYNONYM synonym COMPILE;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/6748488032400343557/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-sinonimos-publicos-y-privados.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6748488032400343557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6748488032400343557'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-sinonimos-publicos-y-privados.html' title='Crear Sinónimos Públicos y Privados'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-2428509862548113773</id><published>2013-10-14T11:34:00.001-07:00</published><updated>2017-04-06T21:11:05.297-07:00</updated><title type='text'>CREATE VIEW, ALTER VIEW Y DROP VIEW</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;La
sintaxis es la siguiente:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;CREATE [OR REPLACE] [FORCE | NO
FORCE]&amp;nbsp; VIEW&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;[esquema.]nombrevista [(alias) [,alias]…)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;AS subquery&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;[WITH CHECK OPTION [CONSTRAINT
constraintname]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;[WITH READ ONLY [CONSTRAINT
constraintname]] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Tenga
en cuenta que las vistas son objetos de esquema. Las palabras claves opcionales
son:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;OR REPLACE&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;. Si
la vista ya existe. Primero será eliminada y luego será creada.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;FORCE o NOFORCE. &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;La palabra
clave FORCE creara la vista incluso si la tabla detalle en el subquery no
existe. NOFORCE es el comportamiento por defecto. Causara error si el detalle
no existe.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;WITH CHECK OPTION&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;. Esto
tiene que ver con DML. Si la subconsulta contiene una clausula WHERE, esta
opción evitará la inserción de filas que no se pueden ver en la vista o cambios
que harían que una fila de desaparece de la vista. De forma predeterminada,
esta opción no está habilitada, lo que puede dar resultados desconcertantes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;WITH
READ ONLY. Previene cualquier DML a través de la vista.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;CONSTRAINT constraintname&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;. Esto
puede ser usado para nombrar las restricciones WITH CHECK OPTION y WITH READ
ONLY para que los mensajes de error cuando las restricciones causan fallos, sean
más comprensible.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Además,
un conjunto de nombres de alias puede ser proporcionar por los nombres de las
columnas de la vista. Si no se proporciona, las columnas se nombran después de
las columnas de la tabla o alias especificados en la subconsulta&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;Ejemplos:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;create view v1region as select *
from regions where id=1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Esta
Vista permite la inserción de filas que no pueden verse en la vista.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US;&quot;&gt;create view v1region as select *
from regions where id=1 with check option;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Esta
vista no permite insertar filas que no se vean en la vista.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;El
uso principal del comando ALTER VIEW es para compilar la vista. Una vista debe
ser compilada exitosamente antes que pueda ser utilizada. Cuando una vista es
creada, Oracle comprueba que las tablas detalle y las columnas necesarias sobre
la cual la vista está basada exista. Si estas no existen, la compilación falla
y la vista no será creada. A menos que se utilice la opción FORCE. En este
caso, la vista será creada pero no será usable hasta que la tabla o columnas a
la cual se refiere sean creadas y la vista sea compilada exitosamente. Cuando una
vista inválida es consultada, Oracle intenta compilarla automáticamente. Si la compilación
es exitosa porque el problema se ha solucionada, incluso si el usuario no
conoce el problema. Excepto si la consulta tome un poco más de tiempo. En términos
generales, se debe compilar manualmente la vista y que compile con éxito. Y no
dejar que los usuarios descubran los errores.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;No
es posible ajustar las definiciones de columnas de una vista después de la
creación en una Tabla la forma en que las columnas de una tabla se pueden
cambiar. La vista debe quitarse y volver a crear. El comando DROP es el
siguiente:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;DROP
VIEW [esquema.]viewname;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Mediante
la palabra OR REPLACE con el comando CREATE VIEW, la vista será automáticamente
eliminada y posteriormente creada.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/2428509862548113773/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/create-view-alter-view-y-drop-view.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2428509862548113773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/2428509862548113773'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/create-view-alter-view-y-drop-view.html' title='CREATE VIEW, ALTER VIEW Y DROP VIEW'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-4983250316272383735</id><published>2013-10-14T10:11:00.001-07:00</published><updated>2017-04-06T21:11:05.378-07:00</updated><title type='text'>Porque Utilizar Vistas</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Seguridad.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Simplificar
SQL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Prevenir
errores.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Hacer
más comprensible los datos.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Rendimiento.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
para Reforzar la Seguridad&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Puede
ser que los usuarios sólo deben ver ciertas filas o columnas de una tabla. Hay
varias maneras de hacer cumplir esto, una Vista a menudo es la más sencilla. Tenga
en cuenta el uso de los calificadores de esquema para la tabla como la fuente
de los datos y la vista: las Vistas son objetos de esquema y pueden sacar sus
datos de las tablas en el mismo esquema o de otros esquemas. Si no se
especifica el esquema, serán del esquema en el cual se encuentra actualmente.
La vista se puede unir a otras vistas o tablas como si se tratara de una tabla.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
para simplificar a los Usuarios SQL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Será
mucho más fácil para los usuarios consultar los datos, si el trabajo duro
(tales como JOINS o Agregaciones) está hecho para ellos por el código que
define la vista. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
para Prevenir Errores&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Es
imposible evitar que los usuarios cometan errores, pero las vistas bien
construidas pueden prevenir algunos errores derivados de la falta de
comprensión de cómo se deben interpretar los datos. Una vista puede ayudar a
presentar los datos de una manera que no es ambigua. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
para hacer los Datos más Comprensibles.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Las
estructuras de datos en una base de datos serán tablas normalizadas. No es
razonable esperar que los usuarios comprendan las estructuras normalizadas.
Como ejemplo de la Suite Oracle E-Business , un &quot;Cliente &quot; en el
módulo de Cuentas por Cobrar es de hecho una Entidad que consiste en
información distribuida a través de las Tablas HZ_PARTIES, HZ_PARTY_SITES,
HZ_CUST_ACCTS_ALL, y muchas más. Todas estas tablas están vinculadas por
relaciones Primary Ley- Foreign Key, pero estos no están definidos en
cualesquiera identificadores visibles para los usuarios (por ejemplo, un número
de cliente ) : se basan en las columnas de los usuarios nunca ven que tienen
valores generados internamente a partir de secuencias . Las formas y los
informes que se utilizan para recuperar información de los clientes no abordan
estas tablas directamente, todo el trabajo a través de puntos de vista. Pero
estos no están definidos en cualesquiera identificadores visibles para los
usuarios: se basan en columnas de los usuarios que nunca ven, que tienen
valores generados internamente a partir de Secuencias. Las formas y los
Reportes que se utilizan para recuperar información de los clientes no abordan las
tablas directamente, todo el trabajo es a través de Vistas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Además
de presentar los datos a los usuarios en una forma comprensible, el uso de Vistas
para proporcionar una capa de abstracción entre los objetos vistos por los
usuarios y los objetos almacenados dentro de la base de datos puede ser muy valioso
para el trabajo de mantenimiento. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
para mejorar el Rendimiento&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;La
instrucción SELECT detrás de un punto de vista puede ser optimizada por los
programadores, por lo que los usuarios no tienen que preocuparse por el código
de tuning. Puede haber muchas posibilidades para conseguir el mismo resultado,
pero algunas de las técnicas pueden ser mucho más lentas que otros.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Teóricamente,
siempre se puede confiar en el optimizador de Oracle para encontrar la mejor
forma de ejecutar una sentencia SQL, pero hay casos en los que se equivoca. Si
los programadores saben qué técnica es mejor, se puede indicar al optimizador.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
Simples y Complejas&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Clasificación
de Vistas Simples y Complejas, la clasificación está relacionada a que si
pueden ser ejecutadas sentencias DML contra estas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vista
Simple,&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt; se basa de una tabla, no utiliza funciones, y no hace
agregaciones.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vista
Compleja,&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt; se basa de la unión de varias tabla, utiliza funciones y
desarrolla agregaciones.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;A
menudo no es posible ejecutar INSERT, UPDATE o DELETE contra una vista
compleja. El mapeo de las filas en la Vista a las filas de la tabla detalle (s)
que no siempre es posible determinar en un uno-a-uno, que es necesaria para las
operaciones de DML. Por lo general, es posible ejecutar DML contra una vista
simple, pero no siempre. Por ejemplo, si la vista no incluye una columna que
tiene una restricción NOT NULL en la tabla, entonces un INSERT a través de la
vista puede no tener éxito (a menos que la columna tiene un valor por defecto).
Esto puede producir un efecto desconcertante porque el mensaje de error
referencia a una tabla y una columna que no se mencionan en la declaración.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/4983250316272383735/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/porque-utilizar-vistas.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4983250316272383735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4983250316272383735'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/porque-utilizar-vistas.html' title='Porque Utilizar Vistas'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-6051418662454490221</id><published>2013-10-14T10:10:00.001-07:00</published><updated>2017-04-06T21:11:05.410-07:00</updated><title type='text'>Crear Vistas Simples y Complejas</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Vistas
y Sinónimos no almacenan datos, sino que proporcionan una capa de abstracción
entre los usuarios y los datos. Las Tablas, Vistas y Sinónimos comparten el
mismo espacio de nombres.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Las
secuencias son un mecanismo para generar números únicos.&amp;nbsp; En muchas Bases de Datos, valores de la Llave
Primaria se definen como un número único. Una secuencia puede emitir dichos
números en demanda, sin que los programadores necesitan preocuparse acerca de
si realmente son únicos.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;Para
el usuario, una Vista parece una Tabla: Una estructura bidimensional de filas con
columnas, con las cuales el usuario puede ejecutar sentencias SELECT y DML. La
vista es simplemente una declaración SELECT. Cualquier instrucción SELECT
devuelve un conjunto bidimensional de filas. Si se guarda la instrucción SELECT
en una vista, entonces, cada vez que el usuario consulta o actualiza las filas
de la vista, la sentencia se ejecuta, y el resultado se presenta a los usuarios
como si fuera una tabla. La instrucción SELECT en la que se basa una vista
puede ser cualquier cosa. Puede ser JOINS, Agregaciones o hacer Ordenamientos;
absolutamente cualquier cosa que es legal en el comando SELECT se puede
utilizar. Sin embargo, si la vista es Compleja, sólo SELECT se pueden ejecutar contra
ella. En una Vista Simple se pueden utilizar DML’s y SELECT. Como es de espera
en una Vista Simple, son basadas sobre sentencias SELECT sumamente sencillas.
Vistas complejas son basadas sobre sentencias más complejas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/6051418662454490221/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-vistas-simples-y-complejas.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6051418662454490221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6051418662454490221'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/crear-vistas-simples-y-complejas.html' title='Crear Vistas Simples y Complejas'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-391306068523916128</id><published>2013-10-12T06:06:00.000-07:00</published><updated>2017-04-06T21:11:05.330-07:00</updated><title type='text'>Definición de restricciones</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Los
Constraint pueden ser definidas al crear una tabla o agregan a la
tabla posteriormente. Al definir las restricciones a la hora de
creación de la tabla, la restricción puede ser definido de acuerdo
con la columna a la que se refiere o al final de la definición de la
tabla. Existe una mayor flexibilidad para el uso de la última
técnica.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Por
ejemplo, es imposible definir un Constraint foreign key que hace
referencia a dos columnas, o un constraint Check que hace referencia
a cualquier columna distinta de verse limitados si la restricción se
define de acuerdo, pero ambos son posibles si la restricción es
definida en el final de la tabla.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/391306068523916128/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/definicion-de-restricciones.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/391306068523916128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/391306068523916128'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/definicion-de-restricciones.html' title='Definición de restricciones'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-4897584192697498033</id><published>2013-10-12T06:02:00.003-07:00</published><updated>2017-04-06T21:11:05.364-07:00</updated><title type='text'>Constraint CHECK</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
Constraint CHECK puede ser utilizado para obligar simples reglas.
tales como que el valor introducido en una columna debe estar dentro
de un rango de valores. La regla debe ser una expresión que evaluará
a TRUE o FALSE. Las reglas se refieren a los valores absolutos
registrados como literales o para otras columnas de la misma fila y
se puede hacer uso de algunas funciones. Los Constraint CHECK que
desee se puede aplicar a una columna, pero no es posible utilizar una
subconsulta para evaluar si un valor es permisible o utilizar
funciones como SYSDATE .&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/4897584192697498033/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-check.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4897584192697498033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4897584192697498033'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-check.html' title='Constraint CHECK'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-4242282371333382706</id><published>2013-10-12T06:02:00.001-07:00</published><updated>2017-04-06T21:11:05.341-07:00</updated><title type='text'>Constraint FOREIGN KEY</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
Constraint Foreign Key es definido en la Tabla Hijo o Tabla
secundaria de una relacion Padre-Hijo.El Constraint nomina una
columna en la tabla hijo que corresponda a la columna Llave Primaria
de la tabla Padre. Las columnas no tienen que tener los mismos
nombres, pero tienen que ser del mismo tipo de datos. Los Constraint
Foreign Key  definen la estructura relacional de la base de datos:
las relaciones muchos-a-uno que conectan las tablas, en su tercera
forma normal.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Si
la tabla Padre tiene un Constraint UNIQUE en lugar de Constraint
PRIMARY KEY, estas columnas pueden ser utilizadas como base de los
Constraint FOREIGN KEY, aun que sean Nullable. &lt;/span&gt;
&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Solo
un Constraint UNIQUE permite valores NULL en la columna restringida.
Lo mismo ocurre con un Constraint FOREIGN KEY. Puede insertar filas
en la tabla Hijo con Llave Externa NULL, incluso si no hay una filas
de la tabla Padre con un valor NULL. Esto crea filas huérfanas y
puede causar confusión terrible. Como regla general, todas las
columnas de un Constraint UNIQUE y todas las columnas de un
Constraint FOREIGN KEY se definen mejor con NOT NULL.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;El
intento de inserción de una fila de la tabla Hijo para la que no hay
ninguna fila coincidente en la tabla padre le dará un error. Del
mismo modo, eliminar una fila de la tabla padre le dará un error si
ya hay filas que se refieren a él en la tabla hijo. Hay dos técnicas
para cambiar este comportamiento. En primer lugar, el Constraint
puede ser creado como ON DELETE CASCADE.  Esto significa que si se
elimina una fila de la tabla padre, Oracle buscará en la tabla hijo
todas las filas coincidentes y eliminarlos también. Esto sucederá
de forma automática. Una técnica menos drástica es la creación de
la restricción como ON DELETE SET NULL . En este caso, si se elimina
una fila de la tabla padre, Oracle buscará en la tabla hijo todas
las filas coincidentes y establecer las columnas de clave externa en
null. Esto significa que quedarán huérfanas las filas secundarias,
pero seguirá existiendo. Si las columnas de la tabla hija también
tienen un Constraint NOT NULL, entonces la eliminación de la tabla
Padre producirá un error.&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;No
es posible hacer un DROP o TRUNCATE a la tabla Padre en una relación
de clave externa, incluso si no hay filas en la tabla hijo. Esto
sigue siendo válido si el ON DELETE SET NULL u ON DELETE CASCADE
cláusulas fueron utilizados. Una variante del Constraint foreign Key
es la referencia a el mismo Constraint Foreign Key. Esto define una
condición en la que existen los padres y las filas secundarias en la
misma tabla. &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
constraint Foreign Key en una tabla hija debe referenciar las
columnas de una tabla padre y estas deben tener Constraint UNIQUE o
PRIMARY KEY.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/4242282371333382706/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-foreign-key.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4242282371333382706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4242282371333382706'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-foreign-key.html' title='Constraint FOREIGN KEY'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-4420141557362697883</id><published>2013-10-12T05:29:00.001-07:00</published><updated>2017-04-06T21:11:05.350-07:00</updated><title type='text'>Constraint PRIMARY KEY</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;La
Llave Primaria es el medio para localizar una fila en una tabla. El
paradigma de la base de datos relacional incluye un requisito de que
cada tabla debe tener una Llave Primaria una columna (o combinación
de columnas) que se puede utilizar para distinguir cada fila. La base
de datos Oracle se desvía del paradigma permitiendo tablas sin
claves principales. &lt;/span&gt;
&lt;/div&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;La
aplicación de un Constraint PRIMARY KEY es, la unión de un
Cnstraint UNIQUE y un Constrant NOT NULL. Las columnas de la Llave
deben tener valores únicos, y no pueden  ser nulo. Al igual que con
Constraint UNIQUE un índice debe existir en la columna restringida
(s). Si este no existe, se creará un índice cuando se define el
Constraint. Una tabla sólo puede tener una Llave Primaria. Trate de
crear un segundo, y obtendrá un error.  Una tabla puede, sin
embargo, cualquier número de Constraint UNIQUE y columnas NOT NULL,
por lo que si hay varias columnas que los analistas de negocios han
decidido debe ser único y pobladas, una de ellas se puede designar
la Llave Principal y los otros UNIQUE y NOT NULL.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;Un
Constraint PRIMARY KEY es la unión de un Constraint UNIQUE y NOT
NULL.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/4420141557362697883/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-primary-key.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4420141557362697883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/4420141557362697883'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-primary-key.html' title='Constraint PRIMARY KEY'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-6738171163985114185</id><published>2013-10-12T05:17:00.001-07:00</published><updated>2017-04-06T21:11:05.457-07:00</updated><title type='text'>Constraint NOT NULL</title><content type='html'>&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;El
Constraint NOT NULL obliga a que se ingresen valores a una columna
determinada, esta columna no puede ser nullable. NOT NULL se definen
por columna, si el requisito de negocio es que un grupo de columnas
debe tener valores, no se puede definir un Constraint NOT NULL para
todo el grupo, pero en su lugar debe definir un Constraint NOT NULL
por columna. Cualquier intento de insertar una fila sin especificar
valores para las columnas restringidas con Constraint NOT NULL en un
error surgira.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/6738171163985114185/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-not-null.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6738171163985114185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/6738171163985114185'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-not-null.html' title='Constraint NOT NULL'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-1446898166788163469</id><published>2013-10-11T15:56:00.003-07:00</published><updated>2017-04-06T21:11:05.248-07:00</updated><title type='text'>Constraint UNIQUE</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Un Constraint UNIQUE nomina una columna o un conjunto de columnas para
el cual el valor debe ser diferente para cada fila en la tabla. Si se basa
sobre solo una columna, esta columna es conocida como llave(Key). Si el
Constraint está compuesto por más de una columna (Constraint UNIQUE – Llave Compuesta
Composite Key). Las columnas no han de ser del mismo tipo o estar adyacentes en
la estructura de la tabla.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Una rareza del Constraint UNIQUE es que es posible ingresar valores
NULL en las columnas key. De hecho es posible tener cualquier número de filas
con valores nulos en sus columnas key. Este constraint garantiza que solo una
fila tendrá un valor único a menos que se refiere a valores NULL que pueden ser
varias filas las que lo tengan.&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;JUSTIFY&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;El
Constraint UNIQUE es realizado por un Indice. Cuando se define un
Constraint UNIQUE, Oracle buscará un índice en la columna  Key, y
si ésta no existe, se creará. Entonces cada vez que se inserta una
fila, Oracle buscará el índice para ver si los valores de las
columnas key ya existen:  si ya existen, el registro se rechazara. La
estructura de estos índices (conocido como B * Tree Index) no
incluye valores NULL, por lo que se permite muchas filas con NULL,
simplemente estas no estan en el índice.Mientras que el primer
objetivo del índice es hacer cumplir el Constraint, tiene un efecto
secundario: mejorar el rendimiento si las columnas de clave se
utilizan en las cláusulas WHERE de SQL. Sin embargo, la selección
WHERE key_column is null no utiliza el índice, ya que no incluye los
valores Null y por lo tanto siempre resultará en una exploración de
toda la tabla.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/1446898166788163469/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-unique.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1446898166788163469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/1446898166788163469'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint-unique.html' title='Constraint UNIQUE'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-3397483181519454203</id><published>2013-10-11T15:55:00.003-07:00</published><updated>2017-04-06T21:11:05.320-07:00</updated><title type='text'>Tipos de Constraint</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Los tipos de Constraint que soporta la Base de Datos Oracle, son los
siguientes:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;UNIQUE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;NOT NULL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;PRIMARY KEY&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;FOREIGN KEY&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;CHECK&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Los Constraint tienen nombres. Una Buena práctica sería especificarlos
de acuerdo a la conversión de nombres, sino es especificado un nombre, Oracle
genera uno automáticamente.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/3397483181519454203/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-constraint.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3397483181519454203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/3397483181519454203'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/tipos-de-constraint.html' title='Tipos de Constraint'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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-2481774504428540064.post-5466692118574945826</id><published>2013-10-11T15:55:00.001-07:00</published><updated>2017-04-06T21:11:05.388-07:00</updated><title type='text'>Constraint</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;&quot;&gt;
Los Constraint son una forma mediante la cual la Base de Datos puede
imponer reglas de negocio. Y garantiza que los datos cumplen al modelo entidad -
relación determinado por los analistas de negocios que definen las estructuras
de datos de la aplicación. Cuando cualquier sentencia DML es ejecutado contra
una tabla con Constraint, si el DML viola el Constraint, entonces la sentencia será
revertida(Rollback) automáticamente. Recuerde que una sentencia DML que afecta
muchas filas podría tener éxito parcialmente antes que llegue un problema con
una fila. Si la sentencia es parte de una transacción multisentencia(muchas
sentencias), entonces las sentencia que ya ha sido afectadas exitosamente permanecerán
intactas pero sin confirmar.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oracle11gnotes2.blogspot.com/feeds/5466692118574945826/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5466692118574945826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2481774504428540064/posts/default/5466692118574945826'/><link rel='alternate' type='text/html' href='http://oracle11gnotes2.blogspot.com/2013/10/constraint.html' title='Constraint'/><author><name>Santiago de la Cruz de los Santos</name><uri>http://www.blogger.com/profile/08859194864243153028</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>