Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help with dynamic insert
CTAS means:
Create table as select ... from ...
Regards, Derya.
"Ryan Gaffuri" <rgaffuri_at_cox.net> wrote in message
news:1efdad5b.0302050422.656ac62b_at_posting.google.com...
> "Howard J. Rogers" <howardjr2000_at_yahoo.com.au> wrote in message
news:<nbU%9.40475$jM5.102996_at_newsfeeds.bigpond.com>...
> > Wouldn't it be easier as he creates the table to do it with a CTAS where
> > rownum <2. That way he gets one row of data. Follow that up with an
update
> > of all fields, and you have your 8888's?
> >
> > Just a thought.
> >
> > Regards
> > HJR
> >
> >
> >
> > "Ryan Gaffuri" <rgaffuri_at_cox.net> wrote in message
> > news:1efdad5b.0302031226.63fa6a41_at_posting.google.com...
> > > Trying to help someone do this. Its not for the application. He is
> > > trying to fix some crystal reports and wants a utility.
> > >
> > > Basically he is going to create a table or a view at runtime. The view
> > > will be based on an existing table but will have no data. He then
> > > wants to populate all the fields in that view with 8's. However, he
> > > wants the 8's to be as long as the field length. Columns will either
> > > be Number or Varchar.
> > >
> > > For example, you have a field length of 10. Add 88888888 and so on.
> > >
> > >
> > > Im having trouble with coming up with a simple insert statement.
> > >
> > > I can build v_fields from a loop and add commas, but cycling through
> > > USER_TAB_COLUMNS
> > >
> > > EXECUTE IMMEDIATE 'INSERT INTO TABLE '||
> > > '('||v_fields||')'||
> > > 'VALUES'( <now what do I here to make it dynamic?>)'
> > by CTAS, you mean create table statement? oh you mean do a dynamic > create table? yeah that could work. I just build my table had it > passed into the procedure and used a couple of loops to build comma > delimited fields for my inserts. > > creat table would work fine. Thanks Howard.Received on Thu Feb 20 2003 - 07:55:54 CST