【问题标题】:How to call a stored procedure in oracle from shell如何从shell调用oracle中的存储过程
【发布时间】:2013-08-28 21:01:18
【问题描述】:

我已经安装了 cygwin 并且我有 Oracle 10 g 现在我想从 shell 连接数据库。有人可以帮我吗?

   SQL> create or replace procedure get_area
2 (n_length in number,
3 n_width in number,
4 n_area out number)
5 as
6 begin
7 n_area := n_length*n_width;
8 end get_area;
9 /

这是我在 oracle 10g 中创建的程序。我想从 shell 调用 get_area

我这样做是为了开始这个过程 subho@subho-PC ~$ #!/bin/csh-f

【问题讨论】:

    标签: oracle shell


    【解决方案1】:

    你可以这样做

    sqlplus login/pass @get_area.sql
    

    get_area.sql 包含您的 SQL 代码的位置

    最后一个细节是在脚本末尾添加一个exit;,否则您将停留在SQL > 提示符上

    【讨论】:

    • 请详细说明我看不懂
    • 我改变了我的解释;希望这可以帮助
    • 声明 n_area number :=0;开始 get_area(10,20,n_area); dbms_output.put_line('区域'||n_area);结尾;但它显示 PL/SQL 过程已成功完成。但没有输出来
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 2011-04-25
    • 2015-05-22
    • 2012-01-27
    • 2017-05-21
    • 1970-01-01
    相关资源
    最近更新 更多