Comments - SELECT

2 years ago Milton Snider

Please direct me to an appropriate place for questions if this is not the place.

I have 26 procedures which worked fine in 5.5. Now I'm getting no results from what looks like a simple query. I'm passing a search parameter. Strings like xml, browse return no records. I am using a cursor to iterate every DB. I've never had an issue before. I started from scratch and here is the procedure. As I said, some strings return no records. The column I'm searching is called Name, values contains no spaces. The procedure code is below this sample table. [Names] aggregator aggregator_test block block_test blog book color comment contact contextual dashboard dblog field field_sql_storage list list_test number options

CREATE OR REPLACE PROCEDURE FirstProc (IN mytext varchar(200)) BEGIN DECLARE finished tinyint DEFAULT 0; DECLARE v_db varchar(400) DEFAULT NULL;

drop temporary table if exists myemaillist; CREATE TEMPORARY TABLE IF NOT EXISTS mydbs AS (SELECT TABLE_SCHEMA AS 'database' FROM information_schema.TABLES WHERE TABLE_TYPE = 'BASE TABLE' and table_name='users'); CREATE TEMPORARY TABLE IF NOT EXISTS myemaillist (module varchar(255), place varchar(255)); BEGIN DECLARE mydb_cursor CURSOR FOR SELECT TABLE_SCHEMA AS 'database' FROM information_schema.TABLES WHERE TABLE_TYPE = 'BASE TABLE' and table_name='users'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;

open mydb_cursor;

SET @j = CONCAT('"%',mytext,'%"');

get_mydb: LOOP FETCH mydb_cursor INTO v_db; IF finished THEN CLOSE mydb_cursor; LEAVE get_mydb; END IF; SET @s = CONCAT('INSERT INTO myemaillist SELECT name, "',v_db,'" FROM system u WHERE type = ''module'' AND status = 1 AND name Like ',@j); PREPARE stmt FROM @s; EXECUTE stmt; END LOOP get_mydb;

END; SELECT @S; select * from myemaillist order by Court; drop temporary table if exists myemaillist; END

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.