Correct information but does not address the questions directly
Terry O'Brien, September 30, 2003 - 11:46 am UTC
Thanks for the response. However, I was hoping for list of other column default examples as it gets short attention in the Oracle docs and the general Oracle publications.
I'll take your respones to indicate that you have not come across any other defaults that would be useful to know about.
As to the rest of the response, I used the simplist example possible to illustrate the concept required and I was looking for a trigger example such as:
begin
select seqno.nextval into :new.seqno from dual;
:new.tot_amt := :new.price * :new.qty;
end
Although your answer is correct that derived values can be easily be done via a function based index, there are times when generating the derived value and storing it in the table and indexing as part of a composite index can yield staggering performance gains.
As to the lookup, again there are times for performance reasons where this type of lookup is a much better than the one you describe. In my particular case, the lookup is to categorize records into buckets and then indexed with the tot_amt into a composite index.
I was looking for any better approach than doing a select from the tigger as follows:
declare
Vto number;
begin
select col1 from table1 into Vto where .....;
:new.column1 = Vto;
......
end;
So it doesn't appear there is anything more in Oracle 9 for setting defaults and calculating values automatically on an insert beyond what I've already indicated.
Thanks again for the response and I'm enjoying your latest Oracle by Design book.