0

Not the nest at coding

with t as
 (
   select MHKAPPEALSINTERNALID as id, 
      Cast(Note as VARCHAR(100)) as Note, 
      UPDATEDAT,
      Cast(MHK_TYPE  as VARCHAR(100)) as MHK_TYPE
   from vcoreMEDHOK_MHK_Notes
   Where cast(UPDATEDAT as Date) >= '2021/08/15'
 ) --- pull table

select MHKAPPEALSINTERNALID, MHK_Type, UpdateAt, Note, 
   regexp_substr(Token, '.*<b>*\K.*'),
   dt.*-- trim everything up to '<b>' 
FROM TABLE
 ( RegExp_Split_To_Table(t.id, t.Note,'<b>|<\/b>|<BR>|</BR>*', 'i')     -- split whenever '<\/b>' occurs
   RETURNS ( MHKAPPEALSINTERNALID BIGINT,
             TokenNum INT,
             Token VARCHAR(100) CHARACTER SET Unicode,
             MHK_TYPE VARCHAR(100) CHARACTER SET Unicode, 
             UPDATEDAT Date)
           ) AS dt

Teradata exception: [Teradata Database] [9881] Function 'RegExp_Split_To_Table' called with an invalid number or type of parameters

Trying to figure out why i am getting this message as im going between RegExp and RegSplit Field has mostly alot of data in it most split with ~ etc. but try to pull out sections of it is always a challenge especially when end user have free reign to do whatever.

dnoeth
  • 59,503
  • 4
  • 39
  • 56
Tekno Joe
  • 21
  • 1
  • 6
  • RegExp_Split_to_Table returns 3 columns, to get MHK_TYPE & UPDATEDAT you must join the result back to vcoreMEDHOK_MHK_Notes. – dnoeth Sep 23 '21 at 20:14
  • To avoid the join you might also try to concat MHKAPPEALSINTERNALID, MHK_TYPE & UPDATEDAT into a single VarChar column and use this as id. And then apply STRTOK to split it back into 3 columns. – dnoeth Sep 23 '21 at 20:20
  • @dnoeth great suggestions. – Tekno Joe Sep 23 '21 at 21:12
  • You are passing too many arguments. It should be `regexp_split_to_table (,,)`. – Andrew Sep 23 '21 at 21:41
  • I'm puzzled by the `>*` within the regexp patterns. Do you really mean match zero or more `>` characters? Or should the preceding expression be in parentheses followed by a `+`? – Fred Sep 23 '21 at 22:05
  • Thank you !!Andrew & @Fred – Tekno Joe Sep 27 '21 at 22:48

0 Answers0