Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Strange syntax in documentation
A copy of this was sent to Yuri Denshchik <yuri_d_at_asainfo.online.ee>
(if that email address didn't require changing)
On Fri, 10 Jul 1998 09:57:02 +0300, you wrote:
>In Oracle8 documentation (Oracle8™ Server Application Developer’s
>Guide) I find example with using of EXISTS:
>IF NOT EXISTS SELECT * FROM emp WHERE emp.empno = :n.empno THEN
> INSERT INTO emp VALUES(:n.empno, :n.name);
>ELSE
> UPDATE emp SET emp.name = :n.name WHERE emp.empno = :n.empno;
>END IF;
>I try to type in my programm in same format but everytime comiler fails
>with exception: PLS-00103: Encountered the symbol "SELECT"
>Is that syntax is realy correct ?
>
that syntax is wrong. I opened a documentation bug #697327 for this.
You would code the above as:
declare
l_cnt number;
begin
select count(*) into l_cnt from dual where exists (select * from emp ....); if (l_cnt > 0) then insert ... else update ... end if;
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jul 10 1998 - 10:40:07 CDT
![]() |
![]() |