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

  • Home
  • SEARCH
  • 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 495461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:35:44+00:00 2026-05-13T05:35:44+00:00

If I have a valid SQL string; is there anyway I can execute it

  • 0

If I have a valid SQL string; is there anyway I can execute it in my PL/SQL – but guarantee that it is a SELECT statement only…without doing complex parsing to ensure it doesn’t have any escape characters/nested commands or any of that jazz?

EDIT:

What I’m really trying to accomplish is a generic, built-in to my application, querying tool. It has a friendly, domain specific GUI and lets a very non-tech user create reasonably complex queries. The tool handles versioning of the searches, adds innerjoins where needed and some other application specific stuff you wouldn’t find a typical SQL DEV type tool.

The application successfully creates a SQL Query. The problem is that I also allow users to directly enter their own SQL. I’m worried about potential SQL injection type issues.

I’m not sure if this is the appropriate place; but, in addition to the question – if anyone could recommend a good Oracle book that would get me up to speed on things of this nature – I’d very much appreciate it.

  • 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-13T05:35:44+00:00Added an answer on May 13, 2026 at 5:35 am

    One solution is to GRANT your user only SELECT privilege if that’s the only thing the user is authorized to do.

    See “Oracle Database Security Guide: Introduction to Privileges“

    However, I don’t think that your application is necessarily secure just because you restrict the queries to SELECT. There are examples of mischief that can be perpetrated when you allow unsafe use of SELECT queries.


    Re your clarified question: I’ve studied SQL injection and written about it quite a bit. What I can advise as a general rule is: Never execute user input as code. That’s how SQL injection occurs.

    You can design a domain-specific language and map user input to SQL operations, but make sure there’s a layer that translates user choices to the database schema. If you separate user input from your SQL code by introducing a mapping layer, then you should be all right.

    See also my answer to “How do I protect this function from sql injection.”

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

Sidebar

Related Questions

I have a template class that is only valid for couple of template parameters:
Suppose I have three classes. It is valid to instantiate A, but there are
My question may not make sense but I have valid reason. We use .net
I have some constants that represent the valid options in one of my model's
If I have a string with a valid math expression such as: String s
I have an object that needs a test if the object data is valid.
Currently we have a DLL that checks whether a username/password is a valid Windows
I have been wondering whether there is any code out there that enables representing
Is there a valid way in SQL Server 2005 to read a row of
first, I can't stand Crystal! Okay, that's off my chest... Now, we have an

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.