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 -> Re: 'IF EXISTS' functionality in Oracle SQL

Re: 'IF EXISTS' functionality in Oracle SQL

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: Mon, 13 Mar 2000 14:02:05 +0000
Message-ID: <JvcGvSAdTPz4EwTC@ahardy.demon.co.uk>


In article <38cce005$0$25792_at_lithium.news.uk.uu.net>, Steve Ball <steve_at_REMOVEMEsdball.com> writes
>All,
>
>I have some SQL written that worked on a Sybase or MS SQL Server db, but not
>Oracle:
>
>if exists (select ...)
>update my_table
>set my_table.status = "65"
>where
>my_table.id = ...

How about...

UPDATE my_table

   SET status = "65"
 WHERE id = xxx
   AND NOT EXISTS (

                SELECT 1
                  FROM my_table
                 WHERE id = yyy
                   AND blah, blah, blah
                )

Andy
--
Andy Hardy. PGP key available on request


Received on Mon Mar 13 2000 - 08:02:05 CST

Original text of this message

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