Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2011
    Posts
    87

    Unanswered: stored procedure - export

    db2 9.7 / windows 2008

    hi, i am trying to write a procedure to export data from a table. I can use the export utility directly, however, the business requirement to create a stored proc.

    As i never did the development, I end up with this.

    Create procedure MI@
    language sql
    begin
    CALL SYSPROC.ADMIN_CMD('export to c:\temp\my.del of del select * from emp');
    end@


    can you please correct assist me.
    Thanks.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Code:
    Create procedure MI@ <<<<<----- remove the @
    language sql
    begin
    CALL SYSPROC.ADMIN_CMD('export to c:\temp\my.del of del select * from emp');
    end@
    Andy

  3. #3
    Join Date
    Nov 2011
    Posts
    87

    Not working.

    Thanks Andy.
    Still not working. I used the data studio v3 and used the db2 CLP. But its giving error.
    But it works with the three lines.


    Create procedure MI
    language sql
    CALL SYSPROC.ADMIN_CMD('export to c:\temp\my.del of del select * from emp');


    The above sql is an example. my actual SQL is around 15 lines (not continous line). But it give error. I am not sure that do I need to specify andy end of line character ?


    Also, how can I do the error handling ?

    Thanks.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If you are using Data Studio, you do not need the @ at the end. If you are using CLP, then you do and you run it like this:

    Code:
    db2 -td@ -vsf MyScriptFile.sql
    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
  •