On 23/11/2015 11:32 AM, Rowan Worth wrote:
> Hi Bruce,
>
> I had a go at post-processing the sqlite3 shell's output to apply thousand
> separators. I don't recommend looking too hard at the sed for the sake of
> your sanity, but the gist is it repeatedly prepends a comma to trailing
> groups of three digits, and then repeatedly removes commas which appear
> after a decimal point[1].

  I thought that it should be "easy enough" to add a custom function 
that outputs the formatted view for numbers... so, instead of
 > select int_val
you could do:
 > select to_thousands_formatted(int_val)
with an optional parameter that says how you want it separated "," being 
the default.

It would be a bit like using upper(X) with a syntax that uses parameters 
like group_concat() does.  Would that not work?  In that case, this 
pretty_printer coule be code only within the sqlite3 shell (or as an 
extension, it could be in anything).

Best Regards,
Mohit.


Reply via email to