2008年12月26日金曜日

Oracleで通番を設定

Oracleで指定しないで通番を指定するには

  1. create table tbl_tree (  
  2.   id number,  
  3.   name varchar2(255) not null,  
  4.   treeXML XMLType,  
  5.   create_dt_d timestamp,  
  6.   update_dt_d timestamp,  
  7.   primary key ( id )  
  8. );  
  9.   
  10. create sequence tblTree_id  start with 1 increment by 1;  
  11.   
  12. select tbltree_id.nextval from dual;  


という風に「tblTree_id」のような変数を作って
指定する必要があります。

SQLではtblTree_id.nextvalみたいな設定が必要です。

0 件のコメント: