Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    3

    Unanswered: left outer join error - strange

    Hi All,

    I'm new to DB2 and have this strange problem.

    I'm running this query

    select legs.leg_n
    , legs.insmt_n
    , legs.CNTPY_M
    , lts.time_seris_n
    from legs left outer join leg_time_seris lts on
    legs.leg_n=lts.leg_n

    and getting this error

    com.ibm.db.DataException: A
    database manager error occurred. : [IBM][CLI Driver][DB2/SUN]
    SQL0206N "LTS.TIME_SERIS_N" is not valid in the context where
    it is used. SQLSTATE=42703

    TIME_SERIS_N is the primary key column on table LEG_TIME_SERIS

    If I exclude TIME_SERIS_N then the query runs ok. What is wrong here?

    The db2 version is DB2 V8.1.0.36

    Thanks for your time,
    Jairaj

  2. #2
    Join Date
    Apr 2003
    Posts
    191

    Re: left outer join error - strange

    Hi,

    weird, can you please paste a

    db2 describe table leg_time_seris

    from a command prompt (or command center)?

    Johann
    Originally posted by jchetty
    Hi All,

    I'm new to DB2 and have this strange problem.

    I'm running this query

    select legs.leg_n
    , legs.insmt_n
    , legs.CNTPY_M
    , lts.time_seris_n
    from legs left outer join leg_time_seris lts on
    legs.leg_n=lts.leg_n

    and getting this error

    com.ibm.db.DataException: A
    database manager error occurred. : [IBM][CLI Driver][DB2/SUN]
    SQL0206N "LTS.TIME_SERIS_N" is not valid in the context where
    it is used. SQLSTATE=42703

    TIME_SERIS_N is the primary key column on table LEG_TIME_SERIS

    If I exclude TIME_SERIS_N then the query runs ok. What is wrong here?

    The db2 version is DB2 V8.1.0.36

    Thanks for your time,
    Jairaj

  3. #3
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    3
    Hi Johann,

    Here it is... Quite ugly, don't think I can format it though. Sorry.

    Thanks for your help,
    Jairaj

    describe table leg_time_seris



    Column Type Type

    name schema name Length Scale Nulls

    ------------------------------ --------- ------------------ -------- ----- ------

    LEG_TIME_SERIS_N SYSIBM DOUBLE 8 0 No

    LEG_N SYSIBM DOUBLE 8 0 No

    SERIS_TYPE_X SYSIBM VARCHAR 50 0 No

    BUSNS_D SYSIBM TIMESTAMP 10 0 Yes

    CNTRT_VALUE_A SYSIBM DOUBLE 8 0 Yes



    5 record(s) selected.

  4. #4
    Join Date
    Apr 2003
    Posts
    191
    Hi Jairaj,

    so it should have been

    select ...
    , ...
    , ...
    , lts.LEG_time_seris_n
    from ...

    instead of
    select legs.leg_n
    , legs.insmt_n
    , legs.CNTPY_M
    , lts.time_seris_n
    from legs left outer join leg_time_seris lts on
    legs.leg_n=lts.leg_n

    Johann

    Originally posted by jchetty
    Hi Johann,

    Here it is... Quite ugly, don't think I can format it though. Sorry.

    Thanks for your help,
    Jairaj

    describe table leg_time_seris



    Column Type Type

    name schema name Length Scale Nulls

    ------------------------------ --------- ------------------ -------- ----- ------

    LEG_TIME_SERIS_N SYSIBM DOUBLE 8 0 No

    LEG_N SYSIBM DOUBLE 8 0 No

    SERIS_TYPE_X SYSIBM VARCHAR 50 0 No

    BUSNS_D SYSIBM TIMESTAMP 10 0 Yes

    CNTRT_VALUE_A SYSIBM DOUBLE 8 0 Yes



    5 record(s) selected.

  5. #5
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    3
    I'm an idiot, thanks for the help.... Its a strange error message though

Posting Permissions

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