File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes How can I store USERID automatically in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How can I store USERID automatically in Oracle" Watch "How can I store USERID automatically in Oracle" New topic
Author

How can I store USERID automatically in Oracle

subir adhikari
Greenhorn

Joined: Jul 17, 2012
Posts: 4
In a simple servlet program I am creating profiles for different persons registering with the application.The related "registration" table has a "USERID" column where the users' unique "USERID" will be stored. Now I have another table named "MEAL" which has the same column "USERID" which is primary key to "registration" table. When an user will select a meal to be taken from meal selection page corresponding meal data are saved to "MEAL" table.Now I wish the corresponding USERID to be automatically stored in the "USERID" column of the "MEAL" table. So how can I achieve this functionality?Please help me on this!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19312
    
  10

What do you mean by "automatically"?
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

how the user is taking meals? how you are identifying which user is taking meals? if you now that user, who is taking meals you can get that "USERID" value(because it is a primary key) and insert it in the meals table.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19312
    
  10

Yes, exactly. Why not just store the user value in the table just the same way you store the meal value?
subir adhikari
Greenhorn

Joined: Jul 17, 2012
Posts: 4
I user session and solved the issue!!Thanks!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I store USERID automatically in Oracle