Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Insert Statement Issues

Insert Statement Issues

From: James <james_at_jamesstarritt.com>
Date: Mon, 25 Jun 2001 12:15:58 -0500
Message-ID: <9h7rpn$cf2h7$1@ID-68406.news.dfncis.de>

I'm to add a record and am having problems

Assuming my table (cat) has

keyfield (number - primary), item_id (text - required)

insert into cat (keyfield, item_id) values (keyfieldvalue,'2001.25b')

the problem comes with the keyfielvalue, I need to increment the primary key by one. I tried the following

insert into cat (keyfield, item_id) values (max(keyfield)+1,'2001.25b') insert into cat (keyfield, item_id) values ((select max(keyfield)+1 from cat),'2001.25b')

ORA-00936: missing expression

If I trade the max query for a straight out number it works fine

insert into cat (keyfield, item_id) values (1457,'2001.25b')

So how do I get the largest value in the table at present and then use it in my statement ?

--

James Starritt
Received on Mon Jun 25 2001 - 12:15:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US