Re: Two questions about views

From: R.A. van Geleuken <roald_at_xs4all.nl>
Date: 1996/04/28
Message-ID: <31834041.75D9_at_xs4all.nl>#1/1


dmoyer_at_gpu.com wrote:
>
> In <4loqru$c9s_at_gaia.cc.gatech.edu>, badri_at_cc.gatech.edu (badri) writes:
> >Hi:
> >
> >1) ORDER BY and views
> > I am creating a view and need to have an order by statement.
> >If I try it, it does not work. How do I make this to work?
> >
>
> The create view may not have an order by statement. When you select from the
> view you may have the order by statement.
>
> >2) Formatting Numbers and Views
> > One of thefields I am selecting is a number and I want it
> >to be nicely formatted with commas. How do I do this?
> >
>
> One way is to create the view with that number column converted to a varchar2
> column as in create view x as select to_char(num_col,'999,999,990.00').
> If you are using a front end tool to access the view, you could then use the tools
> format mask for the item.
>
> >
> >thanks a lot,
> >
> >-Badri
> >
>
> D. Scott Moyer, Jr. dmoyer_at_gpu.com (work)
> GPU Service Corporation dsmoyer_at_enter.net (home)
> Reading, PA

The formatting can also be done by inserting a statement before the select-statement as follows:

col colname format 999.999.999,99

This works for number and char columns (with differrent) format chars of course). While the above mentioned way works, if you want to select a lot of columns and format them all, the col-statement makes your select easier to read.

Roald.

-- 

+-------------------------------------------------------+
| R.A. van Geleuken                     roald_at_xs4all.nl |
+-------------------------------------------------------+
| There's no such thing as impossibility, only          |
| extremely low chance                                  |
+-------------------------------------------------------+
Received on Sun Apr 28 1996 - 00:00:00 CEST

Original text of this message