<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    Chapter 6:  MySQL Language Reference 413 expr2 or expr3 returns string string expr2 or expr3 returns a oating-point value oating-point expr2 or expr3 returns an integer integer If expr2 and expr3 are strings, then the result is case-sensitive if both strings are case-sensitive.  (Starting from 3.23.51) CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] [ELSE result] END CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END The rst version returns the result where value=compare-value.  The second version returns the result for the rst condition, which is true.  If there was no matching result value, then the result after ELSE is returned.  If there is no ELSE part then NULL is returned: mysql> SELECT CASE 1 WHEN 1 THEN "one" WHEN 2 THEN "two" ELSE "more" END; -> "one" mysql> SELECT CASE WHEN 1>0 THEN "true" ELSE "false" END; -> "true" mysql> SELECT CASE BINARY "B" WHEN "a" THEN 1 WHEN "b" THEN 2 -> NULL The type of the return value (INTEGERDOUBLE or STRING) is the same as the type of the rst returned value (the expression after the rst THEN). 6.3.2  String Functions String-valued functions return  NULL  if the length of the result would be greater than the max_allowed_packet server parameter.  See Section 5.5.2 [Server parameters], page 363. For functions that operate on string positions, the rst position is numbered 1. ASCII(str) Returns the ASCII code value of the leftmost character of the string str.  Re- turns 0 if str is the empty string.  Returns NULL if str is NULL: mysql> SELECT ASCII('2'); -> 50 mysql> SELECT ASCII(2); -> 50 mysql> SELECT ASCII('dx'); -> 100 See also the ORD() function. ORD(str) If the leftmost character of the string str is a multi-byte character, returns the code for that character, calculated from the ASCII code values of its constituent characters using this formula:  ((first byte ASCII code)*256+(second byte ASCII code))[*256+third byte ASCII code...].  If the leftmost character is not a multi-byte character, returns the same value that the ASCII() function does:
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide