Orecle 迁移 人大金仓数据库 SQL 问题

ops/2024/10/18 19:28:33/

1. start  with ...  connect by 语法不兼容

      使用 oracle 项目一般使用,start with ... connect by 语法做菜单栏数据查询,该语法在人大金仓数据库提供的可视化工具中可以执行,但在Springboot + mybatis 项目中无法执行(版本2.X),通过与人大金仓人员交涉,可以使用 with recursive.... as(... union ..) select ... where... 语法替代,该语法基础是如下:

      假设有如下一张表(menu_table):

idmenu_idparent_menu_idmenu_desc
11一级
21011二级
310101101三级
4101010110101四级

       我们可以使用一下 SQL查询出树状数据:

       with recursive temp as(

             select * from menu_table where id = 3

             union 

             select * from menu_table a  join  temp b on b.parent_menu_id = a.menu_id

         ) select * from temp

        该SQL执行结果如下:

idmenu_idparent_menu_idmenu_desc
11一级
21011二级
310101101三级

           SQL 语法分析: 

           SQL 中的 select * from menu_table where id = 3 查出来的数据,会作为初始基础数据,union 后面的SQL select * from menu_table a  join  temp b on b.parent_menu_id = a.menu_id ,  定义树状数据的规则,当前SQL是向上查询,使用基础数据中 parent_menu_id 值 101 为条件去    menu_table 表中查询 menu_id 值为 101 的数据,会递归处理直到不满足该条件为止            b.parent_menu_id = a.menu_id

          如果我们要向下查找数据要怎么做呢?把条件该为这样 b.menu_id = a.parent_menu_id 

2.数据精度问题  

      oracle 数据库 numeric 类型数据查询出的数据,不会默认在小数点后面补充无效的 0 ,人大金仓数据查询数据会默认在小数点后面做补充 0 操作,如果 java 接受数据使用 String 类型会出现小数点后面很多零问题,可以在数据库配置文件 url 配置信息,添加后缀:initParams=ignore_zero_number=on 忽略补充零

3.druid 连接池胡乱打印SQL报错

     oracle 数据库切换人大金仓数据库,使用 druid 监控 SQL 信息时,会出现 SQL 执行成功功能正常,但是日志文件中出现 SQL 解析报错信息,需要在 druid 配置文件中添加 druid.filter.stat.merge-sql = false 信息


http://www.ppmy.cn/ops/124254.html

相关文章

Spring Boot集成encache快速入门Demo

1.什么是encache EhCache 是一个纯 Java 的进程内缓存框架,具有快速、精干等特点,是 Hibernate 中默认的 CacheProvider。 Ehcache 特性 优点 快速、简单支持多种缓存策略:LRU、LFU、FIFO 淘汰算法缓存数据有两级:内存和磁盘&a…

以FLV解复用为例详解开源库FFmpeg中解复用器的源码逻辑及处理流程

目录 1、FFmpeg简介 2、FLV文件格式介绍 3、注册解复用器 4、解复用器的处理 4.1、AVFormatContext 4.1.1、AVClass 4.1.2、AVOption 4.1.3 AVDictionary—AV字典 4.1.4、AVIOContext 4.1.4.1、URLProtocol 4.1.4.2、AVIOContext的初始化及获取 4.1.5、AVInputF…

【工具】前端js数字金额转中文大写金额

【工具】前端js数字金额转中文大写金额 代码 <!DOCTYPE html> <html lang"zh"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>金额转…

鸿蒙fork()功能

fork功能 上层通过使用fork()函数创建新进程。 fork是什么&#xff1f; #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>int main(void) {pid_t pid;char *message;int n;pid fork();if (pid < 0) {perror…

LUCEDA IPKISS Tutorial 77:在版图一定范围内填充dummy

案例分享&#xff1a;在给定的Shape内填充dummy 所有代码如下&#xff1a; from si_fab import all as pdk from ipkiss3 import all as i3 from shapely.geometry import Polygon, MultiPolygon import numpy as np import matplotlib.pyplot as pltclass CellFilledWithCon…

SFML库环境配置

bilibili 下载第三方库 以SFML库为例,到官网SFML (sfml-dev.org)下载对应编译器架构的(如gcc是32位的就安装32位的SFML)对应压缩包解压到指定目录下 添加环境配置 c_cpp_properties.json 一般你配置好vscode中的标准c环境之后,都会有这个文件,c_cpp_properties.json是用来…

命令 首选项:打开用户设置(json) 导致错误 文件似乎是二进制文件,不能作为文本打开

方法 1&#xff1a;使用 Notepad 打开 打开命令提示符。输入以下命令&#xff1a; notepad "%APPDATA%\Code\User\settings.json" 这将使用 Notepad 打开 settings.json 文件。 方法 2&#xff1a;使用 Visual Studio Code 如果你已经安装了 Visual Studio Code&…

Sqlite3入门看这一篇就够(超级详细,从零学起)

Sqlite3入门看这一篇就够(超级详细,从零学起) 一、SQLite3 基础1.1 SQLite3 的特点1.2 SQLite3 安装与使用1.2.1 debian操作系统安装SQLite31.2.2 window操作系统安装SQLite3二、下载 SQLite3三、配置 SQLite 环境四、使用 SQLite34.1. **创建数据库**:4.2. **常用命令**:…