Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Insert Statement Issues
ok I got it .... MS Access Query builder and Show SQL might not be ideal but it helps ;-D
-- James Starritt "James" <james_at_jamesstarritt.com> wrote in message news:9h7rpn$cf2h7$1_at_ID-68406.news.dfncis.de...Received on Mon Jun 25 2001 - 12:41:35 CDT
> 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
>
>
![]() |
![]() |