本文介绍了mariadb Regexp有时在存储过程中返回空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要帮助,我几天没遇到麻烦.
need help, i got trouble for few day.
问题是在存储过程上运行的子查询的正则表达式,有时返回空,有时正确.
the problem is regexp from subquery run on stored procedure, sometime return empty sometime correct.
REGEXP
(
select group_concat(_data_grupkasbank_auth.datahirarki separator '|') from _data_grupkasbank_auth where _data_grupkasbank_auth.uid='1'
)
如果我用字符串值替换子查询,则它总是正确的:
if i replace subquery with string value, its always correct :
REGEXP
(
'/Sangatta/K3PC/|/Yayasan Balikpapan/Masjid/'
)
在这里,我的dbfiddle运行完美,但是不能在直接的myserver Windows 10 mariadb 10.3.23上运行
here my dbfiddle run work perfectly, but not on direct myserver windows 10, mariadb 10.3.23
https://www.db-fiddle.com/f/pRWvdP3KUwv7rbTN7H7PZC/0
捕获:结果测试
(来自评论)
select group_concat(_data_grupkasbank_view.kode_grupkasbank separator ',' )
from _data_grupkasbank_view
where _data_grupkasbank_view.hirarki_grupkasbank REGEXP
( SELECT group_concat(_data_grupkasbank_auth.datahirarki separator '|')
from _data_grupkasbank_auth
where _data_grupkasbank_auth.uid='1'
)
INTO v_tempsql
推荐答案
我不知道,但是这项工作,我用它来分配SET v_temp2 = v_temp1;
i dont know, but this work, i use this to assign SET v_temp2=v_temp1;
-- //////////
DECLARE v_temp1 TEXT;
DECLARE v_temp2 TEXT;
select
group_concat(yourfield separator '|')
INTO
v_temp1
from
table;
SET v_temp2 = v_temp1;
select
field1, field2
from table
where
field1 regexp v_temp2;
-- ///////////
这篇关于mariadb Regexp有时在存储过程中返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!