TOracleScript and string with character '&'

pierre42

Member
I have a difficulty with TOracleScript and the character '&'

If I enter in the property edidor for lines:

UPDATE DASHBOARD SET
TYPE_GOV = (case when (offer = 'S&S only') then 'SUP'
else (case when ((type = 'Tiger') or (type = 'NH') or (type = 'FTH')) then 'GOV'
else 'COM' END) END);

the string 'S&S only' is nether recognized.

The same problem if I add the string by

OracleScript1.Lines.Add('UPDATE DASHBOARD SET ');
OracleScript1.Lines.Add('TYPE_GOV = (case when (offer = ''S&S only'') then ''SUP''');
OracleScript1.Lines.Add('else (case when ((type = ''Tiger'') or (type = ''NH'') or (type = ''FTH'')) then ''GOV''');
OracleScript1.Lines.Add('else ''COM'' END) END);');
OracleScript1.Lines.Add('COMMIT;');

But if I use for example a TOracleDataSet all is fine

OracleDataSet1.SQL.Text := 'UPDATE DASHBOARD a SET ' +
'TYPE_GOV = (case when (offer = ''S&S only'') then ''SUP'' ' +
'else (case when ((type = ''Tiger'') or (type = ''NH'') or (type = ''FTH'')) then ''GOV'' ' +
'else ''COM'' END) END)';
OracleDataSet1.ExecSQL;

the string 'S&S only' is recognized.

All tests are with the same OracleSession.

How can I use OracleScript with this character in string?

Thanks,
Pierre
 
You can use a \ as escape character:

UPDATE DASHBOARD SET
TYPE_GOV = (case when (offer = 'S\&S only') then 'SUP'
else (case when ((type = 'Tiger') or (type = 'NH') or (type = 'FTH')) then 'GOV'
else 'COM' END) END);
 
Back
Top