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

Parsing error in EXECUTE STATEMENT with named parameters [CORE2420] #2836

Closed
firebird-automations opened this issue Apr 12, 2009 · 12 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: chedek (chedek2)

Is related to QA397

such query work incorrectly

....
for execute statement (' select s.cod,s.num, http://s.name,sum(g.summa) from sch s
left join getschdet(s.cod,:datedoc ,:datedoc,0,0,0,0,0,0,0,0,0,0,0,1,3) g on 1=1
where s.num in (''50'',''51'') and s.udl<>''У'' and s.root=1
and not exists (select s2.cod from sch s2 where s2.prevcod=s.cod)
group by 1,2,3') (datedoc := :datedoc)

where "datedoc" is TIMESTAMP
it throws error : "....Execute statement preprocess SQL error."

But if I change this query slighlty:

for execute statement (' select s.cod,s.num, http://s.name,sum(g.summa) from sch s
left join getschdet(s.cod,?, ?,0,0,0,0,0,0,0,0,0,0,0,1,3) g on 1=1
where s.num in (''50'',''51'') and s.udl<>''У'' and s.root=1
and not exists (select s2.cod from sch s2 where s2.prevcod=s.cod)
group by 1,2,3') (:datedoc, :datedoc)

It runs wthout any errors !

Commits: 2821d80 3d79776

@firebird-automations
Copy link
Collaborator Author

Commented by: chedek (chedek2)

The strangiest thing is that the query:

for execute statement (' select s.cod,s.num, http://s.name,sum(g.summa) from sch s
left join getschdet(s.cod,:datedoc1 ,:datedoc2,0,0,0,0,0,0,0,0,0,0,0,1,3) g on 1=1
where s.num in (''50'',''51'') and s.udl<>''У'' and s.root=1
and not exists (select s2.cod from sch s2 where s2.prevcod=s.cod)
group by 1,2,3') (datedoc1 := :datedoc, datedoc2 := :datedoc)

doesn't work too with same preprocess error.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Version: 2.5 Beta 1 [ 10251 ]

Version: 2.5 RC1 [ 10300 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

chedek, next time, *please*, post complete script, such as

recreate table sch (cod int, num int, name int, prevcod int, udl char(1), root int);

create or alter procedure getschdet(cod int, datedoc date, datedoc2 date,
p1 int, p2 int, p3 int, p4 int, p5 int, p6 int,
p7 int, p8 int, p9 int, p10 int, p11 int, p12 int, p13 int)
returns (summa int)
as
begin
suspend;
end;

execute block as
declare datedoc date;
declare cod int;
declare num int;
declare name int;
declare summa int;
begin
for execute statement (
' select s.cod,s.num, http://s.name,sum(g.summa) from sch s
left join getschdet(s.cod,:datedoc ,:datedoc,0,0,0,0,0,0,0,0,0,0,0,1,3) g on 1=1
where s.num in (''50'',''51'') and s.udl<>''У'' and s.root=1
and not exists (select s2.cod from sch s2 where s2.prevcod=s.cod)
group by 1,2,3') (datedoc := :datedoc)
into :cod, :num, :name, :summa
do exit;
end

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Changed description by more exact one

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

summary: incorrect preparing execute statement with dynamic parameters with duplicated names => Parsing error in EXECUTE STATEMENT with named parameters

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5 RC1 [ 10300 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA397 [ QA397 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Done successfully

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