Good morning everyone ..
I am using Forms 10G and prescission call some shells that is on the server. I tried to use the host command plus the same so makes the form giving loop and has nothing ... I can call the other form and the reports ...
My question is how I should call these shells ...
grateful from silvio
Call Shell in Forms 10g
- dr_gori
- Moderador
- Posts: 5026
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Search for Package Daemon .
She runs things on the server. (Unfortunately, I do not have her here)
: -O
She runs things on the server. (Unfortunately, I do not have her here)
: -O
- dr_gori
- Moderador
- Posts: 5026
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Yes I have!
Here she, I just do not know if it's just compiling and it will work. Maybe you have to have some file on the server.
Spec
Body
An example of the Its use:
(in this case, send an email by shell)
Here she, I just do not know if it's just compiling and it will work. Maybe you have to have some file on the server.
Spec
create or replace package daemon as
/* Executes a non-query sql statement or plsql block. Arguments:
command: the sql statement to execute
timeout: (optional) number of seconds to wait to send or receive a
message
Returns the sqlcode after execution of the statement. */
function execute_sql(command varchar2, timeout number default 10)
return number;
/* Executes a system (host) command. Arguments:
command: the command to execute
timeout: (optional) number of seconds to wait to send or receive a
message
Returns the value passed to the operating system by the command. */
function execute_system(command varchar2, timeout number default 10)
return number;
/* Tells the daemon listener to exit. Arguments:
timeout: (optional) number of seconds to wait to send the message. */
procedure stop(timeout number default 10);
end daemon;
create or replace package body daemon as
function execute_system(command varchar2, timeout number default 10)
return number is
s number;
result varchar2(20);
command_code number;
pipe_name varchar2(30);
begin
/* Use uniqe_session_name to generate a unique name for the return pipe.
We include this as part of the inital message to the daemon, and it is
send along the pipe named 'daemon'. */
pipe_name := dbms_pipe.unique_session_name;
/* Send the 'SYSTEM' command to the daemon. */
dbms_pipe.pack_message('SYSTEM');
dbms_pipe.pack_message(pipe_name);
dbms_pipe.pack_message('export GTA=/usr/Gta;'||command);
s := dbms_pipe.send_message('daemon', timeout);
if s <> 0 then
raise_application_error(-20010,
'Execute_system: Error while sending. Status = ' || s);
end if;
/* Check for the handshake message. Note that we are now listening on
the pipe which is unique to this session. */
s := dbms_pipe.receive_message(pipe_name, timeout);
if s <> 0 then
raise_application_error(-20011,
'Execute_system: Error while receiving. Status = ' || s);
end if;
/* Get the operating system result code, and display it using
dbms_output.put_line(). */
dbms_pipe.unpack_message(result);
if result <> 'done' then
raise_application_error(-20012,
'Execute_system: Done not received.');
end if;
dbms_pipe.unpack_message(command_code);
dbms_output.disable;
dbms_output.enable(1000000000);
dbms_output.put_line('System command executed. result = ' ||
command_code);
return command_code;
end execute_system;
function execute_sql(command varchar2, timeout number default 10)
return number is
s number;
result varchar2(20);
command_code number;
pipe_name varchar2(30);
begin
/* Use uniqe_session_name to generate a unique name for the return pipe.
We include this as part of the inital message to the daemon, and it is
send along the pipe named 'daemon'. */
pipe_name := dbms_pipe.unique_session_name;
/* Send the 'SQL' command to the daemon. */
dbms_pipe.pack_message('SQL');
dbms_pipe.pack_message(pipe_name);
dbms_pipe.pack_message('export GTA=/usr/Gta;'||command);
s := dbms_pipe.send_message('daemon', timeout);
if s <> 0 then
raise_application_error(-20020,
'Execute_sql: Error while sending. Status = ' || s);
end if;
/* Check for the handshake message. Note that we are now listening on
the pipe which is unique to this session. */
s := dbms_pipe.receive_message(pipe_name, timeout);
if s <> 0 then
raise_application_error(-20021,
'Execute_sql: Error while receiving. Status = ' || s);
end if;
/* Get the result code from the SQL statement, and display it using
dbms_output.put_line(). */
dbms_pipe.unpack_message(result);
if result <> 'done' then
raise_application_error(-20022,
'Execute_sql: Done not received.');
end if;
dbms_pipe.unpack_message(command_code);
dbms_output.put_line('SQL command executed. sqlcode = ' || command_code);
return command_code;
end execute_sql;
procedure stop(timeout number default 10) is
s number;
begin
/* Send the 'STOP' command to the daemon. */
dbms_pipe.pack_message('STOP');
s := dbms_pipe.send_message('daemon', timeout);
if s <> 0 then
raise_application_error(-20030,
'Stop: Error while sending. Status = ' || s);
end if;
end stop;
end daemon;
An example of the Its use:
(in this case, send an email by shell)
declare
ln_daemon number;
begin
ln_daemon := daemon.execute_system('echo "Ocorreu ERRO na Importação das Faturas! Veja tabela LOG_FATURA!" | mail -s $(hostname)_LOGFATURA bill@microsoft.com' ,10000 );
end;
Hi, good afternoon ... I tried error ...
I create this package in the forms or at the bank? For the forms does not accept some PL / SQL expressions
Replace for example ...
Remembering that I am with 10G forms and accessing a Linux server to run commands In shells ...
I create this package in the forms or at the bank? For the forms does not accept some PL / SQL expressions
Replace for example ...
Remembering that I am with 10G forms and accessing a Linux server to run commands In shells ...
-
- Rank: DBA Pleno
- Posts: 264
- Joined: Sun, 19 Aug 2007 8:18 pm
- Location: Ribeirão Preto - SP
Lucas de Souza
OCA Developer
Analista de sistemas
OCA Developer
Analista de sistemas
Galera .... to with a mistake so at the time of running this package.
Someone knows why ??
ERROR at line 1:
ORA-20011: Execute_system: Error while receiving. Status = 1
ORA-06512: at "LUCAS.DAEMON", line 61
ORA-06512: at line 1
-
- Rank: Programador Júnior
- Posts: 18
- Joined: Mon, 26 Jan 2009 2:26 pm
- Location: Brusque - SC
Alexandre Petermann
Some know here what parameters are to run the package code daemon , for the following code:
PROCEDURE EXPORTA_DELPHI IS
ln_daemon number;
begin
ln_daemon := daemon.execute_system(I:\click_Textil\ceja\Delphi\Delphi_Exportaçao_Dados\P_CEJA.exe);
end;
- dr_gori
- Moderador
- Posts: 5026
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
You must also put the timeout: (in the example below, 10000)
But remember that it runs on the Oracle server, not on the local user machine.
declare
ln_daemon number;
begin
ln_daemon := daemon.execute_system('echo "Ocorreu ERRO na Importação das Faturas! Veja tabela LOG_FATURA!" | mail -s $(hostname)_LOGFATURA bill@microsoft.com' ,10000 );
end;
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest