HELPLIB.HLB  —  RDML72  Statements  STARTING_WITH
    The STARTING WITH conditional expression tests for the presence
    of a specified string at the beginning of a string expression. A
    STARTING WITH conditional expression is true if the second string
    expression begins with the characters specified in the first
    string expression.

    If you precede the STARTING WITH expression by the optional NOT
    qualifier, the condition is true if the first value expression
    does not begin with the characters specified by the second value
    expression.

    The STARTING WITH conditional expression is case-sensitive; it
    considers uppercase and lowercase forms of the same character to
    be different.

1  –  Examples

    The following programs demonstrate the use of the STARTING WITH
    clause. These programs create a record stream containing the
    records in the EMPLOYEES relation in which the field LAST_NAME
    has a name that begins with the string "IACO" or "Iaco". These
    programs print the employee ID and last name contained in each
    record in the record stream.

1.1  –  C Example

    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    main()
    {
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR E IN EMPLOYEES CROSS D1 IN DEGREES OVER EMPLOYEE_ID
       WITH (UNIQUE D2 IN DEGREES WITH D2.EMPLOYEE_ID = E.EMPLOYEE_ID)
       AND D1.DEGREE_FIELD = "Arts"
       AND D1.COLLEGE_CODE = "STAN"
          printf ("%s\n", E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    }

1.2  –  Pascal Example

    program multiple_cond (input,output);
    DATABASE PERS = FILENAME 'PERSONNEL';

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR E IN EMPLOYEES CROSS D1 IN DEGREES OVER EMPLOYEE_ID
       WITH (UNIQUE D2 IN DEGREES WITH D2.EMPLOYEE_ID = E.EMPLOYEE_ID)
       AND D1.DEGREE_FIELD = 'Arts'
       AND D1.COLLEGE_CODE = 'STAN'
          writeln (E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    end.

2  –  Format

  (B)0starting-with-clause =

  qqq> value-expr qqwqq>qqqqqqqqwqq> STARTING WITH qqq> value-expr qq>
                    mqq> NOT qqqj

2.1  –  Format arguments

    value-expr             A value expression. A symbol or a string
                           of symbols used to calculate a value. When
                           you use a value expression in a statement,
                           Oracle Rdb calculates the value associated
                           with the expression and uses that value
                           when executing the statement.
Close Help