variable used for proc name
Posted in 2003
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting, Security, Permissions & Auditing, Data Types & Schema Design, Transactions, Locking & Isolation, Versions, Editions & End-of-Life
A co-worker is trying to get the following SPL procedure to work and
gets error 674 when he runs it.
What he wants to do is have a generic stored procedure he can call
passing in the name of another stored procedure and its parameter list
and execute the passed in proc.
Below is his "test" proc and "run" proc to figure out how to do what
the manuals and reference books say can be done. I can't find the
issue, what are we missing?
We have IDS 7.31.UC4 running on HPUX B.11.00.
Help!
John David Adamski
Information Systems Specialist
Graceland University
{
Revision Information (Automatically maintained by 'make' - DON'T
CHANGE)
-------------------------------------------------------------------------
$Header: procskeleton,v 8.0 2002/05/09 08:36:56 debarthe Released $
-------------------------------------------------------------------------
}
{
Test_procedure
}
drop procedure test_proc;
create procedure test_proc(parm_in char(32))
returning char(32);
Set isolation to dirty read;
set optimization low;
return parm_in;
end procedure;
grant execute on test_proc to public;---------------------------------------------------
{
Procedure to run a procedure
}
drop procedure run_proc;
create procedure run_proc(proc_in char(64))
returning char(254);
define the_procname varchar(64);
define the_result char(254);
Set isolation to dirty read;
set optimization low;
let the_procname = "test_proc";
--execute procedure test_proc (proc_in) into the_result;
-- above line works
execute procedure the_procname (proc_in) into the_result;
return trim(the_result);
end procedure;
grant execute on run_proc to public;
{Add an execute for testing and to try to force optimization}
execute procedure run_proc("Test result, it worked!");
-- get the following error
-- 674: Routine (the_procname) can not be resolved.
-- 111: ISAM error: no record found.
You can't do dynamic SPL, there are ways around in 9.x but under 7.x
I believe you are stuck with a big IF statement
John David Adamski wrote:
>
> A co-worker is trying to get the following SPL procedure to work and
> gets error 674 when he runs it.
>
> What he wants to do is have a generic stored procedure he can call
> passing in the name of another stored procedure and its parameter list
> and execute the passed in proc.
>
> Below is his "test" proc and "run" proc to figure out how to do what
> the manuals and reference books say can be done. I can't find the
> issue, what are we missing?
>
> We have IDS 7.31.UC4 running on HPUX B.11.00.
>
> Help!
>
> John David Adamski
> Information Systems Specialist
> Graceland University
>
> {
> Revision Information (Automatically maintained by 'make' - DON'T
> CHANGE)
> -------------------------------------------------------------------------
> $Header: procskeleton,v 8.0 2002/05/09 08:36:56 debarthe Released $
> -------------------------------------------------------------------------
> }
> {
> Test_procedure
> }
> drop procedure test_proc;
> create procedure test_proc(parm_in char(32))
> returning char(32);>
> Set isolation to dirty read;>
> set optimization low;
>
> return parm_in;
> end procedure;
>
> grant execute on test_proc to public;> ---------------------------------------------------
> {
> Procedure to run a procedure
> }
> drop procedure run_proc;>
> create procedure run_proc(proc_in char(64))
> returning char(254);>
> define the_procname varchar(64);
>
> define the_result char(254);
>
> Set isolation to dirty read;>
> set optimization low;
>
> let the_procname = "test_proc";
>
> --execute procedure test_proc (proc_in) into the_result;
> -- above line works
>
> execute procedure the_procname (proc_in) into the_result;>
> return trim(the_result);
>
> end procedure;
>
> grant execute on run_proc to public;>
> {Add an execute for testing and to try to force optimization}
>
> execute procedure run_proc("Test result, it worked!");>
> -- get the following error
>
> -- 674: Routine (the_procname) can not be resolved.
> -- 111: ISAM error: no record found.
--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #