dbTalk Databases Forums  

variable used for proc name

comp.databases.informix comp.databases.informix


Discuss variable used for proc name in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John David Adamski
 
Posts: n/a

Default variable used for proc name - 09-15-2003 , 11:36 AM






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.

Reply With Quote
  #2  
Old   
Paul Watson
 
Posts: n/a

Default Re: variable used for proc name - 09-15-2003 , 12:06 PM






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:
Quote:
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 #


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.