programing

Oracle SQL Developer에서 변수 대체를 피하는 방법

newnotes 2023. 3. 6. 21:25
반응형

Oracle SQL Developer에서 변수 대체를 피하는 방법

Oracle SQL Developer 2.1에서 이 문을 실행하려고 하면 "Enter Substitution Variable" 대화상자가 나타나 TOBAGO의 대체 값을 요구합니다.

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

어떻게 하면 이 문제를 피할 수 있을까요?chr(38)또는u'trinidad \0026 tobago'둘 다 그 진술의 목적을 모호하게 하는 건가요?

쿼리 전에 호출:

set define off;

또는 해킹:

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

SQL*Plus 조정에서:

SET DEFINE OFF는 대체 변수를 값으로 대체하는 명령어 해석을 비활성화합니다.

인 SQL*Plus 퍼팅SET DEFINE ?보통 이 문제를 해결합니다.Oracle SQL Developer에서도 사용할 수 있습니다.

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';

liquibase를 사용하여 sql 파일을 실행하면 오류가 발생하지 않습니다.그러나 SQL 개발자의 경우 이 방법을 사용합니다.set define off;sql sode 전에

set scan off. 위 명령도 작동합니다.

언급URL : https://stackoverflow.com/questions/2333994/how-to-avoid-variable-substitution-in-oracle-sql-developer

반응형