View previous topic :: View next topic
|
Author |
Message |
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
I have to implement a fucntion that the PLI main program will call the external function and pass parameters to the function.
The problem is that is number of parameters is not fixed,as required it can be 1 or 2 or 3 or 4.....and the sub program will do the different process according to number of the parameters,any good way to deal with such situation?Please guide me... |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
Declare the function procedure as GENERIC :
DCL function-procname GENERIC ( procname_1 WHEN ( parm_descriptor_1 ) , procname_2 WHEN ( parm_descriptor_2 ) );
this way, you can just use one function reference name but invoke different procedures depending on the parm that you pass on.
Any.... please correct me if I am wrong.... |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
Hi donateeye,
thanks for your so quick reply,actually logic processing in the function procedure is the same,the requirement is like:
in main program it will pass the table name,and different columns,the number of columns is different as I mentioned above,maybe 1 or 2 or 3......and then the subprogram will form a SQL select statement according to the parameters received from main program.... |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
anyone has the idea?and in additoin the parameter type(column type) is different,e.g:
the 1st call the subprogam it may have two parameters and the types are char and decimal,the 2nd time call the subprogram it may have five parameters and the types are char,decimal,decimal,char,char,decimal,and so on...
so how to manage it in both main and sub program? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Go back and create a different approach. . .
It is most difficult to implement when the rules say "i don'tknow how much i have to handle and i don't know what it will look like". . .
Until some rules can be established, it will most difficult. . .
What business requirement exists that provides no specifics? |
|
Back to top |
|
|
|