Oracle 11g R2 SE运行查询

时间:2011-01-24 15:02:30

标签: oracle sqlplus

如何在sql>中运行以下查询?在Oracle 11g R2 SE中提示

 CREATE TRIGGER "ICD".TR_DEL_SYSTEMALERTCFG_CSTLVL
   after delete on t_custlevel
 begin
   delete t_monitor_systemalertcfg a
   where a.queuetype = 4
     and a.queueid not in (
                   select b.id from t_custlevel b
                   where a.subccno = b.subccno
                     and a.vdn = b.vdn
                   );
 end TR_DEL_SYSTEMALERTCFG_CSTLVL;

请建议。

由于

Kaushal

2 个答案:

答案 0 :(得分:1)

  1. 将查询保存到名为“my_query.sql”的文件中。
  2. 运行命令提示符(DOS,linux shell,等等......)。
  3. 导航到您的脚本所在的目录(可能使用cd命令)。
  4. 运行Oracle sqlplus命令以连接数据库。
  5. 运行命令@my_query.sql以执行查询文件。

答案 1 :(得分:0)

如果您想自动退出sql

,请在结尾处添加斜杠并退出
CREATE TRIGGER "ICD".TR_DEL_SYSTEMALERTCFG_CSTLVL
       after delete on t_custlevel
     begin
       delete t_monitor_systemalertcfg a
       where a.queuetype = 4
         and a.queueid not in (
                       select b.id from t_custlevel b
                       where a.subccno = b.subccno
                         and a.vdn = b.vdn
                       );
     end TR_DEL_SYSTEMALERTCFG_CSTLVL;
    /

    exit

BTW:你没有以root用户身份在数据库服务器上运行sqlplus,是吗?

相关问题