TOracleScript error

Devil

Member²
Hi, I'm using DOA 4.0.6.1.

TOracleScript.Text has a next value:


Code:
/*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:

Code:
--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:

Code:
// 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.

Code:
--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?
 
As a variant of decision of problem - to put a blank before a point, but it is the not best decision:

Code:
--type_script = before_script
update &sv_owner   .&sv_table
   set depno = 10
 where emp_id = 1;
 
This is standard substitution variable behavior, just like in SQL*Plus. The dot terminates the variable name, so you need to use 2 dots:

Code:
update &sv_owner..&sv_table
   set depno = 10
 where emp_id = 1;
 
Thanks.
As variant I can use new subst variable &sv_owner_table:

Code:
update &sv_owner_table
   set depno = 10
 where emp_id = 1;
 
Back
Top