How to suppress Oracle input window without using set define off

Asked

Viewed 148 times

0

I need to insert an image in oracle using php, but after I convert it to insert into the database, it gets some characters & in the middle of the string, this character in Oracle triggers an input screen, when this input screen is triggered, php gets lost and throws an exception, I have tried to use set define off to suppress the input screen but without success, my oracle user does not have this permission and there is no way I can get another user, what would be the way around this question? the question would be, how to delete the oracle input screen without using set define off.

This is the input screen I need to delete:

inserir a descrição da imagem aqui

  • would be able to post your php code you are using to insert ?

  • The problem is not in Insert but in sumprimir the input screen without using set define off, if I post the Insert I will end up taking the focus of the question.

  • I also find the question strange, I would also like to see how this line being executed.

  • Take a test, try to insert into a column with the type varchar2(10) in a test table, with the value: R0b&rT0 and make sure you are entering. Using PHP, of course.

  • I’ve done this test David when I try to do that Oracle fires the input window that’s in the print up there, that’s how I discovered the error after many attempts, when php comes across this window it triggers an exception it would be almost impossible for me to make php communicate with this window in the background, I need to disable this input without using set define off

  • I don’t know much about PHP, but I really believe that the problem is in your PHP code, using PDO? mysqli? Post your code, I believe someone can help.

  • 1

    You can use set escape?

  • I can’t wear a set, unfortunately.

  • So I’m using PDO, yes, if I was going to improve it would have to be the part of the code that turns the photo into hexadecimal,.

  • You can use another character other than &?

  • I can, just because this character is in the middle of a photo transformed in hexadecimal, each string of this has some 6000 characters is invicable to each new photo do the manual search of these characters inside the string.

  • 1

    @ROBERTOALBINOJUNIOR, I believe that your problem is specifically in the query that makes Insert. This seems to me a simple error of string escape. PDO usually escapes everything when using Preparedstatement. You are either concatenating the query or using Preparedstatements ?

  • Concatenating the query

Show 8 more comments

1 answer

1

SET ESCAPE '\'   

CREATE TABLE TABELA ( 
   C1 VARCHAR(10),
   C2 VARCHAR(10))

INSERT INTO TABELA VALUES ( 'CAR\&LOS', 'ANDOR\&INHA')   

Browser other questions tagged

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