Before an action can be commenced by a plaintiff other than the state, or the public corporation named in the undertaking or security, leave shall be obtained of the court or judge thereof where the action is triable. Such leave shall be granted upon the production of a certified copy of the undertaking or security, and an affidavit of the plaintiff or some person on behalf of the plaintiff showing the delinquency; but if the matters set forth in the affidavit are such that, if true, the party applying would clearly not be entitled to recover in the action, the leave shall not be granted. If it does not appear from the complaint that leave has been granted, the defendant on motion shall be entitled to judgment of dismissal without prejudice; if it does, the defendant may controvert the allegation, and if the issue be found in favor of the defendant, judgment shall be given accordingly.
ORS 30.230