ehaerim schrieb am 09.06.2012 um 01:16 (-0000):
> 
> ii INTEGER Not Null;
> si SMALLINT Not Null;
> set width ii 4;
> set width si 2;
> select ii, si from test;
>         ii      si
> ========== =======
>       1001       1
> 
> ii and si displays 10 chars and 7 chars.
> I want them to be 4 chars and 2 chars like
>   ii si
> ==== ==
> 1001  1

SET WIDTH appears to work by truncating data for display. That may be
okay for character data; up to the user to decide. But for numerical
data? Would you rather have your numerical ID or your amount of money
truncated on the left-hand or right-hand side?

In other words, it doesn't do what you want.

One might think that SET WIDTH should behave like printf implementations
that try to fit data, including numerical data, into a given number of
characters but do not under any circumstances truncate data.

Or maybe - and I think this is better - operate like Oracle's sqlplus,
which displays a garden fence #### if a number doesn't fit in a display
column, to indicate display buffer overflow (see below).

"SET WIDTH bla" in Firebird/ISQL versus "COLUMN bla FORMAT <spec>" in
Oracle/SQLPLUS, that's obviously not the same level of sophistication.
But then, they don't operate on the same budget either.
-- 

SQL> col a format 99999
SQL> select * from zwei;

     A          B C
------ ---------- ----------
     9          7 juhu
 34567       8765 em2012

SQL> col a format 9999
SQL> select * from zwei;

    A          B C
----- ---------- ----------
    9          7 juhu
#####       8765 em2012

SQL> col a clear
SQL> select * from zwei where a > 8;

         A          B C
---------- ---------- ----------
         9          7 juhu
     34567       8765 em2012

SQL> help col
...
SQL> -- Michael

Reply via email to