If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > left outer join error - strange

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-03, 04:43
jchetty jchetty is offline
Registered User
 
Join Date: Dec 2003
Location: Johannesburg, South Africa
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 12-18-03, 07:02
jsander jsander is offline
Registered User
 
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
Quote:
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
Reply With Quote
  #3 (permalink)  
Old 12-18-03, 07:12
jchetty jchetty is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 12-18-03, 07:52
jsander jsander is offline
Registered User
 
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

Quote:
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.
Reply With Quote
  #5 (permalink)  
Old 12-18-03, 08:07
jchetty jchetty is offline
Registered User
 
Join Date: Dec 2003
Location: Johannesburg, South Africa
Posts: 3
I'm an idiot, thanks for the help.... Its a strange error message though
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On