您的位置:程序门 -> db2 -> 数据库开发



【询问】db2中命令编辑器(cui)和(command line)有什么区别?(关于事务运行的例子)


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


【询问】db2中命令编辑器(cui)和(command line)有什么区别?(关于事务运行的例子)
发表于:2007-08-23 16:37:26 楼主
在命令编辑器(gui)界面上:  
drop   table   test;  
create   table   test   (number   int);  

begin   atomic  
declare   i   int   default   1;  
while   i   <=   10   do  
          insert   into   test   values(i);  
          set   i   =   i   +   1;  
end   while;  
end  

select   *   from   test;  
quit;  
运行出错,说那个declare   不是有效的sql语句。  

但是,如果我把下面的代码写到一个文件中   1.txt  
connect   to   testdb@  
drop   table   test@  
create   table   test   (number   int)@  

begin   atomic  
declare   i   int   default   1;  
while   i   <=   10   do  
          insert   into   test   values(i);  
          set   i   =   i   +   1;  
end   while;  
end@  

select   *   from   test@  
quit@  

在commad   line   下:   db2   -td@   -v   -f   1.txt   却正确运行了  

请问这个是怎么回事?  
谢谢
发表于:2007-08-23 17:14:411楼 得分:0
命令编辑器   不能写逻辑


快速检索

最新资讯
热门点击