Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7527275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:04:18+00:00 2026-05-30T04:04:18+00:00

I am preparing a screen in which user will input an anonymous block (declare

  • 0

I am preparing a screen in which user will input an anonymous block (declare … begin … end) of plsql, and i will save it’s block into a file an run it when it is necessary.
But I want to validate the user’s input against my database whether it has syntax errors or not before execution. when i googled it i found that I can use antlr, but i could not found any working sample. can anyone show me a sample, I am open for other solutions within the java and plsql context.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:04:19+00:00Added an answer on May 30, 2026 at 4:04 am

    You can parse the plsql command with DBMS_SQL:

    SQL> CREATE OR REPLACE PROCEDURE parse(p_command VARCHAR2) AUTHID CURRENT_USER IS
      2     l_cursor INTEGER;
      3  BEGIN
      4     l_cursor := dbms_sql.open_cursor;
      5     dbms_sql.parse(l_cursor, p_command, dbms_sql.native);
      6     dbms_sql.close_cursor(l_cursor);
      7  EXCEPTION
      8     WHEN OTHERS THEN
      9        dbms_sql.close_cursor(l_cursor);
     10        RAISE;
     11  END;
     12  /
    
    Procedure created
    
    SQL> exec parse ('BEGIN NULL;END;');
    
    PL/SQL procedure successfully completed
    
    SQL> exec parse ('BEGIN incorrect_statement;END;');
    
    begin parse ('BEGIN incorrect_statement;END;'); end;
    
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'INCORRECT_STATEMENT' must be declared
    

    Be careful with what you parse though: DDL will be executed on parse (!).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am preparing an application for Android which will display current status of some
I am preparing to use continuous integration for the first time. I will be
I'm preparing a string that will be eval 'ed. The string will contain a
For example, preparing a launch screen of 320 x 480 would have to be
Im preparing API methods for one of the system. Api will be available for
I am preparing a small C++ dll in which the functions are to be
I'm preparing my paypal system and have a separate page that forwards the user
I'm preparing to send mass email to customers which is in html + images.
We are preparing a solution to multicast the teacher's screen to 40 students' pcs.
I am preparing a Hibernate training. The training will be two days long and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.