Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: nvl and subquery
<celia9268_at_my-deja.com>ÀÌ(°¡) ¾Æ·¡ ¸Þ½ÃÁö¸¦
news:7lmfbk$i3p$1_at_nnrp1.deja.com¿¡ °Ô½ÃÇÏ¿´½À´Ï´Ù.
> Hi, everybody.
> I would like to do an insert:
>
> SQL>insert into emp(comm)
> values ( nvl(select comm from emp where empno=8888), 99)
> where empno=7902;
>
> Unfortunately, this statement doesn't work. I know this can be done in
> pl/sql, but i really want to know whether this can be done in SQL?
> Please help.
>
> Regards
> celia
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
This code has some error. First of all number of columns does'nt match. You insert data into comm column(in emp table) <== only one column but you stated two columns separated by ,(comma).
insert into emp(comm)
select nvl(comm,99) from emp where empno=8888;
<== change the statement like this and where statement does not work in
insert statement.
(there are two where statement ah? I think you would update a table ...)
Received on Sun Jul 04 1999 - 08:27:41 CDT
![]() |
![]() |