|
Yes - a UDTF can be a good idea.
But why don't create the view without the from-period and to-period at all?
If the period is something like "year+month" from a date field - simply
create a column in the view with the period. Why is the view created anyway?
Next question - how is the report run today? Is this a desktop report that
a user is running on demand? Or something that runs in batch?
Last - of course you can create your view with a dynamic SQL statement.
Simply pack everything in a string and use PREPARE/EXECUTE or EXECUTE
IMMEDIATE.
I'm currently not at work - but you can try to use ? parameter markers for
the variable parts (use PREPARE/EXECUTE then) - I don't know if those work
with CREATE VIEW - if not, you can still embed the variable values into the
statement string.
HTH
Daniel
Am 13.06.2025 um 19:26 schrieb Justin Taylor <jtaylor.0ab@xxxxxxxxx>:blhowie66@xxxxxxxxxxx>
Can you create a UDTF instead and make your inputs the parameters?
On Fri, Jun 13, 2025 at 11:40 AM Bill and Lisa Howie <
scriptwrote:
Hello all,
I have a situation where we have a view that I set up using the SQL
andeditor in ACS that we want to incorporate into a program and give it
dynamic parameters. This is a report that we run monthly, so we have a
"from period" and a "to period" that need to change each month when it's
run. I've tried embedding it in an RPG program, complete with the DROP
trying toCREATE statements for the view. I keep running up against a wall
beforeadd in the parameters for the periods, though. The SQL pre-compiler
doesn't seem to like it when I try to use the fields with the colon
Ithem, as in :FROMPERIOD and :TOPERIOD, and it also doesn't like it when
finddon't have the colons in there. I've tried defining the periods in a
database file and also as work fields within the program. When I don't
have the colons, the program runs, but gives an error that it doesn't
third,the period fields.
At this point I'm falling back to regroup and wondering if I'm setting
this up the right way. Would it be better/more elegant to set up an SQL
script in a source file and use RUNSQLSTM to do it? Or is there a
listbetter option that I'm not thinking of? All input would be greatly--
appreciated. Thanks!
Bill
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxrelated questions.
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.