Updated from Aug. 12

BEA Systems

(BEAS)

posted second-quarter revenue that matched its own lowered expectations and slightly exceeded Wall Street's profit forecast.

Guidance for sales in the third quarter was lighter than expected. Nevertheless, citing the possibility of a takeover bid by

Oracle

(ORCL) - Get Report

, Merrill Lynch upgraded the stock Friday.

In recent trading BEA shares were up 31 cents, or 5.2%, to $6.27.

The San Jose, Calif., company earned $30.6 million, or 7 cents a share, in the July quarter, up about 18% from earnings of $25.9 million, or 6 cents a share, last year. Sales rose 7% from a year ago to $262.3 million.

On a pro forma basis, the company earned 8 cents a share. Analysts surveyed by Thomson First Call had been forecasting earnings of 7 cents a share on revenue of $262.8 million a year ago.

The company said on Thursday that second-quarter license revenue, a key indicator of new business, was $116.3 million, down from $127.4 million a year ago but in line with the company's reduced forecast.

Earlier this month, BEA preannounced mildly disappointing July-quarter results. The company sales and EPS were revised to $260 million to $263 million and 7 cents or 8 cents compared with consensus projections of $277 million and 8 cents a share.

The miss was widely expected, and the stock actually rose because in the words of more than one analyst, "It could have been much worse."

Similarly, Thursday's guidance for the third quarter was rather light, but probably better than many had feared, said Sanford C. Bernstein analyst Charlie Di Bona.

Moreover, the stock has already been beaten up this year, having lost about half of its value since January. Merrill Lynch analyst Jason Maynard said the stock is now "cheap and downside is limited given that it holds $2 a share in cash. While we are not impressed with management's strategy, we think the company has value given the growing maintenance revenue stream, strong operating cash flow, and potential for acquisition." (Merrill has a business relationship with BEA, but does not currently do investment banking for the company.)

The company told investors to expect pro forma earnings in the October quarter of 7 or 8 cents a share on sales ranging from $243.9 million to $280.7 million, a sequential change of minus 3% to plus 3%, with a midpoint of $262.3 million. Analysts were expecting a per-share profit of 7 cents on sales of $270.09 million.

Di Bona added, however, that BEA is prone to revenue swings because of the relatively large deal sizes in its business. "One or two deals either way can make a big difference, so it's not all that helpful to judge the company one quarter at a time," he said in an interview.

Di Bona said he was more concerned about looming competition from Oracle, which said earlier in the day that it is doubling the size of its application server sales force. Application servers, which tie together Web-based applications, are BEA's core business.

In a call with analysts, CEO Alfred Chuang said "we're exiting the quarter in good shape." He said he was particularly pleased with the large number of new customers -- 488 -- in the quarter, the heftiest increase in more than two years. He also downplayed the recent departure of several high-level executives, saying they have been replaced and "the company is not in jeopardy."

Oracle has made no secret of its desire to buy BEA for its highly regarded application server technology. "If the DOJ wins its case we believe BEA could be the next target on Oracle's list. If Oracle wins, and is successful in acquiring

PeopleSoft

(SYMBOL)

, it might push out a potential transaction at least 6-12 months," Maynard said.

At least part of that question will be answered in the next few weeks when a federal judge is expected to decide if Oracle can proceed with its hostile takeover of its smaller rival, a move the government regards as "anti-competitive."