Using & in Oracle Search

Asked

Viewed 363 times

2

I’m having a question about using & on Oracle.

See below my table.

inserir a descrição da imagem aqui

When searching for the description 'Easy Breezy Emailmkt & Eu', Oracle opens a window for passing parameter, as shown below.

inserir a descrição da imagem aqui

My question, I have a way to consult with &, without the bank understanding this as a variable? and without using a set set sets off?

2 answers

4


Normally to solve when using PLSQL, I do as follows:

SELECT * 
  FROM MARK_CAMPANHA
-- WHERE DESCRICAO = 'Easy Breezy Emailmkt '||'&'||' Eu';

Researching a little now, I found using SET ESCAPE, using Sqldeveloper.

SET ESCAPE ON
SET ESCAPE "\"
SELECT * 
  FROM MARK_CAMPANHA
-- WHERE DESCRICAO = 'Easy Breezy Emailmkt \& Eu';

And a third option, similar to the first would be:

 SELECT * 
      FROM MARK_CAMPANHA
    -- WHERE DESCRICAO = 'Easy Breezy Emailmkt'||chr(38)||' Eu';
  • 1

    Thanks really @David. They all worked, but I got the first one. Hug

1

Expensive the best option would be to turn off the Define oracle that has this function to call variable. Then Voce executes the query.

SET DEFINES OFF;

then you can call: SET DEFINES ON;

Obs: This set only occurs in your user session, by default the oracle defines is always ON.

Hugs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.