Is it possible to convert datatype when alter the table with check constraint in postgresql

87 views Asked by At

Here, I am only going to get CheckListNo (integer) from select statement "Check_No" ( character varying). when am execute this, error showing like this 'operator does not exist: character varying = integer'. So, I want to check without changing datatypes.

For an example, SELECT "Check_No" FROM "Project_CheckList_Options" let we see I defined "check_No" column as a integer if I want to get records in character varying. I can use just "check_No":: character varying then I can see column records in character varying type without affecting integer datatype. So like that Is it possible to convert datatype when alter the table with check constraint in postgresql?

 alter table "Project_Configuration" 
  add check("CheckListNo" in (SELECT  "Check_No"  FROM "Project_CheckList_Options"))
0

There are 0 answers