Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-2956

With a collated database USER cannot be used in query against user tables without cast

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 10.4.1.3
    • None
    • SQL
    • None

    Description

      ij> create table staff (empname varchar(30));
      0 rows inserted/updated/deleted
      ij> insert into staff values('APP');
      1 row inserted/updated/deleted
      ij> insert into staff values('KATHEY');
      1 row inserted/updated/deleted
      ij> select * from staff where empname like USER;
      ERROR 42ZA2: Operand of LIKE predicate with type VARCHAR(30) and collation TERRITORY_BASED is not compatable with LIKE p
      attern operand with type VARCHAR(128) and collation UCS_BASIC.
      ij>

      Workaround is to use a cast

      ij> select * from staff where empname like CAST(USER as VARCHAR(30));
      EMPNAME
      ------------------------------
      APP

      1 row selected

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kmarsden Katherine Marsden
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: