gpt4 book ai didi

oracle - oracle中单引号'的CHR代码是什么?

转载 作者:行者123 更新时间:2023-12-02 08:58:04 24 4
gpt4 key购买 nike

oracle 中单引号 (') 的 CHR 代码是什么?
我正在为没有 PK 的表生成更新语句 ATM,并使用正则表达式替换一些特殊字符。

select 'UPDATE QUESTION SET questiontypeid = '||questiontypeid||', questiontext = '''||questiontext||''', questiondescription = '''||questiondescription||''', productid = '||productid||', mandatory = '||CASE WHEN mandatory IS NULL THEN 'NULL' ELSE to_char(mandatory) END ||', displayorder = '||displayorder||', minvalue = '||CASE WHEN minvalue IS NULL THEN 'NULL' ELSE to_char(minvalue) END||', maxvalue = '||CASE WHEN maxvalue IS NULL THEN 'NULL' ELSE to_char(maxvalue) END||', parentid = '||CASE WHEN parentid IS NULL THEN 'NULL' ELSE to_char(parentid) END||', questioncategoryid = '||questioncategoryid||', isasset = '||CASE WHEN isasset IS NULL THEN 'NULL' ELSE to_char(isasset) END||', ISTHUNDERHEADONLY = '||CASE WHEN ISTHUNDERHEADONLY IS NULL THEN 'NULL' ELSE to_char(ISTHUNDERHEADONLY) END||', QCODE = '''||QCODE||''' WHERE QUESTIONID = '||QUESTIONID from (
(select * from question where questionid not in
(select t.questionid from question t
full join question@somecomp.co.uk d on t.questionid = d.questionid
where t.questiontypeid <> d.questiontypeid
or t.questiontext <> d.questiontext
or t.questiondescription <> d.questiondescription
or t.productid <> d.productid
or t.mandatory <> d.mandatory
or t.displayorder <> d.displayorder
or t.minvalue <> d.minvalue
or t.maxvalue <> d.maxvalue
or t.parentid <> d.parentid
or t.questioncategoryid <> d.questioncategoryid
or t.isasset <> d.isasset))
)

最佳答案

让我们看看 ASCII 值:

SQL> select ascii('''') from dual;

ASCII('''')
-----------
39

或者,为了避免多个单引号,请使用文字引号技术:

SQL> select ascii(q'[']') from dual;

ASCII(Q'[']')
-------------
39

让我们确认一下:

SQL> select chr(39) from dual;

C
-
'

SQL>

关于oracle - oracle中单引号'的CHR代码是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26908073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com