如何将操作系统变量加载到 PL/SQL 中?
这应该非常简单,但搜索词太常见,以至于我找不到答案:
问:如何将操作系统变量 (RHEL) 中的值加载到 Oracle 11g 数据库上的 PL/SQL 中?
代码:
begin
dba_utilities.utilities_with_ext_proc.send_email(
p_recipient => '$MAIL_LIST',
p_subject => 'Subject'
p_body => 'Body
);
End ;
如果我输入电子邮件地址,该过程工作正常,但有一个名为 $MAIL_LIST 的系统变量包含一组人。我还可以确认这在其他服务器上有效,但我正在设置替代服务器。
提前致谢,如果问题过于简单,我们深表歉意!
This should be pretty straightforward but the search words are so common that I am not finding an answer:
Q. How do I load the values from an operating system variable (RHEL) into PL/SQL on an Oracle 11g database?
Code:
begin
dba_utilities.utilities_with_ext_proc.send_email(
p_recipient => '$MAIL_LIST',
p_subject => 'Subject'
p_body => 'Body
);
End ;
The procedure works fine if I put in an email address but there is a system variable called $MAIL_LIST that contains a group of people. I can also confirm that this is working on other servers but I am setting up a replacement.
Thanks in advance and sorry if the question is overly simple!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过 Java
系统
类。要从 PL/SQL 调用它,您可以创建一个 Java 存储过程,如下所示:现在,您可以编写您的 PL/SQL 代码,如下所示:
该存储过程也可以存在于 PL/SQL 包内(如果您不想)创建一个模式级函数只是为了获取环境变量)。
You can access the environment variables via the
getenv
method in Java'sSystem
class. To invoke this from PL/SQL, you can create a Java stored procedure as follows:Now, you can write your PL/SQL code as follows:
The stored procedure can also exist inside a PL/SQL package (if you don't want to create a schema-level function just to acquire environment variables).