oracle中单引号('
)的CHR代码是什么?
我正在为没有PK的表生成更新语句ATM,并且Regex替换了一些特殊字符。
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))
)
答案 0 :(得分:4)
让我们看一下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>
答案 1 :(得分:1)
感谢@a_horse_with_no_name:
Oracle中'
没有什么特别之处。这是标准的ASCII值。
答案是:CHR(39)