Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUBSTRING accepts only constants as <pos> and <leng [CORE807] #552

Closed
firebird-automations opened this issue Sep 17, 2003 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pcisar

SFID: 808010#⁠
Submitted By: pcisar

the following code

SET TERM ;; ;

CREATE PROCEDURE t(s VARCHAR(10), i INTEGER)
AS
BEGIN
s = SUBSTRING(s FROM 2);
i = 2;
s = SUBSTRING(s FROM i);
END;;

produces

Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 5, char 24
-i

SUBSTRING(s FROM 2+2) and (SUBSTRING s FROM
1 FOR i) do not work also

that is, engine refuses to accept anything but integer
constants as position and length parameters.

The workaround is to use substrlen UDF, but this IMO
defeats the whole point of introducing SUBSTRING as a
core function.

This affects both firebird 1.0 and 1.5 (tested on Windows
SS).

----------------------
User: dimitr
Logged In: YES
user_id=61270

I could say it's as designed <g>, because Claudio did
it that way, but the SQL spec thinks differently, i.e.
<value expression>s are allowed as SUBSTRING
arguments.

Included in the TODO list for the next version.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10831 ] => Firebird [ 15263 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants