If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Function based indexing for trunc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-30-10, 05:00
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
Function based indexing for trunc

Hi,

i have calculated columns which is done on single column against current date trunc(currtent_date-due_date).

because of performance issue i am trying to create the function based indexing,
becuase i have used trunc oracle is not allowing indexing on this columns.

Quote:
SQL Error: ORA-01743: only pure functions can be indexed.
i tried to create index (current_date-due_date) same error is occurred.

is there any alternative way to achieve this..?

Last edited by scharan07; 08-30-10 at 05:04. Reason: updated with my R n d works on this issue.
Reply With Quote
  #2 (permalink)  
Old 08-30-10, 05:50
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Please show us the full CREATE INDEX statement, as we cannot see your screen from here.
(Ideally show us the full definition of the table as a CREATE TABLE as well)

Quote:
i tried to create index (current_date-due_date) same error is occurred.
You can't index an expression that changes every day.
Reply With Quote
  #3 (permalink)  
Old 08-30-10, 06:24
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
This is my index creation code.

Code:
CREATE INDEX NOOFDAYS_INDEX ON MY_TABLE((CURRENT_DATE-DUE_DATE));
SO YOUR SAYING THAT IS NOT POSSIBLE TO CREATE AN INDEX WHICH VALUE IS CHANGE DAILY.
Reply With Quote
  #4 (permalink)  
Old 08-30-10, 06:46
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by scharan07 View Post
TSO YOUR SAYING THAT IS NOT POSSIBLE TO CREATE AN INDEX WHICH VALUE IS CHANGE DAILY.
Correct.

It would actually change every second as CURRENT_DATE includes the time as well.

How do you expect that to work? That Oracle automagically re-creates the index each time the expression changes? With your example, Oracle would need to re-create the entire index every second to recalculate the expression....

And please do not write in all upper-case. That is consider rude (shouting).
Reply With Quote
  #5 (permalink)  
Old 08-30-10, 07:19
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
shammat,
thanks for replies and your valuable information to me.

Quote:
And please do not write in all upper-case. That is consider rude (shouting).
thats unfortunately happened, because of i have written my index code in capitals the same continued in next line.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On