Reputation: 273
Hi all I a have the following code in my java application
DROP TABLE IF EXISTS "countries";
CREATE TABLE "countries" (
"CNT_ISO2" varchar(2) NOT NULL,
"CNT_CODEN" int(11) NOT NULL,
"CNT_NAME" varchar(100) NOT NULL,
"CNT_NAME_SHORT" varchar(50) NOT NULL,
"CNT_CONTINENT" int(11) DEFAULT NULL,
PRIMARY KEY ("CNT_ISO2")
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
using java I want to replace all varchar with another character say text
eg:- Both varchar(2) and varchar(50) should be replaced with text
Thanks......
Upvotes: 0
Views: 244
Reputation: 200206
I think your solution can be as easy as
stmt.replaceAll("varchar(\\(\\d+\\))?", "text")
Upvotes: 1
Reputation: 1854
Try the following code:
stmt.replaceAll("varchar(\\(\\d+\\))?", "text");
Upvotes: 2