Explain plan question
From: Deeptendu Majumder <fallin_at_max.tiac.net>
Date: 9 Feb 1995 03:41:40 GMT
Message-ID: <3hc2tk$f13_at_sundog.tiac.net>
Date: 9 Feb 1995 03:41:40 GMT
Message-ID: <3hc2tk$f13_at_sundog.tiac.net>
I was running the following statement through explain plan:
update <table>
set field2 = 'jumbo'
where field1 = decode('&&var1',NULL,field1,'&&var1');
here field1 is the primary key and var1 is variable defined in SQLPLUS.
The explain plane said it would be full table scan. I was curious if that is really true, especially if var1 is defined ? When does the decode() evaluation happen ? If I change the above to:
update <table>
set field2 = 'jumbo'
where field1 = decode('&&var1',NULL,'bozo','&&var1');
Then explain plan says unique index will be used
thanks for any comments
d
Received on Thu Feb 09 1995 - 04:41:40 CET