Page 1 of 1

How to get the same output generated in SQL*Plus

Posted: Sat 11 Sep 2010 02:29
by Trevis
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.

Posted: Tue 14 Sep 2010 08:55
by AlexP
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;

Posted: Tue 14 Sep 2010 22:14
by Trevis
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?

Posted: Wed 15 Sep 2010 07:00
by AlexP
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.