Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Avoiding any locks in SQL Servers - read and understand....its magic.
Hello Niall,
Please see below.
"Niall Litchfield" <niall.litchfield_at_dial.pipex.com> wrote in message
news:4015509b$0$2436$cc9e4d1f_at_news.dial.pipex.com...
> "VC" <boston103_at_hotmail.com> wrote in message
> news:X0ZQb.20613$U%5.162136_at_attbi_s03...
> > But, anyway, here's an example for SQL purists:
> >
> > create table t1(id int, amount int);
> > create table t2(id int, amount int);
> > insert into t1 values(1, 40);
> > insert into t2 values(1, 60);
> > commit;
> >
> > -- two linked account have 100 total. The constraint is that the total
> > should not go below zero.
>
> and where is this constraint expressed? I don't see it.
This is the constraint:
(select t1.amount+t2.amount from t1 join t2 on t1.id=t2.id) > [the_update_amount] -- corrected thanks to Jonathan Lewis
One has to code it directly in the SQL because Oracle does not provide database constrraints.
VC Received on Mon Jan 26 2004 - 16:40:11 CST
![]() |
![]() |