Advertisement
JAntonio

SP

Feb 12th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. create or replace procedure "SP_INV_CREATE_BOM_ART"(p_nombre IN VARCHAR2, p_art_id IN NUMBER, p_mat_id IN NUMBER, p_cant IN NUMBER)
  2. is
  3. l_articulo INV_ARTICULOS%rowtype;
  4. l_bom_count NUMBER;
  5. begin
  6. SELECT * INTO l_articulo FROM INV_ARTICULOS WHERE ID = p_art_id;
  7. SELECT COUNT(*) INTO l_bom_count FROM INV_ARTICULOS WHERE CODIGO LIKE l_articulo.CODIGO || '-B%';
  8. -- Crear el Nuevo Articulo
  9. INSERT INTO INV_ARTICULOS (NOMBRE, CODIGO, LINEA_ID, UNIDAD_ID, IVA) VALUES (p_nombre, l_articulo.CODIGO || '-B' || l_bom_count, l_articulo.LINEA_ID, l_articulo.UNIDAD_ID, l_articulo.IVA);
  10. -- Crear el BOM
  11. INSERT INTO INV_BOM (ARTICULO_ID, MATERIAL_ID, CANT) VALUES (p_art_id, p_mat_id, p_cant);
  12. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement