The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

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 Vertica Employee Employee

    @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