How do you know it was for your O2 sensor? Was that the interpretation of the sales person at the car parts place? You need to post the actual code here to get valid advice. The code will be a letter and 4 numbers, the code readers used at the car parts houses generally only read the P0xxx codes.
If the gave you a printout from the cash register that suggested the O2 sensor, then the actual code should be at the top. If not, go back and have them run the code again and get the actual code and post it here.