当前位置:网站首页>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');
边栏推荐
- Nips18 (AD) - unsupervised anomaly detection using geometric transformations using geometric augmentation
- Implementation of markdown editor in editor.md
- idea properties文件显示\u不显示中文的解决
- 开盘暴涨215%!国产信号链芯片企业芯海科技登陆科创板
- Force buckle 1331. Array serial number conversion
- redis 主从架构(sizeof函数怎么计算)
- Business visualization - let your flowchart "run" (4. Actual business scenario test)
- Taking the opportunity of digital transformation, how can 3C enterprises achieve efficient collaboration through SRM supplier cloud collaboration platform?
- Cloud computing notes part.1 - system management
- lua语言的左对齐函数(手写)
猜你喜欢

并发程序设计,你真的懂吗?

英文翻译意大利语-批量英文翻译意大利语工具免费

How navicate modifies the database name

How does app automated testing achieve H5 testing

Transformer for anomaly detection - instra "painting transformer for anomaly detection"

CodeIgnier框架实现restful API接口编程

Thoroughly understand bit operations - shift left, shift right

业务可视化-让你的流程图“Run“起来(4.实际业务场景测试)

NetCoreAPI操作Excel表格

shared_ptr 和 make_shared 的使用
随机推荐
MySQL8 tmp_table_size和max_heap_table_size
Codeignier framework implements restful API interface programming
业务可视化-让你的流程图“Run“起来(4.实际业务场景测试)
投资35.45亿元!格力集团参与小米产业基金
2022年全国最新消防设施操作员(中级消防设施操作员)题库及答案
C language cycle sentence strengthening exercises
leetcode day5 删除重复的电子邮箱
China's first chip stamp released: built-in 120um ultra-thin NFC chip
Sword finger offer II 109. unlock the password lock
峰值速率超2Gbps!高通在中国首发通过5G毫米波MIMO OTA测试
彻底理解位运算——与(&)、非(~)、或(|)、异或(^)
助力面板行业创新,FPGA将成屏厂TCON最佳选择?
Investment of 3.545 billion yuan! Gree Group participates in Xiaomi industry fund
BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the Applic
Nokia expands its 5g agreement with BT and will become its largest wireless access device supplier
Redis笔记
Quickly install torch spark, torch geometric and other packages in moment pool cloud
可转债概念表 x Notion 给你方便快捷的体验!
Preliminary learning function (3rd blog)
Cvpr19 - adjust reference dry goods bag of tricks for image classification with revolutionary neural network