Oracle字符串如何连接单引号 写了个存储过程,需要在字符串变量前后加单引号。貌似简单的事情折腾了我一下午,好在天无绝人之路。终于被我弄明白甲骨文的变态规则。 Oracle字符串连接单引号: 1.首尾单引号为字符串识别标识,不做转译用 2.首尾单引号里面如果出现的单引号,并且有多个,则相连两个单引号转译为一个字符串单引号 3.单引号一定成对出现,否者这个字符串出错,因为字符串不知道哪个单引号负责结束 selectto_char('aaa')fromdual; select''|| to_char('aaa') ||''fromdual; select''''|| to_char('aaa') ||''''fromdual; select''''''|| to_char('aaa') ||''''''fromdual; select''''''''|| to_char('aaa') ||''''''''fromdual; select' '' '||' '||' '' '|| to_char('aaa') ||' '' '' 'fromdual; Oracle字符串怎样连接单引号 ROW_NUMBER() OVER (PARTITION BY a.orgunit, a.billcode ORDER BY a.invalidtime desc) AS RN FROM am_card a where a.orgunit = (select recid from md_org where stdcode = srcunitcode) and a.billcode in ('''' || replace(srccardbillcodes, ',' , ''',''') || '''')) WHERE RN = 1); begin DBMS_OUTPUT.PUT_LINE('执行:'); for srccard in c_srccard loop --获取这些卡片编号下的后一个版本数据 dstcardrecid := sys_guid(); DBMS_OUTPUT.PUT_LINE(srccard.recid || srccard.billcode || dstcardrecid ||';'); end loop; end; call proc_createnewcardversion('010101','4701-0001,4701-0002');