parameterised SQL views

From: Paul Singleton <p.singleton_at_keele.ac.uk>
Date: Fri, 06 Oct 2000 12:52:42 +0100
Message-ID: <39DDBD0A.FA50AE4B_at_keele.ac.uk>


I'm having difficulty implementing my design (for a client-server application) in (MS Jet) SQL, and beginning to wonder whether I'm facing a limitation of SQL generally.

I need to pass parameters into some stored SQL views ("queries" in Jet jargon), for use in place of constants in WHERE conditions.

Jet SQL allows me to declare a view as having parameters, and to pass in values when "calling" the view from application code (via ADO), but there seems to be no provision for defining a parameterised view in terms of another parameterised view, i.e. you can pass actual parameters IN but you can't pass them ON.

I suspect that Jet regards parameters in indirectly-called views as global parameters (more like #define constants in C) which is not what I need: my data is historical, tuples are "timestamped" with a From and Until field, and I'm comparing (in one query) the state of the system at two points in time, so the same view will get indirectly called with different parameter values...

I don't regard view parameters as a procedural extension to SQL, since they are essentially declarative, and without them SQL seems to lack some important aspect of practical computational completeness, or at least of scaleability.

I know that Prolog supports the sort of parameterisation I seek, with a declarative relational semantics, so I don't think there's a theoretical problem.

Am I missing something obvious, is this an old chestnut, or what? :-)

-- 
 _  _  Paul Singleton PhD CEng MBCS      tel:  01782 618379 (UK)
|_)(_` SmartArts Computing Consultancy   tel:  +44 1782 618379
|  ._) 36 Larchwood, Keele,            email:  p.singleton_at_keele.ac.uk
       Newcastle, Staffs  ST5 5BB  UK   road:  UK M6 J15 -> Keele Uni.
Received on Fri Oct 06 2000 - 13:52:42 CEST

Original text of this message