PL/MySQL是否存在? [英] PL/MySQL does it exist?

查看:87
本文介绍了PL/MySQL是否存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Oracle中,PL/SQL是一种功能强大的命令性语言. MySQL有什么类似的东西吗?

In Oracle there is PL/SQL, a powerful imperative language. Is there anything similar for MySQL?

推荐答案

虽然MySQL确实具有类似的组件,但是不能,您不能在MySQL中使用PL \ SQL. MS SQL Server使用的T-SQL也是如此.

While MySQL does have similar components, no, you cannot use PL\SQL in MySQL. The same goes for T-SQL used by MS SQL Server.

MySQL在其网站上上有很多文档.

MySQL has plenty of documentation on it at their website.

我不愿提及Yahoo Answers,但有一个很好的解释此处

As much as I'd hate to refer to Yahoo Answers, there's a good explanation Here

您将看到PL \ SQL和T-SQL都是图灵完备的,并且可能会提供更多的功能.但是MySQL有很多方法可以执行类似的任务.

You'll see that both PL\SQL and T-SQL are Turing-complete, and probably provide slightly more functionality. But MySQL has plenty of ways to perform similar tasks.

以下是Yahoo Answers帖子中的内容:

Here is the content from the Yahoo Answers post:

MySQL是一个多线程,多用户SQL数据库管理系统 (DBMS)据MySQL AB称, 1 ,超过一千万 装置.

MySQL is a multithreaded, multi-user SQL database management system (DBMS)1 which has, according to MySQL AB, more than 10 million installations.

用于访问MySQL数据库的库在所有主要库中均可用 使用特定于语言的API来编程语言.此外, 称为MyODBC的ODBC接口允许其他编程语言 支持ODBC接口与MySQL数据库进行通信的程序, 例如ASP或Coldfusion. MySQL服务器和官方库是 大部分是在ANSI C中实现的.

Libraries for accessing MySQL databases are available in all major programming languages with language-specific APIs. In addition, an ODBC interface called MyODBC allows additional programming languages that support the ODBC interface to communicate with a MySQL database, such as ASP or Coldfusion. The MySQL server and official libraries are mostly implemented in ANSI C.

MySQL在Web应用程序中很流行,并充当数据库 LAMP,MAMP和WAMP平台的组件 (Linux/Mac/Windows-Apache-MySQL-PHP/Perl ...以及开放源代码错误 跟踪工具(例如Bugzilla).它作为Web应用程序的受欢迎程度是 与PHP的流行紧密相关,而PHP的流行通常与 MySQL的. PHP和MySQL是运行流行的基本组件 WordPress博客平台.

MySQL is popular for web applications and acts as the database component of the LAMP, MAMP, and WAMP platforms (Linux/Mac/Windows-Apache-MySQL-PHP/Perl... and for open-source bug tracking tools like Bugzilla. Its popularity as a web application is closely tied to the popularity of PHP, which is often combined with MySQL. PHP and MySQL are essential components for running the popular WordPress blogging platform.

以下功能是由MySQL实现的,但不是由其他功能实现的 RDBMS:

The following features are implemented by MySQL but not by some other RDBMSes:

  • 多个存储引擎,使您可以为应用程序中的每个表选择最有效的存储引擎(在MySQL 5.0中, 存储引擎必须被编译;在MySQL 5.1中,存储引擎可以 在运行时动态加载):o本机存储引擎(MyISAM, 猎鹰,合并,内存(堆),联合,存档,CSV,黑洞, 簇) -合作开发的存储引擎(InnoDB,solidDB,NitroEDB,BrightHouse) -社区开发的存储引擎
  • 自定义存储引擎
  • 提交分组,从多个连接中收集多个事务,以增加每秒的提交次数.
  • Multiple storage engines, allowing you to choose the one which is most effective for each table in the application (in MySQL 5.0, storage engines must be compiled in; in MySQL 5.1, storage engines can be dynamically loaded at run time): o Native storage engines (MyISAM, Falcon, Merge, Memory (heap), Federated, Archive, CSV, Blackhole, Cluster) -Partner-developed storage engines (InnoDB, solidDB, NitroEDB, BrightHouse) -Community-developed storage engines
  • Custom storage engines
  • Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.

注意:MySQL是用C和C ++编写的. SQL解析器使用yacc和 自制的词法分析器.描述一些内部文件的文件 代码的结构和编码指南可从以下网站获得: MySQL网站.

Note:: MySQL is written in C and C++. The SQL parser uses yacc and home-brewed lexer. A document describing some of the internal structures of the code and the coding guidelines is available from the MySQL web site.

SQL

SQL通常扩展为结构化查询语言,是一台计算机 设计用于检索和管理数据的语言 关系数据库管理系统,数据库模式创建和 修改和数据库对象访问控制管理.

SQL commonly expanded as Structured Query Language, is a computer language designed for the retrieval and management of data in relational database management systems, database schema creation and modification, and database object access control management.

SQL语言被细分为几种语言元素, 包括:

The SQL language is sub-divided into several language elements, including:

  • 可能对架构和数据产生持续影响的语句,或者可能控制事务,程序流,连接, 会话或诊断.
  • 根据特定条件检索数据的查询.
  • 可以产生标量值或由数据的列和行组成的表的表达式.
  • 谓词,它指定可以评估为SQL三值逻辑(3VL)布尔真值的条件,通常用于 限制语句和查询的影响,或更改程序 流动.
  • 表扬(在某些情况下是可选的)语句和查询的组成部分
  • Statements which may have a persistent effect on schemas and data, or which may control transactions, program flow, connections, sessions, or diagnostics.
  • Queries which retrieve data based on specific criteria.
  • Expressions which can produce either scalar values or tables consisting of columns and rows of data.
  • Predicates which specify conditions that can be evaluated to SQL three-valued logic (3VL) Boolean truth values and are commonly used to limit the effects of statements and queries, or to change program flow.
  • Clauses which are (in some cases optional) constituent components of statements and queries

在查询数据操作数据定义的概念下工作 交易控制

it works under..concept of query data manipulation data defination transaction control

SQL:2003标准对的所有部分进行了较小的修改 SQL:1999,并正式引入了一些新功能,例如: 1

The SQL:2003 standard makes minor modifications to all parts of SQL:1999, and officially introduces a few new features such as:1

  • 与XML相关的功能
  • 窗口功能
  • 序列生成器,它允许标准化序列
  • 两种新的列类型:自动生成的值和标识列
  • 新的MERGE语句
  • 扩展到CREATE TABLE语句,以允许"CREATE TABLE AS"和"CREATE TABLE LIKE"
  • 删除执行不佳的"BIT"和"BIT VARYING"数据类型
  • XML-related features
  • window functions
  • the sequence generator, which allows standardized sequences
  • two new column types: auto-generated values and identity-columns
  • the new MERGE statement
  • extensions to the CREATE TABLE statement, to allow "CREATE TABLE AS" and "CREATE TABLE LIKE"
  • removal of the poorly-implemented "BIT" and "BIT VARYING" data types

PL/SQL

PL/SQL是Oracle Corporation专有的基于服务器的程序扩展,用于 SQL数据库语言. (其他一些SQL数据库管理系统 提供类似于PL/SQL的语言.)其语法与 阿达

PL/SQL is Oracle Corporation's proprietary server-based procedural extension to the SQL database language. (Some other SQL database management systems offer languages similar to PL/SQL.) Its syntax strongly resembles that of Ada.

PL/SQL支持变量,条件,数组和异常. 从Oracle RDBMS版本8开始的实现包括 包含与面向对象相关的功能.

PL/SQL supports variables, conditions, arrays, and exceptions. Implementations from version 8 of the Oracle RDBMS onwards have included features associated with object-orientation.

基础SQL充当声明性语言.标准 与某些功能性编程语言不同,SQL不需要 将尾调用转换为跳转的实现. SQL不容易 提供第一行"和表的其余部分"访问器,它不能 轻松执行某些构造(例如循环).但是,PL/SQL作为 图灵完整的程序语言填补了这些空白,允许 Oracle数据库开发人员可与基础关系交互 命令式数据库. SQL语句可以使显式 内联调用PL/SQL函数,或可能导致PL/SQL触发器 在预定义的数据操作语言(DML)事件时触发.

The underlying SQL functions as a declarative language. Standard SQL—unlike some functional programming languages—does not require implementations to convert tail calls to jumps. SQL does not readily provide "first row" and "rest of table" accessors, and it cannot easily perform some constructs such as loops. PL/SQL, however, as a Turing-complete procedural language which fills in these gaps, allows Oracle database developers to interface with the underlying relational database in an imperative manner. SQL statements can make explicit in-line calls to PL/SQL functions, or can cause PL/SQL triggers to fire upon pre-defined Data Manipulation Language (DML) events.

PL/SQL存储过程(函数,过程,程序包和 执行DML的触发器)被编译到Oracle数据库中: 在这种程度上,他们的SQL代码可以进行语法检查.程式设计师 在Oracle数据库环境中工作可以构造PL/SQL块 用作程序,功能的功能;或者他们可以 在SQL * Plus脚本中编写PL/SQL的内联段.

PL/SQL stored procedures (functions, procedures, packages, and triggers) which perform DML get compiled into an Oracle database: to this extent their SQL code can undergo syntax-checking. Programmers working in an Oracle database environment can construct PL/SQL blocks of such functionality to serve as procedures, functions; or they can write in-line segments of PL/SQL within SQL*Plus scripts.

尽管程序员可以轻松地将SQL DML语句合并到 PL/SQL(例如,作为游标定义或使用SELECT ... INTO语法),数据定义语言(DDL)语句(例如CREATE) TABLE/DROP INDEX等要求使用动态SQL".较早 Oracle版本需要使用复杂的内置DBMS_SQL 系统需要显式解析的Dynamic SQL程序包 并执行一条SQL语句.更高版本包括执行 立即称为"Native Dynamic SQL"的语法 简化事务.在Oracle中对DDL的任何使用都会导致 隐式提交.程序员还可以使用动态SQL执行DML 他们事先不知道声明的确切内容.

While programmers can readily incorporate SQL DML statements into PL/SQL (as cursor definitions, for example, or using the SELECT ... INTO syntax), Data Definition Language (DDL) statements such as CREATE TABLE/DROP INDEX etc require the use of "Dynamic SQL". Earlier versions of Oracle required the use of a complex built-in DBMS_SQL package for Dynamic SQL where the system needed to explicitly parse and execute an SQL statement. Later versions have included an EXECUTE IMMEDIATE syntax called "Native Dynamic SQL" which considerably simplifies matters. Any use of DDL in Oracle will result in an implicit commit. Programmers can also use Dynamic SQL to execute DML where they do not know the exact content of the statement in advance.

PL/SQL为特定目的提供了几个预定义的程序包.这样的 PL/SQL软件包包括:

PL/SQL offers several pre-defined packages for specific purposes. Such PL/SQL packages include:

  • DBMS_OUTPUT-用于对非数据库目标的输出操作
  • DBMS_JOB-用于在特定时间(即计划)运行特定的过程/功能
  • DBMS_XPLAN-用于格式化说明计划"输出
  • DBMS_SESSION-提供对SQL ALTER SESSION和SET ROLE语句以及其他会话信息的访问.
  • DBMS_METADATA-用于从数据字典中提取元数据(例如DDL语句)
  • UTL_FILE-用于读取和写入磁盘上的文件
  • UTL_HTTP-用于从数据库向Web服务器发出请求
  • UTL_SMTP-用于从数据库(通过SMTP服务器)发送邮件
  • DBMS_OUTPUT - for output operations to non-database destinations
  • DBMS_JOB - for running specific procedures/functions at a particular time (i.e. scheduling)
  • DBMS_XPLAN - for formatting "Explain Plan" output
  • DBMS_SESSION - provides access to SQL ALTER SESSION and SET ROLE statements, and other session information.
  • DBMS_METADATA - for extracting meta data from the data dictionary (such as DDL statements)
  • UTL_FILE - for reading and writing files on disk
  • UTL_HTTP - for making requests to web servers from the database
  • UTL_SMTP - for sending mail from the database (via an SMTP server)

Oracle Corporation通常会添加更多的软件包和/或扩展 Oracle DBMS的每个后续发行版都具有软件包功能.

Oracle Corporation customarily adds more packages and/or extends package functionality with each successive release of the Oracle DBMS.

这篇关于PL/MySQL是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆