Kaushal Shriyan
Kaushal Shriyan

Reputation:

Oracle 11g R2 SE run query

How do i run the below query inside sql > prompt in 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;

Please suggest.

Thanks

Kaushal

Upvotes: 0

Views: 1434

Answers (2)

Rob van Laarhoven
Rob van Laarhoven

Reputation: 8915

Put a slash at the end and exit if you automaticly want to exit 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?

Upvotes: 0

  1. Save your query to a file named "my_query.sql".
  2. run command prompt (DOS, linux shell, whatever...).
  3. navigate to directory where your script is (using the cd command, probably).
  4. Run the Oracle sqlplus command to connect to database.
  5. Run command @my_query.sql to execute the query file.

Upvotes: 1

Related Questions