oracle basic syntax, regular expressions application

where the words of the operator:

  = Equal
   <>    unequal
   ! =     Unequal
     <     less than
     <=     Less than or equal
     >     greater than
     > =     greater than or equal 
    between the two specified values between

After the wildcard statements like: multiple%

                                      _ Single

Regular Expressions:

       Select prod_name from products where  REGEXP_LIKE(prod_name,’1000’)

       The above statement indicates that the search all lines of 1000

Execution or matching the query 1000 or 2000:

  Select prod_name from products where  REGEXP_LIKE(prod_name,’1000|2000’)

A plurality of matching characters [], 123 matches any one of

  Select prod_name from products where  REGEXP_LIKE(prod_name,’[123] ton‘)

A plurality of matching characters negated, any one in addition to matching 123

       Select prod_name from products where  REGEXP_LIKE(prod_name,’[^123] ton‘)

Matching range matching 1-5

       Select prod_name from products where  REGEXP_LIKE(prod_name,’[1-5] ton‘)

Matching special characters, with the transfer \

  Select prod_name from products where  REGEXP_LIKE(prod_name,’\.‘)

Matching character classes:

       \ d arbitrary number (equivalent to [ 0 - . 9 ]) 
       \ D any non-numeric character (equivalent to [ ^ 0 - . 9 ]) 
       \ W any letter or number (equivalent to [A -za-Z0- . 9 ]) 
       \ W is any non- letters or numeric characters (equivalent to [ ^ A-zA-Z0- . 9 ]) 
       \ S any whitespace character 
       \ S any non-whitespace characters

Repeat metacharacters

       *       Zero or more matches
        + 1 or more matches (equivalent to { 1 })
        ? 0, or a matching (equivalent to { 0 , 1 }) 
       {} n-number of specific match 
       {n, } hits are less than the specified 
       range {n, m} matches

Text commonly used functions:

       Length () Returns a string length of 
       the Lower () is converted into lowercase 
       LPAD () String with spaces on the left 
       the LTrim () to remove the spaces left 
       RPAD () padded with spaces to the right of the string 
       RTrim () remove the right box 
       the Soundex () Returns a string SOUNDEX value   - and to pronounce a relationship 
       SubString () returns the string of characters 
       Upper () returns uppercase

Date function:

       Add_Month () to add date / minus month 
       Extract () minus the year, month, day, hour and date from the time   --- very important 
       Last_Day () returns the last day of the month 
       Months_Beween () Returns the number of months between two month 
       Next_Day () returns the day following the specified date 
       Sysdate () returns the current date and time 
       To_Date () to convert the string to a date

Note that the Extract () process parameters only YEAR, MONTH, DAY, HOUR, MINUTE, SECOND

       Select * from orders where  Extract(Year from order_date) = 2015
                                                 And Extract(Month from order_date) = 2

 

Guess you like

Origin www.cnblogs.com/cnishop/p/11242544.html