Re: Problem in checking conditions

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Mon, 10 Feb 2014 14:51:47 +0000 (UTC)
Message-ID: <pan.2014.02.10.14.51.47_at_gmail.com>


On Sun, 09 Feb 2014 01:54:41 -0800, Karthick Ravi wrote:

> Thank you Peter,

> But when i use sum(loan)!>sum(deposit) it throws an error that
> functions are not allowed in CHECK CONSTRAIN . I this case
> what should i do? Is there any alternate way to check the
> sum(loan) should be less than the sum(deposit) in a table.
That is something for the compound trigger (not available in 10G), not for a check constraint. Check constraints, which are the same thing as "assertions" from the SQL-92 standard cannot use functions or other rows.
Also, SQL-92 is rather old, I would try SQL:2008 standard, since it is the most widely applied one. SQL standards can be found here:

http://www.wiscorp.com/SQLStandards.html

Speaking of SQL standard, people are using them in the vain hope of developing database agnostic applications. There can be no such thing, since the databases are vastly different among themselves, use different philosophies and have different design principles. Each database is a world in itself. If an application works well on Oracle 11G, it doesn't meant that it will work well on SQL Server 2012 or DB2 10.5. Also, using 10G for education purposes is somewhat flawed, as 10G is a desupported release which misses many of the features available in 11G and 12C releases. The bottom line is this:

  1. Database agnostic application suck equally on any database
  2. You will have to choose and learn a single database variety.

PS:

---
The "compound trigger" is a feature of 11G which allows you to avoid 
mutating table errors and is aligned with the rules of zombieland.

http://www.youtube.com/watch?v=NcwETmj86mk
-- 
Mladen Gogala
The Oracle Whisperer
http://mgogala.byethost5.com
Received on Mon Feb 10 2014 - 15:51:47 CET

Original text of this message