comparing to @ID

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

comparing to @ID

Post by ogmios »

Can someone point me in the right direction. I'm trying to do the following in uv:

UPDATE RT_LOG1111 SET TYPE = 0 WHERE @ID LIKE '//SEQUENCE.NO%';

The problem is that I can't seem to use LIKE on @ID ("DataStage/SQL: The LIKE operator may only be used with character data")

Ogmios.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ogmios

If you edit the dictionary item for @ID in RT_LOG then it looks like this:

>ED DICT RT_LOG @ID
6 lines long.

----: P
0001: D Default record ID for RetrieVe
0002: 0
0003:
0004: RT_LOG
0005: 10'0'R
0006: S
Bottom at line 6.
----:

Field 5 is the problem. It does not want to use a number in a "LIKE" phrase. You can create a new dictionary item called "ID" and use it or:

UPDATE RT_LOG1111 SET TYPE = 0 WHERE EVAL "@ID" LIKE '//SEQUENCE.NO%';

This works fine. I tried it. I wanted to beat Ray to the punch.

Kim.

Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The technically correct way in SQL is to use a CAST.

UPDATE RT_LOG1111 SET TYPE = 0 WHERE CAST (@ID AS VARCHAR) LIKE '//SEQUENCE.NO%';

You can use CHAR or VARCHAR, though with CHAR you will also need a maximum length (VARCHAR has a default maximum length of 254). The LIKE operator requires string data to compare to the pattern.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ray

Can't take a joke? CAST same as EVAL.

Kim.

Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

More DS users are likely to be familiar with CAST (which is part of the SQL standards) than with EVAL, which isn't the same thing at all.
CAST effects a temporary data type change, EVAL generates am on-the-fly value.

Yes, I can take a joke (just see my pictures on DSXchange), but I also like to be accurate as much as possible.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply