Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: passing table name as parameter - CORRECTION
I don't think there is a stored procedure she is calling.
Though I barely know VB, but it seems like she is trying to
"prepare" a statement while trying to provide table_name as
a bind variable.
That of course should not work.
Maybe this will
> > > .CommandText = "truncate table " & table_name
.. and throw that .Append ... bind param .. thingie out.
Just a guess ....
Anurag
"Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message news:v3zd9.361256$UU1.59355_at_sccrnsc03...
> Where is the pl/sql stored procedure you are calling? That is probably
> where the error is.
> I hope this is an occaisional thing and not some SQLServer like temp table
> thing. If it is I would recommend not doing this; instead do it without a
> temp table. (Oracle can have a type of temp table see Global temporary
> tables, if you really really need it.) If it is an occaisional thing (this
> kills scalability) then in your pl/sql function use execute immediate.
> Jim
>
> "Patricia Paulson" <miapjp_at_chartermi.net> wrote in message
> news:unced142ivqa4a_at_corp.supernews.com...
> > whoops, in sub it's
> > Sub truncate_table(table_name as string)
> >
> > I forgot to put in the parameter after taking it out to check hard-coded
> > results.
> >
> > Pat
> >
> > "Patricia Paulson" <miapjp_at_chartermi.net> wrote in message
> > news:unce21sh25r1cd_at_corp.supernews.com...
> > > Hi,
> > >
> > > I'm having problems using the truncate command when I'm passing in the
table
> > > name. Hard-coding works fine, so I'm thinking it's something to do with
DDL
> > > and the double quotes for a string var????? I've tried all sorts of
things,
> > > and searched the Web for hours. Any help would be greatly
appreciated!!!
> > >
> > > Code:
> > >
> > > calling the sub:
> > > truncate_table ("im_header") ' I tried inlcuding the schema name also,
no
> > > go.
> > >
> > > the sub:
> > > Sub truncate_table()
> > >
> > > On Error GoTo err_hand
> > >
> > > Dim truncate_table As ADODB.Command
> > > Dim table_name_parm As ADODB.Parameter
> > >
> > > Set truncate_table = New ADODB.Command
> > >
> > > With truncate_table
> > > .ActiveConnection = rtkprd
> > > .CommandType = adCmdText
> > > .CommandText = "truncate table ?"
> > > Set table_name_parm = .CreateParameter("table_name", adVarChar,
> > > adParamInput, 50, table_name)
> > > .Parameters.Append table_name_parm
> > > .Execute
> > > End With
> > >
> > > Exit Sub
> > >
> > > err_hand:
> > >
> > > Err.Raise Err.Number, , Err.Description & vbCrLf & "Error truncating
> > > tables."
> > >
> > > Exit Sub
> > >
> > >
> > > Thanks in advance!
> > >
> > > Pat
> > >
> > >
> >
> >
>
>
Received on Wed Sep 04 2002 - 22:27:27 CDT