View Single Post

   
  #2 (permalink)  
Old 04-17-2008, 09:29 PM
operationsengineer1@yahoo.com
 
Posts: n/a
Default Re: Last ID Problem

> mitch and all, i noticed that if i keep refreshing
> my
> page that the $insert_id keeps growing... 66 then
> 67
> then 68 then 69.
>
> i guess this makes sense, after all, the "next
> value"
> is always and icnrement higher. this makes me a
> little nervous, though.
>
> i only want one value... the next id i should use
> to
> perform an insert.
>
> i'm hoping currval() does the trick, however, i'm
> getting no result.
>
> do i need to instruct the sequence to go to it last
> value before calling currval()?
>
> tia...


another point of interest. now that i've been
refreshing my nextval() statement, my highest cust_id
value is 65, but nextval() keeps incrementing from
where it was before. reading through the manual, this
is designed in behavior.

it looks like i could reset the value using setval().

i also noticed that currval() returns the value of the
last nextval(). this infers that i must call
nextval() prior to being able to get currval(), yet
nextval() was not included in the original suggestion.

am i missing something here?

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Reply With Quote