Is trunc function with dates better than to_char function with dates for View object in below SQL qu
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.
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.
0