hard parse for SQL (merged) [message #424505] |
Fri, 02 October 2009 15:07 |
casttree
Messages: 83 Registered: August 2008
|
Member |
|
|
I tried the following SQL statement which insert the random data into test table. I can see a lot of hard parse from SQL. Since I use the variable in SQL, should it be use same execution plan? What is the main reason for hard parse in this case?
Thanks,
declarel_number number;
begin for i in 1..1000000
loop
l_number := dbms_random.random;
execute immediate
'insert into test_table values ( ' || l_number || ',' || l_number || ',' || l_number || ',' || l_number || ')';
end loop;
commit;
end;
[Updated on: Sat, 03 October 2009 01:42] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: hard parse for SQL (merged) [message #424709 is a reply to message #424536] |
Mon, 05 October 2009 07:51 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
I'm curious as to why you'd repost part of an AskTom question here?
If you want to avoid hard parses, then do as Tom suggests, and use bind variables, rather than building a different statement each time.
|
|
|