wood burning stoves 2.0*
The moose likes JDBC and the fly likes Generating complaint number automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Generating complaint number automatically" Watch "Generating complaint number automatically" New topic
Author

Generating complaint number automatically

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi,
I need to generate a complaint number in database to a calling person.how can i do this?

Thanks.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by preethi Ayyappan:
Hi,
I need to generate a complaint number in database to a calling person.how can i do this?

Thanks.


Pl elaborate it a little more ? What do you want to do ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
If a customer want to make a complaint registration to a bank through phone,a complaint number should be generated automatically for that particular customer in the database.How can i do this?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37933
    
  22
Do you want that to be the primary key in your complaint table?

Try a BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY.
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
No, it should not be a primary key.can i update the complaint number using update query if the customer wants to register a complaint?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes. You can do this either using a database specific mechanism. You don't mention the database type, but you could use a sequence, or an identity column, or an autoincremenet column, or a timestamp colum depending on the database. Or you can do this in your app. Its easy enough to do that - you'll need to use some sort of pattern (for example the HILO key generation pattern) to get a value and just update the database accordingly.

If you have an entity that needs a unique, unchanging, not null complaint number; is that not a primary key?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating complaint number automatically
 
Similar Threads
Do you use the term R&D?
Ubuntu 10.0 Maverick Meerkat
How to get auto generated primary key from a CMP?
prime numbers -please help
How and Where to complaint for Certificate courier service