Re: PROBLEM with simple SQL-statement
From: Stephen Lappin <SL_at_rtel.demon.co.uk>
Date: Thu, 16 Jun 1994 16:20:03 +0000
Message-ID: <771783603snz_at_rtel.demon.co.uk>
Date: Thu, 16 Jun 1994 16:20:03 +0000
Message-ID: <771783603snz_at_rtel.demon.co.uk>
In article <kooy.3.771678526_at_frw.ruu.nl>
kooy_at_frw.ruu.nl "J.W. van der Kooy" writes:
> I have some problems with performing a, I think, very simple task in an
> ORACLE-database (using SQLPLUS).
>
> My plan was to update a column 'amount' with the value of 'price'
> multiplied by an appropriate VAT-rate from another table. I tried this:
>
> SQL> update MYTABLE set AMOUNT = PRICE *
> (select distinct VAT from VATTABLE where CATEG = 2);
>
> It did not work: I got
>
> (select distinct ....
> *
> missing expression
>
> WHAT must be done differently here???
Try this...
UPDATE mytable mt
SET amount = (SELECT (mt.amount * vt.vat)
FROM vattable vt WHERE categ = 2);
-- Stephen Lappin +-----------------+ | +-------------+ | Real Time Engineering Ltd. | | Real Time | | Capital House | +-------------+ | 20 Park Circus | Engineering Ltd | Glasgow G3 6BE Tel: +44 (0)41 332 9400 +-----------------+ Scotland U.K. Fax: +44 (0)41 331 2509Received on Thu Jun 16 1994 - 18:20:03 CEST