SoFunction
Updated on 2025-03-09

How to run OS commands directly (Part 2) on page 2/2

IF (status) 

printf 
("Daemon error while responding to system command.");
printf(" status: %d\n", status);


ELSE 

printf 
("Daemon error: invalid command '%s' received.\n",  );


ELSE 

printf("Daemon error while waiting for signal.");
printf(" status = %d\n", status);


EXEC SQL COMMIT WORK RELEASE;
exit(0);

The above code is named and precompiled with proc:

proc iname= userid=username/password@service name sqlcheck=semantics

To obtain, when compiling with c, please note that you must add it to NT, otherwise the compilation will be passed and the connection will not be passed.

3. Run on the server

4. Run test statements in sqlplus:

SQL> variable rv number 
SQL> execute :rv := DAEMON.EXECUTE_SYSTEM('ls -la');
The PL/SQL process has been successfully completed.
SQL> execute :rv := DAEMON.EXECUTE_SYSTEM('dir');
The PL/SQL process has been successfully completed.
SQL> 

See the oracle documentation for the usage of DBMS_PIPE.


Previous page12Read the full text