Hi, I'm using DOA 4.0.6.1.
TOracleScript.Text has a next value:
/*operation_id = 30*/
DEFINE sv_owner = 'scott'
DEFINE sv_table = 'emp'
...
--type_script = before_script
update &sv_owner.&sv_table
set depno = 10
where emp_id = 1;
When I execute this script(OracleScript.Execute), get an error: Ora-00942: table or view does not exists, because TOracleScript replace substitution variable &sv_owner deletes together with a point(".").
Query in Oracle Monitor:
--type_script = before_script
update scottemp
set depno = 10
where emp_id = 1
I found a function in which the delete of point(".") is executed together with the put variable:
// Replace substitution variables
function TOracleCommand.ReplaceVariables(S: string): string;
var Vars: TStringList;
i, p: Integer;
Value: string;
begin
Vars := FindVariables(S);
for i := Vars.Count - 1 downto 0 do
begin
Value := OracleScript.GetVariable(Vars[i]);
p := Integer(Vars.Objects[i]);
Delete(S, p, Length(Vars[i]) + 1);
if (Length(S) > p) and (S[p] = '.') then Delete(S, p, 1); //Problem line code: When I comment this line of code, substitute variables is replaced right.
Insert(Value, S, p);
end;
Result := S;
Vars.Free;
end;
When I comment this line of code, substitute variables is replaced right.
--type_script = before_script
update scott.temp
set depno = 10
where emp_id = 1
Help me: Say why in a code the delete of point(".") is executed and how to correct this problem?