oracle sqlplus 格式化输出的命令

类别:数据库 点击:0 评论:0 推荐:

SQL> select * from aa;

        BB         CC
---------- ----------
         1  999999.99

SQL> col bb format '99.9';
SQL> select * from aa;

   BB         CC
----- ----------
  1.0  999999.99

SQL> col bb head '99.9';
SQL> select * from aa;

 99.9         CC
----- ----------
  1.0  999999.99

SQL> col bb head '学号';
SQL> select * from aa;

 学号         CC
----- ----------
  1.0  999999.99

SQL> col bb format '99';
SQL> select * from aa;


学号         CC
---- ----------
   1  999999.99

SQL> col bb head '学|号';
SQL> select * from aa;

 学
 号         CC
--- ----------
  1  999999.99

SQL> select count(bb),sum(cc) from aa;

 COUNT(BB)    SUM(CC)
---------- ----------
      8192 8191999918

SQL> col sum(cc) format '9999999999.99';
SQL> select count(bb),sum(cc) from aa;

 COUNT(BB)        SUM(CC)
---------- --------------
      8192  8191999918.08

SQL> col sum(cc) format '9999999999.99' head '总分';
SQL> col count(bb) format '999999' head '人数';
SQL> select count(bb),sum(cc) from aa;

   人数           总分
------- --------------
   8192  8191999918.08

本文地址:http://com.8s8s.com/it/it19304.htm