Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!isgate!krafla!ejs.is!te From: te@ejs.is (Tryggvi Edwald) Newsgroups: comp.databases Subject: Oracle Embedded SQL FETCH into array Question Keywords: Oracle, SQL Message-ID: <1057@ejs700.ejs.is> Date: 11 Apr 91 09:53:14 GMT Organization: Einar J. Skulason, Iceland Lines: 30 Hi, all. I know that I can FETCH from a table INTO an array, "vertically", i.e. take, say, 100 rows into a 100-element array in one go. What I would like to do, however, is fill an array "horizontally", from a single row fetch. An example: Assume a row in a table FISCALYEAR has fields called PROFIT1, PROFIT2, ... , PROFIT12 and LOSS1, LOSS2, ... , LOSS12 (meaning profits and losses in months #1 to #12 of the year). I have been trying to find a way to FETCH these into arrays, say prof[0] to prof[11], and loss[0] to loss[11], so that some net outcome can be calculated like: outcome = 0.; for( i=0; i<12; i++ ){ outcome += ( prof[i] - loss[i] ) } ... (This example is synthetic, just to explain what I mean.) The problem is, of course, that I have not been able to find a way to do this. I would appreciate almost any comment on this. Greetings. Tryggvi Edwald, te@ejs.is, ICELAND | Don't bother flaming me and calling Einar J Skulason hf, Grensasvegi 10 | me an idiot. I already know that from 108 Reykjavik, ICELAND | different sources. (Previous postings)