熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

如何為oracle中的表增加像sql server一樣的自動列

2022-06-13   來源: Oracle 

  conn scott/tiger@powermis
  
  drop table foo;
  
  create table foo(
   id number primary key
   data varchar());
  
  create sequence foo_seq;
  
  create or replace trigger bifer_foo_id_pk
   before insert
    on foo
    for each row
  begin
   select foo_seqnextval into :newid from dual;
  end;
  /
  
  insert into foo(data)
   values(Chirstopher);
  
  insert into foo(iddata)
   values(Sean);
  
  select * from foo;
From:http://tw.wingwit.com/Article/program/Oracle/201311/17550.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.