That's correct, you do not need a sim card installed to use an iPhone over WiFi. Without a sim card, your iPhone 5 will act just like an iPod Touch. I've done exactly that with an older iPhone 4. What kind of error are you getting if any? If your WiFi network is protected (it should be) you will need to supply the password to the iPhone during setup.
When I reset my iPhone 3GS to use it as an iPod, I had to insert a SIM card to get it working initially, then I took it out and it's been fine since. I also keep it partially sync'd (contacts etc) and loaded with a SIM card adapter so that if I ever need to, I can pull the sim from my 5s and use the 3GS as a phone again.
Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.