当前位置:网站首页>There is a 'single quotation mark' problem in the string when Oracle inserts data
There is a 'single quotation mark' problem in the string when Oracle inserts data
2022-07-28 19:45:00 【Shallow sorrow remembers fleeting years】

In our turn Excel When inserting table data into the table , Often use splicing insert How statements work ;
When excel When table data encounters single quotation marks , final insert into as follows :
insert into test(id,name,age)values(sys_guid(),' Zhang ' 3、 ... and ','28');
At this time SQL The execution will report an error .
Solution :
Judge val1,val2 Whether it contains single quotation marks , If single quotation mark is included , Then use single quotation marks ’ Replace with two single quotes ’' The format of .
Here is a simple tool class :
public static String replaceStr(String sourceStr) {
if (StrUtil.isBlank(sourceStr)) {
return "";
}
String substring = sourceStr.substring(1, sourceStr.length() - 1);
if (substring.contains("'")) {
String replaceStr = substring.replace("'", "''");
return "'" + replaceStr + "'";
}
return sourceStr;
}
Finally processed SQL The statement is as follows :
insert into test(id,name,age)values(sys_guid(),' Zhang '' 3、 ... and ','28');
边栏推荐
- App自动化测试是怎么实现H5测试的
- 英文翻译葡萄牙语-批量英文转换葡萄牙语-各种语言免费互译转换
- 调用整数或字符数组函数里的参数应该传入啥
- The peak rate exceeds 2gbps! Qualcomm first passed 5g millimeter wave MIMO OTA test in China
- MySQL8 Encrypting InnoDB Tablespaces
- 这个客制化键盘,秀翻我了~
- shared_ PTR and make_ Use of shared
- andorid系统layout、values、drawable适配
- The United States will provide $25billion in subsidies to encourage chip manufacturers such as Intel to move back to production lines
- Rust Getting Started Guide (rustup, cargo)
猜你喜欢

Report redirect after authorized login on wechat official account_ The problem of wrong URI parameters

远光软件获得阿里云产品生态集成认证,携手阿里云共建新合作

Basic concept and essence of Architecture

NDK series (5): from introduction to practice, JNI explodes the liver and explains everything in detail!

Implementation of markdown editor in editor.md

毕马威中国:证券基金经营机构信息技术审计项目发现洞察

editor.md中markdown编辑器的实现

Servlet学习笔记

调用整数或字符数组函数里的参数应该传入啥

Netcoreapi operation excel table
随机推荐
Cvpr19 - adjust reference dry goods bag of tricks for image classification with revolutionary neural network
英文翻译意大利语-批量英文翻译意大利语工具免费
Iclr21 (classification) - future classic "vit" an image is worth 16x16 words (including code analysis)
Nokia expands its 5g agreement with BT and will become its largest wireless access device supplier
App自动化测试是怎么实现H5测试的
How does app automated testing achieve H5 testing
The mystery of ID number
投资35.45亿元!格力集团参与小米产业基金
Preliminary learning function (3rd blog)
What parameters should be passed in calling integer or character array functions
Pagoda panel construction novel CMS management system source code measurement - thinkphp6.0
【经验之谈】关于维修电子设备的几点建议和经验
文章翻译软件-批量免费翻译软件支持各大翻译接口
远光软件获得阿里云产品生态集成认证,携手阿里云共建新合作
leetcode day3 查找重复的电子邮箱
Huawei shares in Nanjing core vision, laying out the solid-state laser radar chip field
德国、葡萄牙均宣布不会禁用华为5G设备,但德国会设定严格限制条件!
How openocd directly downloads programs to STM32 board through stlink (solved)
毕马威中国:证券基金经营机构信息技术审计项目发现洞察
Scrapy Spider源码分析