Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Use of host command from scripted SQL
} I was playing around with SQL*Plus and found that I could include the
} host command in my scripts, being a UN*X person I styarted trying to get
} the result of some simple commands (pwd, ls, grep, etc) back into SQL,
} but got no joy.
You can use shell script/sqlplus combinations, instead of the "HOST" command.
} What I'm trying to do is something like:
}
} DEFINE my_var = HOST pwd;
}
} Or
}
} SELECT (HOST pwd) FROM dual;
}
} Or somesuch... Is there a way to do this?
May be this is not exactly what you're looking for, but you can _read_ the environment of your server process:
SQL> var e varchar2(20) SQL> set autop on SQL> exec sys.dbms_system.get_env('PWD',:e)
PL/SQL procedure successfully completed.
E
SQL> exec sys.dbms_system.get_env('SHELL',:e)
PL/SQL procedure successfully completed.
E
$ export E="$(ls)"
$ printf "%s;\n" "var e varchar2(100)" "set autop on" "exec sys.dbms_system.get_env('E',:e)" | sqlplus -s / as sysdba
PL/SQL procedure successfully completed.
E
...
Regards
Dimitre
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Dec 15 2006 - 09:29:59 CST
![]() |
![]() |