number(1)高些,也节省空间。首先,比如VARCHAR(4)你输入1个字符,剩下的它用空格补足。而NUMBER就没此种情况.

解决方案 »

  1.   

    只是做为标记用,可以用char(1)
      

  2.   

    number(1),众所周知,数字型查询速度快,占用空间小。
      

  3.   

    to bobfang(匆匆过客) NUMBER(1) 有什么不好???
      

  4.   

    char(1)并且not null是最省空间的。可以做这样的测试:
    create table t_test1(
    col3 char(1) not null,
    col4 char(1) not null,
    col5 char(1) not null,
    col6 char(1) not null,
    col7 char(1) not null,
    col8 char(1) not null,
    col9 char(1) not null
    )
    /
    create table t_test2(
    col3 number(1) not null,
    col4 number(1) not null,
    col5 number(1) not null,
    col6 number(1) not null,
    col7 number(1) not null,
    col8 number(1) not null,
    col9 number(1) not null
    )
    /insert into t_test1 select '1','1','1','1','1','1','1' from all_tab_columns order by table_name,column_id;
    insert into t_test2 select 1,1,1,1,1,1,1 from all_tab_columns order by table_name,column_id;
    commit;
    insert into t_test1 select * from t_test1;
    insert into t_test1 select * from t_test1;
    commit;
    insert into t_test2 select * from t_test2;
    insert into t_test2 select * from t_test2;
    commit;
    analyze table t_test1 compute statistics;
    analyze table t_test2 compute statistics;
    select segment_name,bytes from user_segments where segment_name like 'T_TEST%';
    select table_name,NUM_ROWS,BLOCKS,AVG_ROW_LEN from user_tables where table_name like 'T_TEST%';