PostgreSQL之pgscript使用方法

2016/11/03 PostgreSQL 共 366 字,约 2 分钟

参考

pgscript

pgScript作用

pgScript是一种客户端脚本语言,而pl/PgSQL在服务器上运行。这意味着它们有完全不同的用例

实例

pgscript小例

declare @i , @labels , @tdef; 
set @i=0;
 
set @tdef='test(';
 
while @i<5
begin
	set @tdef = @tdef + 'id' +cast(@i as string)+ ' text,';
	set @i = @i + 1;
end
set @tdef=@tdef+'id'+cast(@i as string)+' text);';
 
print @tdef;
 
create table @tdef;

--上述脚本会创建表create table test(id0 text,id1 text,id2 text,id3 text,id4 text,id5 text);

调用方法

pgscript_png

文档信息

Search

    Table of Contents