This content has been marked as final.
Show 8 replies
-
-
2. Re: Updating Dates w/CFQUERY
kodemonki Sep 22, 2008 9:32 AM (in response to kodemonki)term_months is an integer (number type in oracle)
launch is a date (date type in oracle)
For example, if a dealer enrolls in a five month program, I want the end date to be five months after the program is launched. -
3. Re: Updating Dates w/CFQUERY
Dan Bracuk Sep 22, 2008 9:36 AM (in response to kodemonki)use oracle's add_months function. -
4. Re: Updating Dates w/CFQUERY
kodemonki Sep 22, 2008 9:47 AM (in response to kodemonki)This gives me the error "invalid number of arguments" (output displayed as add_months(2006-05-23 00:00:00, 36))
update dlr_enrollments
set effecitve_end_date = add_months(#launch#, #term_months#)
where enrollment_id = #enrollment_id#
If I put launch in quotes I get invalid column name error.
If I change add_months(#launch# to add_months(to_date('#launch#','mm/dd/yyyy') I also get invalid column name.
add_months(#month(launch)# || '/01/' || #year(launch)# yeilds even worse results. -
5. Re: Updating Dates w/CFQUERY
Dan Bracuk Sep 22, 2008 12:27 PM (in response to kodemonki)why do you have octothorps around launch and term_months? -
6. Re: Updating Dates w/CFQUERY
kodemonki Sep 22, 2008 12:32 PM (in response to kodemonki)I guess I should have laid out my code (I thought posting the whole thing would be too much.
query to get enrollment id, launch date and term months
loop over query
update query with top query's values
/loop
I have hashes because launch and term_months are variables from the first query result set. -
7. Re: Updating Dates w/CFQUERY
Dan Bracuk Sep 22, 2008 4:26 PM (in response to kodemonki)In that first query, you can always add the add_months function result to your select clause and then you have the value you want.
Better yet, drop the column you are trying to update and just select what you need when you need it. -
8. Updating Dates w/CFQUERY
kodemonki Sep 23, 2008 4:35 AM (in response to kodemonki)This was an excellent suggestion, thank you! (and it worked!)

