Your mechanic is correct. Having disconnected the battery reset the OBD II trouble codes (turning off the check engine light), but it also erased the emission monitors necessary for your 1997 Toyota Camry to pass the OBD II portion of the smog test.
At this point you'll need to first get the monitors ready by driving your Camry through a Toyota Camry drive cycle. If the check engine light turns on during the drive cycle, you'll need to have the problem fixed and than proceed to perform the drive cycle. The drive cycle will not complete if there is any emission system trouble which causes the check engine light to turn on.
The following is a Generic Drive Cycle which should set all the required Monitors and let your 1997 Toyota Camry pass the smog test.
Begin by: (Make sure you have between 1/4 and 3/4 fuel in the gas tank. The EVAP test will not run while your Toyota has a full tank of gas or the gas tank is near empty).
1. Start the engine. Idle the engine in drive for two and a half minutes with the A/C and rear defroster on.
2. Turn the A/C and rear defrost off, and accelerate to 55 mph at half throttle.
3. Hold at a steady speed of 55 mph for three minutes.
4. Decelerate (coast down) to 20 mph without braking.
5. Accelerate back to 55 to 60 mph at ¾ throttle.
6. Hold at a steady speed of 55 to 60 mph for five minutes.
7. Decelerate (coast down) to a stop without braking.
If all emissions systems are functioning properly, completing the drive cycle above should set the emission monitors required to pass the smog check. It will not hurt to perform the drive cycle 2 or 3 times before the smog inspection. Take caution when performing drive cycles on public roadways. Perform the drive cycle at your own risk.