Wall Street experts are in the middle of an interesting debate about the official classification of the stock market. In June 2022, the benchmark S&P 500 index closed 20% below its all-time high, and Wall Street agreed that marked the beginning of a bear market. The widely followed index continued to slide in value until October.

The market has traded with a more positive tone since that October low. In fact, the S&P 500 trades about 19.4% above its October low point (and traded as much as 28.2% higher in late July), which led analysts at Bank of America Securities (among others) to declare the official start of a new bull market. However, not all professionals on the Street agree on what constitutes a bull market; others believe the index needs to reclaim its previous all-time high before the bear returns to hibernation.

No matter which camp is right, history is proof the S&P 500 always climbs to new highs given enough time. For that reason, investors should focus on buying quality stocks and holding them for the long term, because when a new bull market does officially arrive, they will be perfectly positioned to benefit.

With that in mind, here are two great stocks to buy now.

1. Oracle continues to build a presence in AI

Oracle (ORCL 2.02%) is one of America's oldest technology companies. It was founded in 1977 and originally developed database management software, but it has remained at the forefront of technological movements, from the dawn of the internet age to the widespread adoption of cloud computing and now the rapid rise of artificial intelligence (AI).

A decade ago, cloud computing software and services accounted for just 20% of Oracle's total revenue. Today, that number stands at 83%. The cloud allows businesses to rent computing power in centralized data centers managed by providers like Oracle, which enables them to operate and reach customers online. That gives Oracle an edge in AI because developers need to build, train, and deploy applications using all of the data stored on their cloud platform of choice.

Plus, Oracle has partnered with leading AI chip provider Nvidia to power its data centers. Earlier this year, Oracle co-founder and chairman Larry Ellison said his company has the highest-performance and lowest-cost graphics processing unit (GPU) cluster technology in the world. 

He expanded on those comments in the recent fiscal 2024 first quarter (ended Aug. 31) by saying Oracle's interconnected Nvidia superclusters could train AI models at twice the speed and at half the cost of other cloud providers. That's why generative AI start-ups and development companies are flocking to use its new Gen2 Cloud infrastructure -- in Q1, they had signed contracts to purchase $4 billion worth of capacity, doubling the $2 billion number from just three months prior.

Investors were a little disappointed by Oracle's Q1 result because overall revenue grew by just 9% year over year. However, the company said it had $65 billion worth of remaining performance obligations across its businesses, with demand far outstripping supply. Oracle said it expects an acceleration in growth later this year as it races to build more data centers to fill that demand.

Oracle stock is down 13% from its all-time high on the back of its Q1 result, but that could be a great opportunity to buy ahead of a much stronger period for the company in the coming quarters.

2. Palo Alto Networks leads one of the world's most important industries

That industry is cybersecurity. See, while cloud providers like Oracle are giving businesses the opportunity to run all of their operations online, that means their valuable data, applications, and digital assets are at risk from cyberattacks around the clock. Palo Alto Networks (PANW 0.91%) is a leading provider of cybersecurity software, and it's becoming more reliant on AI to better protect its customers.

The company estimates that 93% of security operations centers still rely on human-led processes, which means they are not equipped to deal with the sheer volume of threats popping up each day. In fact, Palo Alto says around 23% of security alerts are ignored and never investigated, which creates gigantic vulnerabilities for organizations. The company is solving that problem by using artificial intelligence to automate incident response and shift some of the investigative work away from human operators.

Data is the secret sauce behind AI; the more information an AI model collects, the faster it learns and the more accurate it becomes. Palo Alto serves over 80,000 businesses worldwide, and it has installed sensors with 48,000 of them to collect a whopping 4.8 petabytes (4,800 terabytes) worth of data each day. It feeds that into its precision AI models, which deliver automated incident responses, and also into its generative AI models, which operators can lean on to identify vulnerabilities. 

Palo Alto believes AI is the future of its product portfolio. During fiscal 2023 (ended July 31), the company invested $1.6 billion in research and development and has now embedded AI into 35 products across its three core segments: cloud security, network security, and security operations. For perspective, one of Palo Alto's closest competitors, CrowdStrike, only spent $705 million on research and development over the same period. 

But Palo Alto has a long way to go because it has released more than 180 new major products over the last four years alone, so those powered by AI still represent a small fraction of its overall portfolio. Consider this: In 2021, it took 44 days for a hacker to penetrate a network and steal data. That number shrank to 30 days in 2022, and now, it takes just a few hours. These rapid attacks will cost businesses $8 trillion this year, according to Palo Alto. 

My point is that demand will likely explode for AI-powered cybersecurity in the coming years, which means Palo Alto's business could be underpinned by a massive investment cycle in the technology, funded by significant new customer acquisitions and strong revenue growth. 

Palo Alto stock soared to an all-time high of $257.88 this year, but it has since fallen 11% on the back of recent seasonal weakness in the broader market. That spells opportunity for investors, no matter when the next bull market officially begins.