学习ORACLE就不要老想着SQLSERVER这样,ORACLE该怎么样实现同样的!!
换个思想学习!

解决方案 »

  1.   

    当然可以
    用check 就可以了
    SQL>  create table test (a3 varchar2(2));Table created.
    SQL> alter table test add constraint check_test check
      2   (a3 = 'a1' or a3='a2');Table altered.SQL> insert into test values('a1');1 row created.SQL> insert into test values('aa');
    insert into test values('aa')
    *
    ERROR at line 1:
    ORA-02290: check constraint (DRM.CHECK_TEST) violated
      

  2.   

    create table a(a1 int,a2 int,a3 number);create or replace trigger tri_a before update or insert on a for each row
    begin
      if not :new.a1 is null and :new.a2<>0 then
        :new.a3:=:new.a1/:new.a2;
      end if;
    end;
      

  3.   

    oracle和sql server 不一样的,同意楼上的做法。