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 6092767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:28:57+00:00 2026-05-23T12:28:57+00:00

delimiter | CREATE FUNCTION BASE64_DECODE (input BLOB) RETURNS BLOB CONTAINS SQL DETERMINISTIC SQL SECURITY

  • 0
delimiter |

CREATE FUNCTION BASE64_DECODE (input BLOB)
        RETURNS BLOB
        CONTAINS SQL
        DETERMINISTIC
        SQL SECURITY INVOKER
BEGIN
        DECLARE ret BLOB DEFAULT '';
        DECLARE done TINYINT DEFAULT 0;

        IF input IS NULL THEN
                RETURN NULL;
        END IF;

each_block:
        WHILE NOT done DO BEGIN
                DECLARE accum_value BIGINT UNSIGNED DEFAULT 0;
                DECLARE in_count TINYINT DEFAULT 0;
                DECLARE out_count TINYINT DEFAULT 3;

each_input_char:
                WHILE in_count < 4 DO BEGIN
                        DECLARE first_char CHAR(1);

                        IF LENGTH(input) = 0 THEN
                                RETURN ret;
                        END IF;

                        SET first_char = SUBSTRING(input,1,1);
                        SET input = SUBSTRING(input,2);

                        BEGIN
                                DECLARE tempval TINYINT UNSIGNED;
                                DECLARE error TINYINT DEFAULT 0;
                                DECLARE base64_getval CURSOR FOR SELECT val FROM base64_data WHERE c = first_char;
                                DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET error = 1;

                                OPEN base64_getval;
                                FETCH base64_getval INTO tempval;
                                CLOSE base64_getval;

                                IF error THEN
                                        ITERATE each_input_char;
                                END IF;

                                SET accum_value = (accum_value << 6) + tempval;
                        END;

                        SET in_count = in_count + 1;

                        IF first_char = '=' THEN
                                SET done = 1;
                                SET out_count = out_count – 1;
                        END IF;
                END; END WHILE;

                WHILE out_count > 0 DO BEGIN
                        SET ret = CONCAT(ret,CHAR((accum_value & 0xff0000) >> 16));
                        SET out_count = out_count – 1;
                        SET accum_value = (accum_value << 8) & 0xffffff;
                END; END WHILE;

        END; END WHILE;

        RETURN ret;
END |

The error I’m getting is:

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 '– 1;
                        END IF;
                END; END WHILE;
         ' at line 52
  • 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-05-23T12:28:58+00:00Added an answer on May 23, 2026 at 12:28 pm

    The problem, silly as it was, was the use of non-standard symbols throughout. -s and ‘s were wrong format. Due to the encoding of the IDE I am using or something just as silly.

    facepalm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code is: DELIMITER $$ CREATE FUNCTION CHECK_AVABILITY(nama CHAR(30)) RETURNS INT(4) DECLARE vreturn INT(4);
I've used the following split function: CREATE FUNCTION dbo.Splitfn(@String varchar(8000), @Delimiter char(1)) returns @temptable
CREATE FUNCTION TWO_FRONT(txt CHAR(30)) RETURNS CHAR(2) RETURN SUBSTRING(txt, 1, 2); DELIMITER $$ CREATE FUNCTION
DELIMITER $$ DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$ CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` ( PONo1 VARCHAR(20),
I have the following UDF. CREATE FUNCTION [dbo].[udf_GenerateVarcharTableFromStringList] (@list varchar(MAX), @delimiter char(1) = N',')
DELIMITER || CREATE FUNCTION InsertEvent (IN iPatientMonitoringId BIGINT, IN iTypeId SMALLINT(6), IN iChannelId SMALLINT(6),
I've this function: DROP FUNCTION IF EXISTS find_linkid; DELIMITER // CREATE FUNCTION `find_linkid`(pc1 VARCHAR(50)
DELIMITER // CREATE FUNCTION F_offshorePrice1(topsbwynum INTEGER, hulsbwynum INTEGER,sbwynum INTEGER, adjprice FLOAT(11,2), price FLOAT(11,2), estprice
I have this code DELIMITER $$ DROP FUNCTION IF EXISTS `GetNextID` $$ CREATE FUNCTION
Modifed. DROP FUNCTION IF EXISTS PersonName; DELIMITER |; CREATE FUNCTION PersonName( personID SMALLINT )

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.