An officer used police computers to access information about the ex-partner of a woman he was in a relationship with, a court heard.
Michael Westbury, 55, from Aberystwyth, then texted her to say he "didn't like what he had seen".
Westbury pleaded guilty at the town's justice centre to nine charges of misusing police computers and the unauthorised use of personal data.
He had a six-month jail sentence suspended for two years.
He must also do 120 hours of unpaid work.
Westbury, who has since retired from Dyfed-Powys Police, accessed the information at Aberystwyth Police Station between April and May last year.
The court heard Westbury "frequently and repeatedly" accessed the unauthorised information.
Following an investigation by the Independent Office for Police Conduct, he was charged with seven offences of accessing police computer systems without lawful purpose, and two offences of unauthorised disclosure of information.
The court heard his actions had not had any impact on police investigations and no information had been disclosed to criminals.
His sentence was suspended after the district judge took into account his guilty pleas and an otherwise unblemished record during 24 years of service.