猿问

oracle存储过程拼接动态sql


v_sql := v_sql ||' and v_name ='''||v_name||'''';

后面为什么要加这么多引号呢?

fenkapian
浏览 3569回答 3
3回答

慕的地8582982

GGGTTTTTERSWHTGYMLLKXKHKWJWXYKJWWMDPDQQDPCQPAZYDQPCLKZYKJIIXWIVUWJYXBNOBAAKXXWOKTIBNCLBNCXSEXEPVZGSMCBGJLRQLOPBMEUUCVVQFYBWUOXBHAIEBDFVBFADUZCEQCUWFBNSUGWKMAMSJLHLDMMKJTFIAWJZLXSCFIRUAWILOPOLHXZHTKSQRJAPIAMYFREGODDPIAVLIMUJPXNPHKGNIOXPYTRGHUNPWCPISILFTDZAAFEILNZBAAFUGTCAGQQQSFZLUKBLITBMBASVSPYUDZGGSGOYTHUZGNQGDMVPFNDTGFUNZBHQLBNXJUTDFINGWLGWLEUXRHMZCJIENMPIDNKBXKJSJFHQLRKHYWUWFTVKJPCUMINJYWNDZSKBROGLECRQQGSCEHQBMVVVVYLTXVUULJZHBTFNDFFVYEWMLGBNSEOSHWQJSEWFYYKXBMEGJGFATEJREFCNTNJHFJQRFOQGWABVRJHGDUZRWZYRMEWOGWBSXXCFNILECHFOOHSKRGWWFNMYKWUGAMRMOKJSJNNPBBMUGWOZPRJBUZDJOWBQSLYNCFLDOOBXPMUPRVXZOGPLVVGULMMAOGXPTNBHGOZBUHSDSQONPBGFCFUHPEOGPOGYOORGLHWRCPLVNXPUDBVTKSKMLQYJFZBHNXFXLRNXYDZLXZUSESOIXDYRMUSWFGAWRDFNAXGFNJUNPNKWYTRJUTLXHVESSUDGLDJBZYTVYSDSFXCECRWEKFKWRNCXFKDVCJEUGHDRANNXSHCRZNVYKRSGLRPRCKMACDNINOTCZSQBSJVADIRMYHRYHCWXXVTFGLPXIDAIAKSEDUIUJEPXDXSIXDYABEMRQSRJTDINJYMFH

fenkapian

现在知道了 那是为了让传入的字符串被两个单引号包裹住,但我用这种写法直接执行sql语句就会报错,只能用一个单引号包住的方式才能正确执行。为什么在存储过程里可以用两个单引号呢

fenkapian

为什么后面分别要加3个和4个引号
随时随地看视频慕课网APP

相关分类

Java
Oracle
我要回答