Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Crear tabla temporal en una SP (https://www.clubdelphi.com/foros/showthread.php?t=92406)

jars 20-10-2017 23:19:10

Crear tabla temporal en una SP
 
Hola amigos.
Como puedo crear una tabla temporal en una SP e insertarle registros.
Estoy intentando esto pero me da error:

Código SQL [-]
...
LWHERE = ' sectorid = '||:P_SECTORID;

EXECUTE STATEMENT
'CREATE GLOBAL TEMPORARY TABLE POSVIEW
(USERID, COUNTER, TALKTIME)
ON COMMIT DELETE ROWS'
WITH AUTONOMOUS TRANSACTION;

stmt = 'INSERT INTO POSVIEW '||
'select userid, count(*), sum(talktime) from logpos where '||LWHERE||
' and talktime < 10 group by userid order by userid';
EXECUTE STATEMENT stmt;

La tabla la veo creada pero al intentar el insert dice column unknown USERID
Alguna idea de que puede estar mal.


La franja horaria es GMT +2. Ahora son las 01:39:24.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi