Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error(74,34): PL/SQL: ORA-00928: falta la palabra clave SELECT

685925Nov 15 2009 — edited Nov 15 2009
INSERT SHOW ME BECAUSE AN ERROR, ORA-00928: WHEN I AM IN COMPLIANCE WITH THE SINTASIX



create or replace
Procedure metodo_inventario( tipo_inventario varchar2 )
As
pl_aux number;
pl_fecha_factura date;
pl_numero_factura number;
pl_id_tp_movimiento nucreate or replace
Procedure metodo_inventario( tipo_inventario varchar2 )
As
pl_aux number;
pl_fecha_factura date;
pl_numero_factura number;
pl_id_tp_movimiento number;
pl_id_producto number;
pl_cantidad number;
pl_vlr_unitario number;
pl_vlr_vairable number;
pl_vlr_peps number;
pl_vlr_upes number;
pl_sum_aux number;
pl_cant_aux number;

Begin
pl_vlr_promedio :=0;
pl_vlr_peps :=0;
pl_vlr_upes :=0;
pl_sum_aux :=0;
pl_cant_aux :=0;

--> primero se crea una tabla auxiliar de facturas...
/*begin
create table c_factura_aux as
select *
from c_factura;

ALTER TABLE C_FACTURA_AUX
ADD ("ESTADO" NUMBER DEFAULT 1 NOT NULL);
end;*/
if (tipo_inventario = '%PEPS%') then

loop
--seleccion de la primera factura....
if (tipo_movimiento = '%COMPRA%') then

select min(FECHA_FACTURA)
, min(NUMERO_FACTURA)
into pl_fecha_factura, pl_numero_factura
from c_factura_aux
where estado = 1;

select FECHA_FACTURA
, NUMERO_FACTURA
, ID_TP_MOVIMIENTO
, ID_PRODUCTO
, CANTIDAD -- cantidad
, VLR_UNITARIO -- vlr unitario
, (CANTIDAD * VLR_UNITARIO) -- vlr total
--, CANTIDAD -- und total,--> este se hace un select aparte para sumar..
--, (CANTIDAD * VLR_UNITARIO) -- vlr total,--> este se hace un select aparte para sumar..
INTO pl_fecha_factura
, pl_numero_factura
, pl_id_tp_movimiento
, pl_id_producto
, pl_cantidad
, pl_vlr_unitario
, pl_vlr_variable
from c_factura_aux
where NUMERO_FACTURA = pl_numero_factura
and Estado = 1;

select cantidad, vlr_unitario
into pl_cantidad, pl_vlr_unitatrio
from c_factura_aux
where estado = 1
and numero_factura = pl_numero_factura;

update c_factura_aux set estado = 0
where numero_factura = pl_numero_factura;

insert into c_inventario_final('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO,
S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura',
pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad,
pl_vlr_unitario, pl_vlr_variable, (pl_cantida+pl_cant_aux), (pl_vlr_peps+pl_vlr_variable);
end if;
end loop;

exception
when others then
dbms_output.put_line(sqlerrm);
--> PROCEDIMIENTO DE GENERACION MEOTDOS DE INVENTARIO...
end;
mber;
pl_id_producto number;
pl_cantidad number;
pl_vlr_unitario number;
pl_vlr_vairable number;
pl_vlr_peps number;
pl_vlr_upes number;
pl_sum_aux number;
pl_cant_aux number;

Begin
pl_vlr_promedio :=0;
pl_vlr_peps :=0;
pl_vlr_upes :=0;
pl_sum_aux :=0;
pl_cant_aux :=0;

--> primero se crea una tabla auxiliar de facturas...
/*begin
create table c_factura_aux as
select *
from c_factura;

ALTER TABLE C_FACTURA_AUX
ADD ("ESTADO" NUMBER DEFAULT 1 NOT NULL);
end;*/
if (tipo_inventario = '%PEPS%') then

loop
--seleccion de la primera factura....
if (tipo_movimiento = '%COMPRA%') then

select min(FECHA_FACTURA)
, min(NUMERO_FACTURA)
into pl_fecha_factura, pl_numero_factura
from c_factura_aux
where estado = 1;

select FECHA_FACTURA
, NUMERO_FACTURA
, ID_TP_MOVIMIENTO
, ID_PRODUCTO
, CANTIDAD -- cantidad
, VLR_UNITARIO -- vlr unitario
, (CANTIDAD * VLR_UNITARIO) -- vlr total
--, CANTIDAD -- und total,--> este se hace un select aparte para sumar..
--, (CANTIDAD * VLR_UNITARIO) -- vlr total,--> este se hace un select aparte para sumar..
INTO pl_fecha_factura
, pl_numero_factura
, pl_id_tp_movimiento
, pl_id_producto
, pl_cantidad
, pl_vlr_unitario
, pl_vlr_variable
from c_factura_aux
where NUMERO_FACTURA = pl_numero_factura
and Estado = 1;

select cantidad, vlr_unitario
into pl_cantidad, pl_vlr_unitatrio
from c_factura_aux
where estado = 1
and numero_factura = pl_numero_factura;

update c_factura_aux set estado = 0
where numero_factura = pl_numero_factura;

insert into c_inventario_final('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
* VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO,*
* S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura',*
* pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad,*
* pl_vlr_unitario, pl_vlr_variable, (pl_cantida+pl_cant_aux), (pl_vlr_peps+pl_vlr_variable);*
end if;

end loop;

exception
when others then
dbms_output.put_line(sqlerrm);
--> PROCEDIMIENTO DE GENERACION MEOTDOS DE INVENTARIO...
end;

THANK ME WHO COLLABORATE WITH THE CORRECTION OF THIS ERROR ...

THANK YOU, GOOD DAY ...
REYNEL MARTINEZ SALAZAR
This post has been answered by 728534 on Nov 15 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2009
Added on Nov 15 2009
3 comments
3,737 views