Oh my...

First off, the NO_DATA_FOUND error can only come from a SELECT...INTO that returns no data. Therefore, one of the SELECT...INTOs that you have is not returning any data, hence your error.

Now, for the laundry list of issues with this trigger, in no particular order:

- IF..END IF does not require a BEGIN..END within it

- You twice use num_of_rows to check for the simple existence of rows. In the first usage, you set it equal to another variable, which I don't get, but the second usage is an issue. If you want to check for the simple existence of data, don't waste time *counting the entire table*. Add AND ROWNUM = 1 to the SELECT COUNT(*) to make it run much faster!

- The rollback will not be performed
---RAISE_APPLICATION_ERROR(-20500,'Trigger forces a rollback');
---ROLLBACK ;
---raise_application_error(-20999, 3100 || '-' || 'Unable to insert.');
This may be intentional.

- This will *not* work in a multi-user environment:

---select next_id into v_next_id
---from next_id
---where table_name='Platforms';

---:new.platformid:=v_next_id+1;

---update next_id
---set next_id=next_id+1
---where table_name='Platforms';

This truly needs to be implemented via a trigger. Trust me.

- This is probably where your NO_DATA_FOUND error is coming from:

---select nvl(keypart1_use,'nothing'),nvl(keypart2_use,'nothing'),nvl(keypart3_use,'nothing')
---into v_keypart1_use,v_keypart2_use, v_keypart3_use
---from platforms
---where platform=:new.platform;

The NVL call will not do anything when the statement returns no data. Do this instead:

---BEGIN
------select keypart1_use, keypart2_use, keypart3_use
------into v_keypart1_use,v_keypart2_use, v_keypart3_use
------from platforms
------where platform=:new.platform;
---EXCEPTION
------WHEN NO_DATA_FOUND THEN
---------keypart1_use := 'nothing';
---------keypart2_use := 'nothing';
---------keypart3_use := 'nothing';
------WHEN OTHERS THEN
---------RAISE;
---END;

- Why are you going to the platforms table twice?

---select nvl(keypart1_use,'nothing'),nvl(keypart2_use,'nothing'),nvl(keypart3_use,'nothing')
---into v_keypart1_use,v_keypart2_use, v_keypart3_use
---from platforms
---where platform=:new.platform;

---select platformid, v_keypart1indic, v_keypart2indic, v_keypart3indic
---from platforms
---where platform=:new.platform;

Get everything you need in one statement.

- Another point for the 2 SELECT..INTO statements you have. It looks like you are inserting into the same table you are selecting from. This means that you can have more than one row with the same platform value, no? If that is the case, then your SELECT..INTOs will blow up on these as well. SELECT..INTO *requires* 1 and only 1 row be returned. Any other number of rows will generate an error. You need to re-think what you are doing here.

----------------------------------------------------

You must remember that you are executing *all* this code for every single record you ever insert into this table. Triggers are wonderful things when used responsibly. You need to seriously consider everything you do inside a trigger as it can have a significant impact on the performance of your database.

Finally, I'm honestly not trying to bust on you or anything, but this is a lot of issues for a single trigger. I hope my critiques help more than they hurt.

- Chris