Subject Re: stored procedure issue
Author d_dude_2003
> Because aggregate query with MIN() always return one and exactly
> one record, so your check for EXISTS is completely pointless.

right, my bad. i just copied the original SELECT into if exists()
statement and forgot to correct it.

> > How do i correct the procedure to calculate total points even if
> >no detail records are found?
> SELECT SUM(HRM_GRADE.POINTS) FROM hrm_applicationsubject INNER
> ON hrm_applicationsubject.gradeid = HRM_GRADE.ID
> WHERE hrm_applicationsubject.applicationid = :applicationid
> INTO :subjectpoints;
> IF(subjectpoints IS NULL) THEN
> subjectpoints = 0;

Yes now this works as expected. The only thing i am still wondering
is, why when adding NULL to SOMETHING the result is NULL? Instead of

This logic seems abit weird....

Thanx Dimitry.