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 6640059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:37:42+00:00 2026-05-25T23:37:42+00:00

Suppose I have a search functionality in front end written in Java. I have

  • 0

Suppose I have a search functionality in front end written in Java. I have a text box for example name. When I pass a name or a character it works fine, but when I pass any special character, it’s not working because I am sending this parameter to the oracle procedure, which is using dynamic query.

Suppose the query in my procedure is this:

create or replace procedure abc
(abc IN  table.name%type
,p_abc   abc_cur 
)
is 
v_var varchar2(2000); 
begin
v_var:='select * from table where name LIKE '%'NVL(p_name,name)'%'';
open c1 for v_var;

end abc;

When I pass [%,_ ,.] it search on the basis of wild card characters as you see in the query.

Now when I pass [‘] only then it gives an exception. Please tell me a solution how to handle this is backend, I don’t want to consider any special character in the query and the use of dynamic query is compulsory.

NOTE: Please see parameters within braces[] are separated by comma.

I am using Oracle as RDBMS.

  • 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-25T23:37:43+00:00Added an answer on May 25, 2026 at 11:37 pm

    escape! Don’t let the user use %. Also beware of sql injection. (Other chars to keep an aye on are _ and ?)

    Btw in oracle you can user something like

    SELECT * FROM TABLE_A WHERE FIELD LIKE '%sometext\%%' escape by '\'
    

    Regards

    EDIT: I prefer using cursor in for loops

    for x in (select whatever from whenever) loop
       DBMS_OUTPUT.putLine(x.field);
    end loop;
    

    this saves me from managing closures in exception handlers and cursor syntax

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

Sidebar

Related Questions

In Java, suppose I have a String variable S, and I want to search
Suppose I was given a URL. It might already have GET parameters (e.g. http://example.com/search?q=question
I'm new to free-text search, so pardon the newbie question. Suppose I have the
Suppose I have a massive table called inactiveUsers and a search form. I want
Suppose I have a search screen that is intended for looking up items. There
suppose i have the following in a text file (or dired buffer) open in
I'm new to Blackberry Development and i have to implement a search functionality. It
Suppose I have a search for government registered charities, how can I craft my
Suppose we have a table with collumns (A,B,C) We want to search this table
Suppose you have a search textbox and have a search algorithm attached to the

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.