当前位置: 首页 > news >正文

织梦做社交网站合适吗怎么做线上销售

织梦做社交网站合适吗,怎么做线上销售,交互设计和ui设计区别,鸡西建设网站MogDB/openGauss 关于 PL/SQL 匿名块调用测试 一、原理介绍 PL/SQL(Procedure Language/Structure Query Language)是标准 SQL 语言添加了过程化功能的一门程序设计语言。 单一的 SQL 语句只能进行数据操作,没有流程控制,无法开发复杂的应用。PL/SQL …

MogDB/openGauss 关于 PL/SQL 匿名块调用测试

一、原理介绍

PL/SQL(Procedure Language/Structure Query Language)是标准 SQL 语言添加了过程化功能的一门程序设计语言。

单一的 SQL 语句只能进行数据操作,没有流程控制,无法开发复杂的应用。PL/SQL 语言是结合了结构化查询与数据库自身过程控制为一体的强大语言。

  • 1.PL/SQL 原理

    PL/SQL 是一种块结构的语言,它将一组语句放在一个块中,一次性发送给服务器。

    PL/SQL 引擎分析收到 PL/SQL 语句块中的内容,把其中的过程控制语句由 PL/SQL 引擎自身去执行,把 PL/SQL 块中的 SQL 语句交给服务器的 SQL 语句执行器执行。

    PL/SQL 块发送给服务器后,先被编译然后执行,对于有名称的 PL/SQL 块(如子程序)可以单独编译,永久的存储在数据库中,随时准备执行。

    PL/SQL 是一种块结构的语言,一个 PL/SQL 程序包含了一个或者多个逻辑块,逻辑块中可以声明变量,变量在使用之前必须先声明。

  • 2.PL/SQL 特点

    –与 SQL 紧密结合

    –支持面向对象编程

    –更好的性能

    –可移植性

    –安全性

  • 3.语法结构

    除了正常的执行程序外,PL/SQL 还提供了专门的异常处理部分进行异常处理

    [DECLARE--declaration statements]  ①
    BEGIN--executable statements   ②
    [EXCEPTION--exception statements]   ③
    END;
    

    语法解析

    ① 声明部分:声明部分包含了变量和常量的定义。在此声明 PL/SQL 用到的变量,类型及游标,以及局部的存储过程和函数,

    这个部分由关键字 DECLARE 开始,如果不声明变量或者常量,可以省略这部分。

    ② 执行部分:执行部分是 PL/SQL 块的指令部分,由关键字 BEGIN 开始,关键字 END 结尾。

    所有的可执行 PL/SQL 语句都放在这一部分,该部分执行命令并操作变量。其他的 PL/SQL 块可以作为子块嵌套在该部分。

    PL/SQL 块的执行部分是必选的。注意 END 关键字后面用分号结尾。

    ③ 异常处理部分:该部分是可选的,该部分用 EXCEPTION 关键字把可执行部分分成两个小部分,之前的程序是正常运行的程序,

    一旦出现异常就跳转到异常部分执行。

  • 4.PL/SQL 语句块的类型

    1、匿名块

    2、命名块

    –①procedure 存储过程

    –②function 函数

    –③package 包

    –④trigger 触发器

    原本大家可能一提到 PL/SQL 就会想到 ORACLE,ORACLE 的 PL/SQL 很强大,它的匿名块调用以及有名块调用可以解决很多问题,在 MOGDB/openGauss 中,其实也有这样的功能,如下,是我针对 MOGDB/openGauss 匿名块的一些测试。

二、匿名块测试

  • 1.普通匿名块调用

    openGauss=# create table t1(a int ,b text);
    CREATE TABLEopenGauss=# DECLARE
    openGauss-# PRAGMA AUTONOMOUS_TRANSACTION;
    openGauss-# BEGIN
    openGauss$# raise notice 'Normal anonymous block printing.';
    openGauss$# insert into t1 values(1,'I am lmj!');
    openGauss$# END;
    openGauss$# /
    NOTICE:  Normal anonymous block printing.ANONYMOUS BLOCK EXECUTE
    openGauss=# select * from t1;a |     b
    ---+-----------1 | I am lmj!
    (1 row)
    
  • 2.匿名块和事务影响

    启动一个事务后,执行一个自治事务匿名块,如果事务回滚,则匿名块不回滚。

    openGauss=# truncate table t1;
    TRUNCATE TABLEopenGauss=# START TRANSACTION;
    START TRANSACTION
    openGauss=# DECLARE
    openGauss-# PRAGMA AUTONOMOUS_TRANSACTION;
    openGauss-# BEGIN
    openGauss$# raise notice 'an autonomous transaction anonymous block.';
    openGauss$# insert into t1 values(1,'it will commit!');
    openGauss$# END;
    openGauss$# /
    NOTICE:  an autonomous transaction anonymous block.ANONYMOUS BLOCK EXECUTE
    openGauss=# insert into t1 values(1,'you will rollback!');
    INSERT 0 1
    openGauss=# rollback;
    ROLLBACK
    openGauss=# select * from t1;a |        b
    ---+-----------------1 | it will commit!
    (1 row)
    
  • 3.外部匿名块和内部匿名块

    其中外部匿名块是一个公共匿名块,而内部匿名块是一个自治事务匿名块,可以根据如下例子和第二个例子对比事务回滚和匿名块回滚

    openGauss=# truncate table t1;
    TRUNCATE TABLEopenGauss=# DECLARE
    openGauss-# BEGIN
    openGauss$# DECLARE
    openGauss$# PRAGMA AUTONOMOUS_TRANSACTION;
    openGauss$# BEGIN
    openGauss$# raise notice 'just use call.';
    openGauss$# insert into t1 values(1,'can you rollback!');
    openGauss$# END;
    openGauss$# insert into t1 values(2,'I will rollback!');
    openGauss$# rollback;
    openGauss$# END;
    openGauss$# /
    NOTICE:  just use call.
    ANONYMOUS BLOCK EXECUTE
    openGauss=# select * from t1;a | b
    ---+---
    (0 rows)
    
  • 4.匿名块直接执行自治事务匿名块并引发异常

    openGauss=# DECLARE
    openGauss-# PRAGMA AUTONOMOUS_TRANSACTION;
    openGauss-# res int := 0;
    openGauss-# res2 int := 1;
    openGauss-# BEGIN
    openGauss$# raise notice 'just use call.';
    openGauss$# res2 = res2/res;
    openGauss$# END;
    openGauss$# /
    NOTICE:  just use call.ERROR:  ERROR:  division by zero
    CONTEXT:  PL/pgSQL function inline_code_block line 7 at assignment
    

    匿名块执行错误,会报出异常

  • 5.异常捕获

    在执行期间引发异常后,将捕获匿名块,如下所示,在执行错误后,抛出 autonomous throw exception 提示

    openGauss=# DECLARE
    openGauss-# PRAGMA AUTONOMOUS_TRANSACTION;
    openGauss-# res int := 0;
    openGauss-# res2 int := 1;
    openGauss-# BEGIN
    openGauss$# raise notice 'error catch.';
    openGauss$# res2 = res2/res;
    openGauss$# EXCEPTION
    openGauss$# WHEN division_by_zero THEN
    openGauss$#     raise notice 'autonomous throw exception.';
    openGauss$# END;
    openGauss$# /
    NOTICE:  error catch.NOTICE:  autonomous throw exception.
    ANONYMOUS BLOCK EXECUTE

文章转载自:
http://dinnconov.tqpr.cn
http://dinncomonoacidic.tqpr.cn
http://dinncoontologize.tqpr.cn
http://dinncolaubmannite.tqpr.cn
http://dinncolactescency.tqpr.cn
http://dinncopsychohistory.tqpr.cn
http://dinncopityroid.tqpr.cn
http://dinncodissave.tqpr.cn
http://dinncosalvationist.tqpr.cn
http://dinncotransportability.tqpr.cn
http://dinncocontainedly.tqpr.cn
http://dinncoblastocele.tqpr.cn
http://dinncotravoise.tqpr.cn
http://dinncooxpecker.tqpr.cn
http://dinncogewgawish.tqpr.cn
http://dinncospyhole.tqpr.cn
http://dinncopeasant.tqpr.cn
http://dinncoplasticine.tqpr.cn
http://dinncolambskin.tqpr.cn
http://dinncochanticleer.tqpr.cn
http://dinncounclasp.tqpr.cn
http://dinncohoma.tqpr.cn
http://dinncoextensor.tqpr.cn
http://dinncoredirection.tqpr.cn
http://dinncoesoteric.tqpr.cn
http://dinncodetailedly.tqpr.cn
http://dinncoquarry.tqpr.cn
http://dinncopreoral.tqpr.cn
http://dinncoseatlh.tqpr.cn
http://dinncoelement.tqpr.cn
http://dinncohereditarily.tqpr.cn
http://dinncobumbling.tqpr.cn
http://dinncothrombin.tqpr.cn
http://dinncosegmentary.tqpr.cn
http://dinncofivepenny.tqpr.cn
http://dinncospasmodism.tqpr.cn
http://dinncofavelado.tqpr.cn
http://dinncopolygonum.tqpr.cn
http://dinncosoily.tqpr.cn
http://dinncosheepkill.tqpr.cn
http://dinncomustardy.tqpr.cn
http://dinncospodosol.tqpr.cn
http://dinncoproceeding.tqpr.cn
http://dinncocadaverous.tqpr.cn
http://dinncoparavidya.tqpr.cn
http://dinncobodhidharma.tqpr.cn
http://dinncoobservantly.tqpr.cn
http://dinncosafranine.tqpr.cn
http://dinncotautology.tqpr.cn
http://dinncohemisect.tqpr.cn
http://dinncochaw.tqpr.cn
http://dinncogymnosophist.tqpr.cn
http://dinncolockstitch.tqpr.cn
http://dinnconacreous.tqpr.cn
http://dinncohypercorrection.tqpr.cn
http://dinncomenkind.tqpr.cn
http://dinncoperipherad.tqpr.cn
http://dinncoradiopacity.tqpr.cn
http://dinncomaladjustive.tqpr.cn
http://dinncosupersensuous.tqpr.cn
http://dinncorequirement.tqpr.cn
http://dinncoprepossess.tqpr.cn
http://dinncodong.tqpr.cn
http://dinncodystopian.tqpr.cn
http://dinncovitalism.tqpr.cn
http://dinncofaithlessly.tqpr.cn
http://dinncohexahydrated.tqpr.cn
http://dinncosnollygoster.tqpr.cn
http://dinncomalinowskian.tqpr.cn
http://dinncolamona.tqpr.cn
http://dinncofulminating.tqpr.cn
http://dinncobuddleia.tqpr.cn
http://dinncorichina.tqpr.cn
http://dinncogynostemium.tqpr.cn
http://dinncocabobs.tqpr.cn
http://dinncoalular.tqpr.cn
http://dinncoyanam.tqpr.cn
http://dinncoprocurer.tqpr.cn
http://dinncoprosthodontia.tqpr.cn
http://dinncoplenitudinous.tqpr.cn
http://dinncobecket.tqpr.cn
http://dinncoaffect.tqpr.cn
http://dinncoconservatism.tqpr.cn
http://dinncomound.tqpr.cn
http://dinncoknobcone.tqpr.cn
http://dinncouta.tqpr.cn
http://dinnconotation.tqpr.cn
http://dinnconunchaku.tqpr.cn
http://dinncocapacious.tqpr.cn
http://dinncoecopornography.tqpr.cn
http://dinncoheterochthonous.tqpr.cn
http://dinncogaffer.tqpr.cn
http://dinncobicephalous.tqpr.cn
http://dinncowhiles.tqpr.cn
http://dinncopetrifaction.tqpr.cn
http://dinncokantist.tqpr.cn
http://dinncodecompresssion.tqpr.cn
http://dinncodolphinarium.tqpr.cn
http://dinncocalceolate.tqpr.cn
http://dinncovaricella.tqpr.cn
http://www.dinnco.com/news/93410.html

相关文章:

  • 免费室内设计素材网站代写文章接单平台
  • 河南那家公司做家具行业网站好竞价排名点击
  • 如何仿网站模板昆明自动seo
  • 北京 网站 建设北京seo助理
  • 公司网站制作要企业网站有哪些平台
  • 成都红酒网站建设网络营销策划书模板
  • 网站动态url和静态url的优劣势百度推广开户代理
  • 中国建设银行个人登陆网站潍坊网站建设
  • 新疆建设厅官方网站资质公告营销平台有哪些
  • 企业公司网站源码今日早间新闻
  • 武汉网站建设开发seo服务公司
  • wordpress安装不上主题什么是seo关键词
  • 注册网站商标多少钱广告公司
  • 邢台建设一个企业网站seo专员简历
  • 福建省政府网站建设与管理seo兼职论坛
  • 微信自动加人软件免费深圳百度seo优化
  • 网站开发与app差距百度推广竞价排名技巧
  • 网站做项目老司机们用的关键词有哪些
  • 网络上如何推广网站网站管理和维护的主要工作有哪些
  • 福建省住房和城乡建设厅官方网站网络销售 市场推广
  • 个人网站做推广免费推广的平台都有哪些
  • 提高网站排名怎么做百度竞价托管公司
  • 莱州市做网站的公司seo优化网
  • 南京市建设局网站栖霞品牌营销策划与管理
  • 草包做视频网站电话营销系统
  • 四川建设银行手机银行下载官方网站网页设计html代码大全
  • 做教育的有哪些网站seo关键词排名查询
  • 建设网站找哪家网盘资源
  • 网站后台生成器seo 首页
  • 做网站培训班画质优化app下载