Note that there are some explanatory texts on larger screens.

plurals
  1. POOracle - Best Sentence: IN(), like, REGEXP_LIKE, otherone
    primarykey
    data
    text
    <p>I'm coming back here as I again need your help!<br /> Which of the following is the better choice?</p> <p><strong>The question is:</strong><br /> I have a table <code>myTable</code> with <code>['DateYYYYMMDD','field1', 'field2', 'field3', 'MyField']</code> and every day someone inserts many records.<br /></p> <p><strong>I have to create</strong> 2 (fast) views <code>myView1</code> and <code>myView2</code> that select records (from <code>myTable</code>) created in the last 30 days, and with different <code>MYFIELD</code> values. <br /></p> <p><strong>I have found some distinct simple solutions and I would like to know which is the fastest:</strong></p> <p><strong>Solution1</strong> <br /></p> <pre><code>--myView1: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and MYFIELD in ('65643L', '65643L174', '65643L8N', ... '6564L7174', '6564L78N','6564L78N_2O15', ... '6564L78N3226T2_2O15', '6564L78N8N322', '6564L78N6T2', '6564L78N6T2_2O15', '6564L7-NOTT1-6T2', '6564L76T2', ... '6563XP8N322', '6563XP8N322_2O15', '6563XP8N3226T2', '6563XP8N3226T2_2O15', '6563XP8N6T2', '6563XP-NOTT1-6T2', '6563XP6T2', '9563XPT1', '9563XPT1_2O15', ... '9566UB', '9566UB_2O15', '9566UB174', '9566UB8N', '6566UB8N_2O15', '6566UB8N174', '6566UB8N322', ...) myView2: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and MYFIELD in ('9P26_B', '9P26_BN', '9P26_8N', ... '9P26_8NN', '9P26_2O158N9', '556_B', '556_8N', ... '5566NP4P', '696N65T', '696N65T6T2', ... '696W1P_B', '696W1P_8N') </code></pre> <p>--solution 2</p> <pre><code>--myView1: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and (MYFIELD like '656%' or MYFIELD like '956%') --myView2: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and (MYFIELD like '9P26%' or MYFIELD like '556_%' or MYFIELD like '5566%' or MYFIELD like '696%') </code></pre> <p>--solution 3</p> <pre><code>--myView1: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and (REGEXP_LIKE(MYFIELD, '^656') or REGEXP_LIKE(MYFIELD, '^956')) --myView2: select field1, field2, ...., fieldn, MYFIELD from myTable where DateYYYYMMDD &gt; sysdate -30 and (REGEXP_LIKE(MYFIELD, '^9P26') or REGEXP_LIKE(MYFIELD, '^556_') or REGEXP_LIKE(MYFIELD, '^5566') or REGEXP_LIKE(MYFIELD, '^696')) </code></pre> <p>I hope that explains what I need, if there is a better solution, please suggest it! Thank You Very Very Much!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload