Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    5

    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

    PLEASE HELP
    THANKS
    PRADEEP

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    The variable v_client_cd was not initialized so after concatenation newsqlQuery is NULL. However, this is the most harmless of your errors.

  3. #3
    Join Date
    Sep 2005
    Posts
    5

    Re:

    n_i,

    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

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I think the error message says it all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •