Passing record to a variable - Performance Issue [message #557725] |
Fri, 15 June 2012 03:03 |
|
I need to optimize a module(Oracle Forms 6i), then I found so many statement that goes like this:
DECLARE
v_param VARCHAR2 (10);
BEGIN
FOR rec IN (SELECT col_name
FROM table_name)
LOOP
v_param := rec.col_name;
EXIT;
END LOOP;
END;
I was planning on changing/ simplifying it to something like this:
DECLARE
v_param VARCHAR2 (10);
BEGIN
SELECT col_name
INTO v_param
FROM table_name;
END;
Is there any difference? Or I'll just leave it as is? Thanks!
{hr]
[Edit MC: add code tags]
[Updated on: Fri, 15 June 2012 03:35] by Moderator Report message to a moderator
|
|
|
|
|
Re: Passing record to a variable - Performance Issue [message #557728 is a reply to message #557727] |
Fri, 15 June 2012 03:34 |
|
Michel Cadot
Messages: 68666 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
The difference in the performances will not be noticeable but the maintenance of the code will.
It is clear you want to have and fetch only one value in the second code when one could ask why there is an EXIT in the LOOP in the first one.
Regards
Michel
|
|
|