args

导航

公告

Free Web Counter

文章

收藏

相册

其他

存档

Blog统计


正在读取评论……

<%sql="if exists (select * from sysobjects where id = object_id(N'[dbo].[phone]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[phone]"
con.execute(sql)
%>
如果表phone存在则删除phone表
其中phone是表名,con是connection对像

------------------------------------------------------------------------
1.create the test table.
SQL> create table test(fld1 number(1));
Table created.
2.Drop the table
SQL> declare
2       strsql varchar2(100);
3       count1 number(1);
4       begin
5       select count(*) into count1 from user_tables where table_name='TEST';
6       if count1>0 then
7       strsql:='Drop table TEST';
8       execute immediate strsql;
9       end if;
10     end;
11 /
PL/SQL procedure successfully completed.
3.Check
SQL> select count(*) from user_tables where table_name='TEST';

COUNT(*)
----------
0



Trackback: http://tb.donews.net/TrackBack.aspx?PostId=138904


[点击此处收藏本文]  发表于2004年10月19日 11:40 AM




正在读取评论……
大名
网址
验证码
评论