Hi ,
We have a table to record all the procedures/functions that a particular transaction needs to call. The user can opt to use/not to use these procedures/functions for a particular transaction. These procedures/functions are predefined and not added dynamically. The user only has the option of using it/not using it dynamically.
We attach these functions, which are flagged to be used by the user to a particular transaction type.
The problem arises since these procedures/functions may have different arguments.
How can I map the arguments to the correct variables in the calling program?
How can I cater for procedures/functions with different number of arguments?
Ex:
I may have variables prefix,suffix,companyid,maintype,subtype,qty as my variables in the main program. Now there can be different sub procedures, which needs to be called using any of these variables. The procedure to be called can be held in a variable as follows:
Wk_sql_stmt = validate_client
prefix,:suffix);
I want to be able to say ‘Execute Immediate Wk_sql_stmt using prefix,suffix;
Now if I want to call another procedure to validate company, I want to call a different procedure with different arguments and different number of arguments.
Wk_sql_stmt = validate_company
company_id,:main_type,sub_type);
Assuming that the sequence of each of the parameters in each procedure is recorded,
We can find the variables needed for each of the 2 statements. But can we generalize or change the code such that both can be called from one execute immediate statement like
Execute Immediate Wk_sql_stmt using value1,value2…….value n
Where value1 will be the value of the 1st parameter and the number of values for the particular procedure is n.
Sorry if the question is lengthy,
Thanking in advance,
J
We have a table to record all the procedures/functions that a particular transaction needs to call. The user can opt to use/not to use these procedures/functions for a particular transaction. These procedures/functions are predefined and not added dynamically. The user only has the option of using it/not using it dynamically.
We attach these functions, which are flagged to be used by the user to a particular transaction type.
The problem arises since these procedures/functions may have different arguments.
How can I map the arguments to the correct variables in the calling program?
How can I cater for procedures/functions with different number of arguments?
Ex:
I may have variables prefix,suffix,companyid,maintype,subtype,qty as my variables in the main program. Now there can be different sub procedures, which needs to be called using any of these variables. The procedure to be called can be held in a variable as follows:
Wk_sql_stmt = validate_client
I want to be able to say ‘Execute Immediate Wk_sql_stmt using prefix,suffix;
Now if I want to call another procedure to validate company, I want to call a different procedure with different arguments and different number of arguments.
Wk_sql_stmt = validate_company
Assuming that the sequence of each of the parameters in each procedure is recorded,
We can find the variables needed for each of the 2 statements. But can we generalize or change the code such that both can be called from one execute immediate statement like
Execute Immediate Wk_sql_stmt using value1,value2…….value n
Where value1 will be the value of the 1st parameter and the number of values for the particular procedure is n.
Sorry if the question is lengthy,
Thanking in advance,
J