Home > database >  After adding columns, change the default precision
After adding columns, change the default precision

Time:09-23

The alter table fcdata_cj00 add (fc_qjs_2 NUMBER (25, 6) default 0 not null). After the default value is 0, rather than 0.000000;

If not null to remove the alter table fcdata_cj00 add (fc_qjs_2 NUMBER (25, 6) default 0); The value of the database is 0.00000

Solving the grateful!!!!!!

CodePudding user response:

His first one

CodePudding user response:

 
SQL>
SQL> Col c1 format 0000;
SQL> Create table test (c1 int);
The Table created
SQL> Insert into test (c1) values (1);
1 row inserted
SQL> The alter table test the add c2 number (25, 6) default 0 not null;
Table altered
SQL> The alter table test the add c3 number (25, 6) default 0;
Table altered
SQL> Insert into test (c1) values (2);
1 row inserted
SQL> Select * from the test;
C1 C2 C3
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1, 0.000000 0.000000
2, 0.000000 0.000000
SQL> Drop table test purge;
Table dropped

SQL>

CodePudding user response:

SQL> The create table test111 (c1 int);
SQL> Insert into test111 (c1) values (1);
SQL> The alter table test111 add c2 number (25, 6) default 0 not null;
SQL> The 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.0000002 0
0.000000
The great god why I C2 is 0, rather than 0.00000

CodePudding user response:

In the up sqlplus run? That's only a matter of display, data that's right,

CodePudding user response:

I am in PLSQL run

CodePudding user response:

Two ways are 0.000000
You try to build table

CodePudding user response:

This thing is also has relationship with OS environment setup, I shows the result is 0. Under the up sqlplus,
 
SQL> Select * from the test;

C1 C2 C3
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1 0 0
2 0 0

SQL> Desc test
The name is empty? Type
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
C1 NUMBER (38)
C2 NOT NULL NUMBER (25, 6)
C3 NUMBER (25, 6)

CodePudding user response:

I'm up sqlplus display is 0, in PLSQL showed that C2 is 0, C3 is 0.000000 is not clear why this happen

CodePudding user response:

Change the number to a decimal try it.

CodePudding user response:

refer to the eighth floor qq_41574206 response:
I display in up sqlplus is 0, in PLSQL showed that C2 is 0, C3 is not clear why 0.000000


And with this, these are two client, belongs to the problem of display format,

In the up sqlplus col col_name syntax format, can be set,
  • Related