Jump to main content
HCL Logo Product Documentation
Customer Support Community
Customer Support HCLSoftware U Community Forums Customer Idea Portal
HCL Informix V15.0.0
  1. Home icon
  2. Welcome
  3. SQL programming

    You can use the HCL Informix® implementation of the SQL language to develop applications for Informix database servers.

  4. Guide to SQL: Syntax

    The HCL® Informix® Guide to SQL: Syntax describes the syntax of the statements, data types, expressions, operators, and built-in functions of the Informix dialect of the SQL language.

  5. Data types and expressions

    These topics describe the data types and expressions that Informix®supports.

  6. Expression
  7. Function Expressions
  8. Substring functions

    The built-in SQL substring functions return substrings from character string arguments, or return positional information for operations on substrings.

Product logo

  • HCL Informix® V15.0.0 documentation

    Welcome to the documentation for HCL Informix® 15.0.0 and related client tools and products.

  • Product overview

    HCL Informix® is a fast and scalable database server that manages traditional relational, object-relational, and dimensional databases. Its small footprint and self-managing capabilities are suited to embedded data-management solutions.

  • Installing

    These topics describe how to install HCL Informix® database servers, client products, and modules.

  • Administering

    In addition to administering the database server, you can tune performance, replicate data, and archive data.

  • Migrating and upgrading

    You can upgrade to the 15.0.0 release of HCL Informix® or migrate from other database servers to Informix. Upgrading is an in-place migration method that uses your existing hardware and operating system software. Some changes to the Informix database server can affect upgrading from a previous release.

  • Client APIs and tools

    You can use the HCL Informix® implementation of client APIs to develop applications for Informix database servers.

  • Embedding Informix®

    When you embed HCL Informix®, you can use enterprise-class high-availability and high performance with embeddability features such as easy programmability, a small disk and memory footprint, and silent deployment.

  • Extending Informix®

    Beyond standard relational database objects, HCL Informix® can be extended to handle specialized data types, access methods, routines, and other objects. Informix includes many built-in extensions that are fully integrated in the database server. Informix also provides modules, which are packages of extended database objects for a particular purpose and that are installed separately from the database server. Alternatively, you can create your own user-defined objects for Informix.

  • Data warehousing

    In addition to designing and implementing Informix® dimensional databases, you can use tools to create data warehouse applications and optimize your data warehouse queries.

  • Designing databases

    The first step in creating a relational database is to construct a data model, which is a precise, complete definition of the data you want to store. After you prepare your data model, you must implement it as a database and tables. To implement your data model, you first select a data type for each column and then you create a database and tables and populate the tables with data. You can also implement fragmentation strategies and control access to your data.

  • JSON compatibility

    You can use the popular JSON-oriented query language created by MongoDB to interact with data stored in HCL Informix®.

  • Security

    You can secure your Informix® database server and the data that is stored in your Informix databases. You can encrypt data, secure connections, control user privileges and access, and audit data security.

  • SQL programming

    You can use the HCL Informix® implementation of the SQL language to develop applications for Informix database servers.

    • Guide to SQL: Syntax

      The HCL® Informix® Guide to SQL: Syntax describes the syntax of the statements, data types, expressions, operators, and built-in functions of the Informix dialect of the SQL language.

      • Overview of SQL syntax

        These topics provide an overview about how to use the SQL statements, SPL statements, and syntax segments.

      • SQL statements

        This chapter describes the syntax and semantics of SQL statements that are recognized by Informix®.

      • SPL statements

        These topics describe Stored Procedure Language (SPL) statements, which you use to write SPL routines. You can store these routines in the database as user-defined routines (UDRs).

      • Data types and expressions

        These topics describe the data types and expressions that Informix®supports.

        • Scope of Segment Descriptions
        • Use of Segment Descriptions
        • Data type and expression segments

          Data type and expression segments can appear in SQL statements.

        • Collection Subquery
        • Condition
        • Data Type

          The Data Type segment specifies the data type of a column, of a component of a collection, of a field within a ROW type, of a routine parameter, or of a value returned by an expression or by a cast function. Use this segment whenever you see a reference to a data type in a syntax diagram.

        • DATETIME Field Qualifier
        • Expression
          • List of Expressions

            Each category of SQL expression includes many individual expressions.

          • Arithmetic Operators
          • Bitwise Logical Functions
          • Concatenation Operator
          • CAST Expressions

            Use the CAST (... AS ...) keywords or the double-colon ( :: ) cast operator to convert the data type of the value of an expression to some other target data type.

          • Column Expressions

            A column expression specifies a data value in a column in the database, or a substring of the value, or a field within a ROW-type column, or a field in a BSON column.

          • Conditional Expressions
          • Constant Expressions

            Certain expressions that return a fixed value are called constant expressions. These include variant function operators that read the system clock, but that are valid in contexts where literal constants are also valid.

          • Constructor Expressions
          • NULL Keyword
          • Function Expressions
            • Algebraic Functions
            • Bitshift Functions

              Bitshift functions perform a bit shift operation on an integer or bigint value and return the shift result.

            • CARDINALITY Function

              The CARDINALITY function returns the number of elements in a collection column (SET, MULTISET, LIST).

            • SQLCODE Function (SPL)

              The SQLCODE function takes no arguments, but returns to its calling context the value of sqlca.sqlcode for the most recently executed SQL statement (whether static or dynamic) that the current SPL routine has executed. Only use SQLCODE in the context of a cursor.

            • DBINFO Function
            • Encryption and decryption functions

              supports built-in encryption and decryption functions.

            • DECRYPT_CHAR Function
            • DECRYPT_BINARY Function
            • ENCRYPT_AES Function
            • ENCRYPT_TDES Function
            • GETHINT Function
            • Exponential and Logarithmic Functions

              Exponential and logarithmic functions take at least one argument and return a FLOAT data type.

            • NVL2 Function

              Returns the second argument when the first argument is not NULL. If the first argument is NULL, the third argument is returned.

            • HEX Function
            • Length functions

              Use length functions to determine the length of a character column, string, or variable, or of the value returned by a character expression, or (for CHAR_LENGTH in multibyte locales) the number of logical characters.

            • Security Label Support Functions
            • SIGN function

              The SIGN function returns an indicator of the sign of the argument.

            • Smart-Large-Object Functions

              The smart-large-object functions support objects of BLOB and CLOB data types:

            • Time Functions

              The time functions of Informix® accept DATE or DATETIME arguments, or character representation of a DATE or DATETIME value. They typically return DATE or DATETIME values, or convert information that they extract from DATE or DATETIME values into character strings or integers.

            • TO_NUMBER Function

              The TO_NUMBER function can convert a number or a character expression representing a number value to a DECIMAL data type.

            • Trigonometric Functions

              The built-in trigonometric functions calculate ratios of the lengths of the sides of right triangles. Two supporting functions, DEGREES and RADIANS, can respectively convert the units of angular values from radians to degrees, and from degrees to radians.

            • String-Manipulation Functions

              String-manipulation functions perform various operations on strings of characters.

            • Case-Conversion Functions

              The case-conversion functions perform lettercase conversion on alphabetic characters. In the default locale, only the ASCII characters in the ranges A - Z and a - z can be modified by these functions, which enable you to perform case-insensitive searches in your queries and to specify the format of the output.

            • Substring functions

              The built-in SQL substring functions return substrings from character string arguments, or return positional information for operations on substrings.

              • CHARINDEX function

                The CHARINDEX function searches a character string for the first occurrence of a target substring, where the search begins at a specified or default character position within the source string.

              • INSTR function

                The INSTR function searches a character string for a specified substring, and returns the character position in that string where an occurrence of that a substring ends, based on a count of substring occurrences.

              • LEFT function

                The LEFT function returns a substring consisting of the leftmost N characters from a string argument.

              • RIGHT function

                The RIGHT function returns a substring consisting of the rightmost N characters from a string argument.

              • SUBSTR function
              • SUBSTRB function

                Returns a substring of a string, beginning at a specified position in the string.

              • SUBSTRING function
              • SUBSTRING_INDEX function

                The SUBSTRING_INDEX function searches a character string for a specified delimiter character, and returns a substring of the leading or trailing characters, based on a count of a delimiter that you specify as an argument to the function.

            • FORMAT_UNITS Function

              The FORMAT_UNITS function can interpret strings that specify a number and the abbreviated names of units of memory or of mass storage.

            • IFX_ALLOW_NEWLINE Function

              The IFX_ALLOW_NEWLINE function sets a newline mode that allows newline characters in quoted strings or disallows newline characters in quoted strings within the current session.

            • User-Defined Functions

              A user-defined function (UDF) is a routine that you write in SPL or in a language external to the database, such as C or Java™, and that returns a value to its calling context.

          • Statement-Local Variable Expressions
          • Aggregate Expressions
        • OLAP window expressions

          You can include On-Line Analytical Processing (OLAP) expressions in a SELECT statement to operate on subsets of the rows in the result set of a query or subquery. You can use OLAP window expressions to examine subsets of the qualifying rows for patterns, trends, or exceptions in the data.

        • INTERVAL Field Qualifier
        • Literal Collection
        • Literal DATETIME
        • Literal INTERVAL
        • Literal Number
        • Literal Row

          The Literal Row segment specifies the syntax for literal values of named and unnamed ROW data types.

        • Quoted String
        • Relational Operator
      • Other syntax segments

        These topics describe syntax segments, which are language elements, such as database object names or optimizer directives, that appear as a subdiagram reference in the syntax diagrams of some SQL or SPL statements.

      • Built-In Routines
      • Appendixes
    • Guide to SQL: Reference

      The HCL® Informix® Guide to SQL: Reference contains the reference information for the system catalog tables, data types, and environment variables of the HCL Informix dialect of the SQL language, as implemented in HCL Informix. These topics also include information about the stores_demo, sales_demo, and superstore_demo databases that are included with HCL Informix.

    • Guide to SQL: Tutorial

      The HCL® Informix® Guide to SQL: Tutorial shows how to use basic and advanced structured query language (SQL) to access and manipulate the data in your databases. It discusses the data manipulation language (DML) statements as well as triggers and stored procedure language (SPL) routines, which DML statements often use.

  • Troubleshooting HCL Informix®

    Several troubleshooting techniques, tools, and resources are available for resolving problems that you encounter in your HCL Informix® database server environment.

 Feedback

Substring functions

The built-in SQL substring functions return substrings from character string arguments, or return positional information for operations on substrings.

Substring Functions
(1)
Notes:
  • 1 Informix® extension
  • 2 See CHARINDEX function
  • 3 See INSTR function
  • 4 See LEFT function
  • 5 See RIGHT function
  • 6 See SUBSTR function
  • 7 See SUBSTRB function
  • 8 See SUBSTRING function
  • 9 See SUBSTRING_INDEX function

Sections that follow describe the syntax and usage of these substring functions.

  • CHARINDEX function
    The CHARINDEX function searches a character string for the first occurrence of a target substring, where the search begins at a specified or default character position within the source string.
  • INSTR function
    The INSTR function searches a character string for a specified substring, and returns the character position in that string where an occurrence of that a substring ends, based on a count of substring occurrences.
  • LEFT function
    The LEFT function returns a substring consisting of the leftmost N characters from a string argument.
  • RIGHT function
    The RIGHT function returns a substring consisting of the rightmost N characters from a string argument.
  • SUBSTR function
  • SUBSTRB function
    Returns a substring of a string, beginning at a specified position in the string.
  • SUBSTRING function
  • SUBSTRING_INDEX function
    The SUBSTRING_INDEX function searches a character string for a specified delimiter character, and returns a substring of the leading or trailing characters, based on a count of a delimiter that you specify as an argument to the function.
  • Share: Email
  • Twitter
  • Disclaimer
  • Privacy
  • Terms of use
  • Cookie Preferences