How to insert a value into a table
I have an ordering system. It displays all the orders by
customer ID. If an order is complete, a check number is entered for
the corresponding line item, otherwise it is left blank.
My code uses the following code to display the form. All are
display fields only, except for the last one, where the check
number can be entered.
<cfoutput query="qryDetail" group="partNumber">
<tr>
<td valign="top" class="TitleText"
align="center">#lineItem#</td>
<td valign="top" class="TitleText"
align="center">#OrderNumber#</td>
<td valign="top" class="TitleText"
align="center">#partNumber#</td>
<td valign="top" class="TitleText"
align="center">#dollarformat(qryDetail.unitValue)#</td>
<td valign="top" class="TitleText" align="center">
<cfinput type="text" name="checkNumber#keyID#">
<input type="hidden" name="keyID"
value="#qryDetail.keyID#">
</td>
I use something like the following to update the table with
the check numbers entered.
<cfloop index="KeyID" list="#form.KeyID#"
delimiters=",">
<cfquery name="qryUpdate" datasource="dbName">
update tblChecks
set checkNumber = '#Evaluate("form.checkNumber#KeyID#")#'
where custID = '#form.custID#'
and KeyID = '#KeyID#'
</cfquery>
</cfloop>
Now we have another table that will contain the customer
order history. If the check number was entered for a particular
line item, I need to insert that line item nubmer into this table,
along with some other columns. I tried to use the same loop, then
other loops, but cannot seem to get this to work. Seems simple
enough, but I obvisouly am missing something.
How would I insert the line item number (only if a check
number was entered for that line item) into the table ?
Here is the code with the queries commented out :
<cfloop list="#form.fieldnames#" index="field">
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
<cfset keyID = listlast(field, '_')>
<cfset lineItem = listgetat(field, 2, '_')>
<cfset checknum = form[field]>
<!---cfquery name="qryUpdate" datasource="dbName">
UPDATE tblChecks
SET checkNumber = '#checknum#'
WHERE custID = #form.custID#
AND KeyID = #keyid#
</cfquery--->
<cfoutput> loop is
field: <b>#field#</b><br>
checknum: #checknum#<br>
lineitem: #lineitem#<br>
keyID: #keyID#<br>
</cfoutput>
<cfelse>
<cfoutput>Else is
field: <b>#field#</b><br>
form[field]: #form[field]#<br>
len: #len(trim(form[field]))#<br>
</cfoutput><cfabort>
</cfif>
</cfloop>
This is the output. If I do not put in cfabort, the code just
drops thru and I never see any output display, so I use cfabort to
stop so I can see the output.
loop is field: CHECKNUMBER_11_218
CHECKNum: xxxxxxxxxxxxxxxxxxxx
lineitem: 11
keyID: 218
Else is field: CHECKNUMBER_1_24
form[field]:
I entered the x's into checknum for line item 11, so that is
correct.
I then took out the comments from the update query and tried
it again and it updated for line item 11 (you were right, I had to
take out the single quotes in the query). I then removed the
commets for the insert query and it did not insert. I tried the
whole thing again and tried to add to line item 10 and it dropped
straight to the else part, displaying :
Else is field: CHECKNUMBER_1_24
form[field]:
len: 0
So it seems the if statement if failing the second time thru
the loop :
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
This is my input statement :
<cfinput type="text"
name="checkNumber_#lineItem#_#keyID#">
I am really confused now. It seems to work the first time
thru the loop, then the second time it fails.
Similar Messages
-
How to insert Legacy data into QP_RLTD_MODIFIERS table?
How to insert Legacy data into QP_RLTD_MODIFIERS table in R12 instance.
I would use the API QP_Modifiers_PUB.Process_Modifiers for pushing legacy pricing data into R12. QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environnment, only promos have data in this table).
-
How to insert column values into database as rows
Hi,
I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
Please help me out....
Thanks in AdvanceLines Table:
line_id, orcl_bank_account_num, product_type, service_type, lease_type,
funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
pricing_start_date, pricing_end_date, install_date, contract_end_date ,
prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
In this table the columns structure is :
-- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
-- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
I have one more table:
PRDCT_INS_AMT NUMBER(14,4)
ACTIVATION_FEE_AMT NUMBER(14,4)
I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations). -
How to insert/Update date into Dictionary Table?
Dear Experts,
I have created a Dictionary Project and Deployed.I think the table had created in portal database.
now i want to insert some data into that table?
Can you plz tell me how to access the table using Abstract Portal Component using DynPage.
Waiting for ur replies...
Thanks and Regards,
Visweswar.Hi
Can u share the Logic??? -
How to insert static data into ADF Table
Hi
I have a requirement , As a part of development of my prototype. I have to populate some static data into table.How to achieve this without using any java is there any way to simply hard code the values into adf table rows.?
Thanks in advancehttp://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/devguide/table.html
http://otndnld.oracle.co.jp/document/products/as10g/101300/B25221_03/web.1013/b25386/web_MasterDetail006.htm
http://andrejusb.blogspot.com/2006/12/displaying-all-columns-in-adf-table.html -
How to insert text data into temp tables....
Dear All,
I have one notepad with three columns, first column is segment1, second column is segment2 & third column is price list....
and there is no delimiter and exact spaces..(i.e, zizak fomat)
Ex:-
xx yy 00009999
kk mmmm 00009333
Data is available like above example...So, I need to insert this data into one table.(2LAKSHS OF RECORDS AVAILABLE IN THAT NOTEPAD)
So, Any can one help me, how to insert this kind of text data into temparory table...
Regards
Krishna
Edited by: user12070109 on May 29, 2010 9:48 PM
Edited by: user12070109 on May 29, 2010 9:49 PMHello,
What manu suggested this can be done through oracle forms.
If as i read your last post you are using that in database it will not work in db. Try to use the same process in oracle forms will work by making some changes.
And if you don't want to use forms then there is one way using SQL LOADER. It required control file to execute for uploading data.
See the below link.
http://www.orafaq.com/wiki/SQL*Loader_FAQ
In this example its showing filename.csv you can use your file name like yourfilename.txt.
So your control file will look like this...
load data
infile 'file_path\file_name.txt'
into table table_name -- use actual table name where you want to upload data
fields terminated by " " -- Here using spaces as you mentioned
(column1, column2, column3) -- Here use the three column names of tableAnd after creating control file with the above code. You can call it in command prompt like this
sqlldr username/password control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
or
sqlldr username/password@dbconnection control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
Before doing this practice make sure SQLLDR.exe availabe in the machine where you have to execute. Otherwise you will have to install db client for using sqlldr.exe
-Ammad -
How to insert a value into a field of binary type?
I've been using Oracle for a while now but never dealt with BLOB
or long raw type before. Does anyone here know how to insert a
record into a field of either blob or long raw type?
Any suggestions would be very appreicated.
Thanks.pls used the loadfromfile procedure which is in the DBMS_LOB
package to insert the data from external os file into blob data
type column.
Kunjan -
How to insert date value into oracle?
hi,
iam reading date from xml using vb.net and inserting it into oracle table.
the date value in xml file is in the format of "01012003".
i want to insert into oracle table.but iam getting an error "ORA-1843: not a valid month".
how to solve this problem.
Any suggestions or examples...That's not a date. It's just a string. Convert it to a date using,
DateTime d = DateTime.ParseExact("01022003", "MMddyyyy", null);
or
Dim d As DateTime = DateTime.ParseExact("01022003", "MMddyyyy", Nothing)
and then bind it to a parameter. ODP.NET will take it from there.
You should never be hard-coding the date literal into your SQL query.
David -
How to insert multiple records into a table?
hi all
i have a table that name is : TiketsItem
now i want to 100 records insert my table
for example : TicketsHeaderRef=52000
Active=False
TicketsItemId=45000 to 45100
how to insert TicketsItemId 45000 to 45100 in my table
thanks all
Name of Allah, Most Gracious, Most Merciful and He created the humanSo, you just want to insert the serialized data into the table, without useDate or WKRef? I'm assuming these values will be updated later?
Try something like this:
DECLARE @TicketsHeader TABLE (TicketsItemID BIGINT, ticketsHeaderRef BIGINT, active BIT, useDate DATETIME, WKRef SMALLINT)
DECLARE @startInt BIGINT = 45000
WHILE @startInt <= 45100
BEGIN
INSERT INTO @TicketsHeader (TicketsItemID, ticketsHeaderRef, active)
VALUES (52000, @startInt, 0)
SET @startInt = @startInt + 1
END
SELECT *
FROM @TicketsHeader
thanks
i edited your codes:
DECLARE @TicketsItem TABLE (TicketsItemID BIGINT, ticketsHeaderRef BIGINT, active BIT, useDate DATETIME, WKRef SMALLINT)
DECLARE @startInt BIGINT = 45000
WHILE @startInt <= 45100
BEGIN
INSERT INTO @TicketsItem (TicketsItemID, ticketsHeaderRef, active)
VALUES (@startInt,52000 , 0)
SET @startInt = @startInt + 1
END
when i execute:
SELECT * FROM TiketsItem
i do not see any records inserted in TiketsItem
how to solve it?
Name of Allah, Most Gracious, Most Merciful and He created the human -
How to insert new record into oracle table from GridView in VS2005.
I need to insert records into Oracle10g table from VS2005 GridView using the Insert Method in Business Logic Class. The Update and Delete Methods are working fine. What's the best way out?
How is it "not possible"?
Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
Where's the problem? -
How to insert & # special characters into oracle table?
I have a text value which contains special characters such as & and #.
After I pass from one page to another,
TEST& becomes "TEST&"
I put " " on the above test, otherwise amp; will be truncated by OTN).
TEST# becomes TEST (# is truncated).
Actually the value is saved in table like this: "TEST&"
How to solve this problem?
How to insert & into table without &
Thank you.
Edited by: user628655 on Jul 27, 2009 9:47 AM
Edited by: user628655 on Jul 27, 2009 9:49 AM
Edited by: user628655 on Jul 27, 2009 10:39 AMAvoid doing that through a link. If this is a page item then submit the page and redirect to the target page using a branching. On the target page, create a computation to compute the target item using the original page item as the source. If you are talking about a report, use the id to pass through the link and fetch the text column in an on load computation.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------------------ -
How to insert parameter value into multiple columns and rows
Hi All,
I have one procedure insert_tab and I am passing
100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
Table:
Col1 Col2 Col3
100 101 102
103 104 105
106 107 108
Awaiting for your reply..That's not more clear for me...
Anyway, if you really want a procedure for that, try :
SQL> create table tblstr (col1 number,col2 number,col3 number);
Table created.
SQL>
SQL> create or replace procedure insert_fct (p_string IN varchar2)
2 as
3 v_string varchar2(4000):=p_string||':';
4 v_substring varchar2(4000);
5
6 begin
7 while instr(v_string,':') > 0 loop
8 v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
9 insert into tblstr(col1,col2,col3)
10 values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
11 substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
12 substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
13 v_string:=substr(v_string,instr(v_string,':')+1);
14 end loop;
15 end;
16 /
Procedure created.
SQL>
SQL> show err
No errors.
SQL>
SQL> select * from tblstr;
no rows selected
SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
SQL> exec insert_fct('109~~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~110~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~~111')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
109
110
111
6 rows selected.
SQL> Nicolas. -
How to insert a UUID into multiple tables in the same form
I am trying to insert a UUID into 2 different tables at the
same time ie to let this be created in the form and then insert
this ID into 2 linked tables in a database using Access.
Does anybody have any suggestions on how to accomplish this?
Thanks very muchSo you have one form that processes information for two
tables, or do you
have two forms (one for each table - except the UUID)?
If it is one form just run two SQL insert statements. One for
the primary
table, then one for the related table.
If it is two forms run the above two SQL statements then an
update statement
to finish filling the second table.
Or am I completely misunderstanding the issue?
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technology, Inc.
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
"weelco" <[email protected]> wrote in
message
news:esjtjj$qtc$[email protected]..
> Thanks for your quick reply, and yes I do know how to do
that however I
> would
> like to do this all in one form field so I would like to
create the UUID
> whith
> the same form that also submits it to another table, is
this possible or
> do I
> have to do that using multiple 'pages'?
> -
How to insert a value in a table using another table
My table is like this
col1 col2 col3
india
Pakistan
my doubt is if i insert India in a table it will automatically insert India Id or code into another table
output i want is like this
col1 col2
10
20
please give the exact query.u will have to use triggers to achieve the functionality..
-
How to insert a picture into a table extracting from another table in a for
i have a form in which i have a image item though which i am saving a picture of datatype of long row or blob.This is working properly.
But when i am saving this picture from screen into another table having same field name and same datatype,
its not working.
Can anybody find out it's solution
om prakash sahoo
ocac,bbsrfind it under the java tutorial... should download n run it locally. its a good tutorial with all the stuff u need to know...
Maybe you are looking for
-
How can I stop Firefox from going to an https url automatically even when I type in http?
The browser is loading https websites even when I type in http. Asking for security certificates, etc. My home page is listed as http:// ....but when Firefox opens it, it is https:// I have changed the autobar fill in abbout:config, but it has had no
-
How to handle the deleted PO in BW?
Hello All, We are facing the following critical problem and need your support if any one of you is experienced before. 1. BW system still gets through the data even the PO document is already deleted in R/3 side! 2. The used data flow is as follows:
-
HP mini 1151nr reboot and select proper device message
I am wanting to reformat my HP mini laptop with windows 7 but this select proper device message is not allowing me to. I have the operating system disk but my laptop is not recognizing the hard drive. I go to diagnostics in the bios setup and it indi
-
I imported a bunch of songs a couple of days ago and now when I put in a CD to import additional songs the window doesn't pop up with the list of songs to import. I cannot figure out what's going on and it's driving me crazy!!!
-
To find the abap print program
hi, I have an sap script form, and i need to find the the abap print program for that? How can i do that? Thanks Vinu