Re: Accessing tmp tables in 4gl program
Posted in 1999
If this is a temp table and you don't know it's structure at
program compilation time you can't do this. If you know it's structure
is simple: just define an array of records and specify the
structure of record to be the same as the table structure:
DEFINE mData ARRAY[500] OF RECORD
field1 INT,
field2 DATE,
field3 CHAR(200)
END RECORD
or something like this, and then use a cursor to fill it up.
Again - you have no way to make this if the structure of your
temporary table is not known at compilation time !!! At least a
way I know.
Best Regards,
Octav
On Thu, Apr 29, 1999 at 02:36:18PM -0700, Krishnakumar Nandagopal wrote:
> Hi,
>
> I want to copy the table data to an array of structures....
>
> I have done this in ESQLC. I declared a sturcture with elements similar
> to the
> columns of the table. Then I declare a SELECT cursor and copy the data
> to the
> structure.
> As a result I had an array of structure equal to the number of rows in
> the
> table.
>
> I have to do the same thing in 4GL. How do I do it?????
>
> Thanks,
> nkrishnakumar
>
> --- Octav Chiriac <com@netinfo-moldova.com> wrote:
> > You can use the temporary table created in stored
> > procedure.
> > BUT, you can't use any RECORD LIKE temp_table.* (or
> > any LIKE temp_table.column)
> >
> > Best Regards,
> > Octav
> >
> > On Fri, Apr 23, 1999 at 09:24:48PM +0000,
> > krishnakn@yahoo.com wrote:
> > >
> > >
> > > Is it possible to access the tmp table created in
> > the Stored procedure in the
> > > 4gl program ?????
> > >
> > > I'm calling a SP in my 4gl program.
> > > The SP creates a temp table and fills some data.
> > >
> > > I need to access this table in my 4gl program
> > after calling the SP....
> > >
> > > It gives me compilation error saying the tmp table
> > not found in the database
> > > ???
> > >
> > > Pl. help me out !!!!!!!!
> > >
> > > The following is the code ..
> > >
> > > DATABASE apstst
> > >
> > > MAIN
> > >
> > > PREPARE s1 FROM "execute procedure p_crtreftabs
> > ()"
> > >
> > > EXECUTE s1
> > > call select_func()
> > > END MAIN
> > >
> > > function select_func ()
> > > define r_applacct RECORD LIKE t_tabname_list1.*
> > >
> > > declare acct_curs CURSOR FOR
> > > SELECT * FROM t_tabname_list1> > >
> > > FOREACH acct_curs INTO r_applacct.*
> > > DISPLAY r_applacct.*
> > >
> > > END FOREACH
> > >
> > > end function
> > >
> > > TIA,
> > >
> > > krishnakumar
> > >
> > > -----------== Posted via Deja News, The Discussion
> > Network ==----------
> > > http://www.dejanews.com/ Search, Read,
> > Discuss, or Start Your Own
> >
> > --
> > Octav Chiriac Phone: (373)
> > 2 21 20 96
> > NetInfo S.R.L. Fax: (373) 2 21 36 59
> > Chisinau (373) 2 24 00 83
> > Moldova, Republic of
> > mailto:com@netinfo-moldova.com
> >
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
--
Octav Chiriac Phone: (373) 2 21 20 96
NetInfo S.R.L. Fax: (373) 2 21 36 59
Chisinau (373) 2 24 00 83
Moldova, Republic of mailto:com@netinfo-moldova.com