By Adam Lashinsky

(FORTUNE Magazine) – IF EVER A BUSINESS STORY LENT itself to a bizarre and unlikely narrative, it is Larry Ellison's quixotic quest to acquire PeopleSoft. What began 16 months ago as an acrimonious attempt by mighty Oracle to swallow the much smaller PeopleSoft has become as twisted a tale as the less-than-scintillating enterprise-software industry can offer. PeopleSoft's CEO, Craig Conway, calls Ellison a "psychopath," fights tooth and nail to fend off Oracle, and ultimately is fired, for allegedly lying to investors. Ellison and a top deputy talk publicly of paying less rather than more for a company they supposedly want badly. As a second exhaustive trial wraps up in Delaware, the two sides prepare for a scene-changer, a third trial in January, in California. Listen carefully, and you can almost hear the doors slamming as the characters endlessly enter stage right, only to exit stage left.

Amusing? Certainly. But if Ellison isn't careful, this farce could turn quickly into a tragedy. You see, while Oracle has been dogging PeopleSoft through the media and in courtrooms across the land, Oracle's prize is dwindling in front of its eyes. PeopleSoft is struggling to attract new business--whether Oracle is to blame is precisely the subject of the next lawsuit. That raises the question: Is Oracle squandering the opportunity it has spent all this time pursuing?

There's no question PeopleSoft's finances have flagged. Second-quarter earnings plummeted 70% from the year before, to $11 million, with then-CEO Conway blaming confusion over the Oracle bid. And it's not as if Oracle has benefited. Its license revenue from application software--the only segment in which Oracle and PeopleSoft compete--fell 36%, to $69 million, in its most recent quarter. The beneficiary instead has been industry leader SAP, whose stock has lapped Oracle's and PeopleSoft's over the past two years. SAP's overall U.S. share for application software jumped to 37% at the end of the second quarter, from 29% the year before.

This couldn't possibly be what Oracle had in mind all along. True, the most valuable part of PeopleSoft is the ongoing maintenance contracts it has with existing customers. If Oracle can wipe out PeopleSoft's spending on new software--Oracle plans to whack $1.2 billion annually in expenses--it can add about $200 million to its bottom line next year. But if Oracle ultimately acquires a severely diminished PeopleSoft, that may cripple its chances to sell PeopleSoft customers on Oracle's applications--and databases. "The number of customers where they have relationships are more valuable inside the Oracle family than they are to PeopleSoft, because our product line is so much larger," says Charles Phillips, Oracle's co-president and top salesman. "The same customer they can only sell $5 million to, we can sell $50 million to." That's provided the customer sticks around, which right now is a big if.

There's reason to believe this drama's denouement is coming sooner rather than later. Phillips says Oracle already has integration teams at work planning to implement the acquisition. It's also possible that despite their public positioning the two sides are beginning to talk behind the scenes and could craft a deal long before they meet again in court in January. -- Adam Lashinsky