Help on triggers
Posted in 1995
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
Hello: Scenario: TableA (master table) , and TableB (child table) Every row of entry into TableA can generate zero or more rows in TableB based on a foreign key from TableA. Triggers have been put into TableA such that for each row of insertion, a stored procedure will be executed to update TableC in another database. For one transaction, insertion of value is done in the following order: Insert a row into TableA will generate a serial number,which will be used as a foreign key for all related child rows to be inserted into TableB. Problem: Within the stored procedure, other than taking values that are coming in from TableA (ie. supplied from the triggers) , an SQL-SELECT is done to retrieve the "child" values from TableB. Yet, no values can be selected. The stored procedure seems to take priority over the insertion of values into TableB. Thus, after a row have been inserted into TableA, trigger will execute stored procedure. After that, insertion into child table TableB will occur. Any advise on how to get the values from the child table TableB within the stored procedure will be much appreciated. Thank you. -mwhyekee@starnet.gov.sg