compare - OID comparison in IBM DB2 -
i'm trying use object oriented features of db2 first time. i've created types, typed tables , inserted data. problem can't compare user generated oids.
my type:
create type "orschema"."pojistovna_typ" as( nazev varchar(30), cislo varchar(3)) instantiable ref using integer mode db2sql;
my typed table:
create table "orschema"."pojistovna" of "orschema"."pojistovna_typ" (ref oid user generated);
succesfully inserted data command:
insert "orschema"."pojistovna" (oid, nazev, cislo) values("orschema"."pojistovna_typ"(1), 'ccc', '105');
but select doesn't work @ all, in ibm knowledge done same way:
select * "orschema"."pojistovna" "p" "p"."oid" = "orschema"."pojistovna_typ"(1);
error: data types not compatible or not comparable "="
one way using cast funcion, i'm not sure if won't slow down query:
select * "orschema"."pojistovna" "p" cast("p".oid integer) = 1;
Comments
Post a Comment