receiving server output

Marco, I am not sure this is the same question, but I would like to run an Oracle report by building the sql statements, passing them to TOracleQuery.sql and then executing the query. I want to take the result and pass it, line by line, to a document such as a tRichEdit or an HTML document. (I am trying to completely eliminate the report writer components in favor of this approach.) TOracleQuery.sql does not seem to accept Oracle report SQL such as COLUMN,BREAK ON, etc.

Is there a way to do this.
 
Server output generated by calls to dbms_output.put_line in a stored procedure can only be retrieved after the stored procedure has finished. The output is stored in a buffer that is only accessible from the same session. The following example enables output, calls a stored procedure that has some put_line statements, and finally displays the output in a memo:

Code:
procedure TMyForm.ButtonClick(Sender: TObject);
var Lines: string;
    NumLines: Integer;
begin
  with Query do
  begin
    // Enable output for up to 10000 bytes before the call
    Session.DBMS_Output.Enable(10000);
    // Call the procedure
    Execute;
    // Retrieve the output in batches of 25 lines and store it in a memo
    repeat
      NumLines := 25;
      Session.DBMS_Output.Get_Lines(Lines, NumLines);
      if NumLines > 0 then Memo.Lines.Add(Lines);
    until NumLines = 0;
  end;
end;

About the second question in this thread: the COLUMN and BREAK commands are SQL*Plus syntax, not SQL syntax. You have to implement your own formatting functionality if you want to generate RTF or HTML reports, Direct Oracle Access will only provide you with raw SQL data.

------------------
Marco Kalter
Allround Automations
 
Back
Top