Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C host arrays
"Ed Prochak" <edprochak_at_adelphia.net> wrote in message
news:3E7F67C4.1090707_at_adelphia.net...
> Brian Beld wrote:
> >
> > Ed Prochak a écrit:
> >
> >> Did you read earlier chapters about declaring data types? Do you know
> >> how to insert a date value that is not part of a host array? (IOW try
> >> to walk before trying to run).
> >
> >
> > I already insert dates.
> > I have dozens of columns that I insert by host arrays.
> > I just want to re-organize them in a structure to simplify the VALUES
> > clause by just setting the structure name instead of all the arrays.
> >
>
> Then have you tried doing this with a structure without using host arrays?
> (check DECLARE). Actually, if you are hoping to just be able to say
someting like
>
> EXEC SQL
> INSERT into ABC_table VALUES ( &my_data_struct );
This works just fine in PROC. However, I usually explicitly list the column names so that they match the order of the values in my structure.
INSERT into ABC_table (col1,col2,col3) VALUES ( my_struct:my_indicator_struct )
or
SELECT col1,col2,col3 FROM ABC_table INTO my_struct:my_indicator_struct WHERE .... And yes, you can create arrays of these structures so that you can read or write large numbers of rows at one time.
> I think it does not work. Oracle doesn't know or care about the structures
you
> use. You still have to list each column value for the INSERT. Make an
array
> for each one of DATES just like you do for other values. I don't think you
can
> get away for the long list. Sorry.
>
> Just to understand this, take a look at the OCI calls generated by the
Pro*C
> precompiler. It's ugly but interesting and informative.
>
> HTH
>
>
> --
> Ed Prochak
> running: http://www.faqs.org/faqs/running-faq/
> family: http://web.magicinterface.com/~collins
> --
> "Two roads diverged in a wood and I
> I took the one less travelled by
> and that has made all the difference."
> robert frost
>
Received on Tue Mar 25 2003 - 08:12:10 CST