2017-02-23 201 views
0

我得到以下代碼的錯誤!請幫助MySQL錯誤代碼:1064.您的SQL語法錯誤;

錯誤代碼:1064.您的SQL語法錯誤;檢查對應於你的MySQL服務器版本的在線使用近「NULL」正確的語法手冊1


- 常規DDL - 注:之前和之後的例行身體的意見將不會服務器


DELIMITER $$ 

CREATE DEFINER=`C_sshankaranar`@`%` PROCEDURE `SIT1_NullCheck`(IN tName Varchar(50),IN attribute Varchar(50),Out NullCount int(11),Out PC Varchar(200),Out x int(11)) 
BEGIN 


set @Sl=NULL; 

set @S1 = Concat('select count(*) into @NullCount from SIT1_STG.',tName,' where ',attribute,' is NULL or ',attribute,'='''); 
Prepare stmt from @Sl; 
Execute stmt; 

select SI into @x from dev2_stg2.Null_Check where Table_Name=tName; 


If (@NullCount<>0) then 

select Problem_Columns into @PC from dev2_stg2.Null_Check where [email protected]; 

Update dev2_stg2.Null_Check set Problem_Columns=Concat(@PC,' ',attribute) where [email protected]; 


End IF; 

Update dev2_stg2.Null_Check 
set Environment="SIT1_STG" 
where [email protected]; 

Update dev2_stg2.Null_Check 
set Update_Time=Now() 
where [email protected]; 

END 

回答

-1

看起來像是準備好的聲明中構建SELECT查詢存儲不正確。

查詢的末尾有語法錯誤,這樣的事情 -

SELECT... or attr=' 

輸出與另一個SELECT查詢,以檢查它 -

BEGIN 
    set @S1 = Concat... 
    SELECT @S1; 
END