|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have many stored procedures written by another person that performs only ONE select statement using an input parameter. Do you think it is better to implement them as dynamic sql in application source rather than calling them using stored procedures? I concern performance issues. -Thanks in advance |
|
#2
|
|||
|
|||
|
Short answer: NO.
Basically, if you actually mean creating SQL statements using EXEC IMMEDIATE or using PREPARE in C, then you degrade system performance because you clutter up the cache with non-reusable junk. |
|
#3
|
|||
|
|||
|
Oracle parses the SQL statement for syntax, execution rights, access rights, etc. and places the executable ( compiled ) code in memory. The code is then executed from memory.
When another SQL statement is to be run, Oracle looks in memory to see if it has run before. If it has, then the parse and validation step is skipped and the executable ( compiled ) code is executed immediately. This can save considerable time if the same SQL is run repeatedly. Note that this works best when using bind variables instead of hard-coding them. However, dynamic SQL is ALWAYS parsed and validated, eliminating the possibility of immediately executing the compiled code. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Dynamic SQL or Stored procedure? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|