Your problem is not the loop, but the data.  One (or more) of your records
has MORE DATA than will fit in the DB column.  eg. Field is defined at 10
characters and you're trying to insert 15 characters.  Check your DB Schema
and your data.

-----Original Message-----
From: laritru [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 9:58 AM
To: CF-Talk
Subject: looping dilema on multiple form inserts


I am trying to insert multiple records for a  form. I am using the code
below. My problem is the following. When I am inserting multiple instances
of events I get the following error
"Error","5384","09/03/03","17:10:37",,"172.16.177.115, Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR
1.1.4322), ODBC Error Code = 22001 (String data right truncation)<P><P>
[MERANT][ODBC Oracle 8 driver][Oracle 8]ORA-01401: inserted value too large
for column <P><P><p>The error occurred while processing an element with a
general identifier of (CFQUERY), occupying document position (73:1) to
(73:75).</p><P><P>Date/Time: 09/03/03 17:10:36<BR>Browser: Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR
1.1.4322)<BR>Remote Address: 172.16.177.115<BR>HTTP Referrer:
http://www.testone.com/cart/testcart.cfm<P>"

The problem for me is the following. when i start it the form i set the
session.crt.calid with the values you see below. The values that i am trying
to loop on multiple events are values that need to go in the db since the
table requires fields.  Any suggestions?
<cfloop index="IndexCount" from="1" To="#ListLen(Session.Crtcalid, "^")#">
<cfoutput>
<cfset xname = #ListGetAt(Session.Crtxname, IndexCount, "^")#>
<cfset ProdQty = #ListGetAt(Session.CrtQuantity, IndexCount, "^")#>
<cfset ProdCost = #ListGetAt(Session.CrtPrice, IndexCount, "^")# *
#ListGetAt(Session.CrtQuantity, IndexCount, "^")#>
</cfoutput>
<cfset rid="W" & numberformat(getrid.recurid + 1,"0000000000")>
<CFQUERY Name = "AdditemseventsToDB" Datasource = #application.dsn#>
  Insert Into test_data.event
  (
   xstatus,
   xdate,
   xtime,
   xgroup$,
   xgroupdate,
   xgrouptime,
   xcreate,
   xupdate,
   xuser,
   rhas_note$,
   xlocator,
   xuniquekey,
   xorigin,
   xnumber
   )
  Values
  (
  'E',
  to_date('#DateFormat(now(),"dd-mmm-yy")#', 'DD-MON-YY'),
  '#registertime#',
  'E',
  to_date('#DateFormat(now(),"dd-mmm-yy")#', 'DD-MON-YY'),
  '#registertime#',
  to_date('#DateFormat(now(),"dd-mmm-yy")#', 'DD-MON-YY'),
  to_date('#DateFormat(now(),"dd-mmm-yy")#', 'DD-MON-YY'),
  'WEB',
  '0',
  '#Session.Crtcalid#',
  '#CustomerIDNumber#',
  '01',
  '#rid#'
  )
  </cfquery>
  </cfloop>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to