The Baltimore Orioles and Dennis Martinez ended a 12-year relationship today when the right-handed pitcher was traded to the Montreal Expos for a player to be named.

Sources said the Expos will pick up the remainder of Martinez's $500,000 contract, which is about $300,000, if he stays on their roster the rest of the season.

The player the Orioles will get is not known. Orioles General Manager Hank Peters said Montreal General Manager Murray Cook would give him a list of names sometime in the future, and the Orioles would pick one of them before the season is over.

The announcement came as no surprise. The Orioles have been trying to trade Martinez for almost a month and were set to release him if no deal had been worked out.

Yet, when it was finalized, it had amounted to more than getting rid of a pitcher who no longer fits into a team's plans. "We signed him as a boy and he leaves us as a mature and successful man," Peters said. "You don't want to forget the good times, and we won't."

It was that much and more. Of the group Martinez came up through the minor leagues with, only pitcher Mike Flanagan and first baseman Eddie Murray still are with the organization and, when Martinez left the Orioles' clubhouse today, he was in tears.

His career has been nothing if not star struck. After working his way up through the Orioles' minor league system, Martinez broke into the big leagues in 1977 and, over the next five seasons, was one of the American League's best pitchers, going 65-43.

After the 1983 season, he fought a much-publicized battle with alcoholism, but, as he was winning that, he appeared to lose something from his game. In the last three seasons, he won only 26 games and lost 36. This spring he made the club only because the team was unwilling to pay off his $500,000 contract. He appeared in only four games this season and had no record when he went on the disabled list May 3.

The Orioles privately said Martinez has lost a lot off his fastball, but that with both a good slider and curveball, should still be able to win in the big leagues.

"We think that a change in scenery might be good for him," Peters said.

Martinez said he was trying to take that approach, too.

"It's another step in my life," he said. "It hasn't been that easy here the last couple of years, and this is something I'm looking forward to. The Expos said they wanted me, and I'm glad to hear that. I'm not happy about leaving Baltimore . . . Baltimore has been my home."