The code is known in the trade as a PUK and you can only get that from the service provider you or the phone were with before.
It won't be a problem provided there is no outstanding money on the account. If there is, pay that off and you'll get a code within 24 hours. Don't pay and you may as well thrown te device in the bin.