Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:13:49+00:00 2026-06-13T19:13:49+00:00

I am barely learning MySQL (moving from SQLite). I am trying to create a

  • 0

I am barely learning MySQL (moving from SQLite). I am trying to create a custom function within the MySQL command line client, but am hitting errors that I can’t correct – and can’t find answers to online. My first function began as this:

    CREATE FUNCTION myDatabase.LCASE_ASCII_VALUE_AT(
        unparsedLine VARCHAR(1024),
        linePos int
    ) RETURNS int DETERMINISTIC
    return ASCII( LCASE( RIGHT( CHAR_LENGTH(unparsedLine) - linePos + 1) ) );

I got this error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') )' at line 10

Any pointers on where my syntax went wrong? I suspected these, but they didn’t fix the problem:

  1. Perhaps MySQL does not like compound statements like return ASCII( LCASE( .... But even after manually unraveling the statement, I still got the same error (but on a line in the newly unraveled statement – I leave out the unraveled statement to save space).
  2. Perhaps the DELIMITER $$ [function definition] END $$ DELIMITER ; business is mandatory – but that didn’t fix the error, and MySQL documentation gives an example of a one-line function where DELIMITER is not needed. (the ‘hello’ function at https://dev.mysql.com/doc/refman/5.0/en/create-procedure.html)

EDIT: Added that I am creating this function within MySQL command line client.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:13:50+00:00Added an answer on June 13, 2026 at 7:13 pm

    right requires two arguments, the string itself and the number of characters. You’ve only given the character count.

    Try this instead:

    return ASCII( LCASE( RIGHT( unparsedLine, CHAR_LENGTH(unparsedLine) - linePos + 1) ) );
    

    Also, you may find that substr is a better option since there’s no need to calculate the argument to right in that case, something like:

    return ASCII( LCASE( SUBSTR( unparsedLine, linePos, 1 ) ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just barely learned how to use a function in parallel. The following line
Morning y'all This is probably an easy one but I barely got any sleep
Sorry this is a basic question, but all my research just barely missed answering
I'm just barely after 2 hours of trying to force it to work and
I'm trying to create a message validation program and would like to create easily
I'm just barely getting into NodeJS a bit and have hit a snag trying
I'm trying to install RSRuby on Ubuntu 10.04. I barely even know what error
I consider myself to be an average PHP coder, but I can barely edit
I know this has been asked before but I'm struggling.. I barely know any
I just barely created a new Area to organize my code. But currently I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.