为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:DM8
【操作系统】:麒麟V10
【CPU】: 鲲鹏
【问题描述】*:
达梦里面是不是没有类似 sql server中自定义表变量的概念?
create type table_type as table
(
col1 int,
col2 varchar(10),
col3 dec(10,2)
)
create proc proc_test
@param_table table_type
as
begin
select * from @param_table
end
只看到了有类似的 是数组。
这种如何翻译成达梦的sql
declare
type record_table is record(id varchar2(10),name varchar2(10));
type v_table is table of record_table;
v_ParamTable v_table ;
begin
select 1,‘a’ bulk collect into v_ParamTable from dual;
select * from table(v_ParamTable);
end;
/
1、使用自定义类型create type 变量 as table of 类型
2、直接在过程里面定义一个record如:type 变量 is record(C1,C2)。
详细的内容可以查看sql语言使用手册