I need to divide selected row into multiple rows when i navigate ADF 11g
Hi
I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
I need to divide selected row into multiple rows when i navigate to other page . Scenario - in first page i'm displaying some records with columns like empno , empstatus , empworkdepts ,curdepts
Here empworkdepts gives the numeric number like no of departments work shifts 3 or 4 or 5. when i select any particular employee and fire next button to navigate next page.I have to divide the selected employee with same information into multiple times based on the empworkdepts value.
empno empstatus empworkdepts curdept
001 eds 2 TS
002 hr 1 FO
003 eds 4 TS
*004 eds 3 TS*
now i selected employee 004 , when i navigate to next page.
Empno EmpStatus EmpWorkDepts CurDept
004 eds 3 TS
004 eds 3 TS
004 eds 3 TS
i did with java code in bean .but not stable .
any help............
thanks advance.............
Edited by: user9010551 on May 5, 2010 10:48 PM
Edited by: user9010551 on May 10, 2010 11:31 PM
user9086775 wrote:
Hi Experts,
I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
Requirment:
This is a sample set record in a table
Product Sub Product Name Age
New Car Nissan Tom 49
New Car Nissan Jack 36
Old Car Audi Sam 24
Old Car Jaguar Pint 26
Old Car Audi Smith 41
I need to be able to fetch the above data in the below fashion
Product Sub Product Name Age
New Car
Nissan
Tom 49
Jack 36
Old Car
Audi
Sam 24
Smith 41
Jaguar Pint 26Please help with ideas as to how can i achive the above without using PLSQL.
Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
For example if you are in SQL Plus you can use the BREAK command.
Similar Messages
-
Split single row into multiple rows containing time periods
Hi,
I have a table with rows like this:
id, intime, outtime
1, 2010-01-01 00:10, 2010-01-3 20:00
I would like to split this row into multiple rows, 1 for each 24hr period in the record.
i.e. The above should translate into:
id, starttime, endtime, period
1, 2010-01-01 00:10, 2010-01-02 00:10, 1
1, 2010-01-02 00:10, 2010-01-03 00:10, 2
1, 2010-01-03 00:10, 2010-01-03 20:00, 3
The first starttime should be the intime and the last endtime should be the outtime.
Is there a way to do this without hard-coding the 24hr periods?
Thanks,
Dan Scott
http://danieljamesscott.orgThanks for all the feedback, Dan.
It appears that the respective solutions provided will give you: a) different resultsets and b) different performance.
Regarding your 'truly desired resultset' you haven't answered all questions from my previous post (there are differences in the provided examples), but anyway:
I found that using CEIL or ROUND makes quite a difference, using my 'simple 3 record testset' (30 records vs. 66 records got initially returned, that's less than half of the original). That's quite a difference. However, I must call it a day (since it's almost midnight) for now, so there's room for more optimizement and I haven't thoroughly tested.
But this might hopefully make a difference performancewise when compared to my previous 'dreaded example':
SQL> drop table t;
Table dropped.
SQL> create table t as
2 select 1 id, to_date('2010-01-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-01-03 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
3 select 2 id, to_date('2010-02-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-02-05 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
4 select 3 id, to_date('2010-03-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-03-03 00:10', 'yyyy-mm-dd hh24:mi') outtime from dual;
Table created.
SQL> select id
2 , max(intime)+level-1 starttime
3 , case
4 when level = to_char(max(t.outtime), 'dd')
5 then max(t.outtime)
6 else max(t.intime)+level
7 end outtime
8 , level period
9 from t
10 connect by level <= round(outtime-intime)
11 group by id, level
12 order by 1,2;
ID STARTTIME OUTTIME PERIOD
1 01-01-2010 00:10:00 02-01-2010 00:10:00 1
1 02-01-2010 00:10:00 03-01-2010 00:10:00 2
1 03-01-2010 00:10:00 03-01-2010 20:00:00 3
2 01-02-2010 00:10:00 02-02-2010 00:10:00 1
2 02-02-2010 00:10:00 03-02-2010 00:10:00 2
2 03-02-2010 00:10:00 04-02-2010 00:10:00 3
2 04-02-2010 00:10:00 05-02-2010 00:10:00 4
2 05-02-2010 00:10:00 05-02-2010 20:00:00 5
3 01-03-2010 00:10:00 02-03-2010 00:10:00 1
3 02-03-2010 00:10:00 03-03-2010 00:10:00 2
10 rows selected.
SQL> By the way: I'm assuming you're on 10g, is that correct?
Can you give us some information regarding the indexes present on your table? -
Urgent: How to break 1 Row into Multiple Rows
Hi Experts,
I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
Requirment:
This is a sample set record in a table
Product Sub Product Name Age
New Car Nissan Tom 49
New Car Nissan Jack 36
Old Car Audi Sam 24
Old Car Jaguar Pint 26
Old Car Audi Smith 41
I need to be able to fetch the above data in the below fashion
Product Sub Product Name Age
New Car
Nissan
Tom 49
Jack 36
Old Car
Audi
Sam 24
Smith 41
Jaguar Pint 26
Please help with ideas as to how can i achive the above without using PLSQL.
Thanks in advance!user9086775 wrote:
Hi Experts,
I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
Requirment:
This is a sample set record in a table
Product Sub Product Name Age
New Car Nissan Tom 49
New Car Nissan Jack 36
Old Car Audi Sam 24
Old Car Jaguar Pint 26
Old Car Audi Smith 41
I need to be able to fetch the above data in the below fashion
Product Sub Product Name Age
New Car
Nissan
Tom 49
Jack 36
Old Car
Audi
Sam 24
Smith 41
Jaguar Pint 26Please help with ideas as to how can i achive the above without using PLSQL.
Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
For example if you are in SQL Plus you can use the BREAK command. -
Need to Divide the string into multiple integers
i have the String like below,that passed by user though one parameter.
200 300 400 500 600(This come from one parameter as a String with space between each value).
i need to use each above value in different column calculations.
anybody help me how can i divide whole string into multiple integer values and use it in other calculations.
Thanks in advance.You will need to use substr and instr functions to get each value. The instr function returns the location of a space in your parameter value..
To get the first value, use this: <?xdofx:substr(AMOUNT,1,(Instr(AMOUNT,' ',1,1)-1))?>
To get second value: <?xdofx:substr(AMOUNT,Instr(AMOUNT,' ',1,1)+1, (Instr(AMOUNT,' ',1,2)-1)- Instr(AMOUNT,' ',1,1)+1)?>
To get third value: <?xdofx:substr(AMOUNT, Instr(AMOUNT,' ',1,2)+1, (Instr(AMOUNT,' ',1,3)- 1) -Instr(AMOUNT,' ',1,2)+1)?>
and so on..
Thanks,
Bipuser -
I have a table time_entries
create table time_entries
(employee_id integer,
start_date date,
end_date date,
CONSTRAINT pk_time_entries PRIMARY KEY (employee_id, start_date))Suppose I have one row in this table (dates in yyyy-mm-dd format):
employee_id, start_date, end_date
1, 2012-08-27, 2012-09-02
As you can see the difference between the dates is 7 days. I want to write a query so that each day has its own row, i.e. I want to write a query which translates the above 1 row into 7 rows. This is the result set I want:
employee_id, start_date, end_date
1, 2012-08-27, 2012-08-27
1, 2012-08-28, 2012-08-28
1, 2012-08-29, 2012-08-29
1, 2012-08-30, 2012-08-30
1, 2012-08-31, 2012-08-31
1, 2012-09-01, 2012-09-01
1, 2012-09-02, 2012-09-02
Is it possible to do it in one select statement?
Edited by: srhcan on Aug 17, 2012 4:26 PM
Edited by: srhcan on Aug 17, 2012 4:26 PMWITH t
AS (SELECT 1 id,
TO_DATE ('2012-08-27', 'yyyy-mm-dd') start_date,
TO_DATE ('2012-09-02', 'yyyy-mm-dd') end_date
FROM DUAL
UNION ALL
SELECT 2 id,
TO_DATE ('2012-10-27', 'yyyy-mm-dd') start_date,
TO_DATE ('2012-11-02', 'yyyy-mm-dd') end_date
FROM DUAL)
SELECT id, start_date, end_date
FROM t
MODEL
PARTITION BY (id)
DIMENSION BY (0 d)
MEASURES (start_date, end_date, end_date stop)
RULES
ITERATE (10000) UNTIL start_date[ITERATION_NUMBER] = stop[0]
(start_date [ITERATION_NUMBER] = start_date[0] + ITERATION_NUMBER,
end_date [ITERATION_NUMBER] = start_date[0] + ITERATION_NUMBER)
ID START_DATE END_DATE
1 8/27/2012 8/27/2012
1 8/28/2012 8/28/2012
1 8/29/2012 8/29/2012
1 8/30/2012 8/30/2012
1 8/31/2012 8/31/2012
1 9/1/2012 9/1/2012
1 9/2/2012 9/2/2012
2 10/27/2012 10/27/2012
2 10/28/2012 10/28/2012
2 10/29/2012 10/29/2012
2 10/30/2012 10/30/2012
2 10/31/2012 10/31/2012
2 11/1/2012 11/1/2012
2 11/2/2012 11/2/2012 -
Convert one record row into multiple rows
Hi,
I have small requirement.I have selected one data base record into an internal table.Now internal table has 1 record i.e 1 row(ex: 10 columns). Now i will convert this single row record into multiple records i.e 10 rows( 10 columns wil; be converted into 10 rows). How i will convert this. Please give me any idea on this.
Regards
GeethaHi Geetha,
Search SCN using keyword, " convert Rows into columns" or vice versa,,,
U will get more answers & solutions,
Look at Some of the Previous threads....
Re: How to create a structure of itab as rows as colums and columns rows dy
Re: Transpose rows and columns
CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE
Convert Internal table Rows into columns of another internal table
how to convert columns of an internal table to rows of another internal tab.
Convert Columns into Rows (internal tables) - Urgent Help Pleasse..
converting columns to rows
Thanks & regards,
Dileep .C -
Inserting Selected Checkboxes into multiple rows
Problem Statement
Form Contains -
Project Name (Select List - Single)
Checklist (Checkboxes - Dynamic LOV, Values from Table - Master Checklist)
Now I have to Insert into ProjectChecklistTabel.
I select Project from list, select multiple checkboxes and click submitt. Now, data should be inserted into table as -
ProjectSelected Checkbox1Value
ProjectSelected Checkbox2Value
ProjectSelected Checkbox3Value
Can anyone explain how can I do this.Sure,
Use the following code in a page process on submit:
DECLARE
l_vc_arr2 htmldb_application_global.vc_arr2;
BEGIN
l_vc_arr2 := HTMLDB_UTIL.string_to_table (:p1_checkbox);
FOR i IN 1 .. l_vc_arr2.COUNT
LOOP
INSERT INTO checkbox_table
(checkbox_value
VALUES (l_vc_arr2 (i)
END LOOP;
END;Also, see numerous examples on that issue here:
http://htmldb.oracle.com/pls/otn/f?p=31517:84
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Multiplex single row into multiple rows
Hi guys,
could you please help me with preparing a select statement.
Table sales:
product name transaction
x laptop 3
y mobile 2
z charger 4
consider we have the table structure as above.
i need a select query, that gives the result as below
product name transaction
x laptop 1
x laptop 1
x laptop 1
y mobile 1
y mobile 1
z charger 1
z charger 1
z charger 1
z charger 1
here the ransactions are divided into several records based on the transaction.
Thanks
KartheeHi Karthee,
Welcome to the forum !!!
Try this...
with xx as(
select 'x' p,'laptop' n,3 t from dual union all
select 'y' p,'mobile' n,2 t from dual union all
select 'z' p,'charger' n,4 t from dual
select t1.p ,t1.n, 1 from (
select p,n,row_number() over(partition by p,n order by p) rn from xx
connect by level<=t) t1, xx
where rn<= xx.t and xx.p = t1.p;gives
o/p =
x laptop 1
x laptop 1
x laptop 1
y mobile 1
y mobile 1
z charger 1
z charger 1
z charger 1
z charger 1Ranit B.
Edited by: ranit B on Nov 24, 2012 9:30 PM
-- added o/p -
Convert 1 row into multiple rows
Guys - I have a table with 6 columns and it looks like this:
1 2 3 4 5 6
1 XX Y A Z ABC
2 XX P AB CN CAB
Now I want my output to be:
1 2 3 4 5 6
1 XX Y AAA AAB ABC
2 XX Y AAC AAD ABC
3 XX Y AAE AAF ABC......
26 XX Y AAY AAZ ABC
27 XX P ABA ABB CAB
28 XX P ABC ABD CAB
9999 XX P CNY CNZ CAB
I am trying to do this in SQL , but without much luck. I can always do it with pl-sql but I want to keep that as my last option.
Please, let me know if I need to explain this further...
Thanks..1. Its not that I cannot do with pl/sql, but would like to try this with pure sql than pl / sql, thats what I meant
2. for length( col4 and col5 ), its actually length(col4) =3 and length(col5) = 3, sorry if you miss understood it
3. You are making up your data for all the possible combinations you might have i the future, thats why you are adding 'A' till 'Z' to each and every row...
so for example if a row has
col1 col4 col5 col6
1 ZZX ZZZ john
Now I need to make this row as:
col1 col4 col5 col6
1 ZZX ZZY john
2 ZZZ ZZZ john
So in the future if john is replaced by jack...then all I have to do it update these 2 rows col6 to 'jack' instead of 'john'.
Now the col1 which is the primary key for my new table actually goes into another table as ID field (in my fact as a dimension key)....so I dont have to update both the tables rather I can live with just updating 1 table...
Let me know if you need further explanation... -
Spliting rows into multiple rows based on time interval
Hi experts need your help for framing query for the below scenarios
Scenario 1
Query should check for priority record(25), if the start_date and end_date of that priority record is the max in that group, records will not have any split.
output will be the same.
DC Store St Date End date Priority
955 3 1/1/2010 12/31/9999 25
966 3 4/5/2011 10/10/2011 50
977 3 10/12/2011 12/12/2012 100
output
DC store St Date End date Priority Rank
955 3 1/1/2010 12/31/9999 25 1
966 3 4/5/2011 10/10/2011 50 2
977 3 10/12/2011 12/12/2012 100 3
Scenario 2
If priority record is not covering the max range, then split the records as shown below,
1. during the time period 1/1/2011 & 4/30/2011 there were no other DC for that store so rank would be 1
2. the next range would be 5/1/2011 to 6/29/2011 we have 2 records in service so the record with low priortiy would be ranked 1 and second priority would be ranked 2
3. similarly, for 6/30/2011 to 10/1/2011 we have 3 records in service and it will be ranked accordingly on the priority.
DC Store St Date End date Priority
966 3 6/30/2011 10/1/2011 25
955 3 5/1/2011 11/30/2011 50
977 3 1/1/2011 12/31/2011 100
output
DC store St Date End date Priority Rank
977 3 1/1/2011 4/30/2011 100 1
955 3 5/1/2011 6/29/2011 50 1
977 3 5/1/2011 6/29/2011 100 2
966 3 6/30/2011 10/1/2011 25 1
955 3 6/30/2011 10/1/2011 50 2
977 3 6/30/2011 10/1/2011 100 3
955 3 10/2/2011 11/30/2011 50 1
977 3 10/2/2011 11/30/2011 100 2
977 3 12/1/2011 12/31/2011 100 1
Scenario 3
This works similar to scenario 2
DC Store St Date End date Priority
966 3 2/1/2011 12/31/2011 25
955 3 1/1/2011 12/31/2012 50
977 3 5/1/2011 06/31/2011 100
output
DC store St Date End date Priority Rank
955 3 1/1/2011 1/31/2011 50 1
966 3 2/1/2011 12/31/2011 25 1
955 3 2/1/2011 12/31/2011 50 2
977 3 5/1/2011 6/30/2011 100 3
955 3 1/1/2012 12/31/2012 50 1
Note: the number of rows coming in input will be dynamic and there are possibilities for the date ranges to overlap.Hi,
Sorry, your requirement are unclear.
What role do dc, store and priority play in this problem? Prioriry obviously has something to do with how rows are split. Why is priority=25 special? Does the number 25 have some speciakl meaning, or does it just happen to be the lowest value of priority? Can 2 (or more) rows have the same priority? if so, can their dates overlap? Include examples in your sample data and results.
I think you want something like this:
WITH all_dates AS
SELECT st_date AS a_date
, priority
FROM table_x
UNION ALL
SELECT end_date + 1 AS a_date
, priority
FROM table_x
, got_break_date AS
SELECT a_date
, LEAD (a_date) OVER (ORDER BY a_date) AS next_date
, MIN (priority) AS min_priority
FROM all_dates
GROUP BY a_date
, paired_data AS
SELECT x.*
, b.*
, GREATEST ( x.st_date
, b.a_date
) AS s_date
, LEAST ( x.end_date
, b.next_date
) AS e_date
, RANK () OVER ( PARTITION BY GREATEST (x.st_date, b.a_date)
ORDER BY x.priority
) AS rnk
FROM table_x x
JOIN got_break_date b ON b.a_date >= x.st_date
AND b.a_date < x.end_date
AND b.min_priority <= x.priority
SELECT dc
, store
, s_date AS st_date
, e_date - CASE
WHEN rnk = 1
AND end_date = e_date
THEN 0
ELSE 1
END AS end_date
, priority
, rnk
FROM paired_data
ORDER BY s_date
, priority
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data, formatted, between \ tags. See the froum FAQ {message:id=9360002}
Point out where the results of the query above are wrong, and explain, using specific examples, how you get those results from the given data in those places.
Always say what version of Oracle you're using. -
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. -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
How can i select some row from multiple row in the same group of data
I want to select some row from multiple row in the same group of data.
ColumnA
Column B
1 OK
1 NG
2 NG
2 NG
3 OK
3 OK
I want the row of group of
ColumnA if ColumnB contain even 'NG'
row , select only one row which Column B = 'NG'
the result i want =
ColumnA Column B
1 NG
2 NG
3 OK
Thank youThat's some awful explanation, but I think this is what you were driving at:
DECLARE @forumTable TABLE (a INT, b CHAR(2))
INSERT INTO @forumTable (a, b)
VALUES
(1, 'OK'),(1, 'NG'),
(2, 'NG'),(2, 'NG'),
(3, 'OK'),(3, 'OK')
SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
FROM @forumTable f
LEFT OUTER JOIN @forumTable f2
ON f.a = f2.a
AND f.b <> f2.b
GROUP BY f.a -
Select or deselect multiple rows with one single selection event
Does anyone know how to create a JTable which can select or deselect multiple rows with one single selection event in JTable. Fore example, if the table has
row1
row2
row3
row4
row5
row6
What I need is when user select row1 or row2, both row1 and row2 should be set to be selected. Then if user press CTRL and click one of row3 or row4, both of them should be selected including the previouse selected row1 and row2.
For deselection, if row1 and row2 are selected, when users deselect one of row1 or row2, both of them should be deselected.
Hopefully someone can give me a hint.Here is a partial solution using a JList. Only one line gets highlighted when the user makes a selection in the list. But, two lines are returned. There is a blank line between every two lines.
private void addLineToList() {
String a = f_one.getText();
String b = f_two.getText();
if (a.length() == 0) {
Utils.showInformationMessage("Item field is empty.");
f_one.requestFocusInWindow();
return;
if (b.length() == 0) {
Utils.showInformationMessage("Match field is empty.");
f_two.requestFocusInWindow();
return;
model.addElement("item: " + a);
model.addElement("match: " + b);
model.addElement(" ");
int size = model.getSize();
pairList.setSelectedIndex(size - 3);
f_one.setText("");
f_two.setText("");
f_one.requestFocusInWindow();
private void editList() {
if (pairList.getSelectedValue().toString().equalsIgnoreCase(" ")) {
Toolkit.getDefaultToolkit().beep();
f_one.requestFocusInWindow();
return;
if (!f_one.getText().equals("")) {
int result = JOptionPane.showConfirmDialog(this,
"The Item field contains text. Replace the text?",
"Flash Card Activity", JOptionPane.YES_NO_OPTION,
OptionPane.INFORMATION_MESSAGE);
if (result == JOptionPane.NO_OPTION) return;
if (!f_two.getText().equals("")) {
int result = JOptionPane.showConfirmDialog(this,
"The Match field contains text. Replace the text?",
"Flash Card Activity", JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE);
if (result == JOptionPane.NO_OPTION) return;
String item = "";
String match = "";
int index = pairList.getSelectedIndex();
String choice = model.getElementAt(index).toString();
if (choice.startsWith("item")) {
item = choice;
match = model.getElementAt(index + 1).toString();
model.remove(index);
model.remove(index);
model.remove(index);
else {
item = model.getElementAt(index - 1).toString();
match = choice;
model.remove(index + 1);
model.remove(index);
model.remove(index - 1);
int size = model.getSize();
if (size > 2) {
pairList.setSelectedIndex(size - 2);
f_one.setText(item.substring(6));
f_two.setText(match.substring(7));
f_one.requestFocusInWindow();
} -
Easy Question: How to split concatenated string into multiple rows?
Hi folks,
this might be an easy question.
How can I split a concatenated string into multiple rows using SQL query?
INPUT:
select 'AAA,BBB,CC,DDDD' as data from dualDelimiter = ','
Expected output:
data
AAA
BBB
CCC
DDDDI'm looking for something kind of "an opposite for 'sys_connect_by_path'" function.
Thanks,
TomasHere is the SUBSTR/INSTR version of the solution:
SQL> WITH test_data AS
2 (
3 SELECT ',' || 'AAA,BBB,CC,DDDD' || ',' AS DATA FROM DUAL
4 )
5 SELECT SUBSTR
6 (
7 DATA
8 , INSTR
9 (
10 DATA
11 , ','
12 , 1
13 , LEVEL
14 ) + 1
15 , INSTR
16 (
17 DATA
18 , ','
19 , 1
20 , LEVEL + 1
21 ) -
22 INSTR
23 (
24 DATA
25 , ','
26 , 1
27 , LEVEL
28 ) - 1
29 ) AS NEW_STRING
30 FROM test_data
31 CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(DATA,'[^,]','')) - 1
32 /
NEW_STRING
AAA
BBB
CC
DDDD
Maybe you are looking for
-
I recently bought a used macbook (2008) and was told that it was set back to factory settings and came with all the orignal software, box etc. The first Installer disk of the Mac os X was already in the disc drive, but I'm not able to get past where
-
Migration problem with new macboo
Hi all, I have, what I hope is, a newbie question. I used migration assistant to transfer data from my imac 20 to the new macbook. The goal was to transfer itunes, docs, etc. What I seem to have gotten is virtually everything including duplicate prog
-
HELP! My music is not working! It freezes. What can I do?
Okay. So, I played my music but then, I couldn't stop it. So, I waited untill all the songs played and it stopped. I tried to play another song but nothing was working. It froze. It still does now. I can't go to the artists, the songs, my playlists,
-
ACCESSING INTERNET ON WINDOWS VISTA AFTER PARTITIONNG THE HARD DRIVE. HELP?
We have just bought a new Apple Imac. We partitioned the Hard drive, using Bootcamp in order, to install Windows Vista Home edition (so that we can run our Sage Accounting package), We have been able to access our broadband internet with no problems
-
Webpage not displaying content in Firefox?
Hi friends, Following is the address of the Indian Income Tax Department website: http://law.incometaxindia.gov.in/DIT/Income-tax-acts.aspx As you can see, the sections of the Tax Act are listed. The content of each section is displayed in another wi