Error 3349: Expression for column string cannot be coerced. What does it mean and how can it be reso

While exporting a table, I came across this error.
Error 3349: Expression for column <xyz> cannot be coerced
 How to overcome this?

Comments

  • Very informative.

    >> How to overcome this?
    very carefully.

  • Hi Daniel,

    I can't get you. Can you please elaborate?

    Regards,
    Abhi 
  • Hi Abhishek,

    I believe that's Daniel's way of giving as much information as he felt that you gave in your question :-)

    Could you please provide a bit more information?  What's the particular statement that causes this error, for example?

    Thanks,
    Adam
  • Hi Adam,

    I am trying to export few tables from cluster A to cluster B. I can't go for backup & restoration as database name is different. But the Vertica version is same on both the cluster.

    Few of the tables get exported successfully but some of them was not exported throwing the below error:

     ERROR 3349: Expression for column ALERT_CLDR_DT cannot be coerced.

    The same error is for those which are not exported with their respective column name.

    So, I want to know what does it mean and how to resolve it?

    Thanks in advance !!!!

    Regards,
    Abhishek
  • Most probably the error is due to data type mismatch between the source and target tables. Check the data types for ALERT_CLDR_DT .

  • Hi Satish,

    I already checked the data types. They are same for both.

    Regards,
    Abhishek
  • Can you post the source and target tables schema ? Also the export/import command .
  • Hi Satish,

    Target db name is vrt_dev.

    Below is the command:

    CONNECT TO VERTICA vrt_dev USER ebi_etlusr PASSWORD 'vertica123' ON '16.216.4.20',5433; 
    EXPORT TO VERTICA vrt_dev.RPT.WF_INCID_R As select * from RPT.WF_INCID_R ;
    DISCONNECT vrt_dev;

     ERROR 3349: Expression for column ALERT_CLDR_DT cannot be coerced.


    The above command exported data successfully for almost all tables except few with the said error.


    The ALERT_CLDR_DT column datatype and size is same on both source and target. 

    Regards,
    Abhishek
  • Can you post the schema as well by doing '\d table name ' for both source and target tables ? Also you said if fails for some tables ? Vertica version for both source and target ?
  • Hi Satish,

    As you asked, here is the detail:

    List of Fields by Tables

    -[ RECORD 1 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | INCID_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | t

    Primary Key | t

    Foreign Key |

    -[ RECORD 2 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | INCID_ID

    Type        | varchar(240)

    Size        | 240

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 3 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | SRC_SYS_NM

    Type        | varchar(240)

    Size        | 240

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 4 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | AGNT_OWN_CLDR_DT

    Type        | date

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 5 ]----------------------------

    Schema      | RPT

     

    Table       | WF_INCID_R

    Column      | CI_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 6 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CLOSE_AGNT_GRE_LOC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 7 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CLOSE_AGNT_WRKFRC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 8 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CLOSE_CLDR_DT

    Type        | date

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 9 ]----------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CLOSE_RSN_CD_KY

    Type        | int

     

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 10 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CLOSE_WKGP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 11 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CO_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 12 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CUR_AGNT_GRE_LOC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 13 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CUR_AGNT_WRKFRC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

     

    Primary Key | f

    Foreign Key |

    -[ RECORD 14 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | CUR_WKGP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 15 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | ILC_WKGP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 16 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | IMPACT_CD_KY

    Type        | int

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 17 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | INCID_EVNT_CATG_GRP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 18 ]---------------------------

     

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | MED_CD_KY

    Type        | int

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 19 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | OPEN_AGNT_GRE_LOC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 20 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | OPEN_AGNT_WRKFRC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 21 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | OPEN_CLDR_DT

    Type        | date

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 22 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | OPEN_WKGP_KY

     

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 23 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | PRTY_CD_KY

    Type        | int

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 24 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | RCPT_CLDR_DT

    Type        | date

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 25 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | RSLV_AGNT_GRE_LOC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 26 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | RSLV_AGNT_WRKFRC_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

     

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 27 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | RSLV_WKGP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 28 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | SEC_WKGP_KY

    Type        | varchar(128)

    Size        | 128

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 29 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | SEVR_CD_KY

    Type        | int

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    -[ RECORD 30 ]---------------------------

    Schema      | RPT

    Table       | WF_INCID_R

    Column      | SLO_STAT_CD_KY

    Type        | int

    Size        | 8

    Default     |

    Not Null    | f

    Primary Key | f

    Foreign Key |

    Version are same for source and target i.e 6.1.2

    Also you said if fails for some tables ? 
       
        Yes, I executed the same command to export other tables under same schema . For few tables it exported successfully but for few it fails with the same ERROR 3349.

    Regards,
    Abhishek
  • Hi,

    I also got the same error.  Datatype is same in both source and destination tables.  Only difference I see is in ordinal position of the column which is giving error.  How to resolve this issue?

    Regards,
    Shridhar
  • Hi ,

    Ordinal position  mismatch can be solve by using COPY on top of view . Your data source will be a view on top of the original table , the view will have full match  Ordinal position   as the target table .

    Thanks .

  • Ordinal position of the columns in source and target table might be different.can check the ordinal position number in tables(system table). 

                 specifying the column names along with the copy command would solve the issue.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file