Does DS support insert into XXX(XX) select from XX statement

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
caola
Participant
Posts: 10
Joined: Tue Jul 24, 2007 3:42 am

Does DS support insert into XXX(XX) select from XX statement

Post by caola »

My job design is like:

several db2 api to select------> funnel--------->db2 api

In the target db2 api, I use below user defined sql. The ? stands for the only one field that output by funnel.
I got an error: This SQL statement did not contain the same number of parameters as columns on this link.

My question is does DS support this kind of insert statement?

Code: Select all

INSERT INTO TargetTable  (A) 
select
     b
   from
      TableX
    where
      b  = ?
and c='XX';
:)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Technically, yes - as long as the number of bind parameters in the SQL is equal to the number of columns defined in the stage - which is what the error is saying. Note that (at least in the past) the ODBC stage doesn't care about that little detail.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Syntax varies on this from database to database.
Mamu Kim
caola
Participant
Posts: 10
Joined: Tue Jul 24, 2007 3:42 am

Post by caola »

The database is db2. I tried odbc and it works, but still don't know why db2 api gave that error, as the number of parameters(where ? shows) is the same as the number of columns...

Thanks guys. I will mark it as workaround.
:)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Since they're not numbered (as in Oracle) you have to realize that only columns marked as Key columns get used in the 'where' clause. Guessing yours isn't.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply