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
What is the difference between IN subselects and EXISTS subselect?
What is dbrm library?
What does the sqlcode of -818 pertain to?
What is a synonym? How is it used?
wht displays the number of times a query modified ?
Can a Db2 table data be retrived through JCL?
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.
What is package in cobol db2?
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?
can all users have the privilage to use the sql statement select * (dml)?
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..