• Oracle11g R2学习系列 之八高级数据类型


    所谓的高级数据类型,就是大数据类型,即BCNB(助记词:BC牛逼)+XML数据类型。

    B:blob,用来存储可变长度的二进制数据。

    C:clob,主要用来存储可变长度的字符型数据,也就是其他数据库中提到的文本型数据类型。

    N:nclob,跟CLOB数据类型相似,也是用来存储字符类型的数据,不过其存储的是Unicode字符集的字符数据。

    B:bfile,在数据库外面存储的可变二进制数据,最大可存储4G内容。

    在dbms_lob包中内建了read()、append()、write()、erase()、copy()、getlength()、substr()等函数,可以方便地操作LOB对象

    XML:xpath,xquery. 而xquery中最有特色的是FLWOR(发音同flower)表达式。FLWOR实际上是“For,Let,Where,Order by,Return”的缩写.包含模式匹配、过滤选择和结果构造这三种操作。感觉有点jquery的意味,选择,然后操作。只不守flwor似乎只有选择得到结果的意味。

     输入以下代码来体验一下flwor表达式,先创建一个有XMLType的表,然后插入一些数据,最后我想查询出第二条note的内容。

      create table table_notes(noteitem xmltype);
      
      insert into table_notes values('<notes>
        <note id="1">
          <to>wang</to>
          <from age="20">zhang</from>
          <heading>Reminder</heading>
          <body>Don not forget me this weekend!</body>
          <number>12</number>
      </note>
      <note id="2">
        <to>liu</to>
        <from age="30">li</from>
        <heading>Reminder</heading>
        <body>Don not forget me this weekend!</body>
        <number>12</number>
      </note>
    </notes>');
    
    select xmlquery('for $ageof in /notes/note
      where $ageof/@id="2"
      return string($ageof)'
      passing noteitem returning content) noteitem
    from table_notes;
    View Code

    结果显示如下:

    xquery

  • 相关阅读:
    maven 父子模块保持相同
    Maven deploy时排除指定的某个module
    源码,反码,补码
    Java日志之Slf4j,Log4J,logback原理总结
    Git Bash设置代理
    分享2个分布式锁
    二叉树的遍历记忆方法
    MySQL百万级数据分页查询及优化
    eclipse无法访问sun.misc.Unsafe类的解决办法
    Spring学习日志之纯Java配置的MVC框架搭建
  • 原文地址:https://www.cnblogs.com/SLKnate/p/oracle11g_advance_data.html
Copyright © 2020-2023  润新知