Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2012
    Posts
    177

    Unanswered: bash: syntax error near unexpected token `(

    Hi,

    I am trying to execute this command:

    db2 select count(*) from "db2DWH"."TIS_LOC_TFM"

    bash: syntax error near unexpected token `('


    Could you please let me know why this error occuered?

    Thanks,
    laxman...

  2. #2
    Join Date
    Mar 2008
    Posts
    136
    run this ....
    db2 "select count(*) from db2DWH.TIS_LOC_TFM"
    Regards
    Pawan Kumar

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by laxman babu View Post
    db2 select count(*) from "db2DWH"."TIS_LOC_TFM"
    bash: syntax error near unexpected token `('

    Could you please let me know why this error occuered?
    The explanation is, that the arguments to the "db2" command are first seen by your shell (bash). Parentheses and double quotes are special characters for bash (and several others as well), and the construct "count(*)" is invalid bash syntax, which explains the error message.
    To avoid such problems (and to avoid detailed knowledge about bash special characters), place your SQL statement in a file, and pass that file's name as argument to the "db2 -f" command.
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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