Re: Any reason not to have logic in the db?

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <linehanp@xxxxxx>, "oracle-l" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 12 Jun 2012 14:43:17 +0300

From: "Paul Linehan" <linehanp@xxxxxx>
Subject: Any reason not to have logic in the db?


> Hi all,
> 
> 
> Apart from my various meanderings as a DBA and
> programmer, I am also in College by night and thus
> want to get at the fundamentals of CS and databases.
> 
> I don't profess to being an expert (I wish!), but I believe
> that I've grasped at least the rudiments of my field, i.e.
> databases and how they should be used.
> 
> I've read loads (apart from my studies) of blogs and
> Oracle (which as we all know, has its flaws) books.
> 
> What I want to know is: Is there any reason whatsoever
> to have logic outside the database that could potentially
> be kept there - notably CHECKs, CONSTRAINTs,
> TRIGGERs, containing possibly complex PL/SQL - i.e.,
> it's sort of a question about App-tiers vs. DB.
> 
> My own opinion (to put my  cards on the table) is that
> "logic" should be stored as far down the stack as possible
> (DB, first, then app-server... &c).
> 
> Anyone know of any counter-examples?


It is OK to keep low-level logic like constraints in DB, because most of the 
time if those constraints are not respected, the data may become corrupted.

But it is not a good idea to keep the business logic in the database because it 
would be very hard to change the database which will be used by your 
application in the future, and your app won't be very flexible.

Of course, if you don't think that you will ever change the DB, and especially 
if you require the best possible speed from your app, no matter how many 
million-hours of work it will require, then you may also want to keep the logic 
in DB.

Octavian




--
http://www.freelists.org/webpage/oracle-l


Other related posts: