什么是oracle存储过程

数据库系统中的触发器也是一种存储过程。存储过程在数据库中运算时自动生成各种执行方式,因此,大大提高了对其运行时的执行速度。在大型数据库系统如Oracle、SQL Server中都不仅提供了用户自定义存储过程的功能,同时也提供了许多可作为工具进行调用的系统自带存储过程。

 所谓存储过程(Stored Procedure),就是一组用于完成特定数据库功能的SQL 语句集,该SQL语句集经过编译后存储在数据库系统中。在使用时候,用户通过指定已经定义的存储过程名字并给出相应的存储过程参数来调用并执行它,从而完成一个或一系列的数据库操作。

自我观点:相当于java的成员方法,处处可以调用。Procedural 相当于void类型的无返回值的放大。funcation相当于有返回值的方法;

 

WHAT IS  PL/SQL

Procedural Language/Structured Query Language

想回答这个问题,你首先要知道的是:你访问的每个网站,每个应用的运行都是由一堆软件技术构成的。

  • 在这堆栈的头部是表现层(presentation layer),用户直接与之交互的屏幕或交互式设备。这些,最热门的实现表现层的语言是java和.net
  • 在这个堆栈的最底层是用来与硬件交流的机器语言
  • 在这个技术堆栈的中间某个位置,你会找到数据库(database),确保我们去储存和处理大量复杂的数据。关系型数据库技术,在sql的基础上构建而成,是当今世界上占主导地位的数据库技术。

 

SQL是一种非常强大的、面向集合的语言,其惟一目的是操作关系数据库的内容。如果你写一个应用基于oracl Database,你或者某些在技术栈更低级别写代码的人一定会执行sql语句在这个数据库中检索数据或操纵数据。

然而,sql不能被用来实现我们程序的所有商业逻辑和最终用户功能。这就带来了pl/sql

pl/sql的意思是(Procedural Language/Structured Query Language)程序语言和结构查询语言。PL/SQL 提供一系列程序命令(IF statements, loops, assignments), 这些命令组织在块(BLOCKS)中(以后将进行解释),它们补充并扩展了SQL的范围。

当然,你也可以在SQL和Oracle数据库之上构建应用程序,而不需要使用PL/SQL。

但是利用PL/SQL执行特定于数据库的操作,它提供了几个优点,包括

  • 与SQL的紧密集成、
  • 通过减少网络流量提高性能和可移植性(PL/SQL程序可以在任何Oracle数据库实例上运行)。

因此,许多应用程序的前端代码同时执行SQL语句和PL/SQL块,从而在提高这些应用程序的可维护性的同时最大化性能。

 

To answer this question, it is important to remember that every Website you visit, every application you run is constructed from a stack of software technologies. At the top of the stack is the presentation layer, the screens or interactive devices with which the user directly interacts. (These days the most popular languages for implementing presentation layers are Java and .NET.) At the very bottom of the stack is the machine code that communicates with the hardware.

Somewhere in the middle of the technology stack you will find thdatabase, software that enables us to store and manipulate large volumes of complex data. Relational database technology, built around SQL, is the dominant database technology in the world today.

SQL is a very powerful, set-oriented language whose sole purpose is to manipulate the contents of relational databases. If you write applications built on Oracle Database, you (or someone writing code at a lower level in the technology stack) must be executing SQL statements to retrieve data from or change data in that database. Yet SQL cannot be used to implement all business logic and end-user functionality needed in our applications. That brings us to PL/SQL.

PL/SQL stands for Procedural Language/Structured Query Language. PL/SQL offers a set of procedural commands (IF statements, loops, assignments), organized within blocks (explained below), that complement and extend the reach of SQL.

It is certainly possible to build applications on top of SQL and Oracle Database withoutusing PL/SQL. Utilizing PL/SQL to perform database-specific operations, most notably SQL statement execution, offers several advantages, though, including tight integration with SQL, improved performance through reduced network trafficand portability (PL/SQL programs can run on any Oracle Database instance).Thus, the front-end code of many applications executes both SQL statements and PL/SQL blocks, to maximize performance while improving the maintainability of those applications.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值