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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help--"Quoted String not Properly Terminated"?

Re: Help--"Quoted String not Properly Terminated"?

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: Mon, 15 Nov 1999 13:11:54 -0500
Message-ID: <38304CEA.74B874A4@Unforgettable.com>


Kate Woodman wrote:
>
> Environment:
> Oracle 8.0.5
> VB program using Microsoft ODBC for Oracle (NOT Microsoft Oracle Driver)
>
> This is driving me nuts. I've got a program with lots of selects &
> inserts in various spots, which work okay. But the problem I'm
> describing here is just bafflihg me.
>
> When I go to insert some information programmatically, using:
>
> dbCOSMOS.Execute ("Insert into tblincidenthistory " & _
> "(key, date_r, pcnnumber, callnumber, technician, routedto, " &
> vbCrLf & _
> "description, category, componentserviced, resolutioncode) " &
> _
> "values " & _
> "(ih_seq.nextval, " & vbCrLf & _
> "to_date('" & Format(.m_dDate, "MM/DD/YYYY hh:mm:ss AMPM") &
> "','MM/DD/YYYY HH:MI:SS AM'), " & _
> "'" & mvarm_sPCNNumber & _
> "', " & mvarm_nCallNumber & _
> ", '" & Trim(.m_sTechnician) & _
> "', '" & .m_sRoutedTo & "'," & vbCrLf & _
> "'" & .m_sDescription & "'," & vbCrLf & _
> "'" & .m_sCategory & _
> "', " & .m_nComponentServiced & _
> ", " & .m_nResolutionCode & ")")
>
> I get the following errors:
>
> SQL Server Error # 0 NA000: [Microsoft][ODBC driver for
> Oracle][Oracle]ORA-01756: quoted string not properly terminated
> SQL Server Error # 1 ODBC--call failed.
>
> But, when I dump the *same* *exact* *string* into a text file, and
> cut-and-paste into SQL*Plus, it works perfectly:
>
> Insert into tblincidenthistory (key, date_r, pcnnumber, callnumber,
> technician, routedto,
> description, category, componentserviced, resolutioncode) values
> (ih_seq.nextval,
> to_date('11/15/1999 09:48:21 AM','MM/DD/YYYY HH:MI:SS AM'), '119721', 6,
> 'kaw28 ', '',
> 'this is a test summary',
> 'Opened', 0, 0)
>
> I thought, for a while, that I had figured it out--that the string was
> reaching SQL*Plus without any returns, so the SQL statement was being
> "virtually wrapped" in the midst of a character string. So I made sure
> to insert the carriage returns programmatically, so no character string
> was being broken by a "virtual" carriage return. (That's why all the
> "vbCrLf"s in the code.) Alas, that didn't seem to make any difference.
>
> I've searched on DejaNews...I've tried the OTN site...The only ideas
> I've encountered are the "don't break your string across a line" and one
> person who suggested changing the SQL*Plus termination character, but
> that doesn't apply here...
>
> HELP! If you have *any* clue, I'd appreciate some info.
>
> Please reply via email as well...
>
> Kate

Get rid of the vbCrLf that you have embedded in the statement. Think of the sql statement as just a character buffer. Oracle doesn't care about wrapping, etc. It looks like your real problem is that you don't have all of your quote marks in all of the right places.

Try stepping into your code to the point where the sql statement is built and then take a look at it in a watch window and see where the quotes are out of place.

...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
...................................................................................
Received on Mon Nov 15 1999 - 12:11:54 CST

Original text of this message

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