Detective Garda Colin Greenway objected to bail being granted to Joseph McGoey, aged 23, of St Thomas Terrace, Dungarvan, Co Waterford, who is charged with assault causing harm to the other man at Parnell Place on Monday, July 2.
Det Greenway said a knife was recovered at the scene and the alleged incident was captured on CCTV.
Eddie Burke, defence solicitor, said Mr McGoey was applying for bail.
The judge was told the accused was addicted to benzodiazepam and was in Cork in an attempt to buy Xanax on the street from someone he knew.
“Will you turn up in court if granted bail?” Mr Burke asked the accused. Mr McGoey replied: “100%.”
“Will you give an undertaking to stay out of Cork City?” the solicitor asked.
The defendant replied: “I will never come back to Cork again if that is a condition.”
Despite the evidence about his relations, Insp Finbarr O’Sullivan said it was alleged the injured party was stabbed twice in the leg following a dispute over two packets of Xanax.
Mr Burke replied that there were counter-allegations from Mr McGoey.
The inspector put it to the accused: ”Why did you not go to your GP in Waterford rather that coming up here to Cork?”
The defendant said his doctor would not prescribe the tablets just because he wanted them.
Judge Olann Kelleher said of the accused: “What concerns me more than anything is that he had an addiction to prescribed medication and he could not control his impulse and he comes to Cork where there is now an allegation of assault causing harm.”
Mr McGoey was remanded in custody until July 9.