How to avoid variable substitution in Oracle SQL Developer with 'trinidad & tobago'

前端 未结 5 1406
天命终不由人
天命终不由人 2020-12-07 15:29

When I try to execute this statement in Oracle SQL Developer 2.1 a dialog box \"Enter Substitution Variable\" pops up asking for a replacement value for TOBAGO<

相关标签:
5条回答
  • 2020-12-07 15:51

    I was having some issue around this too. Something was starting up everytime I tried to setup a connection to any DB..

    What worked for me was removing any startup script that you might have configured!

    i.e. Tools>Preferences...>Database and remove any file path that you have in the text box labeled "Filename for connection startup script"!

    0 讨论(0)
  • 2020-12-07 15:52

    Call this before the query:

    set define off;
    

    Alternatively, hacky:

    update t set country = 'Trinidad and Tobago' where country = 'trinidad &' || ' tobago';
    

    From Tuning SQL*Plus:

    SET DEFINE OFF disables the parsing of commands to replace substitution variables with their values.

    0 讨论(0)
  • 2020-12-07 15:56

    set scan off; Above command also works.

    0 讨论(0)
  • In SQL*Plus putting SET DEFINE ? at the top of the script will normally solve this. Might work for Oracle SQL Developer as well.

    0 讨论(0)
  • 2020-12-07 16:04

    this will work as you asked without CHAR(38):

    update t set country = 'Trinidad and Tobago' where country = 'trinidad & '|| 'tobago';
    
    create table table99(col1 varchar(40));
    insert into table99 values('Trinidad &' || '  Tobago');
    insert into table99 values('Trinidad &' || '  Tobago');
    insert into table99 values('Trinidad &' || '  Tobago');
    insert into table99 values('Trinidad &' || '  Tobago');
    SELECT * FROM table99;
    
    update table99 set col1 = 'Trinidad and Tobago' where col1 = 'Trinidad &'||'  Tobago';
    
    0 讨论(0)
提交回复
热议问题