MySQL Forums
Forum List  »  Spanish

Re: Problema al crear tabla temporal
Posted by: Daniel Bernabe Inche Ticlavilca
Date: July 04, 2017 02:28PM

CREATE PROCEDURE `MI_PROCEDIMIENTO`()
BEGIN
drop temporary table if exists PRUEBA;
set @rownum=0;
CREATE TEMPORARY TABLE PRUEBA AS (Select *, @rownum:=@rownum + 1 AS posicion FROM ARTICULOS Order by Codigo_Articulo asc) ;

select * from prueba

END

La variabla @rownum que usas nunca la declararas
Te aconsejo usar un procedimientos almacenados y lo llamas en tu bloque sql con un call MI_PROCEDIMIENTO`() .

Options: ReplyQuote


Subject
Views
Written By
Posted
177
June 16, 2017 05:08PM
Re: Problema al crear tabla temporal
51
July 04, 2017 02:28PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.