PurpleSlade
asked on
Getting key or variable returned to java program from SQL Server Trigger which inserts to multiple tables
Hi, my problem is this:
We have a java application that sends an INSERT statement to a table.
The table has a trigger on it which performs multiple INSERTS and UPDATES to multiple tables, one of which is to a PRODUCT table after it creates a new product.
I am interested in retrieving the product_id of the new product from the PRODUCT table.
After the statement executes, I try and grab the product_id by doing a select statement, but it does not seem that it is available as I am executing the code the first time. However, it works during the next fire of the application.
i.e. - String query = "SELECT PRODUCT_ID FROM TABLE WHERE FILE_NAME = 'document." + an + ".pdf'";
works the 2nd time, after the trigger has run, but not the first.
We have a java application that sends an INSERT statement to a table.
The table has a trigger on it which performs multiple INSERTS and UPDATES to multiple tables, one of which is to a PRODUCT table after it creates a new product.
I am interested in retrieving the product_id of the new product from the PRODUCT table.
After the statement executes, I try and grab the product_id by doing a select statement, but it does not seem that it is available as I am executing the code the first time. However, it works during the next fire of the application.
i.e. - String query = "SELECT PRODUCT_ID FROM TABLE WHERE FILE_NAME = 'document." + an + ".pdf'";
works the 2nd time, after the trigger has run, but not the first.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER