Re: Problema al crear tabla temporal
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`() .
Subject
Views
Written By
Posted
1695
June 16, 2017 05:08PM
Re: Problema al crear tabla temporal
944
July 04, 2017 02:28PM
Sorry, you can't reply to this topic. It has been closed.
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.