Hi Norm, Norm [TeamT] wrote the following post at 20 Apr 2017 9:28 AM: Morning Tom, Being the curious type, I tried two text searches, on our Production server (11gR2), with and without the use of the upper function, e.g. one line or the other commented out (but not both) for testing. I'm just showing a snippet of the original code below: The use or not of UPPER() is not meant to save time, it's meant to be correct ! Okay, but this is NOT the first point you made about the use of the UPPER() function. If you refer back to your earlier reply, Norm [TeamT] / 18 Apr 2017 at 8:01am, you wrote: "You don't need to upper case the table name. You can use the table name returned from all/user_tables as is, when looking for columns, as it is already correct. Using upper() will stop oracle from using an index, if there is one, on table_name, in all/user_tab_columns." In fact, you didn't even use the word error or imply incorrect result. While I say "Thank You" for this correction to Mr. Kyte's code, I think you could have said something like "gee, I missed an important point earlier....The use or not of UPPER() is not meant to save time, it's meant to be correct because.... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This will help identify if you have a problem: select table_name from user_tables where table_name <> upper(table_name); In my case, I have no user_tables at all in our Production database, so the above query returns zero rows without the WHERE clause. I had to modify it slightly, by querying all_tables and adding an owner criteria: select table_name from all_tables where owner = 'APDBMS_SOR' and table_name <> upper(table_name); The result is still zero rows (there are 4 system tables, owned by SYS, if I remove the above owner criteria). So, I think I am good in either case, but like I said yesterday, I have removed the call to the UPPER function. Incidentally, this UNION query returns zero Tables and (62) Views--that is our friendly "low-life" at work! -- Look for case-sensitive table and view names: select table_name as objectname, 'Table' as objecttype from all_tables where owner = 'APDBMS_SOR' and table_name <> upper(table_name) union select view_name as objectname, 'View' as objecttype from all_views where owner = 'APDBMS_SOR' and view_name <> upper(view_name) order by objecttype, objectname; Tom
↧