Split Single Cell Value to Multiple Rows
Uses: Oracle 9i;
There is this restriction in our country, where an individual cheque value can not exceed Rs. 100,000,000. We organize our Payment list for a settlement date and the sample data table looks like this:
PaymentID | AccountID | PaymentMode | PaymentDate | PaymentValue
=============================================
p1,ac1,cheque,01-Dec-2009,99,000;
p2,ac2,cheque,01-Dec-2009,789,772,984;
p3,ac3,cheque,01-Dec-2009,433,941,200;
p4,ac4,cheque,02-Dec-2009,199,900;
( row values are separated by commas )
ii.e Row No. 3 has a payment value of 433,941,200, so splitting them into 100 million blocks will need to create the following separate payments:
100,000,000
100,000,000
100,000,000
100,000,000
33,941,200
and will be inserted into the same table having different paymentID's. Is there anyway of solving the via SQL?
Regards,
Edited by: _hifni on Dec 17, 2009 2:42 PM
Hi,
You can do that by joining your table to a Counter Table that counts from 1 to the greatest number of checks needed.
This should give you some ideas:
VARIABLE MaxPerCheck NUMBER
EXEC :MaxPerCheck := 1e8;
WITH cntr AS
SELECT LEVEL AS n
, (LEVEL - 1) * :MaxPerCheck AS LowAmount
FROM dual
CONNECT BY LEVEL <= CEIL ( ( SELECT MAX (PaymentValue)
FROM table_x
/ :MaxPerCheck
SELECT x.PaymentID
, x.PaymentValue
, c.n
, LEAST ( x.PaymentValue - c.LowAmount
, :MaxPerCheck
) AS CheckAmount
FROM table_x x
JOIN cntr c ON x.PaymentValue > c.LowAmount
ORDER BY x.PaymentID
, c.n
;if you'd like to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
Similar Messages
-
Cell value spanning multiple rows in JTable
Hi,
I have a JTable where I want a single column value alone to span multiple rows.
Something like
Course No. | Location | Cost
| loc1 | 1000
1 ---------------------------------------------
| loc2 | 2000
How can I create a JTable like this?
Thanks for the help.I have a link for that,
http://www2.gol.com/users/tame/
go in swing examples, JTable #4.
Hope it helps :) -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Reg : Concatenation of a column value with multiple rows... URGENT
Hello,
Could any of u help me in concatenating a column value with
multiple rows ???
For ex : I've the following data from emp table :
DEPTNO ENAME
10 KING'S
30 BLAKE
10 CLARK
10 TOM JONES
30 ALLEN
30 JAMES
20 SMITH
20 SCOTT
20 MILLER
10 MILLER
20 rajeev
I want the following output :
deptno Concat_value
10 KING'S,CLARK,TOM JONES,MILLER
20 Rajeev,MILLER,SMITH,SCOTT
30 BLAKE,ALLEN,JAMES
Thanks in Advance,
SriniHello Naveen,
Thanks for ur answer. But I need a single SQL query for getting
what I want. I know the solution in PL/SQL.
Please try it in a single SQL....
Thanks again,
Srini -
How to Split Single Outbound Idoc into Multiples
Hi guys
Hope you all are doing good.
Can you please let me know , How to Split Single Outbound IDOC into multiples.
I am looking for some sought of configuration in IDOC/from SHIPMENT Configuration level. Because this needs to be implemented for Shipment IDOCS. Please let me know if this can be done through configurations apart from implementing User exit or copying the outbound shipment function module.
Awaiting for your valuable replies.
Best Regards
ShivaHello,
1. Routes
2. Packaging used
3. Shipment Type
Regards
Waza -
Concatenate a column value across multiple rows - PDW
We are using PDW based on SQL2014. We require an efficient logic on how to concatenate a column value across multiple rows. We have the following table
T1
(CompanyID, StateCD)
Having following rows:
1 NY
1 NJ
1 CT
2 MA
2 NJ
2 VA
3 FL
3 CA
We need a code snippet which will return following result set:
1
CT,NJ,NY
2
MA,NJ,VA
3
CA,FL
We have tried built-in function STUFF with FOR XML PATH clause and it is not supported in PDW. So, we need a fast alternative.Hi Try this:
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
INSERT INTO ##CDB (ID, NAME) SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
OR
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
UNION
SELECT 5 AS ID,'LG' AS NAME
UNION
SELECT 5 AS ID,'AP' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME INTO #TEMP
INSERT INTO ##CDB (ID, NAME) SELECT ID, NAME FROM #TEMP WHERE NAME<>''
DROP TABLE #TEMP
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
Thanks Shiven:) If Answer is Helpful, Please Vote -
How to read and write data in to a specified range of cells(it include multiple row & columns) in excel
CVI Comes with a sample project that explains how to read/write to a Excel file: choose "Explore examples..." in CVI welcome page and navigate to <cviSampleDir>\activex\excel folder where you can load excel2000dem.prj.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Please - immediate help needed parsing csv values into multiple rows
Hello, we have a very immediate need to be able to parse out a field of comma separated values into individual rows. The following is an example written in SQL Server syntax which does not work in Oracle.
The tricky part is that each ROUTES can be a different length, and each CSV can have a different number of routes in it.
Here is an example of the table ("Quotes") of CSV values I want to normalize:
TPNUMBER ROUTES
1001 1, 56W, 18
1002 2, 16, 186, 28
Here is an example of what I need it to look like:
TPNUMBER ROUTES
1001 1
1001 56W
1001 18
1002 2
1002 16
1002 186
1002 28
Here is the "Tally" table for the query below:
ID
1
2
3
4
5
6
7
And finally, here is the query which parses CSV values into multiple rows but which does not work in Oralce:
SELECT TPNUMBER,
NullIf(SubString(',' + ROUTES + ',' , ID , CharIndex(',' , ',' + ROUTES + ',' , ID) - ID) , '') AS ONEROUTE
FROM Tally, Quotes
WHERE ID <= Len(',' + ROUTES + ',') AND SubString(',' + Phrase + ',' , ID - 1, 1) = ','
AND CharIndex(',' , ',' + ROUTES + ',' , ID) - ID > 0
It may be necessary to use a cursor to loop through the CSV table and process each row (a loop within another loop...) but this is beyond my comprehesion of PL/SQL.
Many thanks in advance for your advice/help.
apkNot sure what you are trying to do with the last step, but this should work for the first part. I assume you would use sqlldr but I just did inserts instead. You might need more than 5 "routes" in the csv. You could put some reasonable max on that number of columns:
SQL>create table t_csv
2 (TPNUMBER varchar2(20),
3 ROUTE_1 VARCHAR2(5),
4 ROUTE_2 VARCHAR2(5),
5 ROUTE_3 VARCHAR2(5),
6 ROUTE_4 VARCHAR2(5),
7 ROUTE_5 VARCHAR2(5),
8 ROUTE_6 VARCHAR2(5) );
Table created.
SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2) values( '1001 1', '56W', '18' );
1 row created.
SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2,ROUTE_3) values( '1002 2', '16', '186', '28');
1 row created.
SQL>create table t_quotes(
2 tpnumber NUMBER,
3 routes VARCHAR2(5));
Table created.
SQL>DECLARE
2 L_tpnumber NUMBER;
3 L_route VARCHAR2(5);
4 begin
5 for rec in (select * from t_csv) loop
6 L_tpnumber := SUBSTR(rec.tpnumber,1,INSTR(rec.tpnumber,' ')-1);
7 L_route := SUBSTR(rec.tpnumber,INSTR(rec.tpnumber,' ')+1);
8 insert into t_quotes values( L_tpnumber, l_route );
9 if rec.route_1 is not null then
10 insert into t_quotes values( L_tpnumber, rec.route_1 );
11 end if;
12 if rec.route_2 is not null then
13 insert into t_quotes values( L_tpnumber, rec.route_2 );
14 end if;
15 if rec.route_3 is not null then
16 insert into t_quotes values( L_tpnumber, rec.route_3 );
17 end if;
18 if rec.route_4 is not null then
19 insert into t_quotes values( L_tpnumber, rec.route_4 );
20 end if;
21 if rec.route_5 is not null then
22 insert into t_quotes values( L_tpnumber, rec.route_5 );
23 end if;
24 end loop;
25 end;
26 /
PL/SQL procedure successfully completed.
SQL> select tpnumber, routes from t_quotes;
TPNUMBER ROUTE
1001 1
1001 56W
1001 18
1002 2
1002 16
1002 186
1002 28
7 rows selected. -
Display values of a single field in a multiple rows in a table region
Hi Tech-Gurus,
I want to display values of a single field ( which is in a table region) in multiple rows and also need to restrict the values from decimal number. If i click save, then it will throw exception "Decimal not allowed".
xxxxxx
yyyyyy
Reg.No
1234
5678
7654
I need to display the values of REG.NO in different rows like,
1234
5678
7654
and also need to validate as well against Decimal values.
Please help me with the code how i will iterate ?Hi,
I am assuming you are talking about displaying substrings from the Reg No in different rows. For this you would need to write a query which identifies the substrings and creates a separate row for each (ensure you choose values for all other columns in the table row). Kindly let me know if the understanding is incorrect.
To validate against decimal value you can use the java code by checking the difference of the number and the number on which modulus has been applied. Hope that helps.
Regards
Sumit -
How To Load SINGLE CELL Value as Object - In 2D Object Array - InvalidCastException
Setup: ---- VB.net - Visual Studio 2010 - Excel Version 2010 - Option Strict ON
The following WORKS FINE all day long for loading MULTIPLE range values IE: ("F2:F5") or more into a 2D Object Array... No problem... as in the following..
Dim myRangeTwo As Range = ws.Range("F2:F5") ' MULTIPLE CELL RANGE
Dim arr2(,) As Object = CType(myRangeTwo.Value(XlRangeValueDataType.xlRangeValueDefault), Object(,))
The ws.range("F2:F5") values are stuffed into the myRangeTwo range variable as 2D Objects and then those are easily stuffed into the 2D object array...
But this does not work for a SINGLE cell range...
Dim myRangeTwo As Range = ws.Range("F2:F2") ' SINGLE CELL RANGE F2 ONLY
Dim arr2(,) As Object = CType(myRangeTwo.Value(XlRangeValueDataType.xlRangeValueDefault), Object(,))
This triggers an Invalid Cast Exception error on trying to load into the arr2(,).. because the ws.range("F2:F2") is stuffed into the myRangeTwo variable as a "string"
not as an object therefore is not possible to stuff it into an Object Array and so correctly causes the Invalid Cast Error...
How do you handle this seemingly ridiculously simple problem ??
thanks... CjHello,
Simply answer, you need to determine if the range is a single cell or multiple cells. So the following is geared for returning a DataTable for a start and end cell addresses that are different, granted there is no check to see if the cells are valid i.e.
end cell is before start cell i.e.
Since B1 and B10 is a valid range we are good but if we pass in F1:F1 or F10:F10 we must make a decision as per the if statement at the start of the function and if I were expecting this to happen I would have another function that returned a single value.
Option Strict On
Option Infer On
Imports Excel = Microsoft.Office.Interop.Excel
Imports Microsoft.Office
Imports System.Runtime.InteropServices
Module ExcelDemoIteratingData_2
Public Sub DemoGettingDates()
Dim dt As DataTable = OpenExcelAndIterate(
IO.Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"GetDatesFromB.xlsx"),
"Sheet1",
"B1",
"B10")
Dim SomeDate As Date = #12/1/2013#
Dim Results =
From T In dt
Where Not IsDBNull(T.Item("SomeDate")) AndAlso T.Field(Of Date)("SomeDate") = SomeDate
Select T
).ToList
If Results.Count > 0 Then
For Each row As DataRow In Results
Console.WriteLine("Row [{0}] Value [{1}]",
row.Field(Of Integer)("Identifier"),
row.Field(Of Date)("SomeDate").ToShortDateString)
Next
End If
End Sub
Public Function OpenExcelAndIterate(
ByVal FileName As String,
ByVal SheetName As String,
ByVal StartCell As String,
ByVal EndCell As String) As DataTable
If StartCell = EndCell Then
' Decide logically what to do or
' throw an exception
End If
Dim dt As New DataTable
If IO.File.Exists(FileName) Then
Dim Proceed As Boolean = False
Dim xlApp As Excel.Application = Nothing
Dim xlWorkBooks As Excel.Workbooks = Nothing
Dim xlWorkBook As Excel.Workbook = Nothing
Dim xlWorkSheet As Excel.Worksheet = Nothing
Dim xlWorkSheets As Excel.Sheets = Nothing
Dim xlCells As Excel.Range = Nothing
xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlWorkBooks = xlApp.Workbooks
xlWorkBook = xlWorkBooks.Open(FileName)
xlApp.Visible = False
xlWorkSheets = xlWorkBook.Sheets
' For/Next finds our sheet
For x As Integer = 1 To xlWorkSheets.Count
xlWorkSheet = CType(xlWorkSheets(x), Excel.Worksheet)
If xlWorkSheet.Name = SheetName Then
Proceed = True
Exit For
End If
Runtime.InteropServices.Marshal.FinalReleaseComObject(xlWorkSheet)
xlWorkSheet = Nothing
Next
If Proceed Then
dt.Columns.AddRange(
New DataColumn() _
New DataColumn With {.ColumnName = "Identifier", .DataType = GetType(Int32), .AutoIncrement = True, .AutoIncrementSeed = 1},
New DataColumn With {.ColumnName = "SomeDate", .DataType = GetType(Date)}
Dim xlUsedRange = xlWorkSheet.Range(StartCell, EndCell)
Try
Dim ExcelArray(,) As Object = CType(xlUsedRange.Value(Excel.XlRangeValueDataType.xlRangeValueDefault), Object(,))
If ExcelArray IsNot Nothing Then
' Get bounds of the array.
Dim bound0 As Integer = ExcelArray.GetUpperBound(0)
Dim bound1 As Integer = ExcelArray.GetUpperBound(1)
For j As Integer = 1 To bound0
If (ExcelArray(j, 1) IsNot Nothing) Then
dt.Rows.Add(New Object() {Nothing, ExcelArray(j, 1)})
Else
dt.Rows.Add(New Object() {Nothing, Nothing})
End If
Next
End If
Finally
ReleaseComObject(xlUsedRange)
End Try
Else
MessageBox.Show(SheetName & " not found.")
End If
xlWorkBook.Close()
xlApp.UserControl = True
xlApp.Quit()
ReleaseComObject(xlCells)
ReleaseComObject(xlWorkSheets)
ReleaseComObject(xlWorkSheet)
ReleaseComObject(xlWorkBook)
ReleaseComObject(xlWorkBooks)
ReleaseComObject(xlApp)
Else
MessageBox.Show("'" & FileName & "' not located. Try one of the write examples first.")
End If
Return dt
End Function
Private Sub ReleaseComObject(ByVal sender As Object)
Try
If sender IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(sender)
sender = Nothing
End If
Catch ex As Exception
sender = Nothing
End Try
End Sub
End Module
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Display CLOB value in multiple rows in ADF UIX
Hi,
I have an ADF UIX application that uses data that are stored in a CLOB column in an Oracle Database.
The table data is presented in a simple table in page1.uix, I use BC4J for accessing the Database and Oracle JDeveloper 9.0.5.2.
The problem is that the CLOB data appear properly (meaning the rows appear OK) only in a frame (messageTextInput element) of a predefined size and if I change the element into a styledText or a formattedText the frame will not appear, but all the CLOB characters appear in a single row.
Does anyone know how I can present the CLOB text data in a UIX page, without having a frame around the text, and at the same time keep the CLOB text in multiple rows?There's no completely trivial way. You'd have to do a bit of extra processing of your CLOB data. The most straightforward work to do is to convert "\n" into "<br>", and then pass that into a <formattedText>.
-
Populating Combo Box list value In Multiple Row
Hi,
i to have the same problem .
I have used add_list_element to populate the list value of the combo box in multiple row.
I am selecting the list value from the database where the combo box value will be different for each row. However, when i do this.
All the previous row combo box list value will follow the combo box value in the last row. How can i resolve this?
i tried with lov but hasnt had any sucesss.in case of LOV can we make the list to appear automatuically and select a value????i havent had much sucesss over it??
is thr any work around for this apart from lov?Hi,
which product or technology are you talking about ?
Frank -
Need to return a cell value in a row where a date was selected from a column
I'm looking for a formula for OS Numbers and can't seem to find it.
I use the MIN function to select the earliest date in a range of cells. The dates all flow down one column. I need to be able to have numbers return the contents of a cell in the same row that was selected as the earliest date.
For example:
ID
Exp. Date
3
4
LJ-1
May-2014
LJ-2
Jun-2014
LJ-3
Jul-2014
LJ-4
Aug-2014
LJ-5
Sep-2014
I need to search for the earliest date in the 'Exp. Date' column and once it finds it, return the value from the 'ID' column.
So, in this case, i would need a formula to find May-2014 and return LJ-1 to the cell.
Any help would be greatly appreciated.Hi 86,
Rearrange your table then add another table to find the result:
A2 in Table 1-1 will find the earliest date in Table 1 without having to sort Table 1.
A2 contains this formula
=MIN(Table 1::A)
B2 in Table 1-1 uses VLOOKUP to find which ID matches that MIN date.
The reason for rearranging your table (Table 1) is that VLOOKUP compares a search value to the values in the leftmost column of a specified collection.
(in this case, it looks in the leftmost column of the range Table1::A:B, then returns a match from column 2 of that range).
I forgot to include "Exact Match" in the VLOOKUP formula. Is that what you want, or "Close Match"?
Edit: I don't suppose that matters because MIN will always give an exact match. Duh!
Regards,
Ian. -
Passing values of multiple rows to OracleCallableStatement
Hi,
I have a table with multiselection and a submit button. I want to select multiple rows and pass the values of selected rows one by one to a OracleCallableStatement in AM.
I have below code in CO. RowSelection is a transient attribute of type string in ItemsNotReturnedVO. 'Checked Value' is Y
When I run the page, select rows, click on Update button, I get this error. "*Attribute set for RowSelection in view object ItemsNotReturnedVO1 failed*"
if ("WaiveItemBtn".equals(pageContext.getParameter(EVENT_PARAM))) {
OAViewObject itemVO = (OAViewObject)am.findViewObject("ItemsNotReturnedVO1");
OARow row = (OARow)itemVO.first();
for(int i=0;i<itemVO.getRowCount();i++)
String appStatus=itemVO.getCurrentRow().getAttribute("RowSelection").toString();
if(appStatus.equalsIgnoreCase("Y"))
String vHeaderID = pageContext.getParameter("vTraHeaderId");
pageContext.putTransactionValue("vTraHeaderId", vHeaderID);
String vTempID = pageContext.getParameter("vTraTempId");
pageContext.putTransactionValue("vTraTempId", vTempID);
Serializable[] params = { vHeaderID,vTempID };
am.invokeMethod("waiveItemRequest", params);
row = (OARow)itemVO.next();
Below code in AM
public void waiveItemRequest(String vHeaderID, String vTempID){
try{
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
OracleCallableStatement oraclecallablestatement =
(OracleCallableStatement)oadbtransactionimpl.createCallableStatement(" { call xxitemreturn_pkg.waive_item(:1,:2) } ",1);
oraclecallablestatement.setInt(1, Integer.parseInt(vHeaderID));
oraclecallablestatement.setInt(2, Integer.parseInt(vTempID));
oraclecallablestatement.execute();
catch(Exception e){
e.printStackTrace();
Using 10g database, Jdeveloper 10.1.3.3.0Hi Nadir,
The error is coming because you transient attribute is not updateable.
To make it updateable,
1) Open your VO
2) Go to Attributes
3) Select your transient attribute and make UPDATEABLE = Always.
Let me know, if this helps or you need further assistance.
Thanks
Saurabh -
Saving values of Multiple rows
hi Friends,
I am developing Timesheet Tracking System which enables an employee to enter his project details and submit the weekly timesheet to his Project Manager
I have eight columns and 3 Rows
Columns
1. Project Description
2. Mon
3. Tue
4. Wed
5. Thurs
6. Fri
7. Sat
8. Sun
Rows
Leave
Training
I have seven textboxes (time1-time7 for values entered in columns Mon-Sun) for all 3 Rows
i want to save the values entered in the textboxes in the table
The things is that i m able to save the first row only
Mon Tue Wed Thurs Fri Sat Sun
Timesheet Project 6 6 7 7 8 4 0
Leave 1
Training 2 1 1.5 1
how do i save all values all 3 rows
how do i save values of second row i.e.'Leave'
PreparedStatement pstmt=con.prepareStatement("insert into poojac_Week26 values(?,?,?,?,?,?,?,?)");
pstmt.setInt(1,time1);
pstmt.setInt(2,time2);
pstmt.setInt(3,time3);
pstmt.setInt(4,time4);
pstmt.setInt(5,time5);
pstmt.setInt(6,time6);
pstmt.setInt(7,time7);
pstmt.setInt(8,time1+time2+time3+time4+time5+time6+time7);
int cnt=pstmt.executeUpdate();
System.out.println("values inserted");
the above code is saving values of only first row
Do help me
Thanx & Regards,
Poojahi Friends,
I am developing Timesheet Tracking System which
enables an employee to enter his project details and
submit the weekly timesheet to his Project Manager
I have eight columns and 3 Rows
Columns
1. Project Description
2. Mon
3. Tue
4. Wed
5. Thurs
6. Fri
7. Sat
8. Sun
PreparedStatement pstmt=con.prepareStatement("insert
into poojac_Week26 values(?,?,?,?,?,?,?,?)");
pstmt.setInt(1,time1);The first Column is a String right? Why are you putting a time?????
pstmt.setInt(2,time2);
pstmt.setInt(3,time3);
pstmt.setInt(4,time4);
pstmt.setInt(5,time5);
pstmt.setInt(6,time6);
pstmt.setInt(7,time7);
pstmt.setInt(8,time1+time2+time3+time4+time5+time6+time
);I saw you had values like 1.5, and this is not an int......
You only made one insert why are you expecting to have two rows inserted????
You need to make two calls to execute update if you want two insertions.... and you should clear up you mind about the nature of the fields on your table....
Maybe you are looking for
-
ALE logical systems for business service or process
Hi, I am trying to send an IDOC into my R/3 system. It is the same IDOC type that I have sucessfully sent out to parties. All the config is in place for communicating with the system, because I have sent others IDOCs in the past. However, they always
-
Hello! I just tried to build i simple CAF-DC with a simple Entity-Service. I use NWDS 7.0.0 and Netweaver 2004s Sneak Preview. When trying to Deploy the corresponding DCs to the j2ee-engine, I get the following output: 06/08/21 10:24:14 - ERROR: Not
-
How to adjust line sampling frequency in photoshop CC on surface pro 3
I just got a Surface Pro 3 so that I could work on my art on the go. I am used to working on a mac with a cintiq, but fell for the hype that photoshop was optimized to work with SP3. However, when I try to use the brush tool, my lines look AWFUL! no
-
Hi, does anyone has the joboptions for pdf/x-4:2010 specs for indesign cc 2014 (win 7 64b). I noticed they are out, but on my indesign I stiil ahve the 2008 joboptions (in the default preset) thnks
-
Problem with stopCellEditing in JTable
hi there, i have a JTable whose model is of defaultTableModel. after entering the values in the table and i click the button im not able to get the values from the cells. i have to click else where to get the values of the cells. i tried using table.