Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sequence returns multiple numbers
On Mon, 10 May 1999 12:20:29 GMT, claese_at_my-dejanews.com wrote:
>Thanks, guys, you were right on the money! There were two rows in DUAL.
>Further consulation with Oracle Support in Sweden (they were excellent,
>BTW) shed some more light on the problem. DUAL works almost like any
>other table, in that you can INSERT into and SELECT from it. You can't
>however, do a DELETE FROM DUAL WHERE.... Instead, you have to DELETE
>FROM DUAL, and then do a simple INSERT od the single row. Apparently,
>the value which you put in DUAL doesn't matter too much, but the
>default is 'X'.
DUAL doesn't "works almost like any other table" - it *is* just another normal table, and as such it behaves *exactly* as any other table. So you can do anything with it, you can insert, update, delete (with or without the where clause, so your assumption about DELETE FROM DUAL WHERE .... is not correct!), you could even drop it! But you need appropritae privileges for all that.
Examples:
SYS_at_PO73> select * from dual;
D
-
X
SYS_at_PO73> insert into dual(dummy) values('Y')
1 row created.
SYS_at_PO73> select * from dual;
D
-
X
Y
SYS_at_PO73> delete from dual where dummy = 'Y';
1 row deleted.
SYS_at_PO73> select * from dual;
D
-
X
>I had no idea that it was *possible* to INSERT INTO DUAL. It is, after
>all, a pretty scary proposition. I haven't yet determined if you need
>any special privileges to do this kind of thing. If not, I feel that
>this is a serious security issue.
No, no Oracle's security issue. It all depends on how your DBA treets the database security, especially the security of system objects. DUAL is owned by user SYS (super-superuser) and by default (at database creation time) the PUBLIC is granted a SELECT privilege on it. And that is all. But if your DBA has granted something elese on this table to anyone, or if he made SYS acount available to any unauthorised user, or if he/she likes to play with the database connected as SYS - then this is only your internal security issue that can leed to such unexpected results as you were experiencing.
>Anyway, thanks again!
>
>--
>Claes Engelin
>Prevas AB
>Gothenburg, Seden
>claes(dot)engelin(at)prevas(dot)se
HTH,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)
![]() |
![]() |