DBMS output
Posted: Thu 25 Aug 2016 00:53
I have a stored procedure in oracle that puts information on dbms_output. How can I access this information in within Delphi after I execute this procedure ?
Discussion forums for open issues and questions concerning database tools, data access components and developer tools from Devart
https://forums.devart.com/
Code: Select all
CREATE OR REPLACE procedure Pet(StringParameter IN VARCHAR2) is
begin
DBMS_Output.Enable(1024);
DBMS_Output.Put_Line(StringParameter);
end;
Code: Select all
var
OutPutSQL: TOraSQL;
begin
...
OraStoredProc.StoredProcName := 'Pet';
OraStoredProc.Prepare;
OraStoredProc.ParamByName('StringParameter').AsString := 'Hello, World !';
OraStoredProc.ExecProc;
...
OutPutSQL := TOraSQL.Create(Self);
try
OutPutSQL.Session := OraSession;
OutPutSQL.SQL.Add('begin');
OutPutSQL.SQL.Add(' dbms_output.get_line(:LINE, :STATUS);');
OutPutSQL.SQL.Add('end;');
OutPutSQL.ParamByName('LINE').DataType:= ftWideMemo;
OutPutSQL.ParamByName('LINE').ParamType := ptOutput;
OutPutSQL.ParamByName('STATUS').DataType := ftInteger;
OutPutSQL.ParamByName('STATUS').ParamType := ptOutput;
OutPutSQL.Execute;
if OutPutSQL.ParamByName('STATUS').AsInteger = 0 then
ShowMessage(OutPutSQL.ParamByName('Line').AsString);
finally
OutPutSQL.Free;
end;
end;