• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q about Mikalai Zaikin Study Notes Ch 9

 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EJB-QL chapter, it is mentioned that:

"aword.underscored LIKE '\_%' ESCAPE '\'" means the following:

"TRUE for '_foo', FALSE for 'bar'"

What does ESCAPE mean here? Please explain this to me.

Thanks
Deep
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use \ when you want to use _ as actual _ and not _ (for equivalent of any one character)

Escape character is used to use % and _ to match actual % and _ chracateres and not like it's meaning is QL otherwise that is matching single character or macthing none or many characters.

Hope it explains

Gemini
 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. So is ESCAPE a keyword in EJB QL? Also, in this example, we are saying that use '_' as _ only and not in EJB-QL sense but use '%' in EJB-QL sense. If we want to use '%' in normal sense then we will have to write something like

'\_\%' ESCAPE '\'

Is that right?

Thanks again
Deep
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think you need to specify ESCAPE /.
By default / is ESCAPE character in EJB QL.

Your question --
If we want to use '%' in normal sense then we will have to write something like

\%'

And not

'\_\%' ESCAPE '\'

Although

\%' ESCAPE '\'
should work fine. (my guess)

Hope it helps..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic