Is there any way to create a local table variable inside a Firebird stored proc?

柔情痞子 提交于 2019-12-05 06:20:19

Firebird doesn't support table variables the same way SQL Server does.

The close thing you have at your disposal is Global Temporary Tables (Requires Firebird 2.1 or greater)

(v.2.1) Global temporary tables (GTTs) are tables that are stored in the system catalogue with permanent metadata, but with temporary data. Data from different connections (or transactions, depending on the scope) are isolated from each other, but the metadata of the GTT are shared among all connections and transactions.

There are two kinds of GTT:

with data that persists for the lifetime of connection in which the specified GTT was referenced; and

with data that persists only for the lifetime of the referencing transaction.

You have to create the GTT beforehand.

CREATE GLOBAL TEMPORARY TABLE
  ...
  [ON COMMIT <DELETE | PRESERVE> ROWS]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!