Is it possible to do arithmetic operations inside SUBSTR?

General
Enthusiast

Is it possible to do arithmetic operations inside SUBSTR?

Hi,

    In my Teradata script, I'm using SUBSTR(columnname,1,(character_length(columnname)-4)). But, I'm getting the error as "2662   SUBSTR: string subscript out of bounds." Please help me on this.

Thanks,

Vinay.

1 REPLY
Enthusiast

Re: Is it possible to do arithmetic operations inside SUBSTR?

Vinay,

Yes you can but in this case I suspect columnname has values less than 4 chars which would produce this error.

Rglass