zoukankan      html  css  js  c++  java
  • oracle学习之第一个存储过程:打印Hello World

    数据库对象:表、视图、索引、序列、同义词、存储过程、存储函数
    存储过程:指的是存储在数据库中供全部用户程序调用的子程序叫存储过程、存储函数
    存储过程和存储函数的同样点:完毕特定功能的程序
    存储过程和存储函数的差别:是否用return语句返回值(存储函数能够,可是存储过程不行)


    --第一个存储过程:打印Hello World
    /*
         调用存储过程2种方式:
         1、exec sayhelloworld();
         2、begin
                sayhelloworld();
                sayhelloworld();
            end;
            /
    */
    create or replace procedure sayhelloworld  --假设这个存储过程存在就replace替换否则create创建,这里创建无參数的存储过程
    as --不可省略
    
    begin
       dbms_output.put_line('Hello World');--注意不是双引號而是单引號,否则调用存储过程会报错
    end;
    /
    
    

    在dos窗体连接oracle数据库方式:sqlplus username/password@127.0.0.1:1521/orcl。或者直接打开sql plus输入username和password
    SQL> set serveroutput on
    SQL> exec sayhelloworld();
    或者:
    SQL>begin
             sayhelloworld();
             sayhelloworld();
        end;
        /


  • 相关阅读:
    【YbtOJ#20064】预算缩减
    【GMOJ6805】模拟speike
    【洛谷P5675】取石子游戏
    【YbtOJ#20061】波动序列
    【洛谷P4302】字符串折叠
    flash 上传文件
    HTTP 客户端发送的 头 格式
    FLEX 在本地使用 只访问本地文件
    as3 重写
    iis7 上传限制问题
  • 原文地址:https://www.cnblogs.com/cynchanpin/p/6973720.html
Copyright © 2011-2022 走看看