zoukankan      html  css  js  c++  java
  • 使用call在sqlplus中调用procedure和funtion

    使用call在sqlplus中调用procedure和funtion!call 不可以使用在plsql中,只能在sqlplus中使用。

    SQL> create or replace procedure proc_test
    2 is
    3 v_count number;
    4 begin
    5 select count(*) into v_count from tt;
    6 dbms_output.put_line(v_count);
    7 end;
    8 /

    过程已创建。

    SQL> set serveroutput on
    SQL> call proc_test();
    2

    调用完成。

    --使用call调用过程时即使过程没有参数依然要加上括号

    SQL> exec proc_test;
    2

    PL/SQL 过程已成功完成。
    SQL> create or replace function fun_test(p_a int , p_b int)
    2 return number
    3 is
    4 begin
    5 return p_a/p_b;
    6 end fun_test;
    7 /

    函数已创建。

    SQL> select fun_test(10,2) from dual;

    FUN_TEST(10,2)
    --------------
    5

    SQL> call fun_test(10,2) ;
    call fun_test(10,2)
    *
    第 1 行出现错误:
    ORA-06576: 不是有效的函数或过程名

    --由于函数有返回值,所以要使用绑定变量来接收。
    SQL> variable i number;
    SQL> call fun_test(10,2) into :i;

    调用完成。

    SQL> print i;

    I
    ----------
    5

  • 相关阅读:
    KVCKVO
    音频
    静态库
    百度地图API
    CALayer
    触摸事件
    iOS中打电话、打开网址、发邮件、发短信等
    NSURLSession网络接口
    Quartz2D常见图形的绘制:线条、多边形、圆
    通知中心(NSNotificationCenter)
  • 原文地址:https://www.cnblogs.com/wbzhao/p/2427365.html
Copyright © 2011-2022 走看看