licenciado
1. UPDATES
http://azuara.unizar.es/trac/Ing2Ora/wiki/GuiaScriptSqlUpdate:
== Sobre los UPDATES de ORACLE ==
1. Una URL con información sobre la sintaxis UPDATE: http://psoug.org/reference/update.html
2. Ejemplo:
Query en ingres:
update be_solicitud bs
from
cab_expediente ce,
centros_depart cd
set c_tipo_cent = 9 where bs.num_expediente = ce.num_expediente
and ce.cod_centro = cd.cod_centro
and bs.f_ano_acad = 2010
and cd.tipo_centro = 'A'
and cd.ind_publico_priv = 'S'
and bs.c_tipo_cent != 9
\p\g
2.1 Opción 1 en Oracle:
update be_solicitud bs
set c_tipo_cent = 9
where exists
(select bs.c_tipo_cent
from
cab_expediente ce,
centros_depart cd
where
bs.f_ano_acad = 2010 and
bs.num_expediente = ce.num_expediente and
ce.cod_centro = cd.cod_centro and
cd.tipo_centro = 'A' and
cd.ind_publico_priv = 'S'
and bs.c_tipo_cent != 9);
2.2 Opción 2 en Oracle:
update(
select
bs.c_tipo_cent as c_tipo_cent
from
be_solicitud bs,
cab_expediente ce,
centros_depart cd
where
bs.f_ano_acad = 2010 and bs.num_expediente = ce.num_expediente and
ce.cod_centro = cd.cod_centro and
cd.tipo_centro = 'A' and
cd.ind_publico_priv = 'S'
and bs.c_tipo_cent != 9
)
set c_tipo_cent = 9;
3. Ejemplo:
Query en ingres:
update session.pago_especie_acreditado A
from session.persona B
set nip_alumno=B.nip_alumno
where B.dni_pasaporte = A.dni_alumno
and B.indbaja='N'
\p\g
3.1 Opción 1 en Oracle:
update gtt_pago_especie_acr A
set nip_alumno=
(select B.nip_alumno
from gtt_persona_am B
where B.dni_pasaporte = A.dni_alumno
and B.indbaja='N')
where A.dni_alumno in (select dni_pasaporte from gtt_persona_am
where indbaja='N');
5608 filas actualizadas.
Transcurrido: 00:01:08.27
3.2 Opción 2 en Oracle:
UPDATE /*+BYPASS_UJVC*/ ( ...
Regístrate para leer el documento completo.