dbTalk Databases Forums  

Function myschema.HEX doesn't exist???

comp.databases.mysql comp.databases.mysql


Discuss Function myschema.HEX doesn't exist??? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Hairgrove
 
Posts: n/a

Default Function myschema.HEX doesn't exist??? - 06-20-2010 , 12:28 PM






Has anyone run into this before? Is it documented as expected behavior
somewhere, or just a bug? I have a statement like this in a stored
procedure (vNewPwd is a SHA1 hash value which is a 40-digit hex number):

IF HEX ( UNHEX( vNewPwd )) != vNewPwd THEN
---
END IF;

The procedure compiles OK, but calling it gives me the rather strange
runtime error "Function myschema.HEX does not exist". (?!?! -- of course
it doesn't exist because there is a perfectly good built-in HEX()
function in MySQL...)

If I remove the spaces and put parentheses around the function calls, it
works:

IF (HEX(UNHEX(vNewPwd)) != vNewPwd) THEN
---
END IF;

However, in other languages I like to increase readability by inserting
spaces sometimes. Or is it just the extra parentheses that make a
difference?

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: Function myschema.HEX doesn't exist??? - 06-20-2010 , 12:38 PM






Robert Hairgrove wrote:
Quote:
Has anyone run into this before? Is it documented as expected behavior
somewhere, or just a bug? I have a statement like this in a stored
procedure (vNewPwd is a SHA1 hash value which is a 40-digit hex number):

IF HEX ( UNHEX( vNewPwd )) != vNewPwd THEN
---
END IF;

The procedure compiles OK, but calling it gives me the rather strange
runtime error "Function myschema.HEX does not exist". (?!?! -- of course
it doesn't exist because there is a perfectly good built-in HEX()
function in MySQL...)

If I remove the spaces and put parentheses around the function calls, it
works:

IF (HEX(UNHEX(vNewPwd)) != vNewPwd) THEN
---
END IF;

However, in other languages I like to increase readability by inserting
spaces sometimes. Or is it just the extra parentheses that make a
difference?
Nope, in MySQL, the spaces make a difference, also.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #3  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: Function myschema.HEX doesn't exist??? - 06-20-2010 , 01:10 PM



Robert Hairgrove wrote:
Quote:
Has anyone run into this before? Is it documented as expected behavior
somewhere, or just a bug? I have a statement like this in a stored
procedure (vNewPwd is a SHA1 hash value which is a 40-digit hex number):

IF HEX ( UNHEX( vNewPwd )) != vNewPwd THEN
---
END IF;

The procedure compiles OK, but calling it gives me the rather strange
runtime error "Function myschema.HEX does not exist". (?!?! -- of course
it doesn't exist because there is a perfectly good built-in HEX()
function in MySQL...)

If I remove the spaces and put parentheses around the function calls, it
works:

IF (HEX(UNHEX(vNewPwd)) != vNewPwd) THEN
---
END IF;

However, in other languages I like to increase readability by inserting
spaces sometimes. Or is it just the extra parentheses that make a
difference?
I have found that MySQL will not work with spaces between parentheses
and contents.

Like it or not, that's the way it is.

Reply With Quote
  #4  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: Function myschema.HEX doesn't exist??? - 06-20-2010 , 05:22 PM



Robert Hairgrove <rhairgrove (AT) bigfoot (DOT) com> wrote:

Quote:
Has anyone run into this before? Is it documented as expected behavior
somewhere, or just a bug?
Documented behavior.

Quote:
However, in other languages I like to increase readability by inserting
spaces sometimes. Or is it just the extra parentheses that make a
difference?
With default settings MySQL requires that no space is between the
function name and the opening parenthesis. This allows to use function
names as identifiers (this is sometimes important because new versions
can add new functions and would then break old applications).

However there exists the IGNORE_SPACE SQL mode that allows space after
the function name. See

http://dev.mysql.com/doc/refman/5.1/...esolution.html
http://dev.mysql.com/doc/refman/5.1/...-sql-mode.html


XL

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.