Consider my select statement:
SELECT course_id from courses
WHERE
course_id = (
SELECT course_id FROM courses
WHERE course_id = 3
AND max_size > students_registered);
- The values that are to be inserted are not coming from the select. They are submitted from a form by the user. The select tells me if there are slot available to make the insert.
Currently I do this check on the front end with 1 Ajax call, I'm trying to move this away from the front end. Any suggestions would be greatly appreciated.
The insert statement only inserts 8 values into a table. Nothing extraordinary that would value to this question. I've researched extensively. Is my only option moving everything into a stored procedure?
I need this insert to fail when the select returns no rows or null so I can return the right view/jsp to my application.
Please let me know any details I could provide to help.