Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New record

Status
Not open for further replies.

maxxx

Programmer
Nov 15, 2000
12
RU
Developer2000

I insert new record in detail block
The key(id) of this record is autonumber field
I press commit but this key field is still null
(It will become valid value if i execute_query but i don't
want to do it)
After that i go to another block, i must use
those key field (id) , but i don't know it.
Can you solve this problem?
 
Well, I think you will either have to execute the query to get that ID or you will have to manually create the number yourself so that you can control when the next ID is available. What about executing the query, remembering the ID assigned, and then deleting the record if you decide not to keep it. This will use up your autonumbers, I don't believe it reuses them, but it will probably be easier than creating your own "autonumber".


Terry M. Hoey
th3856@txmail.sbc.com

Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?
 
I hope your using a sequence when you talk about auto numbers or this probably wont work but,Can you either:-

a) put a default value against the item of sequence_name.nextval

b) put a before insert on the block and at this point stick the sequence number in

when you talk about needing the ID in another block can you not just refer to it as :block.column_name??

let me know if your still stuck.

Mike.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top