alter table fcdata_cj00 add (fc_qjs_2 NUMBER(25,6) default 0 not null);  后默认值为0 而不是0.000000;如果把not null 去掉 alter table fcdata_cj00 add (fc_qjs_2 NUMBER(25,6) default 0 );  数据库的值就为0.00000了   求解  跪谢!!!

解决方案 »

  1.   


    SQL> 
    SQL> col c1 format 0000;
    SQL> create table test(c1 int);
    Table created
    SQL> insert into test(c1) values(1);
    1 row inserted
    SQL> alter table test add c2 number(25,6) default 0 not null;
    Table altered
    SQL> alter table test add c3 number(25,6) default 0;
    Table altered
    SQL> insert into test(c1) values(2);
    1 row inserted
    SQL> select * from test;
      C1                          C2                          C3
    ---- --------------------------- ---------------------------
       1                    0.000000                    0.000000
       2                    0.000000                    0.000000
    SQL> drop table test purge;
    Table droppedSQL> 
      

  2.   

    SQL> create table test111(c1 int);
    SQL> insert into test111(c1) values(1);
    SQL> alter table test111 add c2 number(25,6) default 0 not null;
    SQL> alter table test111 add c3 number(25,6) default 0;
    SQL> insert into test111(c1) values(2);
    SQL> select * from test111;
      C1                          C2                          C3
    ---- --------------------------- ---------------------------
       1                             0                       0.000000
       2                             0                       0.000000大神为什么我的C2是0,而不是0.00000
      

  3.   

    是不是在sqlplus 里跑的? 那个只是显示的问题,数据没错。
      

  4.   

    我是在plsql 里面跑的
      

  5.   

    这个东东是不是与OS的环境设置也有关系啊。我显示结果,都是0.在sqlplus下。SQL> select * from test;        C1         C2         C3
    ---------- ---------- ----------
             1          0          0
             2          0          0SQL> desc test
     名称                                      是否为空? 类型
     ----------------------------------------- -------- ----------------------------
     C1                                                 NUMBER(38)
     C2                                        NOT NULL NUMBER(25,6)
     C3                                                 NUMBER(25,6)
      

  6.   

    我在sqlplus 里面显示的也都是0,  在plsql里面显示C2是0, C3是0.000000    不清楚为什么会这样
      

  7.   

    把number换成decimal试试看。
      

  8.   


    还有纠结这个呢, 这是两个客户端,属于显示格式的问题。sqlplus 里有 col col_name format 语法,可以设置。