Oracle SQL escape character (for a '&')

后端 未结 8 1830
囚心锁ツ
囚心锁ツ 2020-11-28 09:58

While attempting to execute SQL insert statements using Oracle SQL Developer I keep generating an \"Enter substitution value\" prompt:

insert into agregadore         


        
相关标签:
8条回答
  • 2020-11-28 10:38

    add this before your request

    set define off;
    
    0 讨论(0)
  • 2020-11-28 10:45

    The real answer is you need to set the escape character to '\': SET ESCAPE ON

    The problem may have occurred either because escaping was disabled, or the escape character was set to something other than '\'. The above statement will enable escaping and set it to '\'.


    None of the other answers previously posted actually answer the original question. They all work around the problem but don't resolve it.

    0 讨论(0)
  • 2020-11-28 10:48

    || chr(38) ||

    This solution is perfect.

    0 讨论(0)
  • 2020-11-28 10:53
    SELECT 'Free &' || ' Clear' FROM DUAL;
    
    0 讨论(0)
  • 2020-11-28 10:54
    insert into AGREGADORES_AGREGADORES (IDAGREGADOR,NOMBRE,URL)
    values (2,'Netvibes',
    'http://www.netvibes.com/subscribe.php?type=rss' || chr(38) || 'amp;url=');
    
    0 讨论(0)
  • 2020-11-28 10:55

    the & is the default value for DEFINE, which allows you to use substitution variables. I like to turn it off using

    SET DEFINE OFF

    then you won't have to worry about escaping or CHR(38).

    0 讨论(0)
提交回复
热议问题