Book a Demo

Author Topic: SQL Escape Character Issue  (Read 5097 times)

yannick_bur

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
SQL Escape Character Issue
« on: July 26, 2023, 04:45:59 pm »
Hi everyone

I have an issue with my SQL statement within Sparx EA.
Within my SQL statement I would like to find out, if a string starts with a underscore.
My statement is as follows:

.....
AND SourceObject.NAME LIKE '\_%'
.....

From what I know, the escape character is usually the backslash before the underscore to escape the special character.
If I do the exact same SQL statement directly on our Oracle Database it works perfectly fine.

However, if I try to do this with a custom search within Sparx EA it doesn't work.
Has anyone the same issue or can anyone help me with this?

Thanks already in advance!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQL Escape Character Issue
« Reply #1 on: July 26, 2023, 07:27:56 pm »
No Oracle knowledge...

- Have you tried \\_ ? Might be that your compiler treats \_ as a single special char?!

- Look into https://stackoverflow.com/questions/21380261/underscore-is-not-working-in-oracle-like-clause where they use the escape keyword.

q.

yannick_bur

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: SQL Escape Character Issue
« Reply #2 on: July 26, 2023, 07:59:03 pm »
Hey qwerty. thanks for your reply

I have tried both and it doesn't seem to work

The strange thing is that if I use the SQL statement like this '\_%' I don't get an error message or something. There is just no result even though I know for a fact that there is 1 result that should be shown.

Trying two backslashes also doesn't change anything (no result) and with the "escape" keyword I get an error message from the Oracle OLEDB that there is an issue with sorting the results (also strange).

Maybe Oracle doesn't know the "escape" keyword? (I'm not a DB specialist so i sadly don't know)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQL Escape Character Issue
« Reply #3 on: July 26, 2023, 08:53:33 pm »
You might send a priority support request to Sparx. Not sure you will find many Oracle guys here that are deep in those matters.

q.