Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 16 Dec 2005 @ 16:41:46 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Varbyte Conversion
From:   Geoffrey Rommel

  has anyone converted a hex value into a varbyte ?  

The manuals say that BYTE and VARBYTE cannot be converted to or from any other data type. You would therefore have to use either a UDF (I believe this is one of the reasons UDF's were provided) or dynamic SQL.

In a stored procedure, the dynamic SQL would be something like this (UNTESTED):

     declare big_string varchar(64000) character set unicode;
     declare big_sql varchar(64000) character set unicode;

     select char2hexint(char_column) ... into :big_string;
     set big_sql = 'insert into target_tbl (''' || big_string || '''xbv)';
     call DBC.SysExecSql(:big_sql);

Messy, isn't it? I like UDF's better.

  <Prev Next>   <<First <Prev
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020