Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: passing table name as parameter - CORRECTION
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 - 11:50:03 CDT