Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Indexing by number or by varchar2
Inaki Agirre <inaki.agirre_at_si.unirioja.es> wrote ...
> If I must implement some codification, does it pay to define the primary
> column as number or could I use a meaningful varchar2, say, (3) length.
Better to use number datatype. The sort order is always correct (with varchar2 you must pad with zeroes for sorting to occur properly), and you save a little bit of storage. And, it's easily populated with a sequence called by a before-insert trigger.
Chris