With their respective transitions to the cloud, analytics, and software-as-a-service (SaaS) in full swing, both Microsoft (MSFT 0.92%) and Oracle (ORCL -0.99%) have been powering a profitable 2017 for their shareholders. Microsoft stock is up 32% so far this year, while Oracle shares have climbed a solid 26%.

The better news is that their share price gains are entirely warranted. Oracle may have been a bit slow to jump on the cloud train, but it's quickly making up time with each passing quarter. And to CEO Satya Nadella's credit, Microsoft's shift in focus toward the cloud came relatively early on.

Both tech giants also reward shareholders with a decent dividend. But which is the better buy now?

Picture of several Oracle employees standing outside behind its logo.

Image source: Oracle.

The case for Oracle

It's safe to say founder and now-CTO Larry Ellison has put his infamous dislike of all things cloud-related behind him. As Oracle demonstrated last quarter, not only has it embraced SaaS and infrastructure delivered via the cloud, those have become the primary drivers of its growth.

Last quarter's $1.47 billion in cloud revenue accounted for 16% of its $9.2 billion in total sales. And the 51% jump in cloud-related sales made it far and away Oracle's leading segment, led by the 61% increase in SaaS revenue.

That focus on software in particular is critical given that most pundits agree SaaS cloud solutions represent a tremendous opportunity. According to one study, cloud SaaS sales will generate $46.3 billion in revenue this year, and climb to $75.7 billion in 2020. And Oracle is picking up steam. As CEO Mark Hurd noted in in the last earnings release, "Our cloud applications business continues to grow more than twice as fast as Salesforce.com."

Though operating expenses increased 7% along with total revenue, a lower tax provision helped boost earnings per share by 21% to $0.52, exceeding last year's $0.43 a share. And with nearly $67 billion in cash, equivalents, and marketable securities on the balance sheet, Oracle's  dividend, which now yields 1.6%, is a payout shareholders can rely on.

Picture of several labels with Microsoft solutions written on them.

Image source: Microsoft.

The case for Microsoft

It's been nearly four years since Nadella became Microsoft's CEO. Unlike Ellison, Nadella made it clear from the get-go with his "mobile-first, cloud-first" mantra that his company would undergo a sweeping transformation. Though the "mobile-first" half of that two-pronged plan didn't pan out, its cloud initiatives certainly have.

Last quarter's annual cloud revenue run-rate of $20.4 billion puts Microsoft near the top of global providers. For some perspective, a year ago, its cloud run-rate was a "mere" $13 billion. That strong cloud sales growth helped push total revenue up an impressive 12% to $24.5 billion in its fiscal 2018 first quarter.

Though cost of revenue and operating expenses rose slightly, which wasn't surprising given Microsoft's forays into artificial intelligence (AI), data analytics, and augmented reality (AR), its top-line gains boosted EPS 17% to $0.84 a share.

Though many pundits bemoaned Microsoft's decision  to acquire LinkedIn for a cool $26.2 billion, it added $1.1 billion in revenue last quarter. Again, thanks to the cloud, every SaaS solution Microsoft offers grew, led by a whopping 90% gain from its Azure cloud platform.

Perhaps the best news is that as fast as Microsoft is growing, there are no signs that its meteoric improvements will slow anytime soon. And similar to Oracle, Microsoft's balance sheet is rock solid, including over $138 billion in ready cash. In other words, Microsoft's dividend, currently yielding 2%, is safe.

And the better buy is...

As you may have gathered, I'm bullish on both Oracle and Microsoft. The two tech titans are focused on the right markets, and are making significant inroads with each passing quarter. Solid, if not spectacular, dividends, along with continual growth on the top and bottom lines, make both strong buys.

That said, Microsoft gets the nod, and the reason boils down to the fact Nadella got his company on the right track well ahead of Ellison and Oracle. Toss in the slightly better dividend payout, and Microsoft wins the day.