Solved

array of domain in a stored procedure

Posted on 2004-08-04
4
2,003 Views
Last Modified: 2013-12-09
is there a way to create an array of some domain ? the domain would have a few fields like:

TKnjizba = record
  RecID: Integer;
  Kolicina: Double;
  Cena: Double;
  Vrednost: Double;
  P1: Integer;
end;

TKnjizbe = array of TKnjizba;


I'd really prefer the array approach over a temp table approach
is this at all possible ?

using FireBird 1.5

tnx
0
Comment
Question by:Lee_Nover
  • 2
4 Comments
 
LVL 19

Expert Comment

by:NickUpson
ID: 11714229
you can't have an array of a structure,  the best you can get is an array of one type

RecID INTEGER [10],

for example.

Temporary tables, as such, don't exist in firebird either due to limits on how many create/drop's you can do before a backup & restore are required. The best solution is usually to create the table permanently and just populate/delete as required.

I normally find that a table as above and a select loop through it avoid the need for arrays, which do have a fixed size unlike tables.
0
 
LVL 12

Author Comment

by:Lee_Nover
ID: 11714280
fixed size arrays for each field is no good .. I'm better off with a temp table then :)
tnx
0
 
LVL 10

Accepted Solution

by:
kacor earned 500 total points
ID: 11730322
Some remarks on using array-based columns:

InterBase (I don't know FireBird) allows you to define a column as an array of elements. You can then manage the entire array as a single entity, as a series of elements in one dimension of the array, or as individual elements.

Array-based columns cannot be addressed using standard interactive SQL. Arrays are provided for applications that use embedded or dynamic SQL statements within the compiled application.

The RDBMS-experts don't support/suggest the array-based columns because it's use hurts the most rules of a good RDBMS otherwise InterBase supports this data handling only very poor. I suggest the use of standard columns instead.

If you decide to use array-based columns you have to solve/program all data handling tasks. And this is not simple.

wbr

kacor
0
 
LVL 12

Author Comment

by:Lee_Nover
ID: 11941000
I went for a temp table .. less code and more flexibility :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now