简体   繁体   English

SQL DB2 / 400:检查是否存在全局临时表

[英]SQL DB2/400 : check existence global temporary table

SQL DB2/400 : Does anyone knows how to check existence globale temporary table before déclare instruction in a SQL function ? SQL DB2 / 400:有谁知道如何在SQL函数中的声明指令之前检查是否存在全局临时表?

The statement "DECALRE" causes a crash of the SQL function if the temporary table is already created. 如果已经创建了临时表,则语句“ DECALRE”将导致SQL函数崩溃。

I use the instruction: "if not exists ((select count (*) from session.TEMP_IDX)) then ..." but I have the impression that it does not work ... 我使用指令:“如果不存在((从session.TEMP_IDX中选择count(*)),则...”),但我的印象是它不起作用...

Use the with replace clause of the DECLARE GLOBAL TEMPORARY TABLE statement 使用DECLARE GLOBAL TEMPORARY TABLE语句的with replace子句

That way it won't matter if the table is there or not. 这样,表是否存在都没有关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM