var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Execute Immediate...problem
DECLARE client_cd VARCHAR(40) ;
DECLARE v_client_cd VARCHAR(40) ;
SET client_cd=' 301';
SET newsqlQuery=' SELECT COUNT(CLIENT_CD) INTO'|| v_client_cd ||'FROM PRV.ARTPROA WHERE CLIENT_CD ='|| client_cd ;
EXECUTE IMMEDIATE newsqlQuery ;
when I run the code above it says .........
A database manager error occurred.[IBM][CLI Driver][DB2/NT] SQL0198N The statement string of the PREPARE or EXECUTE IMMEDIATE statement is blank or empty. SQLSTATE=42617
The variable v_client_cd was not initialized so after concatenation newsqlQuery is NULL. However, this is the most harmless of your errors.
I debugged and saw newsqlQuery has no statement , now I have the code below and this is the new error...please advice
SET newQ= 'SELECT COUNT(CLIENT_CD) INTO '|| v_client_cd ||' FROM PRV.ARTPROA WHERE CLIENT_CD ='|| '301;' ;
EXECUTE IMMEDIATE newQ ;
A database manager error occurred.[IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token ";" was found following "CLIENT_CD=client_cd". Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
I think the error message says it all.