Originally posted by marist89
I thought of that too, but I'm only down to 3 bullets and will probably need them for my own guys today...
Table of the present rooms in building BL1 (RM): SEX 1 = M - SEX 2 = F SEX = 0 (ROOM WITHOUT SEX)
I thought you guys were going to say "who wants to live in a room with a sex code of zero?"

Raf, you aren't going to get someone to completely do you job for you. Besides I see 4 procedures and a function in a single package not one procedure. Steps 1, 3 and 4 can be separates procedures in a package. Step two is a function that returns an available room. Step 5 should be called when you want to assign someone to a room. It in turn will call the other procedures and the function. You need to break down the problem more and test each part seperately, then write the main procedure. You might also want to look at error handling and error logging.

step1: verify if the student is in table em:
if the student is not in table em, then insert new student

step2: find available room
if find it reserve room INTO rmpct

step3: update students in em

step4: update sex of room or apartment floor

step5: if no room is available raise error