Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/04/2011, 10:13
LOD_Fredy
 
Fecha de Ingreso: abril-2009
Mensajes: 341
Antigüedad: 15 años, 9 meses
Puntos: 3
Respuesta: obtener el ultimo registro y guardarlo en variable

Oye no funciona, me marca error, este es el codigo del procedimiento:

Código MySQL:
Ver original
  1. DELIMITER $$   
  2. CREATE PROCEDURE REGISTRO_ARTICULO(IN codigarticulo VARCHAR(10), IN nombre VARCHAR(50), IN descripcion VARCHAR(100), IN especificaciones VARCHAR(100), IN medidas VARCHAR(50), IN peso DOUBLE, IN foto VARCHAR(100), IN moneda INT, IN margenminimo INT,IN ti_nombre INT)
  3. BEGIN  
  4.     SET @ti_id=SELECT ti_id FROM tipo_iva WHERE tipo_iva.ti_nombre=ti_nombre;
  5.     INSERT INTO articulos VALUES (NULL,@ti_id, codigarticulo, nombre,descripcion,especificaciones,medidas,peso,foto,0,0,0,0,0,moneda,margenminimo,NOW(),1, 0,0,0);     
  6. END$$

este es el error:

Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT ti_id FROM tipo_iva WHERE tipo_iva.ti_nombre=ti_nombre;
INSERT INTO arti' at line 3