简体   繁体   English

Oracle 11g R2 SE运行查询

[英]Oracle 11g R2 SE run query

How do i run the below query inside sql > prompt in Oracle 11g R2 SE 我如何在Oracle 11g R2 SE中在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;

Please suggest. 请提出建议。

Thanks 谢谢

Kaushal 考沙尔

  1. Save your query to a file named "my_query.sql". 将查询保存到名为“ my_query.sql”的文件。
  2. run command prompt (DOS, linux shell, whatever...). 运行命令提示符(DOS,Linux shell,等等)。
  3. navigate to directory where your script is (using the cd command, probably). 导航到脚本所在的目录(可能使用cd命令)。
  4. Run the Oracle sqlplus command to connect to database. 运行Oracle sqlplus命令以连接到数据库。
  5. Run command @my_query.sql to execute the query file. 运行命令@my_query.sql以执行查询文件。

Put a slash at the end and exit if you automaticly want to exit sql 如果要自动退出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 : your are not running sqlplus on the database server as root, are you? 顺便说一句:您不是以root身份在数据库服务器上运行sqlplus,是吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM