Database Tuning (MOSC)

MOSC Banner

Oracle PL/SQL Procedure shows different (Explain plan)cost

edited Dec 15, 2009 7:27AM in Database Tuning (MOSC) 3 commentsAnswered
 I am using a procedure to capture the cost of a sql using dynamic SQL (Execute Immediate), the cost varies drastically when ran using the procedure. My question is when i use dynamic sql which executes at that moment, not in the cursor, not pre-fetched etc why is the cost different when compared to running it manually ? The plan remains the same only cost of the below changes.

Manual:

SELECT STATEMENT                          38072

SORT                                                   38072

USing Procedure:

SELECT STATEMENT              98

SORT                                       98

Here is my procedure: CREATE OR REPLACE PROCEDURE SQL_COND_ANALYZE IS OR REPLACE PROCEDURE SQL_COND_ANALYZE IS v_sql VARCHAR2(30000); VARCHAR2

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center