首页 > 代码库 > oracle学习之第一个存储过程:打印Hello World
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;
/
oracle学习之第一个存储过程:打印Hello World
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。