I try to fill my temp table but i get the following error :

SQL Error (-958) : Temp table (temp_table11) already exists in session.

CREATE TEMP TABLE temp_table11
  ( emp_num int);


SELECT emp_num FROM hrgetd INTO  temp_table11
WHERE( emp_num = v_emp_num AND calc_year = p_calc_year)
有帮助吗?

解决方案

You are trying to create table again in your select statement, try this

CREATE TEMP TABLE temp_table11
  ( emp_num int);

INSERT INTO temp_table11
SELECT emp_num FROM hrgetd
WHERE( emp_num = v_emp_num AND calc_year = p_calc_year)

其他提示

When you use SELECT INTO you no need to declare your table

SELECT emp_num FROM hrgetd INTO  temp_table11
WHERE( emp_num = v_emp_num AND calc_year = p_calc_year)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top