Re: SELECT 'X'

From: Steve <smontgomerie_at_hotmail.com>
Date: 14 Aug 2002 06:57:01 -0700
Message-ID: <156709aa.0208140557.2815ff3c_at_posting.google.com>


tks

here's a better example

delete from my_table t1
where exists (select 'x' from my_table t2

              where t2.deptno = t1.deptno
              and t2.dname = t1.dname
              and t2.rowid      > t1.rowid);

the delete removes duplicates from a table

so in this case is 'X' like a cursor, cheking for all records tht meet the criteria and then subsequently passing the records to the delete for removal?

steve

tenmuc_at_onlinehome.de (Michael) wrote in message news:<e5a603fb.0208140113.421429ed_at_posting.google.com>...
> Hi Steve,
>
> SELECT 'X' FROM emp WHERE empno = 1 does result in ONE record
> containing 'X' if there is a record in the table emp where empno=1
> else the result is empty (NULL). SELECT 'X' means the result is ALWAYS
> 'X'.
> This Statement will never work.
> What do you want to do?
>
> DELETE FROM EMP WHERE EMPNO=1;
> It says: All records in the table EMP are deleted in which the clause
> after "WHERE" is true, in the example all records where empno=1.
>
> After "WHERE" is an expression expected, and only those records in the
> table are deleted, where the clause results in a TRUE.
>
>
> Regards
> Mike
>
> > Hello,
> > Having developer trying to run something like this
> >
> > DELETE FROM EMP
> > WHERE (SELECT 'X' FROM emp WHERE empno = 1);
> >
> > the statement fails with missing expression
> >
> > I'm unclear on the usage of SELECT 'X'
> > an also why does the statement fail?
> >
> > tks
> >
> > steve
Received on Wed Aug 14 2002 - 15:57:01 CEST

Original text of this message