我已经加上了end了,可是提示一样

解决方案 »

  1.   

    insert触发子,没有:old伪记录表。
      

  2.   

    建议你看一看机械工业出版社出版的Oracle8 PL/SQL程序设计的第九章
      

  3.   

    to:xxj():
    我删除insert也没有用,
    我这个trigger是在<<Oracle8i初学者指南>>机械工业出版,P67上抄下来的,能有怎么也有错
      

  4.   

    先写one table 后写before insert or update试试!我手上oralce
      

  5.   

    在我的 ORACLE 7.2.3 上做,没有问题呀,你的详细系统环境,编译错误号!
      

  6.   

    我是在windows2000 prefessional下安装了Oracle8i 8.1.6.0.0,编译时没有提示错误号,但我运行插入后有提示如下:
    SQL> set serveroutput on 
    SQL> insert into customer
      2  values
      3  (11,'CHADIRDJIAN','JACK','QC',15003.32,39540.75);
    insert into customer
                *
    ERROR 位于第 1 行:
    ORA-04098: 触发器 'A.DISPLAY_NEW_SALES' 无效且未通过重新确认
      

  7.   

    我这边还是没有问题,可以显示出来
    insert into customer values(11,'CHADIRDJIAN','JACK','QC',15003.32,39540.75)
    ;
    New sales amount: 39540.751 row created
      你的问题有如下的提示,自己试试看吧:
    Cause: A trigger was attempted to be retrieved for execution and was found to be invalid. This also means that compilation/authorization failed for the trigger. Action: The options are to resolve the compilation/authorization errors, disable the trigger, or drop the trigger. For more information about enabling and disabling triggers, see the index entries on "enabling, triggers," "disabling, triggers," and "DROP TRIGGER command" in Oracle7 Server SQL Reference
      

  8.   

    感谢你的热心,让我慢慢试着看吧。主要是我oracle功底不深,
      

  9.   

    9  dbms_output.put_line('New sales amount: '&brvbar;&brvbar; new_sales_amt);
    这种话毫无意义,可能是这个错误。
      

  10.   

    Drop掉你的触发器,再重建;
    我这边试验也没有问题
      

  11.   

    我将display_new_sales改为display_new_sales1,并加上end; 仍有错!!!SQL> create or replace trigger display_new_sales1
      2  before insert or update 
      3  on customer
      4  for each row
      5  declare
      6   new_sales_amt number;
      7  begin  
      8   new_sales_amt := :new.total_sales-nvl(:old.total_sales,0);
      9   dbms_output.put_line('New sales amount: '|| new_sales_amt);
     10  end;
     11  /警告: 创建的触发器带有编译错误。SQL> sho errors
    TRIGGER DISPLAY_NEW_SALES1 出现错误:
    LINE/COL ERROR
    -------- -------------------------------------------
    4/19     PLS-00049: 错误的赋值变量 'NEW.TOTAL_SALES'
    4/40     PLS-00049: 错误的赋值变量 'OLD.TOTAL_SALES'
      

  12.   

    恐怕是Oracle出了问题,我把表及触发子都建了,没有你说的错误。只是没有输出。
      

  13.   

    你看的是oracle8i初学者指南吧,书里的程序错挺多的,丢三落四,上面程序主要错误是缺少end;
    你往后看pl_sql的时候就明白了,show error命令很管用
      

  14.   

    我问题已解决了,重装了Oracle,即可!!!