Thanks for that last thought
Peter Nosko, February 13, 2016 - 5:34 pm UTC
Connor, thanks for the reply. There may be other reasons unknown to me why using define_column is useful, but it seems unnecessary to make it required. Fortunately, a simple loop lets me define the output from the input.
Using it to change datatypes seems as sloppy to me as writing SQL that relies on implicit datatype conversions. I go out of my way to avoid implicit conversions, especially in WHERE and JOIN clause conditions. Helping the optimizer with thoughtfully-written SQL instead of using hints has worked well for me.
My particular use is a context manager to populate our application context from a view. We're in development mode and the view is growing a bit here and there and this context manager is very generic in handling the columns. Or abstract, like the OO folks like to say. It sure would be nice if context variable could be typed.
On an unrelated note, I'd like to give you a positive shout out for your great KISS series on YouTube. Is this forum a good place to discuss those? The YouTube comments section is a little inadequate.
February 14, 2016 - 4:11 am UTC
I tend to agree. I'd love to have a setting where you choose to have Oracle return an error whenever implicit datatype conversions took place, although I guess a whole lot of code, including mine :-) would suddenly break.
As is often the case, convenience leads to laziness.
Thanks for the feedback on the KISS series. If you have questions, probably the best way would be to ask AskTom question with a reference to the video in question. That way the broader community can participate and learn from it.