Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Row based keys or composite key
Nandakumar <N.Kumar_at_rocketmail.com> wrote in message
news:7vcnl3$3sp$1_at_nnrp1.deja.com...
> hi
>
> few question regarding row based keys ( user-generated or system
> generated).
>
> 1) if we define a composite primary key with several fields, can these
> fields allow null values in them?
Yes, but it is better to define it as a not null column and have some default value in it e.g. NOTAVAIL, otherwise the index will not be used.
> 2) Is there a simple way to generate a UNIQUE number for each distinct
> row? ( say if there are three fields f1,f2,f3 in a table, rows are
> distinct if f1||f2||f3 are different in each row)
> i would like to get a unique number corr. to each distinct row, like
> row1 num1
> row2 num2
> row3 num3 where num1 != num2 != num3
Not sure what you are trying to achieve here. If you have a composite key on these three columns, then it is very fast to do a lookup based on these three values if they are all in the where clause of a query. If you have a sequence on a primary key in this table, then every record will have a unique id.
Give more info and I might be able to help more. Received on Fri Oct 29 1999 - 14:23:24 CDT