User-defined query in DRS stage
Moderators: chulett, rschirm, roy
User-defined query in DRS stage
Hi,
I am trying to update fields through an update query in DRS stage & my query looks like this
update <tbl> set fld1 = :1, fld2 =:2, fld3 =:3 where fld4 := 4 and fld3 = <constant value>
i.e., i need to update a field thats also used in the where condition. the update is not succesful and the director shows an error with the query formation repeatedly. is this not possible? let me know more about this.
thanks,
I am trying to update fields through an update query in DRS stage & my query looks like this
update <tbl> set fld1 = :1, fld2 =:2, fld3 =:3 where fld4 := 4 and fld3 = <constant value>
i.e., i need to update a field thats also used in the where condition. the update is not succesful and the director shows an error with the query formation repeatedly. is this not possible? let me know more about this.
thanks,
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard.
Any field that is to appear in the WHERE clause must be marked as Key in the Columns grid. Key in this context does not necessarily mean primary key; it means search key.
Any field that is to appear in the WHERE clause must be marked as Key in the Columns grid. Key in this context does not necessarily mean primary key; it means search key.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hi,chulett wrote:From what I recall, the DRS stage uses the ? parameter markers, not the numbered ones - they are exclusive to OCI. ...
I dont think the issue is to do with that coz I've just taken the generated query & modified that in the user-defined section. Moreover this worked fine when I didnt have the field that I update in the where clause but that updated more rows than that need to be (which is not the correct result expected.)
thanks,
Well, here it is. I have a total of 7 fields in the col grid of which three are search only (marked key) and three are update only. there is one field that needs to appear in the where as well updated. I get the same error even if I mark it a key or not (I am using a user-defined query).
I actually get a set of 4 warning msgs for each row (basically msgs from SQL Server odbc driver).
- Incorrect syntax near ':'
- Statements could not be prepared.
the next two are actually DS infos
- <displays the set of field values for that row in the link. for the field thats being updated shows the update value>
- Row rejected
let me know if i need to give more info...
I actually get a set of 4 warning msgs for each row (basically msgs from SQL Server odbc driver).
- Incorrect syntax near ':'
- Statements could not be prepared.
the next two are actually DS infos
- <displays the set of field values for that row in the link. for the field thats being updated shows the update value>
- Row rejected
let me know if i need to give more info...
7 columns would require 7 parameter markers to bind them. Any field used in the 'where' clause must be marked as a Key field.chulett wrote:ensure that you have exactly 4 colums defined in the stage and that the 4th one is the only one marked as a Key.
Unless we're talking ODBC here, anything else will *not* work.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Hey gangs,
Can you do us a favour by posting the User Defined SQL Query you are using?
Can you do us a favour by posting the User Defined SQL Query you are using?
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
s.. i shud ve done this in the first instance but thot the stating it generic would give more understanding abt wats the exact issue behind than just getting the soln.Minhajuddin wrote:Hey gangs,
Can you do us a favour by posting the User Defined SQL Query you are using?
the query i am using is
Code: Select all
UPDATE CUST_ADDR SET EFF_END_DT=TO_DATE(:4, 'YYYY-MM-DD HH24:MI:SS'),CUR_IND=:5,LASTUPD_EW_DTTM=TO_DATE(:6, 'YYYY-MM-DD HH24:MI:SS'),BATCH_SID=:7 WHERE SETID=:1 AND PART_ID=:2 AND SRC_SYS_ID=:3 AND CUR_IND='Y'
Just curious to know more on this statement
what is it that u meant will work/ will not workUnless we're talking ODBC here, anything else will *not* work
thanks again
Re: User-defined query in DRS stage
So... what you are doing doesn't actually "look like this". It never helps to post "generic" examples as they make it too easy for people trying to help to be led astray.gangs wrote:my query looks like this
update <tbl> set fld1 = :1, fld2 =:2, fld3 =:3 where fld4 := 4 and fld3 = <constant value>
Not work = generate error. In other words, not work.
So, for the DML you just posted you need to have:
1) 7 columns defined in the stage
2) Columns 1, 2 and 3 marked as Key fields
And it "should" work.
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
Try changing them all to ? and see if that works, if it still complains after checking the two items posted above.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Hi Chulett,
I don't think the error is with the ':', because Even I get colons (:) in a DRS stage, I work on 7.5x2.
@gangs
But the query looks just fine to me. I don't think there's a problem with the Date conversion too, because you said it was working fine previously.
Let's analyze this thing and get back to you.
I don't think the error is with the ':', because Even I get colons (:) in a DRS stage, I work on 7.5x2.
@gangs
But the query looks just fine to me. I don't think there's a problem with the Date conversion too, because you said it was working fine previously.
Let's analyze this thing and get back to you.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
i am actually working on the solns u had suggested. plz give me a couple of moments & will get back with the observationschulett wrote:Hmm... UNIX server, DS 7.5.1A - question marks. And it specifically complained about the colons. Still, the actual errors were not posted - they were paraphrased instead - so who knows.
I'll step away and let you guys 'work it out'.
sorry for the delay (as got held up with some other work too)
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Come on Chulett, You are THE GURU ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>