So i am working on an installer where the installer connects to a database and creates tables and populates them. Every aspect of this works correctly except when i attempt to add rows to a certian table.
declare
retVal INTEGER;
rptID INTEGER;
catID INTEGER;
wsID INTEGER;
paramID INTEGER;
dtID INTEGER;
begin
select PK into catID from RPT_CATEGORY where KEYVALUE = 'ProductivityReportsCategory';
select PK into rptID from RPT_REPORT where KEYVALUE = 'ProductivitySummaryReport2';
select PK into wsID from RPT_WEBSVC where KEYVALUE = 'NotApplicable' and category_fk = catID;
The select statements that populate the database look like this:
select PK into wsID from RPT_WEBSVC where KEYVALUE = 'GetMachineNameList' and category_fk = catID;
paramID := RPT_CONFIGURATION.ADD_PARAMETER( rptID, wsID, dtID, 'Machine', 'parameters.GetProductivityDataSet3.inserterid', 4, NULL, NULL, NULL, 0, 0, 0, 'Y', 'Y', 'N', 'N', 'Y' );
There are 13 more select statements structured like this (i won't add them since they are all similar and the only difference is the stored values that would go into the table.)
My problem is that when i run the installer, i get this error in the logs upon completion:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 30
What i would like to know is what exactly is the reason for this error to occur, and what would be the means to fix this error?
I've done some research on the topic, and found this to be the common theme of my search:
1.There's a bug in the code and the developer did not realise that you could get more than one row returned;
2.The data has been hacked rather than using the API so that validation has been broken;
3.The software is OK, what the user did was OK, but two parallel updates occurred at the same time and neither could see the uncommitted change that the other did - hence not validated correctly.
I'm positive it is not #2, but i do not quite understand what exactly the other 2 reasons mean, or how to fix them.
Any help or suggestions are greatly appreciated.
Thanks