Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Strange behaviour of Scalar Subquery

Strange behaviour of Scalar Subquery

From: <tncc>
Date: Thu, 6 Jan 2005 03:23:57 +0800
Message-ID: <41dc3ef1_2@rain.i-cable.com>


I have a table:

create table c (
adate date,
pk number
)

assuming the columns having proper non-null values, the following update returns error:

update c
set adate=(select min(adate) from c) + 1;

ora-00933 sql command not properly ended

However, this update command executed successfully(i.e. I just swap the operands of + operator) !!

update c
set adate=1+(select min(adate) from c) ;

xxx rows updated

Anyone know why there is a difference? My guess may be the type of the scalar subquery may not be DATE (implicity converted to VARCHAR) in the first case because Oracle evaluates + operator from left to right and converts date to char implicitly. Am I correct? Received on Wed Jan 05 2005 - 13:23:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US