*TSX edges up 0.06 percent to 13,340.83
* Three biggest sectors keep index in positive territory
* RIM falls to lowest level in about 5 yrs
* Nexen up as China's CNOOC to buy Opti Canada (Updates to close)
By Ka Yan Ng
TORONTO, July 20 (Reuters) - Toronto's main stock market index closed slightly higher on Wednesday as weakness in industrials was offset by stronger energy and banking shares.
The index's three biggest groups -- energy, financials, and materials -- all advanced, and their mild gains were enough to prop up the index for a second straight daily rise.
All three groups were represented among the most heavily weighted climbers. Royal Bank of Canada (RY.TO), up 0.94 percent at C$53.56, led all influential gainers. Barrick Gold (ABX.TO) rose 1.08 percent to C$46.71, followed by Encana (ECA.TO), which added 1.29 percent to C$29.83.
The Toronto Stock Exchange's S&P/TSX composite index .GSPTSE closed up 7.91 points, or 0.06 percent, at 13,340.83. Six of its 10 main sectors were lower, led by a 1 percent decline in the industrials group, while telecoms slid 0.94 percent. The infotech group was unchanged on the day.
"We've been accustomed to markets that can change their mind in a hurry," said Fred Ketchen, director of equity trading at ScotiaMcLeod. He said sector rotation was one reason behind the sharp declines in some sectors.
The political battle over increasing the U.S. debt ceiling as well as the worries about sovereign debt problems in Europe have been a drag on stocks.
European Union leaders must find a convincing solution to Greece's debt crisis at a summit on Thursday or the global economy will pay the price, the head of the European Commission said in an unusually somber warning. [ID:nL6E7IK1QO]
In individual company news, Nexen Inc NXY.TO was up 1.93 percent at C$23.21 after China's top offshore oil producer, CNOOC Ltd (0883.HK), said it would buy Opti Canada Inc OPC.TO, which owns a 35 percent interest in Nexen's struggling Long Lake oils sands project in northern Alberta. [ID:nL3E7IK12D]
Nexen owns the remaining 65 percent stake, and is now seen having a stronger partner, said Youssef Zohny, portfolio manager at Van Arbor Asset Management in Vancouver.
Shareholders will receive 12 U.S. cents a share in cash, compared with Opti Canada's last traded price of C$0.115 a share. Opti stock has not traded since July 12 and has tumbled from a peak of C$25.40 in mid-2008.
Canadian National Railway was the most notable decliner, falling 1.28 percent to C$73.53 after it was cut to "market perform" from "outperform" by Raymond James.
Research In Motion RIM.TO was dented by news that a senior product manager for RIM's PlayBook quit and as main rival Apple unveiled blockbuster quarterly results. RIM shares fell to their lowest point in about five years at C$24.31 before paring losses. The stock closed down 0.71 percent at C$25.26. [ID:nN1E76J100]
($1=$0.95 Canadian) (Reporting by Ka Yan Ng; editing by Peter Galloway)