Hi All,
Can table procedures (or row producing procedures) use the execute procedure statement?
Unless I'm doing something wrong (which is odds on) it appears that the procedure can be defined with an execute procedure call but the attempt to execute it will fail with:
E_QE0310 Unsupported procedure statement type: CALL
drop procedure trial_date_cast;
\p\g
create procedure trial_date_cast(
a_string varchar(40) not null not default
)
as declare
int_date ingresdate not null not default;
begin
int_date = date(:a_string);
return iierrornumber;
end;
\p\g
drop procedure is_date;
\p\g
create procedure is_date(
a_string varchar(40) not null not default
)
result row myrow (is_date integer not null)
as declare
int_string varchar(40) not null not default;
a_date integer not null not default;
begin
for select :a_string into :int_string
do
execute procedure trial_date_cast(a_string = :a_string) into :a_date;
return row (:a_date);
endfor;
end;
\p\g
declare global temporary table x_date(
a_string varchar(40) not null not default
) on commit preserve rows with norecovery;
insert into x_date(a_string) values('not a date');
insert into x_date(a_string) values('1/1/2011 11:13:45');
insert into x_date(a_string) values('1/11/2010');
insert into x_date(a_string) values('31/1/2002');
\p\g
select x.a_string,
select x.a_string, y.is_date
from x_date x, is_date(a_string = x.a_string) y
\p\g
Whoops, sent some partially edited code…
It should have been:
drop procedure trial_date_cast;
\p\g
create procedure trial_date_cast(
a_string varchar(40) not null not default
)
as declare
int_date ingresdate not null not default;
begin
int_date = date(:a_string);
return iierrornumber;
end;
\p\g
drop procedure is_date;
\p\g
create procedure is_date(
a_string varchar(40) not null not default
)
result row myrow (is_date integer not null)
as declare
int_string varchar(40) not null not default;
a_date integer not null not default;
begin
for select :a_string into :int_string
do
execute procedure trial_date_cast(:int_string) into :a_date;
Hi All,
Can table procedures (or row producing procedures) use the execute procedure statement?
Unless I'm doing something wrong (which is odds on) it appears that the procedure can be defined with an execute procedure call but the attempt to execute it will fail with:
E_QE0310 Unsupported procedure statement type: CALL
drop procedure trial_date_cast;
\p\g
create procedure trial_date_cast(
a_string varchar(40) not null not default
)
as declare
int_date ingresdate not null not default;
begin
int_date = date(:a_string);
return iierrornumber;
end;
\p\g
drop procedure is_date;
\p\g
create procedure is_date(
a_string varchar(40) not null not default
)
result row myrow (is_date integer not null)
as declare
int_string varchar(40) not null not default;
a_date integer not null not default;
begin
for select :a_string into :int_string
do
execute procedure trial_date_cast(a_string = :a_string) into :a_date;
Aha, just found it in the documentation. Row producing procedures (and hence Table Procedures) cannot call a procedure.
Marty
From: Martin Bowes [mailto:martin...@ctsu.ox.ac.uk]
Sent: 20 January 2012 09:39
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Table procedures and execute procedure
Whoops, sent some partially edited code…
It should have been:
drop procedure trial_date_cast;
\p\g
create procedure trial_date_cast(
a_string varchar(40) not null not default
)
as declare
int_date ingresdate not null not default;
begin
int_date = date(:a_string);
return iierrornumber;
end;
\p\g
drop procedure is_date;
\p\g
create procedure is_date(
a_string varchar(40) not null not default
)
result row myrow (is_date integer not null)
as declare
int_string varchar(40) not null not default;
a_date integer not null not default;
begin
for select :a_string into :int_string
do
execute procedure trial_date_cast(:int_string) into :a_date;