sql 中单引号包单引号应该怎么处理呀?
execute immediate 'delete table haoma where sid = 'aaa'';

解决方案 »

  1.   

    execute immediate 'delete table haoma where sid = ''aaa''';''两个单引号表达一个'号.
      

  2.   

    原来语句中一个'的,变成两个
    如果在语句开头或者结尾的,就变成3个,如果是单独的',就变成4个
    比如原语句
    delete table haoma where sid = 'aaa'
    假设没有变量,改成动态SQL,就是
    'delete table haoma where sid = ''aaa'''
    如aaa是变量产生的,语句丈相当于delete table haoma where sid = ' +aaa变量+'
    改写是变成这样
    'delete table haoma where sid = '''||aaa|''''