How to get the same output generated in SQL*Plus

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Trevis
Posts: 2
Joined: Sat 11 Sep 2010 02:13

How to get the same output generated in SQL*Plus

Post by Trevis » Sat 11 Sep 2010 02:29

Hello, I need to make a form where a user can type in a TEdit commands such as

Code: Select all

alter session set NLS_DATE_FORMAT = 'dd/mm/yyyy';
and would show the user a feedback message, such as "session altered."

Otherwise the user enter "set linesize 200" and the result of your query (any valid query) is displayed in a TMemo (not in grid) the same way that would show if it were running on SQL*Plus respecting settings set pages, set feedback, col format, etc...

Or even run a

Code: Select all

show sga
or

Code: Select all

show parameter db_block
and see the result the same way as is shown in SQL*Plus

This is possible with the ODAC? What components and events can help me? Any demo?

Thank you.

Sincerely,
Rafael Trevisan.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 14 Sep 2010 08:55

ODAC does not have such functionality, but you can manually check the result of executing commands, and show the message. For example:

try
OraSession1.ExecSQL('alter session set NLS_DATE_FORMAT = ''dd/mm/yyyy''',[null]);
Memo1.Lines.Add('session altered');
except
On E:Exception do Memo1.Lines.Add(E.Message);
end;

Trevis
Posts: 2
Joined: Sat 11 Sep 2010 02:13

Post by Trevis » Tue 14 Sep 2010 22:14

But then I would have to know all possible commands and their outputs. Not quite what I was looking for. Would you like a way to run a script or a query and get the text generated by the server in an event like OnPutConsole.

Any ideas?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 15 Sep 2010 07:00

Hello,

You can manually parse a SQL query to determine type of the query and it responce.

We will consider adding this functionality in one of the next versions.

Post Reply