开发者

How to replace string values inside plpython?

Hi i need to replace value into null value in plpython, but how can i do that?Can somebody help?

for example开发者_JAVA技巧 inside plpython sql i wrote.

aa = 'World 123'
bb = aa.replace('World ', '')
rv = plpy.execute("SELECT id FROM ABC WHERE  name ilike '" + bb  + "';" )

But it doesnot work;

if i use replace (aa,''), it shows error like, no global replace is defined..


replace is in the string namespace, so it can only be called on strings. Calling replace in the global namespace would not make much sense as you are not providing it with the original text upon which to perform the replacement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜