We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


CREATE FUNCTION ERROR — Vertica Forum

CREATE FUNCTION ERROR

AlokTAlokT Community Edition User
edited September 2020 in General Discussion

CREATE FUNCTION replaceSpChar (x VARCHAR)
RETURN VARCHAR
AS BEGIN
RETURN REGEXP_REPLACE (x, '[.,;‘`:/*()
?/"&%$!+={}<>]', '') end

END

ERROR 4856: Syntax error at or near "end" at character 128

This manual select works->
select REGEXP_REPLACE ('?' , '[.,;‘`:/*()
?/"&%$!+={}<>]', '')

Answers

  • SruthiASruthiA Administrator

    @AlokT: Semicolon is missing in your CREATE statement before END. Please find working example below

    dbadmin=> CREATE FUNCTION replaceSpChar (x VARCHAR) RETURN VARCHAR AS BEGIN RETURN REGEXP_REPLACE (x, '[.,;‘`:/*()?/"&%$!+={}<>]', ''); end;
    CREATE FUNCTION
    dbadmin=>

Leave a Comment

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