SET is the ANSI standard for variable assignment, SELECT is
not.
SET can only assign one variable at a time, SELECT can make
multiple assignments at once.
If assigning from a query, SET can only assign a scalar
value. If the query returns multiple values/rows then SET
will raise an error. SELECT will assign one of the values
to the variable and hide the fact that multiple values were
returned (so you'd likely never know why something was
going wrong elsewhere - have fun troubleshooting that one)
When assigning from a query if there is no value returned
then SET will assign NULL, where SELECT will not make the
assignment at all (so the variable will not be changed from
it's previous value)
As far as speed differences - there are no direct
differences between SET and SELECT. However SELECT's
ability to make multiple assignments in one shot does give
it a slight speed advantage over SET.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More DB2 Interview Questions

What is the difference between IN subselects and EXISTS subselect?

1 Answers   HCL, PreVator, TCS,


What is dbrm library?

0 Answers  


What does the sqlcode of -818 pertain to?

3 Answers  


What is a synonym? How is it used?

2 Answers  


wht displays the number of times a query modified ?

2 Answers   TCS,






Can a Db2 table data be retrived through JCL?

4 Answers  


Select empno, sal from emptbl where empno < 101.By this query can we fetch first 100 recs? where empno is primary key.It won't throw -811 error? if it wont,then what is use of cursor technique while fetching first 100 recs. Please need more clarification.

2 Answers  


What is package in cobol db2?

0 Answers  


i have an employment table whch has salary,dept,name? i want salary b/w 1000 to 5000 can anyone pls say the query for ths ?

8 Answers   Cap Gemini, CGI, EDS, IBM, Satyam, Wipro,


When is the results table for the query in a DECLARE CURSOR statement created?

5 Answers  


can all users have the privilage to use the sql statement select * (dml)?

0 Answers   IBM,


I have some 3 particular fields ..i want to know which all tables have those 3 fields. Is there any way to identify.. can we know by quering system tables..

5 Answers   CTS,


Categories