Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle INSERT into LONG datatype field thru ODBC

Re: Oracle INSERT into LONG datatype field thru ODBC

From: <toffie_at_my-dejanews.com>
Date: Fri, 20 Nov 1998 14:32:41 GMT
Message-ID: <733ui8$ko5$1@nnrp1.dejanews.com>


In article <7321c4$1n1$1_at_nnrp1.dejanews.com>,   dgeiser6568_at_my-dejanews.com wrote:
> Simple question I hope -- for which a simple answer has eluded me...
>
> I'm trying to run an insert statement thru ODBC (in an Active Server Pages
> application) as follows:
>
> INSERT INTO TABLENAME (ID, TIMESTAMP, DETAIL) VALUES (1, '5:00:00 PM',
> '<<DETAIL TEXT>>')
>
> In this example, <<DETAIL TEXT>> is actually a text string. Anytime the text
> string is over 2000 characters in length, an error is returned stating that
> the value is too large for the column when in fact the DETAIL field is a LONG
> datatype.
>
> I'm told by the DBA that the value can't be posted as a literal string in the
> SQL statement - it must be assigned to a variable first. For example in
> PL/SQL:
>
> variable detailtxt varchar2(32700)
> BEGIN
> detailtxt = '<<TEXT GOES HERE>>'
> INSERT INTO TABLENAME (ID, TIMESTAMP, DETAIL) VALUES (1, '5:00:00 PM',
> :detailtxt)
> .
> .
>
> I'm not certain that this is the exact syntax of the PL/SQL needed to do this
> but I think anyone with an answer will get the idea.
>
> Any idea how this can be accomplished with a single SQL string through ODBC?
> We're using the Microsoft ODBC Driver on IIS 4.0
>

For the use a variable in ODBC/ADO you would need to use a questionmark. So the SQL would look like: INSERT INTO TABLENAME (ID, TIMESTAMP, DETAIL) VALUES (1, '5:00:00 PM',?) Then to define the parameter when using ODBC: check the ODBC SDK (free download from www.microsoft.com\data\odbc) ASP/ADO: check some ADO helpfile or have a look at www.microsoft.com\data\ado

That's all folks..
Toffie.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Nov 20 1998 - 08:32:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US