Results 1 to 2 of 2

Thread: export table

  1. #1
    Join Date
    Dec 2003
    Posts
    10

    Unanswered: export table

    I tried to export table from SQL store procedure and I got this error.
    SQL0104N An unexpected token "EXPORT TO lxxx OF DEL" was found following "UMMY1; END; ". Expected tokens may include: "<psm_for>". LINE NUMBER=20. SQLSTATE=42601

    Here is my procedure:
    CREATE PROCEDURE UFHDBTBL.Proc2 ( IN a_table_name VARCHAR(100),
    IN a_table_column varchar(9000),
    IN a_stmtSelect varchar(3000),
    OUT stmt VARCHAR(4000),
    OUT SQLSTATE_OUT char(5),
    OUT SQLCODE_OUT int )
    LANGUAGE SQL
    ------------------------------------------------------------------------
    -- SQL Stored Procedure
    ------------------------------------------------------------------------
    P1: BEGIN
    DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
    DECLARE SQLCODE INT DEFAULT 0;

    DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    SELECT SQLSTATE, SQLCODE INTO SQLSTATE_OUT, SQLCODE_OUT FROM SYSIBM.SYSDUMMY1;
    END;

    EXPORT TO lxxx OF DEL SELECT * FROM sample_table;


    SET SQLSTATE_OUT = SQLSTATE;
    SET SQLCODE_OUT = SQLCODE;
    END P1

    Where could be a problem?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: export table

    Originally posted by haburai
    I tried to export table from SQL store procedure and I got this error.
    SQL0104N An unexpected token "EXPORT TO lxxx OF DEL" was found following "UMMY1; END; ". Expected tokens may include: "<psm_for>". LINE NUMBER=20. SQLSTATE=42601

    EXPORT is not a SQL statement - it's a CLP command and therefore cannot be used in a stored procedure.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

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