Stocks rose on Friday as a rally in bank shares and a focus on positive results from Oracle buoyed a market that struggled for direction after mixed economic data.

Financial shares gained after lawmakers agreed on an overhaul of regulations in an all-night session, but the bill must still be approved by both chambers of Congress before it can be signed into law.

JPMorgan Chase & Co , up 3 percent at $39.15, contributed the most to the Dow's advance. The KBW bank index <.BKX> jumped 3.1 percent.

Regulation is less onerous than people's fears, so you're seeing a bit of a relief rally in the financials today, which obviously is helping, said Michael James, senior trader at Wedbush Morgan in Los Angeles.

Having been down for the last four days, the market was due for a little bit of balance, he said, adding that Oracle's numbers gave support to gains in technology.

Oracle Corp's quarterly profit beat expectations as sales of new software rose, signaling the tech spending recovery is on track. Oracle added 4.1 percent to $23.13.

The Dow Jones industrial average <.DJI> gained 19.58 points, or 0.19 percent, to 10,172.38. The Standard & Poor's 500 Index <.SPX> rose 6.71 points, or 0.62 percent, to 1,080.40. The Nasdaq Composite Index <.IXIC> added 14.20 points, or 0.64 percent, to 2,231.62.

Despite the day's gains, the main indexes were set to post their first negative week in three and the weakest in the past five. The week's high and low points covered a wider span than last week's. Closing below the previous week's low in an outside week is seen as a technical bearish signal.

Consumer sentiment rose in June to its highest point since January 2008, a survey showed, but separate data showed first-quarter economic growth, measured by gross domestic product, was slower than previously estimated.

On the downside, BlackBerry maker Research in Motion Ltd was the biggest drag on the Nasdaq 100 <.NDX> a day after reporting shipments and subscribers fell short of expectations. Those comments fueled fears that the Canadian company was losing market share to rivals like Apple Inc . RIM's U.S. stock slid 9.6 percent to $52.97.

KB Home shares tumbled 7.9 percent to $11.26 after the fifth-largest U.S. homebuilder reported a wider-than-expected quarterly loss.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)