Re: Passing arrays to a stored procedure

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joe Celko (jcelko212_at_earthlink.net)
Date: 11/19/04


Date: Fri, 19 Nov 2004 10:20:58 -0800


>> Can you pass arrays to a stored procedure? if so, how? Please
explain. <<

You reallllllly need to get a book on the basics before you try to
program in the language.

SQL uses tables as its only data structure and it holds only scalar
(atomic) values. There are no arrays in the language. Parameters are
scalars. You will need to break the the host language array elements
into scalars.

There are several kludges for this kind of bad programming available in
FAQ. However, the right answer is to learn to think and write proper
SQL code instead of trying to force your old mental model of data into
SQL.

--CELKO--
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Theodore Adorno, a prophet of data systems design
    ... I have a program which reads the log file looking for leaks.) ... > The second objection is that the C language leaves certain behaviours ... the way in which C allocates arrays and fails to ... >> The ideal is in fact to be able to create a string, ...
    (comp.programming)
  • Re: why cant functions return arrays
    ... The real problem with the idea of changing C to allow arrays to be ... treated as first-class objects is that there's no good way to do so ... The C language is already quite useful, ... but is really a pointer). ...
    (comp.lang.c)
  • Re: A VB.NET Critique
    ... You believe certain types, like strings and arrays, shouldn't be ... Should the language still ... They *aren't* reference types. ... Under your scheme, every new rectangle declaration just broke, and broke ...
    (comp.programming)
  • Re: c / c++ : is it end of era ?
    ... null-terminated strings doesn't mean that null-terminated strings are a ... That's a design flaw. ... has taken the trouble to learn the language. ... and the other sophistications of when arrays are ...
    (comp.lang.c)
  • Re: About alternatives to Matlab
    ... allocating arrays when, in a functional language, you could just as ... don't exactly understand why you'd need a functional language to get ... Python can't easily make. ...
    (comp.lang.python)