Re: Another interview question

From: Tim Witort <trwAT_at_ATmedicalert.DOTorg>
Date: 1997/07/10
Message-ID: <33C576A3.7886_at_ATmedicalert.DOTorg>#1/1


Michael Serbanescu wrote:
>
> "A production database table contains a column defined as NUMBER(6,2).
> However, at this point in the life of the application using the table,
> *only integer numbers* can be used (although this may change in the
> future, hence the column format). All the values currently contained in
> the column are integers. Can you, the ORACLE DBA, provide as soon as
> possible, a solution to this problem, i.e. allow only integers in that
> column ? Your solution must have minimal or no impact on the
> application, be easy to implement, flexible and generic."

An insert and update trigger on the table would do it. The trigger code could round or truncate (or whatever you want) the column value to integer if the updated or inserted value is not integer. Or it could raise an exception if you don't want the trigger to change the column value transparently - that way users would know that only integers could be entered because when the try to update or insert non-integers they get an error. If you don't raise an exception, you may get the users looking at the values they had already inserted, and say, "Hey! I thought I entered 12.5 there, not 13!"

  • TRW -- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | Tim Witort || He is not silent. He is not | | trwATmedicalertDOTorg || whispering. We are not quiet | | || we are not listening. | | Pin: TZ, only one :^( || - Out of the Grey | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Received on Thu Jul 10 1997 - 00:00:00 CEST

Original text of this message