views:

51

answers:

1

I am recently inclined towards in Oracle jargon and the more I am looking into the more is attracting me.

I have recently come across the MODEL clause but to be honest I am not understanding the behaviour of this. Can any one with some examples please let me know about the same.

Thanks in advance

+4  A: 

Some examples of MODEL are given here.

Personally I've looked at MODEL several times and not yet succeeded in finding a use case for it. While it first appears to be useful, there's a lot of places where only literals work (rather than binds or variables) which restrict its flexibility. For example, on inter-row calculations, you can't readily refer to the 'previous' or 'next' row, but have to be able to absolutely identify it by its attributes. So you can't say 'take the value of the row with the same date in the previous month' but can only code a specific date.

It might be used (internally) by some analytical tools. But as an end-user tool, I never 'got' it. I have previously recommended that, if you ever find a problem you think can be solved by the application of the MODEL clause, go and have a lie down until the feeling wears off.

Gary
+1 For confirming what I "thought" I had heard about this clause during a session at a UKOUG event. Thanks
carpenteri