
    Claudia JENNINGS, Appellant, v. The CITY OF HOMESTEAD, d/b/a James Archer Smith Hospital, Appellee.
    No. 92-273.
    District Court of Appeal of Florida, Third District.
    Nov. 24, 1992.
    Rehearing Denied Jan. 12, 1993.
    Ward & Caggiano, and Anthony J. Cag-giano, Miami, for appellant.
    Womack & Bass, and Judith Bass, Miami, for appellee.
    Before SCHWARTZ, C.J., and FERGUSON and GERSTEN, JJ. .
   PER CURIAM.

Affirmed. Hospital Corporation of America v. Lindberg, 571 So.2d 446 (Fla.1990); Solimando v. International Medical Centers, 544 So.2d 1031 (Fla. 2d DCA), review dismissed, 549 So.2d 1013 (Fla.1989); Neilinger v. Baptist Hospital of Miami, Inc., 460 So.2d 564 (Fla. 3d DCA 1984).

SCHWARTZ, C.J., and GERSTEN, JJ., concur.

FERGUSON, Judge

(dissenting).

The first two cases cited in support of the majority’s per curiam affirmance hold that failure to allege compliance with the prelitigation notice requirements of section 768.57, Florida Statutes, does not deprive the court of subject matter jurisdiction and that the trial court may consider principles of estoppel and waiver to excuse such noncompliance. That rule of law answers the narrow procedural issue presented by the order of dismissal from which this appeal is taken, and compels a reversal.

It is alleged that Claudia Jennings, a bedridden patient at James Archer Smith Hospital, suffered serious injury when she was negligently dropped four feet to the floor by hospital employees while being transferred from a stretcher to a bed. The trial court dismissed the complaint for the reasons alleged by the appellee in its motion to dismiss — lack of subject matter jurisdiction.

At a hearing on the defendant’s motion to dismiss for lack of subject matter jurisdiction, the plaintiff argued that failure to allege compliance with the statutory notice did not deprive the court of subject matter jurisdiction. She was correct. Ingersoll v. Hoffman, 589 So.2d 223, 224 (Fla.1991) (the failure to comply with statutory prelitigation notice requirements is not jurisdictional and may be excused by showing estoppel or waiver). The trial court disagreed.

It is critical that the trial court incorrectly dismissed for lack of subject matter jurisdiction, rather than for failure to state a cause of action. The statute of limitations expired while the motion was pending. If the dismissal had been, as it should have been, for failure to state a cause of action with leave to amend, service of the statutory pre-notice along with an amended complaint would have tolled the running of the statute. Hospital Corp. of Am. v. Lindberg, 571 So.2d 446 (Fla.1990). The dismissal for lack of subject matter jurisdiction cut off the plaintiff’s right to file an amended complaint relating back to the date the original complaint was filed.

In this appeal the defendant persists in its argument that the court is without jurisdiction arguing here, for the first time, that the statute of limitations expired during the five months the motion to dismiss was pending in the trial court and is now a bar to the court’s exercise of subject matter jurisdiction. It is settled law, however, that just as the failure to comply with a statutory prelitigation notice requirement is not a jurisdictional impediment, Inger-soll, neither does the running of the statute of limitations oust the court of subject matter jurisdiction. Barnett Bank v. Estate of Read, 493 So.2d 447 (Fla.1986) (statute of limitations is not jurisdictional and may be waived if not raised as an affirmative defense).

In what may be described as a “gotcha” maneuver by the appellate court, the majority makes one of two possible sub silen-tio rulings, either of which is contrary to the law.

First, it assumes, without a record of an evidentiary hearing, that facts alleged by the defendant in its motion to dismiss — that no prelitigation notice was given — are true so as to apply a “right for the wrong reason” analysis. At the stage of the proceedings where the motion to dismiss was presented the appropriate inquiry was simply whether the pleading was sufficient. A defense judgment on the merits where the plaintiff fails to comply with the notice statute cannot be entered unless the defendant pleads, by answer or affirmative defense, and proves the noncompliance after the time for amending the complaint has expired. Metropolitan Dade County v. Braude, 593 So.2d 563 (Fla. 3d DCA 1992) (defendant entitled to judgment at end of plaintiff’s case where it was pleaded affirmatively and proved that the prelitigation notice was not given). In this case there is an admission by the appellee that no responsive pleading was filed alleging a failure of the appellant to comply with the statute.

Alternatively, and most likely, the majority has granted the defendant’s request that its motion to dismiss for lack of subject matter jurisdiction be treated here as if the correct motion had been made to the trial court. If the majority is treating the motion as one to dismiss for failure to state a cause of action, then the dismissal should be with leave to amend. There is absolutely no authority for dismissing a complaint with prejudice where a plaintiff has failed to allege compliance with the prelitigation notice statute. The purpose of the statute is not to deprive a litigant of the opportunity to be heard on the merits. Rather, the legislative intent “is to reduce the number of unnecessary lawsuits by providing the prospective defendant the opportunity to investigate the claim and make a settlement offer, if appropriate.” Solimando v. International Med. Centers, 544 So.2d 1031, 1033 (Fla. 2d DCA), review dismissed, 549 So.2d 1013 (Fla.1989).

Dismissal of the complaint with prejudice for the incorrect reasons alleged in the defendant’s motion to dismiss caused extreme prejudice to the plaintiff. It is not the function of this appellate court to correct the defendant’s defective motion. If we chose to do so, the consequence could only be to affirm the dismissal as one without prejudice to amend. 
      
      . Section 768.57, Florida Statutes, was transferred to section 766.106, Florida Statutes, in 1988. See Allen v. Orlando Regional Medical Ctr., 606 So.2d 665 (Fla. 5th DCA 1992). The order of dismissal was grounded on lack of subject matter jurisdiction due to Jennings’s failure to comply with section 766.106.
     
      
      . A pleading of compliance with the notice statute is necessary for the complaint to state a cause of action upon which relief may be granted. Hospital Corp. of Am. v. Lindberg, 571 So.2d 446, 448 (Fla.1990).
     
      
      . The colorful phrase was coined by Chief Judge Schwartz in Salcedo v. Asociacion Cubana, Inc., 368 So.2d 1337 (Fla. 3d DCA), cert. denied, 378 So.2d 342 (Fla.1979), to describe a practice where a defendant secured the dismissal of an action on an improper basis then used the delay occasioned by the ruling as grounds for later asserting a statute of limitations defense. That is precisely one of the theories advanced by the defense as a ground for affirming the dismissal.
     
      
      . Explaining the failure to assert noncompliance with the notice requirement as a substantive defense, appellee states that it "inadvertently dropped three affirmative defenses.”
     