Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION public.add_rec_inventario()
- RETURNS trigger
- LANGUAGE plpgsql
- AS $function$
- begin
- -- table_schema: id_movto | id_cedis | id_tipo_movto | id_producto | folio_movto | lote | cantidad_entrada | cantidad_salida | id_usuario | fecha_add
- --
- insert into inventario (id_cedis, id_tipo_movto, id_producto, folio_movto, lote, cantidad_entrada, cantidad_salida, id_usuario, fecha_add) values (NEW.id_cedis, 1, NEW.id_producto, NEW.id_recepcion, NEW.lote, NEW.cantidad, 0, NEW.id_usuario, current_timestamp);
- exception when others then
- -- log if fails;
- insert into function_logs(message,fecha_add) values('ERR: add_rec_inventario ' || SQLERRM, current_timestamp);
- return NEW;
- end;
- $function$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement