I'm using DB2 version 7 and I'm writing several scripts to be executed from the command line.
These are simple inserts.
Here's an example script:
-------------------------------------------
db2 "INSERT INTO nysa.bp37t_temp_approp_distinct SELECT DISTINCT budget_yr, agency_code, substr(prog_code,2,3), category, fund_type, substr(dob_object,1,1),0, sum(summary_value),0,0 FROM nysa.bp30t_dob_bps WHERE module = 'APPR' AND group_type = 'UNIVERSAL_OBJECT' AND dob_yr = '2001' AND event_name = 'Exec Budgt Rec' GROUP BY (budget_yr,agency_code,substr(prog_code,2,3),category,fund_type,substr(dob_object,1,1))"
--------------------------------------------------
My question is this:
Since the only thing that changes in this script when it is executed from year to year is the dob_yr , we would like to assign variables for the different years.
Then, these could be assigned to the current year at the top of the script.
Is it possible to do this against db2?
Thanks in Advance.
John
These are simple inserts.
Here's an example script:
-------------------------------------------
db2 "INSERT INTO nysa.bp37t_temp_approp_distinct SELECT DISTINCT budget_yr, agency_code, substr(prog_code,2,3), category, fund_type, substr(dob_object,1,1),0, sum(summary_value),0,0 FROM nysa.bp30t_dob_bps WHERE module = 'APPR' AND group_type = 'UNIVERSAL_OBJECT' AND dob_yr = '2001' AND event_name = 'Exec Budgt Rec' GROUP BY (budget_yr,agency_code,substr(prog_code,2,3),category,fund_type,substr(dob_object,1,1))"
--------------------------------------------------
My question is this:
Since the only thing that changes in this script when it is executed from year to year is the dob_yr , we would like to assign variables for the different years.
Then, these could be assigned to the current year at the top of the script.
Is it possible to do this against db2?
Thanks in Advance.
John