What code are you getting? There are two different ones for the O2s. You can get a A/F ratio code, or a heater circuit. If it's the heater circuit code just make sure the wiring isn't broke and replace the sensor. Those are really the only two things that cause it. You can test the heater circuit with a multi-meter if you really want to waste your time.
If it's the A/F ratio it could be other things, but chances are it's the sensor. You need to hook up a scanner and monitor it to figure it out. Is it the pre-cat sensor, or post cat?
Also, I notice you're in CA. Make sure you get the right sensor. CA trucks have different O2s from the federalized vehicles. More expensive of course.