Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!tdsnet-transit!newspeer.tds.net!sn-xit-02!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: Daniel Morgan <damorgan@x.washington.edu>
Newsgroups: comp.databases.oracle.misc
Subject: Re: How to fix this error
Date: Sun, 10 Oct 2004 10:56:33 -0700
Organization: Ye 'Ol Disorganized NNTPCache groupie
Message-ID: <1097431077.308062@yasure>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
References: <d98bdb57.0410091801.25341f7f@posting.google.com>
In-Reply-To: <d98bdb57.0410091801.25341f7f@posting.google.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Cache-Post-Path: yasure!unknown@oracle.advtechserv.com
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
X-Complaints-To: abuse@supernews.com
Lines: 42
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:113303

Rich Sias wrote:

> I am getting the below error, 0947. What can I do to fix this problem. 
> 
> SQL> run 1
>   1  merge into aim m1
>   2  using flataim m2 on (m2.sn = m1.snam)
>   3  when matched then update set m1.snam = m2.sn,
>   4      m1.fnam = m2.fn, m1.lnam = m2.ln, m1.midnam = m2.mn,
>   5      m1.maidn = m2.md, m1.cntry = m2.na, m1.st = m2.st,
>   6      m1.city = m2.cy, m1.empt = m2.mt, m1.nick = m2.nk,
>   7      m1.zip = m2.zp, m1.street = m2.rd
>   8  when not matched then insert ((select aimsq.nextval from dual),
>   9      m1.fnam, m1.lnam, m1.midnam,
>  10      m1.maidn, m1.cntry, m1.state, m1.city, m1.nick,
>  11      m1.zip, m1.street, m1.snam, m1.empt)
>  12  values ( m1.fn, m2.ln, m2.mn, m2.md, m2.na, m2.st, m2.cy
>  13*     m2.nk, m2.zp, m2.rd, m2.sn, m2.mt);
> when not matched then insert ((select aimsq.nextval from dual),
>                               *
> ERROR at line 8:
> ORA-00947: not enough values
> 
> Rich

Fix your syntax and learn to use a sequence properly in an
insert statement.

CREATE TABLE t (
seq_col NUMBER(5));

INSERT INTO t
(seq_col)
VALUES
(aimsq.NEXTVAL);

-- 
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)

