
694 So.2d 633 (1997)
James K. HAYS, Plaintiff-Appellant,
v.
Kenneth VOLENTINE, Sheriff of Claiborne Parish, Defendant-Appellee.
No. 29555-CA.
Court of Appeal of Louisiana, Second Circuit.
May 7, 1997.
*634 Paul Garner, Homer, for Plaintiff-Appellant.
Usry & Weeks by T. Allen Usry and Craig E. Frosch, Metairie, for Defendant-Appellee.
Before NORRIS, STEWART and GASKINS, JJ.
NORRIS, Judge.
James Hays appeals a judgment sustaining the sheriff of Claiborne Parish's exception of no cause of action and dismissing his petition for writ of mandamus with prejudice. For the reasons expressed, we amend and remand.

Procedural background
In his petition for writ of mandamus, Hays alleged that Sheriff Kenneth Volentine issued him a permit to carry a concealed weapon in February 1995. When the one-year term of the permit expired, Hays applied for a renewal, but received no response so he hired an attorney to inquire regarding the status of his application. In April 1996 the Sheriff's attorney notified Hays by letter that "a decision has been made not to renew" the permit; no explanation was offered.
Hays alleged that there had been no significant change in his personal circumstances, fitness or criminal history since the issuance of the prior permit in February 1995, and that the Sheriff's inaction constituted a refusal to perform the statutory duty imposed by La.R.S. 40:1379.1 F. He also alleged that in the event the court determined the Sheriff's duty was not purely ministerial, the refusal to issue the permit was arbitrary and capricious. He therefore prayed that a writ of mandamus issue directing the Sheriff to grant him a permit, or to show cause to the contrary. He also requested all appropriate general and equitable relief. The rule to show cause was issued.
Sheriff Volentine filed an exception of no cause of action, arguing that under R.S. 40:1379.1 the chief law enforcement officer of a parish has the authority to issue a concealed handgun permit, but is not mandated to do so in all instances; the statute merely provides that issuance of a permit shall not be "unreasonably withheld." Thus the Sheriff urged there is no mandatory duty to issue a permit to all applicants, but rather a discretionary duty involving the review of applications and issuance as deemed proper. Because of the discretionary aspect of the duty, the Sheriff argued that mandamus was inappropriate and that the petition failed to state a cause of action.
After argument of counsel at a hearing on the exception, the District Court sustained the Sheriff's exception of no cause of action and dismissed the petition with prejudice at Hays's cost. Hays took the instant devolutive appeal; Sheriff Volentine has answered, seeking damages for a frivolous appeal.

Applicable law
Mandamus is an extraordinary remedy which lies to compel performance of prescribed duties that are purely ministerial, and is proper in all cases where the law provides no relief by ordinary means or where the delay involved in obtaining ordinary relief may cause injustice. La. C.C.P. arts. 3861, 3862. It does not lie to compel performance of an act which contains any element of discretion, however slight. Felix v. St. Paul Fire & Marine Ins. Co., 477 So.2d 676 (La.1985); Terral Barge Line Inc. v. Madison Parish Port Com'n, 577 So.2d 787 (La.App. 2d Cir.1991). Mandamus does not *635 issue in a "doubtful" case. City of Shreveport v. Stanley, 446 So.2d 839 (La.App. 2d Cir.), writ denied 450 So.2d 956 (1984). A ministerial duty is one performed without requiring the exercise of judgment, in obedience to some clear command. Note, "MandamusCompelling an Official to Perform Discretionary Duty," 29 La.L.Rev. 570, 574 (1969).
The function of the exception of no cause of action is to test the legal sufficiency of the petition by determining whether the law affords a remedy on the facts alleged in the pleading. Everything on Wheels Subaru Inc. v. Subaru South Inc., 616 So.2d 1234 (La.1993). The exception of no cause of action is an appropriate means of attacking a petition for mandamus on grounds that the duty involved is discretionary. Acadiana Bank v. Hayes, 498 So.2d 275 (La.App. 1st Cir.1986); Wilkinson v. LaFranz, 574 So.2d 403 (La.App. 4th Cir.1991). However, when the grounds of the objection pleaded by the peremptory exception may be removed by amendment of the petition, the judgment sustaining the exception shall order such amendment within the delay allowed by the court. La. C.C.P. art. 934; Alexander & Alexander Inc. v. State, 486 So.2d 95 (La. 1986); Goodwin v. Agrilite of La., 26,061 (La.App.2d Cir. 9/21/94), 643 So.2d 249.

Discussion
The statute which grants Sheriff Volentine the authority to issue concealed weapons permits, La.R.S. 40:1379.1, provides in pertinent part:
F. The chief law enforcement officer of a parish shall have the authority to issue a concealed handgun permit to an individual, which permit shall be valid only within the boundaries of the chief law enforcement officer's parish. Upon application, the officer shall personally perform a standard criminal record check. The officer who performed the standard criminal record check shall not be liable for acts committed by the permittee, unless the officer had actual personal knowledge at the time he issued the permit that the permittee was mentally unstable or disqualified by law from possessing a firearm. Notwithstanding the provisions of this Subsection, the issuance of a permit shall not be unreasonably withheld.

* * * * * *
H. The superintendent of state police or the chief law enforcement officer of a parish shall have the authority to revoke any concealed handgun permit, and is further empowered to require those holding handgun permits to furnish proof of their being bonded, and such other information as may be deemed necessary for determining suitability for holding a concealed handgun permit.

(emphasis added)
A plain reading of this statute, with its reference to "unreasonable" withholding of the permit and "other information deemed necessary" to determine an applicant's suitability, shows that an element of discretion inheres in the chief law enforcement officer's decision to grant or deny the concealed handgun permit. For this reason, the writ of mandamus is not appropriate. Terral Barge Line Inc. v. Madison Parish Port Com'n, supra, and authorities therein. The District Court was not plainly wrong to sustain the exception of no cause of action.
With this finding, however, we also observe that Hays prayed for all general and equitable relief. The petition must be construed as challenging the exercise of the Sheriff's discretion to withhold a permit. La. C.C.P. art. 865. This relief may be sought by ordinary process for permanent injunction or declaratory judgment. See State ex rel. Neighborhood Action Committee v. Edwards, 94-0630 (La.App. 1st Cir. 3/3/95), 652 So.2d 698. The instant record requires that Hays be granted leave to amend his petition to remove the grounds of the exception. La. C.C.P. art. 934. We therefore amend the District Court's judgment to state that Hays's petition is dismissed without prejudice, and we remand the case for the court to fix a reasonable time in which Hays may amend his petition.
By answer to appeal, Sheriff Volentine has sought damages for a frivolous appeal. La. C.C.P. art. 2164. An appeal is *636 deemed frivolous only if it does not present a substantial legal question; or if it is obvious either that the sole purpose is delay, or that appealing counsel does not seriously believe the view he has advocated. Joyner v. Wear, 27,631 (La.App.2d Cir. 12/6/95), 665 So.2d 634. In light of the fact that Hays is entitled to some relief, we find damages for frivolous appeal are not warranted.

Conclusion
For the reasons expressed, the judgment is affirmed insofar as it sustains the Sheriff of Claiborne Parish's exception of no cause of action, but it is amended to reflect that the dismissal is without prejudice. The case is remanded to the District Court to grant the plaintiff a reasonable time in which to amend his petition. We deny the relief sought by the answer to appeal. Costs of this appeal are not assessed. La.R.S. 13:4521 A(1).
JUDGMENT AMENDED AND CASE REMANDED.
