Need a Help in Select statement & Update query

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Enthusiast

Need a Help in Select statement & Update query

hello , 

i want to execute the follwing Update statement but it won't work , i'm new to teradata aned any help would be very appreciated , thank you.

 

UPDATE X
FROM
   MI_TABLE.ZD_TEST as X,
    MI_TABLE.INDEX_TABLE as Y
    
SET vect2=
CASE 
WHEN X.item6 = Y.ITEMNAME AND Y.IND <= 64 THEN  SETBIT(vect2,Y.ind,1) 
END 
SET vect1= CASE WHEN X.item6 = Y.ITEMNAME AND Y.IND > 64 THEN SETBIT(X.vect1,Y.ind-64,1)
END
WHERE X.item6 = Y.itemname

 

1 REPLY
Senior Supporter

Re: Need a Help in Select statement & Update query

it woulf good if you would also share the error code you get...

 

but at least there is one syntax issue im you update. Only one set statement is allowed. Use a , to separate the different asignments

SET vect2=
CASE 
WHEN X.item6 = Y.ITEMNAME AND Y.IND <= 64 THEN  SETBIT(vect2,Y.ind,1) 
END,
 vect1=
CASE 
WHEN X.item6 = Y.ITEMNAME AND Y.IND > 64   THEN  SETBIT(X.vect1,Y.ind-64,1)
END