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

Is db2 a mainframe database?

0 Answers  


Hi All, In a Cobol-DB2 program, I am fetching rows from 4 tables using cursor and then based on the a field present in that table, It processes the information accordingly..for example stat-c is one digit field..if stat-c is 'D' then the a row is deleted from table and written those details in to a file. If the stat-c is 'U' then a row is updated (hardcoded what to update)in a table and written those details in to a file. If the stat-c is 'I' then a row is inserted in a table and written those details in to two files. The issue is i have to include the intermediate commits. When an abend occurs, due to commit statement db2 tables will be saved, But there will be lose of file contents. When we resubmitting the job associated with this program there will be insert ,update and delete anomolies to avoid that what measures could be taken?. The intermediate commit is nothing but issuing commit after massive inserts, updates and deletes(sum of 500actions)

1 Answers  


How can we define a table? How can we apply SEARCH ALL on it ?

1 Answers  


Differentiate between cs and rr isolation levels? Where do you specify them?

0 Answers  


WHAT IS MEANT BY COMMIT COMMAND?

7 Answers   Wipro,






What is dynamic SQL?

1 Answers   ADP,


What is the SQL Communications Area and what are some of its key fields?

1 Answers  


what is dynamic cursor?gives syntax for this?

1 Answers   TCS,


ther r 2 tables OTTABLE & SALTABLE, add the otamt from OTTABLE to empsal of SALTABLE if eid is matched else add the unmatched from OTTABLE to SALTABLE

0 Answers  


Where besides the DB2 catalog is database object information stored by DB2?

1 Answers  


in column y record abc.v abc.s xyz.j abc.h i wan only abc columns how to retrieve thi records

2 Answers   IBM,


Following a db2 update statement, what is the quickest way to compute the total number of updated rows?

0 Answers  


Categories