把写好的代码粘贴过去
(最后要有'/'符号),回车便可以了,如
CREATE OR REPLACE TRIGGER OnlyPositive
  BEFORE INSERT OR UPDATE OF num_col
  ON temp_table
  FOR EACH ROW
declare 
com_num NUMBER;
tran_container t_decl_container%rowtype;
cursor c_get_goods is
 select * from t_decl_goods 
 where decl_no=:new.decl_no;
BEGIN
  IF :new.num_col < 0 THEN
    RAISE_APPLICATION_ERROR(-20100, 'Please insert a positive value');
  END IF;
END OnlyPositive;
/

解决方案 »

  1.   

    把写好的代码粘贴过去
    (最后要有'/'符号),回车便可以了,如
    CREATE OR REPLACE TRIGGER OnlyPositive
      BEFORE INSERT OR UPDATE OF num_col
      ON temp_table
      FOR EACH ROW
    declare 
    com_num NUMBER;
    tran_container t_decl_container%rowtype;
    cursor c_get_goods is
     select * from t_decl_goods 
     where decl_no=:new.decl_no;
    BEGIN
      IF :new.num_col < 0 THEN
        RAISE_APPLICATION_ERROR(-20100, 'Please insert a positive value');
      END IF;
    END OnlyPositive;
    /
      

  2.   

    unix/linux下:
    sql>host vi yourtrigger.sql //写上你的trigger
    sql>@yourtrigger.sql   //执行该文件就行了
    windows下
    sql>host edit yourtrigger.sql //写上你的trigger
    sql>@yourtrigger.sql   //执行该文件就行了
    这种方法比较方便,并且易于修改
      

  3.   

    unix/linux下:
    sql>host vi yourtrigger.sql //写上你的trigger
    sql>@yourtrigger.sql   //执行该文件就行了
    windows下
    sql>host edit yourtrigger.sql //写上你的trigger
    sql>@yourtrigger.sql   //执行该文件就行了
    这种方法比较方便,并且易于修改
      

  4.   

    呵呵,谢谢,怎么我看的所有资料里面都没有说要加“/”的
    但是还是报错啊
    帮我看看:)
    create or replace trigger pricesTouch 
    after insert or update on prices
    for each row
    begin
    select * from prices;
    end pricesTouch;
    /SQL> @a.sql
    Input truncated to 1 charactersWarning: Trigger created with compilation errors.
      

  5.   

    create or replace trigger pricesTouch 
    after insert or update on prices
    for each row
    declare 
    com prices%rowtype;
    begin
    select * into com from prices where rownum=1;//只能取一条
    end pricesTouch;
    /
      

  6.   

    pl/sql中的select 必须带into select * 是不行的
    还有,你敲完‘/’后没加回车吧?
      

  7.   

    pl/sql中的select 必须带into select * 是不行的
    还有,你敲完‘/’后没加回车吧?
      

  8.   

    调试错误
    sql>show error