Error in cfquery insert

I have a form that is submitting a list of values, The insert
query worked fine until I needed a where clause in it and now it
bombs out. Here is the code, and help would be appreciative.

well, i am not so sure you do...
first, you never mentioned your intention to check for
duplicate
records... hence i did not suggest how to do it best.
second, all you said was that your query does not work - and
i gave you
an exact reason why it didn't - your where clause in the
insert query.
third, my saying "the record does not exist yet" refers to
the record
you are inserting, not *any* record in your table. the one
you are
inserting (which means you are creating a new record) surely
does not
yet exist in your db. there could be ANOTHER record with
exactly the
same info you are inserting, true.
it will also be nice if you post your solution to your
problem instead
of just posting "i fixed it, nevermind"... when someone else
has a
similar problem they can then find your thread and have an
answer
instead of asking the same question again.
as for your trying to check for duplicate records, the way to
do it
would be to use a select query inside your loop first to
check if a
record with same data as in the loop's row exists, and if
that query
returns 0 rows, then run your insert query (definitely
without any where
clause).
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Similar Messages

  • Error in updating/inserting task in database

    When I pass in a runtimeFault Code, Detail and Summary into Flexstring1,2,3 I am getting this runtime error :
    Error in updating/inserting task in database. SQL Exception while updating/inserting task into the database. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
    Where can I find the error stack?
    Pete

    turn the following loggers from info to debug level (bpel console/manage domain/ tab logging)
    default.collaxa.cube.ws and
    default.oracle.services
    given you are using a developer isntall, you should see the stack a dos box
    if you are using an application server mid tier cou can find them in $AS_HOME/opmn/logs/OraOc4J_BPELxxxx.log
    hth clemens

  • [SOLVED] FRM-40508:ORACLE error: unable to INSERT record

    Hi all,
    I have migrated this form from 4.5 to 10g (Version 10.1.2.0.2 ). This form inserts a record into the database table when all the fields in the form are filled and a button Save is presed.
    At the time when I press the Save button, I get this error. FRM-40508:ORACLE error: unable to INSERT record
    So I went on to see the "Display Error" from help and found to be the database error, inserting into a table.
    The error message is ORA-00932: inconsistent datatypes: expected DATE got NUMBER
    The form where I press Save button has 3 date fields and I checked the properties of them and they are Date only.
    I also generated to object list report and tried to find some answer, but no use.
    Please help me in debugging this form.
    Edited by: Charan on Aug 18, 2011 4:05 PM

    I think you need to get a description of the table and compare all the "database" columns in the form with the ones in the database table to see that the types match. Somewhere there's a mismatch. Also check the block(s) "query data source columns" and see if there's any
    columns in there that the type does not match the table. (check the sizes of things too while you're at it.)

  • Where is the syntax error in my Insert statement?

    It says that there is a syntax error in my insert statement, pointing to the .ExecuteNonQuery() at the end:
    'Defining the activity ID from the datatable
    Dim ActivityID As Integer = DataTableActivities.Rows(0).Item(0)
    'Defining the calories from the datatable
    Dim calories As Decimal = (DataTableActivities.Rows(0).Item(3)) * (DurationNum.Value / 60)
    'Insert statement to add new training events
    Dim SqlQueryActivityInsert As String = "INSERT INTO tblTraining (RunnerID, ActivityID, Full_Name, Time, Calories_Burnt, Date) VALUES (@RunnerID, @ActivityID, @Full_Name, @Time, @Calories, @Date)"
    Dim SqlCommandActivity As New OleDbCommand
    With SqlCommandActivity
    .CommandText = SqlQueryActivityInsert
    .Parameters.AddWithValue("@RunnerID", LoginForm.UserIDlbl.Text)
    .Parameters.AddWithValue("@ActivityID", ActivityID)
    .Parameters.AddWithValue("@Full_Name", LoginForm.Full_Namelbl.Text)
    .Parameters.AddWithValue("@Time", DurationNum.Value)
    .Parameters.AddWithValue("@Calories", calories)
    .Parameters.AddWithValue("@Date", WeekPicker.Value)
    .Connection = conn
    .ExecuteNonQuery()

    Viorel is right.  The 'Date' field is probably throwing it off.  Date is a reserved word. 
    https://www.drupal.org/node/141051
    Putting square brackets [] around the field name should get it working for you.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • How to resolve ORA-00001 Error in SQL Insert?

    Hi all, I need your appreciated help.
    I make a plsql procedure that is inserting a row according cursor value, I'm having oracle error ORA-00001: unique constraint (constraint_name) violated.
    You may see this message if a duplicate entry exists at a different level: in RDBMS MySQL I have the syntax IGNORE to resolve this duplication error... and in Oracle ?
    Thanks for your time and hints.
    Miguelito

    user6317803 wrote:
    How to resolve ORA-00001 Error in SQL Insert?ORA-00001 means table has unique/primary key/index and you are trying to insert a row with key value that already exists in the table. I'll assume table COUNTRIES has primary key on COUNTRY_ID. Then change SQL to:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ')"There is a good chance table COUNTRIES also has unique key/index on COUNTRY_NAME. If so use:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR COUNTRY_NAME = 'BLZ')"SY.

  • Errors with post-insert trigger

    I had a POST-INSERT TRIGGER here.but i encountered some problems.can someone help me with the errors?
    begin
         insert into user_acct
         userid_n, user_m, coy_c, contact_n, emp_n,
         work_loc_c, curr_passwd_t, prt_f, indv_pc_f, pc_deploy_c,      
         ext_email_addr_t, other_na_sys_t, status_c, status_rmk_t, upd_d)
         values
         (:user_acct.userid_n, :user_acct.user_m, :user_acct.coy_c, :user_acct.contact_n, :user_acct.emp_n,
         :user_acct.work_loc_c, :user_acct.curr_passwd_t, :user_acct.prt_f, :user_acct.indv_pc_f, :user_acct.pc_deploy_c,                
         :user_acct.ext_email_addr_t, :user_acct.other_na_sys_t, :user_acct.status_c, :user_acct.status_rmk_t,                
         :user_acct.upd_d);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Applicant Particulars failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
    begin
    insert into user_acct_na_detl
         na_sys_c)
         values
         (:na_sys_cd.na_sys_c);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Non-Application failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
              when others then
                   null;      
    end;     
    the error:
    Error 103 at line 31, column 3
    Encountered the symbol 'WHEN' when expecting one if the following:
    begin declare end exception exit for goto if loop mod null
    pragma raise return select update while <an identifier>
    <a double-quoted delimited-identifier><a bind variable><<
    close current delete fetch lock insert open rollback
    savepoint set sql commit<a single-quoted SQL string>
    The symbol "exception"was substituted for "WHEN" to continue
    Error 103 at line 2, column 1
    Encountered the symbol "END"

    i delete the "END" already but when i compile again, i encountered some error again.
    Error 370 at line 27, column
    OTHERS handler must be last among the exception handlers of a block
    Error 0 at line 1, column 1
    Statement ignored

  • EXEC SQL Error: ORA-01401: Inserted value too large for column

    Getting this SQL Error: ORA-01401: Inserted value too large for column..on an EXEC SQL Insert statement when writing to an
    external Oracle DB from SAP.
    On further analysis..it appears that this happens to the fields..when the string length matches the field length.
    Example:  Plant field is defined as char(4) on the SAP side and it is a Varchar2(4) on the Oracle side.
    When a value like '1015' is passed thru a variable in the insert statement then this ORA-01401 error pops up.
    No error:
       - if the value '1015' is passed directly in the insert statement to the external table  (or)
       - when a value with 3 chars or less(like the first three chars..101) is passed thru a variable  defined as 'Plant(4) type c'.
       - when using EXEC sql within SAP
       - when reading from the external db table
    This was working ok until the  Oracle Patch P9147110 was installed recently.
    Any suggestions !

    Hello Dvas,
    what's the characterset of your external database?
    What's the column definition in your external database (byte or character based)?
    If you use a characeterset like UTF8 it is possible, that one character needs more than one byte and then you will run into such kind of issues if the definition is too small.
    Regards
    Stefan

  • Snapshot refresh error:  ora-01401 inserted value too large for column

    I have an error ora-01401 "Inserted value too large for column" when I try to do a refresh on a group at the materialized view site.
    My model is 1 master replicating to a readonly materialized view site. I have 2 refresh groups for separate sets of tables. 1 refresh group work fine...the other I got the above error.
    I have doubled the rbs and system tablespace without any help thinking that I must be running out of default rollback segment space.
    Anyone has this before?

    The error is related to a field, not to any tablespace. This normaly happens to me when I change the lenght or resolution of a field in the base tables. The structure changes don't "flow" to the materialized view! I must "regenerate" them. Normally droping and creating it again to make them receive the new lenght of that field.
    Sometimes, when the field changed is not part of any primary key I have changes directly the field in the materialized view as if it was a normal table.
    Hope this helps
    Luis

  • Getting error ORA-01401: inserted value too large for column

    Hello ,
    I have Configured the scenario IDOC to JDBC .In the SXMB_MONI am getting the succes message .But in the Adapter Monitor am getting the error message as
    ORA-01401: inserted value too large for column and the entries also not inserted in to the table.I hope this is because of the date format only.In Oracle table date field has defined in the format of '01-JAN-2005'.I am also passing the date field in the same format only for INVOICE_DATE and INVOICE_DUE_DATE.Please see the target structure .
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns:INVOICE_INFO_MT xmlns:ns="http://sap.com/xi/InvoiceIDoc_Test">
    - <Statement>
    - <INVOICE_INFO action="INSERT">
    - <access>
      <INVOICE_ID>0090000303</INVOICE_ID>
      <INVOICE_DATE>01-Dec-2005</INVOICE_DATE>
      <INVOICE_DUE_DATE>01-Jan-2005</INVOICE_DUE_DATE>
      <ORDER_ID>0000000000011852</ORDER_ID>
      <ORDER_LINE_NUM>000010</ORDER_LINE_NUM>
      <INVOICE_TYPE>LR</INVOICE_TYPE>
      <INVOICE_ORGINAL_AMT>10000</INVOICE_ORGINAL_AMT>
      <INVOICE_OUTSTANDING_AMT>1000</INVOICE_OUTSTANDING_AMT>
      <INTERNAL_USE_FLG>X</INTERNAL_USE_FLG>
      <BILLTO>0004000012</BILLTO>
      <SHIPTO>40000006</SHIPTO>
      <STATUS_ID>O</STATUS_ID>
      </access>
      </INVOICE_INFO>
      </Statement>
      </ns:INVOICE_INFO_MT>
    Please let me know what are all the possible solution to fix the error and to insert the entries in the table.
    Thanks in Advance!

    Hi muthu,
    // inserted value too large for column
    When your oracle insertion throws this error, it implies that some value that you are trying to insert into the table is larger than the allocated size.
    Just check the format of your table and the respective size of each field on your oracle cleint by using the command,
    DESCRIBE <tablename> .
    and then verify it with the input. I dont think the problem is with the DATE format because if it is not a valid date format, you would have got on error like
    String Literal does not match type
    Hope this helps,
    Regards,
    Bhavesh

  • Why do I get this error when opening I-Tunes 10.5.2?Internal Error: Could not insert menu bar item..  Error code = 5603

    I just upgraded to Snow Leopard and downloaded the latest version of I-tunes, 10.5.2, but everytime I open I-tunes, i get this error: Internal Error: Could not insert menu bar item.. Error code = 5603
    How do I fix this? Any help would be appreciated.
    Thanks.

    hello Mac.INXS, please [[Clear the cache - Delete temporary Internet files to fix common website issues|clear the cache]] & [[Delete cookies to remove the information websites have stored on your computer|cookies from mozilla.org]] and then try logging into AMO again.

  • Javascript preferences error when clicking insert

    hi,
    i tried looking around on the net however no solution i could see for this.
    when i click insert in DW CS3 i get an error in "yy/scripts/preferences.js" error 3
    i cannot see that file in my program files, how can i resolve this?
    many thanks

    hi,
    i gave this a go however it did not resolve the issue. still error when clicking insert. only started happening past few days. cant think of what has happened to make it do it.
    any other suggestions?
    many thanks

  • Error in BP: insert valid value for bp

    Hello experts,
    we use msa 50sp11 and it works fine, but sometimes
    we have problems with creating/changing activitis to a bp:
    error in BP: insert valid value for bp     -   error 2007 mtbfll
    This happens after the user have made some changes to the bp and
    replicated it. Then sometimes we get this error.
    On other client with the same bp, there I do not get this error althoug the changes are there too.
    When I then download an extract 'customer hierarchy' to the affected client, then
    the user can work with the bp without problems again.
    Does anybody know what there the problem could be ?
    Thanks
    Gerd

    I am so pleased to see this post on the forum.
    We have been having exactly the same issue intermittently since upgrading to SP11 but it is incredibly difficult to replicate.
    It looks like a short record is missing but when checking the entry in SMOKNA1SHT, it has a full record there.
    For us, we have generally seen it when navigating from the calendar, and then clicking the back button and for some reason, it does not seem to call the record from SMOKNA1SHT properly.
    Closing MSA and reopening fixes it.
    I believe that we raised an OSS but it is so difficult to replicate, it makes it vitually impossible to troubleshoot.
    We are actually going to be replacing SMOKNA1SHT with a view in January, so it will be interesting to see if that fixes the issue - if it is framework, then it should not.
    As well as the reported message, we had another one in the background that was half in English, half in French saying something like "Transferring the objects from cMSAActivities in section _IAC failed. Details: Not possible to carry out a cast from an object of type 'MSA.SCalendarTS' to type 'MSA.SMSAACTactoverview'"
    That may not be the exist message as my French is a little shaky
    Just so you know that we share the pain of this error
    Regards
    James

  • About the FRM-40508 ORACLE ERROR, Unable to insert'

    Dear Friends:
    I use the Toolbar button to insert one record -- do_key('CREATE_RECORD') in the Toolbar_actions procedure, and then, input the value for this record, and then, click the "Save" button -- commit_form; in the when_button_pressed trigger. There will be the problem FRM-40508 ORACLE ERROR, Unable to insert' .
    Please kindly help to fix it...........

    Hi,
    See...just for a test, please give whatever u input in the form, give the same in the sql query
    like
    insert into tablename etc in sql builder and see what happens,
    This error will come,
    if input value does not meet the datatype in the table or
    if u fail to input value for not null column or
    access rights pbm(check whether you have rights to insert in to the table)
    Regards
    Priya

  • Error occuye while inserting in MSAccess

    I'm filling a DB from a file , this file have steady formate .
    there is a 9 record in this file make error when i insert it in DB but at the same time the other record inserted normally
    the error released is
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6986)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
    at Wordfind.Insert(Wordfind.java:277)
    at Wordfind.LineProcess(Wordfind.java:235)
    at Wordfind.main(Wordfind.java:52)
    one of those records the record
    CC -!- CATALYTIC ACTIVITY: 2 R'-SH + ROOH = R'-S-S-R' + H(2)O + ROH.
    i make a sub string: 2 R'-SH + ROOH = R'-S-S-R' + H(2)O + ROH.
    this substring which i insert it in the db
    this is the code i make the substring
         if(line.startsWith("CC")&& yeastflag == true && line.indexOf("CATALYTIC ACTIVITY") != -1 )//Get the PFam
              TLine = line.substring(29).toString();      
              if(TLine.endsWith("."))
                   CatalyticActivity +=TLine;
                   CAF = CatalyticActivity;
                   CatalyticActivity = "";
                   CA = CAF;
                   return;
              else
                        CatalyticActivityFlage = true;
                        CatalyticActivity +=TLine;
                        return;
         if(CatalyticActivityFlage == true )
              TLine = line.substring(7).toString();
              CatalyticActivity+=TLine;
              if(line.endsWith("."))
                   CatalyticActivityFlage = false;
                   CA = CatalyticActivity;
                   CatalyticActivity="";
    I can send u the file ,DB & the program on ur email
    plz help me

    java.sql.SQLException: General errorThis is generally just an error in the SQL statement. So we're more insterested in the SQL statement.
    Capture the SQL statement which is being sent to the DB, print it out and show it us.
    I guess it is just caused by a String with uncaptured singlequotes in a plain Statement. If this is the case, use PreparedStatement instead.

  • When I insert a CD that I know has photos burned into it, I get an error message: you inserted a blank disc. How can I access the photos?

    when I insert a CD that I know has photos embedded in it, I get an error message: you inserted a blank disc.
    The disc shows up nowhere on mhy computer, desktop,etc.
    How can I access the disc that isn't there?
    Dan Miller

    See my FAQ*:
    http://www.macmaps.com/cdrfailure.html

Maybe you are looking for

  • Mythweb no longer works after PHP 5.3 upgrade

    After upgrading to php 5.3 and manually patching up the configurations according to the news post, I'm now seeing the following error in /var/log/httpd/error_log when starting mythweb: [Mon Sep 28 10:26:23 2009] [error] [client 127.0.0.1] PHP Fatal e

  • Tax condition(JVAT) of ship to party is not triggering in Sales order

    Hi, Tax condition(JVAT) of ship to party is not triggering in sales order... Scenario: Tax condition types: JCST- CST Payable JVAT- VAT Payable GJ Customer Tax classification for JVAT in OVK3: 1-  VAT 4% A- VAT 0% B- VAT 2% Material Tax classificatio

  • Vendor master data - massive change

    Hello all, I have to change payment method for several vendors. Do you know how to do a massive change in vendor master data? Thanks, Davide

  • Workflow Suspended error in sharepoint 2013

    Hi, I have created one list and attached one workflow to send notification mail when item is creatd. The problem is while i created the item ,notification mail triggers.But the when other user creates item,the workflow get suspended and showing the f

  • Jtree expandPath is not working

    Hi All, I am performing following opertion on jtree First i am taking path of selected jtree node. i am updating jtree then i am trying to expand jtree on the basis of selected path. but it is not getting expanded at all.pls help code ---> TreePath t