Announcement

Collapse
No announcement yet.

Saving a textfield with a single quote to Oracle

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Saving a textfield with a single quote to Oracle

    When saving a textfield with eg the contents O'Hara to Oracle processing halts with a ORA-00933 error complaining the SQL ended premature.

    Why is this?

    Oracle offers the Q-quote operator for this and I wonder why the Scriptcase system is not using this. Trying to use it yourself in the sql-statement gives no positive results. ORA 00933 errors keep coming.

    I found a workaround by using str_replace and replacing the single quote with 2 single quotes. Then it works flawless. But to be frank I find this a silly and cumbersome solution. The system should do it.

    Would it be possible for Scriptcase to have a look into this glitch?

  • #2
    Originally posted by scriptfan View Post
    When saving a textfield with eg the contents O'Hara to Oracle processing halts with a ORA-00933 error complaining the SQL ended premature.

    Why is this?

    Oracle offers the Q-quote operator for this and I wonder why the Scriptcase system is not using this. Trying to use it yourself in the sql-statement gives no positive results. ORA 00933 errors keep coming.

    I found a workaround by using str_replace and replacing the single quote with 2 single quotes. Then it works flawless. But to be frank I find this a silly and cumbersome solution. The system should do it.

    Would it be possible for Scriptcase to have a look into this glitch?
    In general this is a common problem to databases. In PHP there's a statement you could use, i.e. in the onvalidate:

    http://php.net/manual/en/function.addslashes.php
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Searching the forum I found this addslashes solution and tried it, but it didn't work. Still the ORA 0933 error.

      Apparently Oracle doesn't like the backslash as an escape character. Then I found by accident the single quote escape.

      Comment

      Working...
      X