Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 19th, 2005, 05:05 AM
Ach Ach is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 46 Ach User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 36 m 29 sec
Reputation Power: 5
Question Dynamic SQL or Stored procedure?

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

Reply With Quote
  #2  
Old July 19th, 2005, 10:42 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 20 m 49 sec
Reputation Power: 48
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.

Reply With Quote
  #3  
Old July 22nd, 2005, 06:39 PM
michaeljshannon michaeljshannon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 26 michaeljshannon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 38 m 15 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Dynamic SQL or Stored procedure?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT