TOraScript and Macros
Posted: Wed 13 Jan 2010 17:20
I'm unsig ODAC (5.10.4.12) TOraScript and load the script at runtime. I assign a value to a macro but when I execute the script the macro is not substituted.
Sample Script:
CREATE OR REPLACE DIRECTORY AS &P1
/
Sample Code:
for i := 0 to OraScript.Macros.Count - 1 do
begin
MacroName := 'P' + IntToStr(i + 1);
OraScript.FindMacro(MacroName).Value := MainFrm.Macro;
end;
Application.ProcessMessages;
// execute the script
try
OraScript.Execute;
except
on e: Exception do
begin
MainFrm.AddMessage(e.Message);
end;
end;
The documentation states theat the substitution occurs "In time of opening Query..."
There is no Open for TOraScript and when I execute the script the substitution does not occur and I get an oracle error becuase it can't create a directory named &P1.
How can I force the macro substitution at runtime?
John
Sample Script:
CREATE OR REPLACE DIRECTORY AS &P1
/
Sample Code:
for i := 0 to OraScript.Macros.Count - 1 do
begin
MacroName := 'P' + IntToStr(i + 1);
OraScript.FindMacro(MacroName).Value := MainFrm.Macro;
end;
Application.ProcessMessages;
// execute the script
try
OraScript.Execute;
except
on e: Exception do
begin
MainFrm.AddMessage(e.Message);
end;
end;
The documentation states theat the substitution occurs "In time of opening Query..."
There is no Open for TOraScript and when I execute the script the substitution does not occur and I get an oracle error becuase it can't create a directory named &P1.
How can I force the macro substitution at runtime?
John