virtual-column

What is the alternative for generated column in MySQL 5.6

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-22 06:59:46
问题 I have a MySQL alter statement ALTER TABLE `employee` ADD `employee_name_generator` CHAR(20) GENERATED ALWAYS AS (COALESCE(concat(`employee_name`), '^')) VIRTUAL; This is needed for adding employee_name_generator in a unique constraint. This works fine in MySQL 5.7 onwards. But the environment where I need this has MySQL 5.6. Is there an alternative for MySQL 5.6? 回答1: If your earlier version of MySQL does not support generated columns, then you'll have to compute that column at the time you

Concatenating numbers in virtual column expression throws ORA-12899: value too large for column

对着背影说爱祢 提交于 2019-11-30 19:25:20
While I gave this answer to a question yesterday, I suggested to use a VIRTUAL COLUMN for computed values instead of manually updating it. I did a test myself, and figured out an issue with the data size that the virtual column expression takes while concatenating two NUMBER type columns. Though, no issue while concatenating two characters. DB version : SQL> select banner from v$version where rownum = 1; BANNER -------------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production SQL> Test case 1 :

Concatenating numbers in virtual column expression throws ORA-12899: value too large for column

99封情书 提交于 2019-11-30 03:55:38
问题 While I gave this answer to a question yesterday, I suggested to use a VIRTUAL COLUMN for computed values instead of manually updating it. I did a test myself, and figured out an issue with the data size that the virtual column expression takes while concatenating two NUMBER type columns. Though, no issue while concatenating two characters. DB version : SQL> select banner from v$version where rownum = 1; BANNER --------------------------------------------------------------------------------