Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    39

    Unanswered: ADMIN_CMD for Load

    Hi

    I have written the following procedure to load from file to table


    CREATE PROCEDURE x.ADM_LOAD
    (IN FILE_NAME VARCHAR(1000),
    IN TABLE_NAME VARCHAR(500)
    )
    SPECIFIC x.ADM_LOAD
    LANGUAGE SQL
    NOT DETERMINISTIC
    CALLED ON NULL INPUT
    MODIFIES SQL DATA
    INHERIT SPECIAL REGISTERS
    Begin
    Declare QRY varchar(2000);
    SET QRY='CALL SYSPROC.ADMIN_CMD(LOAD Client FROM '||file_name||' OF DEL MODIFIED BY PAGEFREESPACE=1 NOHEADER USEDEFAULTS INSERT INTO '|| table_name||' NONRECOVERABLE)';
    Execute Immediate QRY
    End



    I get the error:
    SQL0104N An unexpected token "Execute" was found following "' NONRECOVERABLE)' ". Expected tokens may include: "<psm_semicolon>". LINE NUMBER=13. SQLSTATE=42601

    Statement processed with ERROR.


    Thanks in advance
    Last edited by usDB2; 05-19-08 at 07:51.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I do not know if this will work, but try it like this:

    Begin
    Declare QRY varchar(2000);
    SET QRY='LOAD Client FROM '||file_name||' OF DEL MODIFIED BY PAGEFREESPACE=1 NOHEADER USEDEFAULTS INSERT INTO '|| table_name||' NONRECOVERABLE';

    CALL SYSPROC.ADMIN_CMD(QRY);
    End

    Andy

Posting Permissions

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