Loop over form values & insert into db

Form
prod_id     prod_name       prod_price    prod_status
001         product 001     1.00          1            
002         product 002     2.00          1      
003         product 003     3.00          0      
004         product 004     4.00          0      
Form Dump
prod_name      product 001,product 002,product 003,product 004
FIELDNAMES     prod_id, prod_name, prod_price, prod_status
prod_price     1.00,2.00,3.00,4.00
prod_status    1,1,0,0
prod_id        001,002,003
I want to update a few fields, prod_price and prod_status. I submit these values to my update page but I'm not sure how to loop over these values and update by the prod_id. In my update page I'm using cfdump and I see the structure of the form, the fieldnames as well as the prod_id, prod_name, etc and their values.
My question is how do I loop over these form values so I'll be able to update by each prod_id? I've played around with looping over the form collection values but no luck.

When I do stuff like this, I append the "id" value to the end of each form field.  That enables me to ensure the other fields match up.
When processing the form, I generally do something like this:
<cfloop list="#form.fieldnames# index="ThisField">
<cfif left(ThisField, 9) is "prod_name">
<cfscript>
ThisID = removechars(thisfield, 9);
ThisName = form["prod_name" & ThisID];
same for other fields
Then do something with those variables.

Similar Messages

  • Insert values to one table based on a value inserted into another table

    Hi,
    I've got a form based off a report which creates a new project. I've added an additional process to this form to insert four new values into another table as soon as the new project is created and the PK for that project is generated. This was working last week (of course!) and now seems to not work at all. It's complaining that the PK I was getting from my first insert was null. Here is one the the statements in my process I'm trying to run:
    insert into week_group values(week_group_seq.nextval, (SELECT trunc(NEXT_DAY(SYSDATE, 'FRIDAY')) FROM dual), 0, '', :P45_PROJECT_SEQ, sysdate, :APP_USER);
    The complaint I get that it's getting null where :P45_PROJECT_SEQ should be.
    Thoughts?
    Thanks,
    Jon

    Hi Andy,
    Thanks for the tip. Those two values didn't match and I updated them so they do and I'm still getting a "cannot insert NULL..." error.
    When I turn on debug I see that I'm getting the PK and I see the value. Here's my debug output:
    0.24: ...Process "Get PK": PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin for c1 in (select PROJECT_SEQ.nextval next_val from dual) loop return c1.next_val; end loop; end; begin :P45_PROJECT_SEQ := get_pk; end;
    0.25: ...Session State: Saved Item "P45_PROJECT_SEQ" New Value="252"
    0.25: ...Process "Process Row of PROJECT": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:PROJECT:P45_PROJECT_SEQ:PROJECT_SEQ|IUD
    0.26: ...Session State: Save "P45_PROJECT_SEQ" - saving same value: "252"
    0.26: ...Process "reset page": CLEAR_CACHE_FOR_PAGES (AFTER_SUBMIT) 45
    0.27: Nulling cache for application "120" page: 45
    0.27: ...Process "Add Week Groups": PLSQL (AFTER_SUBMIT) insert into week_group values(week_group_seq.nextval, (SELECT trunc(NEXT_DAY(SYSDATE, 'FRIDAY')) FROM dual), 0, '', :P45_PROJECT_SEQ, sysdate, :APP_USER); insert into week_group values(week_group_seq.nextval, (SELECT trunc(NEXT_DAY(SYSDATE, 'FRIDAY') +
    0.28: Encountered unhandled exception in process type PLSQL
    0.28: Show ERROR page...
    0.28: Performing rollback...
    I notice that when it runs my process "Add Week Groups" it's not displaying all of the SQL. But the SQL is fine, it's right here:
    insert into week_group values(week_group_seq.nextval, (SELECT trunc(NEXT_DAY(SYSDATE, 'FRIDAY')) FROM dual), 0, '', :P45_PROJECT_SEQ, sysdate, :APP_USER);
    Hmmm....what about the "reset page" action in the last of the 0.26 lines?
    Thanks,
    Jon

  • Concatenating strings to form an INSERT INTO

    I am trying to build an insert statement by concatenating
    strings. Basically, this is what I'm doing:
    <cfset string1 = "INSERT INTO #tablename# (">
    <cfset string1 = string1 & #colname#>
    <cfset string1 = string1 & ") ">
    <cfset string2 = "VALUES ('">
    <cfset string2 = string1 & #coldata#>
    <cfset string2 = string1 & "') ">
    <cfquery name="insert" datasource="db">
    #string1##string2#
    </cfquery>
    So if I exchange the <cfquery> tags for
    <cfoutput> I get a valid INSERT statement:
    INSERT INTO Habitat (AREA, ARTID, BIOTOP) VALUES (43, 37,
    'text')
    But when I have the <cfquery> tag I get this error:
    Syntax error (missing operator) in query expression
    '''text'''.
    I have tried changing the ('#coldata#') to (''#coldata'') and
    also tried ("#coldata#") and (""#coldata#"") but I get errors all
    the time...
    So. How do I do this?

    quote:
    Originally posted by:
    Newsgroup User
    To build the form - even dynamically - you need to know what
    you're
    building, so you have that information at the time you're
    adding your form
    fields. You know the order the fields are displayed, the data
    types and
    business rules (you say you're validating the values), and
    the input
    controls used to capture the data.
    Ditto you *must* know the structure of the table you're
    storing the data
    in
    Hehe, looks like someone got a bit curious. ;-)
    I do know a few things. I have a base table that contains a
    column with the table-names of all tables which are part of the
    application. Whenever a new table is created, it is added to this
    list so it can be loaded with all the others.
    I have a form that loads tables with their structures from
    the database, and lets the user change both column names,
    datatypes, table names, whatever... Assuming of course that the
    existing data in the table doesn't conflict with the proposed
    change. All form elements are given names from table-names or
    column-names and datatype from the database stored alongside.
    Tricky thing was to make sure the "insert into" gets the right
    columns and values for that table since the form items are thrown
    out in any order and multiple tables are treated in the same form.
    But now I got it all figured out. :-)

  • ORA-22908: reference to NULL table value (insert into nest)

    Hi all,
    When attempting to insert a record into a nested table I get the above error (ORA-22908...). I've read what the error means, but to be honest it's a bit confusing. I'm wondering if someone could shed some light on the topic for me.
    The insert statement I'm using is:
    IF (:P50_CASEN IS NOT NULL) THEN
    INSERT INTO TABLE(SELECT LSMCS FROM SIN WHERE CASEN = :P50_CASEN)
    VALUES
    (LSMC_TY(:P50_C1,:P50_C2,:P50_C3,:P50_C4));
    END IF;
    The table def/DDL for SIN is:
    CREATE TABLE "SIN"
    (     "ID" NUMBER NOT NULL ENABLE,
         "CASEN" NUMBER,
         "EB" VARCHAR2(100),
         "EO" DATE,
         "ED" DATE,
         "NAME" VARCHAR2(100),
         "TITLE" VARCHAR2(100),
         "STATUS" VARCHAR2(20),
         "SPR" VARCHAR2(100),
         "BUNIT" VARCHAR2(100),
         "ECM" VARCHAR2(100),
         "PHONE" VARCHAR2(30),
         "REGION" VARCHAR2(30),
         "CAT" VARCHAR2(30),
         "PII" VARCHAR2(10),
         "RTN" VARCHAR2(10),
         "TCSIRC" VARCHAR2(10),
         "USCERT" VARCHAR2(10),
         "OCCS" VARCHAR2(10),
         "NOTES" VARCHAR2(4000),
         "LSMCS" "LSMCS_NT"
    NESTED TABLE "LSMCS" STORE AS "LSMCS_NT_TAB"
    RETURN AS VALUE
    CREATE OR REPLACE TRIGGER "BI_SIN"
    before insert on "SIN"
    for each row
    begin
    if :NEW."ID" is null then
    select "SIN_SEQ".nextval into :NEW."ID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_SIN" ENABLE
    ++++++++++++
    The DDL for the type is:
    CREATE OR REPLACE TYPE "LSMC_TY" AS OBJECT
    (C1 VARCHAR2(50),
    C2 VARCHAR2(50),
    C3 VARCHAR2(10),
    C4 VARCHAR2(4000));
    +++++++
    Any help would be much appreciated...

    A simplified example.
    SQL> select * from sin
      2  where id = 1
      3  /
            ID
    LSMCS(C1, C2, C3, C4)
             1
    LSMC_NT(LSMC_TY('APC', 'TOOTING', 'JUST A GUY', 'http://radiofreetooting.blogspot.com'))
    SQL> insert into  table(select s.lsmcs from sin s where s.id=1) t
      2  values ( LSMC_TY('HAROLD SAXON', 'UTOPIA', 'MASTER', 'http://www.haroldsaxon.co.uk/'))
      3  /
    1 row created.
    SQL> select * from sin
      2  where id = 1
      3  /
            ID
    LSMCS(C1, C2, C3, C4)
             1
    LSMC_NT(LSMC_TY('APC', 'LONDON', 'JUST A GUY', 'http://radiofreetooting.blogspot.com')
    , LSMC_TY('HAROLD SAXON', 'UTOPIA', 'MASTER', 'http://www.haroldsaxon.co.uk/'))
    SQL> This is basically what you have. So I think you need to simplify your implementation to get it working and then complicate it until you discover what breaks it :)
    Cheers, APC

  • Adding Form for insert into Ext Js Layout

    Hi all,
    How to adding form for insert record into EMP table
    +[http://apex.oracle.com/pls/apex/f?p=43040:7|INSERT EMP]+
    into Ext JS layout with one Array Grid report from EMP ?
    +[http://apex.oracle.com/pls/apex/f?p=43040:5|ExtJS layout EMP report]+
    (this is extend threat from
    Re: ExtJS report with JsonStore -examples? apex and extjs grid table]
    implements by munky)
    regards,
    Gordan
    Edited by: useruseruser on Aug 3, 2010 9:17 AM

    Hi Gordan
    Just for information, the link syntax doesn't work on the forum anymore, just paste the link in with no tags or brackets and it will be 'clickable'.
    Exactly what are you trying to achieve here?
    Have you had a look at these sites which may be of some use to you...
    http://oracleinsights.blogspot.com/ - Mark Lancaster
    http://application-express-blog.e-dba.com/ - e-DBA (Matt Nolan)
    http://apex-at-work.blogspot.com/ - Tobias Arnhold
    Cheers
    Ben

  • MULTIPLE VALUES INSERTION INTO MULTIPLE TEXTBOXES

    I HAVE TO INSERT DATA INTO DATABASE TABLE FROM TEXTBOXES.DTABASE STRUCTURE
    table name Insert_damo_1
    name nvarchar(50)
    lastname nvarchar(50)
    addr  nvarchar(50)
    C# CODING
            SqlConnection cnn1 = new SqlConnection("my connection string");
            cnn1.Open();
            SqlCommand cmd;
            String[] nam1 = {TextBox1.Text,TextBox2.Text,TextBox3.Text };
            foreach (String na in nam1)
                cmd = new SqlCommand("insert into Insert_damo_1(name) values(@name)",cnn1);
                cmd.Parameters.AddWithValue("@name",na);
                cmd.ExecuteNonQuery();
            String[] last1 = { TextBox4.Text, TextBox5.Text, TextBox6.Text };
            foreach (String la1 in last1)
                cmd = new SqlCommand("insert into Insert_damo_1(lastname) values(@lastname)", cnn1);
                cmd.Parameters.AddWithValue("@lastname", la1);
                cmd.ExecuteNonQuery();
            String[] ad1 = { TextBox7.Text, TextBox8.Text, TextBox9.Text };
            foreach (String a1 in ad1)
                cmd = new SqlCommand("insert into Insert_damo_1(addr) values(@addr)", cnn1);
                cmd.Parameters.AddWithValue("@addr", a1);
                cmd.ExecuteNonQuery();
            cnn1.Close();
            Response.Write("insert successful");
    I GOT THE RESULT AS
    name          lastname
     address
    a                  null                     null
    b                  null                     null
    c                  null                     null
    null             d                         null
    null             e                         null
    null             f                          null
    null            null                      g
    null            null                      h
    null            null                      i
    1. I WANT RESULT WITHOUT NULL
    2. IF USER DOES'T INSERT ANYTHING IN A TEXT BOX THEN ONLY NULL IS INSERTED AT THAT PLACE
    ANY HELP WILL BE DEEPLY APPRECIATED.
    THANK YOU. 

    Try this
    cnn1.Open();
    SqlCommand cmd;
    String[] nam1 = {TextBox1.Text,TextBox2.Text,TextBox3.Text };
    String[] last1 = { TextBox4.Text, TextBox5.Text, TextBox6.Text };
    String[] ad1 = { TextBox7.Text, TextBox8.Text, TextBox9.Text };
    cmd = new SqlCommand("insert into Insert_damo_1(name,lastname,addr) values(@name,@lastname,@addr)",cnn1);
    cmd.Parameters.Add("@name", SqlDbType.VarChar);
    cmd.Parameters.Add("@lastname", SqlDbType.VarChar);
    cmd.Parameters("@addr", SqlDbType.VarChar);
    for(int i; i < nam1.Length; i++)
    cmd.Parameters["@name"].Value = nam1[i];
    cmd.Parameters["@lastname"].Value = last1[i];
    cmd.Parameters["@addr"].Value = last1[i];
    cmd.ExecuteNonQuery();
    cnn1.Close();
    Response.Write("insert successful");
    jdweng

  • Insert into 4 tables

    Hi
    what is the best way to insert into 4 DEPENDENT tables?
    i have tables like:
    Cat_tbl (id, name)
    sub1_tbl (id, name, idcat)
    sub2_tbl (id, name, idsub1)
    sub3_tbl (id, name, address, phone1, phone2, idsub2)
    * Is it better to build a form which insert into the 4 tables one time? or build a form for each table (in such a case how to link the id's').
    the reason i ask because i built a form to insert into the 4 tables but the form repeated the data(say the cat_tbl has only 2 records (USA, UK) and the sub1_tbl has 3 records (NY,NJ, London) and the third table has 4 records (Brooklyn, Bronx, Luton, Watford) i needed to add only to the fourth tables without repeating the Data for the first 3 tables. but also be able in the future to add to the others if needed..
    lorie

    ok
    * I managed to have this page done, but i got a little problem:
    the last foreign key (in my example it is idite_det) always get the NULL Value and i could not figure out how to fix it.
    * Anyway here is the code for the whole page if someone needs to build a similar page.. (or wait untill ... someone can have time to take a look at the code and tell how to fix this little issue !!!)
    http://twayns.150m.com/index.html
    lorie

  • Link and insert into 2 tables

    Hi Everyone,
    I am building an application that that contains information about helpdesk calls. I am using 2 tables:
    Table 1 contains tracking info- TRK_CALLS
    ID -primary key
    USER_
    ASSIGNED_TO
    PROBLEM
    SOLUTION
    STATUS
    EDIT
    Table 2 contain date and time info - TRKCALLS_TIME
    ID - primary key
    CALL_ID - same number as ID in table 1
    DATE_
    TIME
    I have taken the advice that Denes Kubicek gave another poster and created a workspace at apex.oracle.com and places my app in there for others to look at
    workspace: kjwebb
    username: [email protected]
    password: gtmuc
    application: calltracking2
    I have a report called create/edit call tracking in there that I can either Edit or create an entry into TRK_CALLS. clicking create takes me to a form, after info is entered I have a create button that assigns the PK and inserts info into TRK_CALLS. I then have to click Edit Call Time button to input info on a form that inserts into TRKCALLS_TIME table. I would like to link these tables somehow so that when I go to the (Edit Call Time) form the Call ID is populated with the PK ID from the TRK_CALLS table.
    It would be easier to insert this info all in one page but I worked on that for a long time before giving up because I could not get anything to insert into the tables so I have taken this route.
    The basic desired outcome is to tie the tables with a PK, ID in table 1 and CALL_ID in table 2. So that they correspond and displayed on the report page.
    Please help in any way you can and make changes to my app.
    I would not be asking for help unless I have reached the ends of my apex knowledge.
    Thanks and please let me know if there are any questions,
    Kirk

    I can imagine it is pretty obscure when your knowledge of PL/SQL is not (yet) so big.
    The statement I wrote ar meant exactly for your situation.
    OK, here we go:
    First you have created a view in the Object Browser. Suppose it is called trkcalls_view .
    Then you go to SQL Workshop > SQL Commands.
    You cut the next statement and paste it in the upper white part of the screen, just under the autocommit checkbox. Replace the bold sequence references by the real name of the sequences that are used to populate the ID's of the two tables.
    You say Run and the trigger is created.
    A trigger on the view is created. Creation of such a trigger is not possible in the Object Browser, so I understand your confusion. This triggers performs when an insert in the view is performed. As you might see in the code, it creates seperate insert statements for both tables.
    CREATE OR REPLACE TRIGGER bi_trkcalls_view
    INSTEAD OF UPDATE ON trkcalls_view
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    v_id number;
    bv_id2 number;
    BEGIN
    select sequence1.nextval into v_id from dual;
    select sequence2.nextval into v_id2 from dual;
    INSERT INTO TRK_CALLS
    ( ID
    , USER_ASSIGNED_TO
    , PROBLEM
    , SOLUTION
    , STATUS
    , EDIT
    VALUES
    ( v_id
    , :new.user_assigned_to
    , :new.problem
    , :new.solution
    , :new.status
    , :new.edit
    insert into TRKCALLS_TIME
    ( id
    , call_id
    , date_time
    values
    ( v_id2
    , v_id
    , :new.date_time
    end;
    END ;good luck,
    DickDral

  • Insert into table.

    i want insert rows in table b having 5 columns from table a having 3 columns how to achieve that ?
    eg..
    table a
    column 1
    column 2
    column 3
    table b
    column 1
    column 2
    column 3
    column 4
    column 5...
    i used beloc script
    insert into usename.table b @dblink ( column 1,column 2,column 3) select column 1,column 2,column 3 from table a
    but i m gettin error
    ORA-01400: cannot insert NULL into
    plz suggest.
    Edited by: user511621 on Feb 4, 2010 11:23 PM

    If the following:
    insert into usename.table b @dblink ( column 1,column 2,column 3) select column 1,column 2,column 3 from table araises ORA-01400 then either column4 or column5 are NOT NULL.
    1) discover what are the not null column executing
    DESC tableBfrom sql*plus prompt.
    2) Provide values for not null columns
    For example if column4 is a number and you want to insert 0 as value
    insert into usename.table b @dblink ( column 1,column 2,column 3,column4)
    select column 1,column 2,column 3,0 from table aMax
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/31/le-direttive-di-compilazione-pragma/]

  • INSERT INTO TABLE (SELECT -----)

    I laready posted But i think people got confused this is the same query in easiest way
    Hi Please please here Insdie the curusr FOR Loop i am using INSERT INTO by SELECT (see the below code EACH INSERT WILL FETCH 800-1000 records Minimum !!!)
    In that satement here i am using the MINUS also ,,thi is taking minute to insert each record approx
    This way I need to insert 5 insert Into sattement for different tables see EXA
    Inside the FOR loop------
    INSERT INTO PICKSLIP
    ( SELECT FIELDS
    FROM table p, table d
    WHERE ---- AND ---
    AND ---
    AND -----
    IN ( SELECT Fields
    FROM p, d
    WHERE ---- AND ---
    AND ----
    MINUS
    SELECT PICKSLIP_PREFIX, PICKSLIP_NUMBER FROM C
    GROUP BY Fields);
    This WAY
    5 insert it dam slow taking 1 minutes to insert to all 5 tables ...this way i have lot of recordss....

    But i think people got confused this is the same query in easiest way I don't think this is more clear with your current thread. Your query is bad, and shouldn't work at all.
    It shouldn't work for too many reasons (at least because AND without nothing behind) and use a group by clause where is not required.
    Nicolas.

  • SharePoint List Form using InfoPath 2010 "Cannot insert the value NULL into column 'tp_DocId', table 'Content_SP_00003.dbo.AllUserData'; column does not allow nulls"

    I am experiencing issue with my SharePoint site , when I am trying to add new Item in List . Error given below :--> 02/03/2015 08:23:36.13 w3wp.exe (0x2E04) 0x07E8 SharePoint Server Logging Correlation Data 9gc5 Verbose Thread change; resetting trace
    level override to 0; resetting correlation to e2e9cddc-cf35-4bf8-b4f3-021dc91642da c66c2c17-faaf-4ff9-a414-303aa4b4726b e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015 08:23:36.13 w3wp.exe (0x2E04) 0x07E8 Document Management Server Document Management 52od
    Medium MetadataNavigationContext Page_InitComplete: No XsltListViewWebPart was found on this page[/sites/00003/Lists/PM%20Project%20Status/NewForm.aspx?RootFolder=&IsDlg=1]. Hiding key filters and downgrading tree functionality to legacy ListViewWebPart(v3)
    level for this list. e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015 08:23:36.17 w3wp.exe (0x1B94) 0x1A0C SharePoint Server Logging Correlation Data 77a3 Verbose Starting correlation. b4d14aec-5bd4-4fb1-b1e3-589ba337b111 02/03/2015 08:23:36.17 w3wp.exe (0x1B94)
    0x1A0C SharePoint Server Logging Correlation Data 77a3 Verbose Ending correlation. b4d14aec-5bd4-4fb1-b1e3-589ba337b111 02/03/2015 08:23:36.31 w3wp.exe (0x2E04) 0x07E8 SharePoint Foundation Database 880i High System.Data.SqlClient.SqlException: Cannot insert
    the value NULL into column 'tp_DocId', table 'Content_SP_00003.dbo.AllUserData'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
    stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavi... e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015
    08:23:36.31* w3wp.exe (0x2E04) 0x07E8 SharePoint Foundation Database 880i High ...or runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream,
    Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,
    RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand
    command, CommandBehavior behavior,

    Are you trying to setup P2P? Could you explain the process you followed completely? By anychance you create the backup and then created the publication?
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Problem in Insertion into table through After Report Parameter form trigger

    Hi All,
    I am getting problem in inserting some data into temp table through Report.
    My requirement is like that, I have to do a calculation based on user parameters, and then insert the data into the temp table. I wanted to do this into After Report Parameter form trigger function. I have done all the calculation and wrote all the insert statement in that function. There is no problem in compilation. then I am taking value from this temp table in my formula columns.
    When I run this report, it hangs, don't understand what is the problem.Can anybody help me out in this.
    Thanks,
    Nidhi

    The code is as follows:
    function AfterPForm return boolean is
    CURSOR CUR_RECEIPT(RECEIPT_NUM_FROM NUMBER, RECEIPT_NUM_TO NUMBER) IS
    SELECT DISTINCT receipt, item_no FROM xxeeg.xxeeg_1229_sp_putaway WHERE RECEIPT BETWEEN
    RECEIPT_NUM_FROM AND RECEIPT_NUM_TO ;
    V_CUR_RECEIPT CUR_RECEIPT%ROWTYPE;
    begin
    OPEN CUR_RECEIPT(:RECEIPT_NUM_FROM, :RECEIPT_NUM_TO);
    FETCH CUR_RECEIPT
    INTO V_CUR_RECEIPT;
    LOOP
    EXIT WHEN CUR_RECEIPT%NOTFOUND;
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST1' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 12
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 13
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 14
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST2' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 16
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 17
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 18
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 19
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 20
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 21
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    END IF;
    END IF;
    END LOOP;
    COMMIT;
    CLOSE CUR_RECEIPT;
    return(TRUE);
    end;
    .....................................................................................................................

  • ORA-01461: can bind a LONG value only for insert into a LONG colu

    Hello - I have a variable defined in a package as VARCHAR2(32720). This is not a table column. I am building a string inside the vairable, loading in invoice data in sections one at a time. It seems that once I get a larger number of invoices (say 100+) to load in, I get the "ORA-01461: can bind a LONG value only for insert into a LONG column" error. I am not trying to insert into a table column; just stringing together data in this large variable.
    Why would I be getting this error ? And is there a workaround ? The variable is read back out iin 80 byte strings which are then loaded to a table column that is varchar2(80).
    Thanks !!
    Jim Ernst
    Invacare Corporation

    Here is the definition of the field:
    l_EDI820_Data VARCHAR2(32720);
    And here is the loop used to populate the field. As i mentioned, it seems that once the process gets over 100 invoices coming in that the field hits the error; seems as if we are hitting say 4000 characters or near it at that point...
    FOR r_INVOICE_DETAIL IN cr_INVOICE_DETAILS LOOP
    l_EDI820_Data := l_EDI820_Data
    ||l_RMR_Statement
    ||r_INVOICE_DETAIL.INVOICE_NUM
    ||'*PI*'
    ||LTRIM(TO_CHAR(NVL(r_INVOICE_DETAIL.PAYMENT_AMOUNT,0))) -- Net Amount to be applied
    ||'*'
    ||LTRIM(TO_CHAR(r_INVOICE_DETAIL.INVOICE_AMOUNT,'999999.99')) -- Gross Amount
    ||l_Delimiter;
    l_TOTAL_SEGMENTS := l_TOTAL_SEGMENTS + 1;
    END LOOP; -- r_INVOICE_DETAIL
    There are some other statements that are adding additional data onto l_EDI820_Data ; this one is the loop that is basedon the invoices coming in.
    This code writes it to the table (field EDI820_DATA in the table is VARCHAR2(94)):
    l_EDI820_String_Length := LENGTH(RTRIM(l_EDI820_Data));
    l_EDI820_SUBSTR_START := 1;
    l_RECORD_SEQ_NO := 1;
    WHILE SUBSTR(l_EDI820_Data, l_EDI820_SUBSTR_START, 80) <> ' ' LOOP
    INSERT INTO XXAP_NACHA_EDI820_GTEMP_TBL
    SELECTED_CHECK_ID
    ,EDI820_SEQ
    ,EDI820_DATA
    VALUES (
    r_CHECK_IDS.SELECTED_CHECK_ID
    ,l_RECORD_SEQ_NO
    ,'705'||SUBSTR(l_EDI820_Data, l_EDI820_SUBSTR_START, 80)
    -- * Increment starting point for substring and also record sequence number
    l_EDI820_SUBSTR_START := l_EDI820_SUBSTR_START + 80;
    l_RECORD_SEQ_NO := l_RECORD_SEQ_NO + 1;
    END LOOP; -- WHILE Loop

  • Looping Over INSERT

    I've got a form. The form asks the visitor their address
    (first name, last name, street address, apartment number, city,
    state, and zip code... each a separate text field). This form is
    repeated 10 times on the page, allowing the visitor to enter
    multiple addresses. I've given each form field a unique name by
    just appending "_1" or "_2" after it. For example, my fields are
    named...
    FIRST FORM BLOCK
    first_name_1
    last_name_1
    SECOND FORM BLOCK
    first_name_2
    last_name_2
    Each form block (address) will be inserted into a table in my
    database as a new row. Is there a quick and easy way to loop over
    the insert 10 times, rather than have 10 separate INSERT statements
    in my code? A CFLOOP would work just fine if not for dynamic form
    field names, but I would have to take into account the "_X". I want
    to say I've done this before; I'm just overthinking.

    <cfloop from="1" to="10" index="i">
    <cfquery ...>
    INSERT INTO ...
    (aCol,bCol,cCol...)
    <!--- The important part, accessing the form structure
    with array
    notation --->
    #form['first_Name_' & i]#,
    #form['last_Name_' & i]#
    </cfquery>
    </cfloop>
    The array notation for a complex variables is a very powerful
    concept.
    Many advance techniques can be used with it.

  • Create ADF Form not insert all values

    Hi to all i have been trying to develop an ADF form Using Master -> Master Detail form inside a train
    on the screen i have on top customer info view object (master view)
    on down side a view object using 2 entities and composite association  (master detail view)
    On a train i have 2 create insert one for customer info vo (master view)
    other for the master detail view
    at the time to do insert not all the fields save info to the database
    I have some autosummit = true and a list of values setting default values, for some reason only field with autosumit are saving info on database and the others no
    <OracleSQLBuilderImpl> <buildInsertStatement> [3247] INSERT buf XXXEO>#i SQLStmtBufLen: 300, actual=100
    <OracleSQLBuilderImpl> <doEntityDML> [3248] INSERT INTO TABLE(XXX,XXX,XXX,XXX) VALUES (:1,:2,:3,:4)
    <ADFLogger> <begin> Entity DML
    <OracleSQLBuilderImpl> <bindInsertStatement> [3249] Insert binding param 1: TALL
    <OracleSQLBuilderImpl> <bindInsertStatement> [3250] Insert binding param 2: 3
    <OracleSQLBuilderImpl> <bindInsertStatement> [3251] Insert binding param 3: 52452345243
    <OracleSQLBuilderImpl> <bindInsertStatement> [3252] Insert binding param 4: Address
    Any help will be appreciate

    here is the script:
    CREATE OR REPLACE PROCEDURE per_create_phone IS
    l_object_version_number number :=0;
    l_phone_id number :=0;
    cursor c is (
    select
    per.PARTY_ID --party
    --,pa.ASSIGNMENt_id assi
    ,per.PERSON_ID --person
    ,tmp.TELEPHONE phone
    from
    PER_PEOPLE_F PER,
    PER_ASSIGNMENTS_F PA,
    temp_emp_phone tmp
    where
    PER.PERSON_ID = pa.PERSON_ID
    and per.BUSINESS_GROUP_ID <> 81
    and primary_flag='Y'
    and per.current_employee_flag='Y'
    and assignment_type='E'
    and pa.EFFECTIVE_END_DATE >= sysdate
    and per.EFFECTIVE_END_DATE >= sysdate
    and tmp.EMP_NO = per.EMPLOYEE_NUMBER);
    BEGIN
    for phone_rec in c
    loop
    apps.hr_phone_api.create_phone
    (p_date_from => (SYSDATE - 365),
    p_date_to => NULL,
    p_phone_type => 'W1',
    p_phone_number => phone_rec.phone,
    p_parent_id => phone_rec.person_id,
    p_parent_table => 'PER_ALL_PEOPLE_F',
    p_effective_date => (SYSDATE - 365),
    p_party_id => phone_rec.party_id,
    p_object_version_number =>l_object_version_number,
    p_phone_id =>l_phone_id
    end loop;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    RAISE;
    dbms_output.put_line('Error - '||SUBSTR(SQLERRM,1,500));
    END per_create_phone;
    what do you mean by :
    2) Provide the full output when DBMS_OUTPUT is enabled
    thanks for your help....

Maybe you are looking for

  • I interrupted am Maverick download and now I can't get it going again

    I am trying to upgrade from 10.7.3 to Mavericks. I interrupted the download and now cannot get it going again. How  do I proceed?

  • Flash 8 in flash 6 ??

    hello we have done a few animation in flash 8, and we done the export in flash 6 ( because it was asked by our client) the result is bad, because the flash animation are moved in the html page, and a logo is completely mashed do you know a few rules,

  • Adding code to aid in responding to submitted forms

    I would like to add a line of code to my existing forms (.asp) so when I reply to the message by email the "to" line of the reply message is automatically poplulated by the email address entered in the form.

  • IPhoto 08 Problems: Crashes on new iMac and library pix now out of focus

    I updated my Intel MacBook and all seems OK so far using the iLife 08 Family Pack I bought. On a new Intel iMac iPhoto 08 crashes frequently and library pix appear to have lost sharpness/focus. Obviously, the user for this iMac is not happy. 1. Is th

  • Photoshop CC images

    Hi all, After being away i have return to eagerly install Photoshop CC. However to disappointment. After installing all seemed fine. Then I opened my 1st image... ...the image looked terrible on the screen, as if it had been posterize. I tried anothe