By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,040 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,040 IT Pros & Developers. It's quick & easy.

a problem when I create a trigger procedure.

P: 2
Hi,

I have been tesing a trigger procedure.
I'd like to know how i can assgign the return value of the aggregation fuction to a user-defined variable.
I have an example below. I'm trying to get st_count to have a retun value of the count(id). However, when i tested, the assignment didn't perform correctly. and the update opeartion didn't work.

I guess there is a type mismatch problem or something else. st_count is integer type and the retun value of the count() is biginteger type. Am I wrong?
Please advise me.


....
declare
st_count integer;
begin
st_count = (select count(id) from ENROLLMENT
WHERE CrsCode = NEW.CrsCode
AND SectionNo = NEW.SectionNo));

UPDATE OFFERED_CLASSES SET ENROLLMENT = ST_COUNT
WHERE CrsCode = NEW.CrsCode
AND SectionNumber = NEW.SectionNumber;
-- RETURN NULL;
end;
....
Dec 9 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.