PL/SQL (MOSC)

MOSC Banner

Is trunc function with dates better than to_char function with dates for View object in below SQL qu

edited Jul 14, 2009 5:06AM in PL/SQL (MOSC) 7 commentsAnswered
Hello,
The query is a regular "insert into......select * from..." -:

insert  /*+ append, nologging, parallel(prod_tab, 4) */ into prod_tab select * from prod
where
to_char(create_date,'DD-MON-YYYY' ) like '%-2008' or
to_char(create_date,'DD-MON-YYYY' ) like '%-2009'

;

However, someone said it is 'bad sql practice' and should NOT use to_char() function - they said because to_char() function will cause 'data conversion problem' or 'indexing problem' since the base object 'prod' is a view, build upon 4 other tables and 1 view; it will search 'create_date' column in base tables and if it is NOT indexed, it is a full-table-scan.

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