Which, query performance wise, is more effective?
Considering T is a table, and PK is the primary key in the table T. Are they different or they are just a matter of choice?
select col1, col2 into :var1, :var2
from T
where PK = a
...or:
- EXEC SQL DECLARE aCursor CURSOR FOR select col1, col2 into :var1, :var2 from T where PK = a;
- EXEC SQL OPEN aCursor
- EXEC SQL FETCH aCursor
I think declaring a cursor to fetch a single row from a table based on primary key make less sense if the single row could be retrieved directly instead?
If you are only fecthing a single row, i would NOT use a cursor, that seems like over kill