oracle判断表是否存在 写一个txt文件 是创建表的 执行这脚本文件时候 判断这个表是否存在 如果存在 就 不执行,不存在就创建 CREATE TABLE "NICK"."A" ( "ID" VARCHAR2(10), "NAME" VARCHAR2(10) ) 麻烦大家给个sql 语句 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 oracle没有类似sql server中的那样的exists所以如果想这样做,只能写PL/SQL程序。只有这样,才能加进逻辑判断和分支结构。 declare cnt number; begin ---查询要创建的表是否存在 select count(*)into cnt from all_tables where table_name='D_CHANNEL'; ---如果存在则删除该表 if cnt>0 then dbms_output.put_line('表存在不创建'); else dbms_output.put_line('表不存在'); execute immediate 'create table能在 sqlplus 中 执行txt 文件吗 当然可以了。SQL>@文件名 --当然可以,把下面的SQL拷贝到TXT里面,然后重命名为xxx.sql declare cnt number; begin ---查询要创建的表是否存在 select count(*)into cnt from all_tables where table_name='D_CHANNEL'; ---如果存在则删除该表 if cnt>0 then dbms_output.put_line('表存在不创建'); else dbms_output.put_line('表不存在'); execute immediate 'create table-cmd里 运行 sqlplus xxx/xxx@orcl @d:\xxx.sql 就可以了 sqlplus 执行没反映 也不报错 oracle触发器 oracle数据快损坏,求解释~ 难难,超级难的存储过程问题 怎样以root身份执行oracle命令 谁弄过informix 转到 oracle 10G ?还有现在一个Oracle 10G 标准版大概多少钱 字符串比较 关于查询的问题(在线等你回答) 请教高手一个SQL语句的问题 怎么第一次登陆Oracle Management Server oracle 报错提示ora-20001在解决 一年1T的数据容量,数据库设计 oracle 执行报错
所以如果想这样做,只能写PL/SQL程序。只有这样,才能加进逻辑判断和分支结构。
declare cnt number;
begin
---查询要创建的表是否存在
select count(*)into cnt from all_tables where table_name='D_CHANNEL';
---如果存在则删除该表
if cnt>0 then
dbms_output.put_line('表存在不创建');
else
dbms_output.put_line('表不存在');
execute immediate 'create table
能在 sqlplus 中 执行txt 文件吗
SQL>@文件名
--当然可以,把下面的SQL拷贝到TXT里面,然后重命名为xxx.sql
declare cnt number;
begin
---查询要创建的表是否存在
select count(*)into cnt from all_tables where table_name='D_CHANNEL';
---如果存在则删除该表
if cnt>0 then
dbms_output.put_line('表存在不创建');
else
dbms_output.put_line('表不存在');
execute immediate 'create table-cmd里 运行 sqlplus xxx/xxx@orcl @d:\xxx.sql 就可以了
sqlplus 执行没反映 也不报错