在sql Server中,可以声明一个表变量(DECLARE @table TABLE),该脚本在脚本运行时生成,然后从内存中删除。
Oracle有没有类似的功能?或者我停留在分段我的硬盘驱动器的CREATE / DROP语句?
是。
Declare TABLE TYPE variables in a
PL/sql declare block. Table variables
are also known as index-by table or
array. The table variable contains one
column which must be a scalar or
record datatype plus a primary key of
type BINARY_INTEGER. Syntax:DECLARE
TYPE type_name IS TABLE OF
(column_type |
variable%TYPE |
table.column%TYPE
[NOT NULL]
INDEX BY BINARY INTEGER;— Then to declare a TABLE variable of this type:
variable_name type_name;— Assigning values to a TABLE variable:
variable_name(n).field_name :=
‘some text’; — Where ‘n’ is the
index value
参考:http://www.iselfschooling.com/syntax/OraclePLSQLSyntax.htm
你也可以看看Global Temporary Tables