Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Need SQL Server Temp Table equivalent (challenge!)
Brian Peasland wrote:
> Have a look at Global Temporary Tables. You can find more information in
> the Oracle docts (http://technet.oracle.com).
>
> HTH,
> Brian
>
> Kin Ng wrote:
> >
> > I have a need to create a temp table for a session only. The temp
> > table's structure is not fixed. Thus the current Oracle temp session
> > table won't work.
> >
> > Let me explain why I need this. Our business requirement is to have
> > dynamic product attributes. I.e. the product's attribute is user
> > defined. I have a table that stores row wise for each attribute (say
> > Brand) what the values will be (say Ford). Thus the user can define
> > as many attributes as they need. Here is the simplified table:
> >
> > Product Attribute Value
> > ---------------------------
> > Sparkplug1 Brand Ford
> > Sparkplug2 Brand GM
> > Sparkplug1 Size Big
> > Sparkplug2 Size Small
> > Sparkplug1 Weight Heavy
> > Wiper1 Brand Acura
> > Wiper1 Size Long
> > Wiper2 Brand GM
> > Wiper2 Size Small
> > Wiper3 Brand Ford
> >
> > Now the tricky part, the user expects to see their definition as this
> > from a View that I need to create:
> >
> > Product Brand Size Weight
> > ------------------------------------
> > Sparkplug1 Ford Big Heavy
> > Sparkplug2 GM Small null
> > Wiper1 Acura Long null
> > Wiper2 GM Small null
> > Wiper3 Ford null null
> >
> > This is almost like a pivot table but I need to do this dynamically.
> > If I can create a table (may I say like the SQL Server temp table) and
> > fill this table and return it, the whole world will be happy.
> >
> > So how can I do this in Oracle?
>
> --
> ===================================================================
>
> Brian Peasland
> dba_at_remove_spam.peasland.com
>
> Remove the "remove_spam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good. Now pick two out of
> the three"
As I recall the OP said he couldn't use a GTT for what he was doing.
I've had that situation before and created a <horrifying> table with many columns and default names </horrifying> and then mapped the columns on-the-fly.
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Mon Jul 14 2003 - 10:25:35 CDT