Separate the values in the columns in lines
HelloHere is my requirement
create table test_test2 (deptno number ,enos varchar2(30))
insert into test_test2 values (10,'101,102,103')
insert into test_test2 values (20,'104,105,107')
insert into test_test2 values (30,'106')
Desired output
deptno enos
10 101
10 102
10 103
20 104
20 105
20 107
30 106
How can I achieve the above format.Thank you
Hello
Smile says:
... I tried your query, but get invalid data type error. I can't solve it. My version of oracle's 10g
My apologies. Apparently, odcinumberlist does not work as I thought, he did it in Oracle 10. I tried the query I posted earlier in Oracle 11.1, but in 10.1.0.2.0 I «...» ORA-00904. invalid identifier"error, as you do.
Even I tried the other ways in the link you provided I get the output as
10 1 10 0 10 1 10 , ---
OP in the thread else wanted each character on a separate line.
You want each substring , separated by commas, on a separate line, so the technique of iterating over the chain and get a number N will be the same as in other this thread, but, once you have found a number N, how to generate the N - th line will be different.
The changes I need to make...
I just tested this in Oracle 10.1:
WITH got_part_cnt AS
(
SELECT deptno
, enos
, 1 + LENGTH (enos)
- LENGTH (REPLACE (enos, ',')) AS part_cnt
FROM test_test2
)
, cntr AS
(
SELECT LEVEL AS n
FROM (
SELECT MAX (part_cnt) AS max_part_cnt
FROM got_part_cnt
)
CONNECT BY LEVEL <= max_part_cnt
)
SELECT p.deptno
, REGEXP_SUBSTR ( p.enos
, '[^,]+'
, 1
, c.n
) AS eno
FROM got_part_cnt p
JOIN cntr c ON c.n <= p.part_cnt
ORDER BY p.deptno
, c.n
;
This assumes that your column enos is not missing elements, such as 901, 904', ot, if so, you want to treat commas repeated like a comma. If you have data like this, and you want to be the 4th point, 904 not the 2nd, then the apprioach even basic will work, but the details are a little more complicated.
Tags: Database
Similar Questions
-
I need to convert PDF to Excel, however, the columns and tabs make many merged cells and the number of columns empty. In addition to not separate the columns properly, I see many not separate lines together in the same cell. I even think that Adobe Acrobat Pro DC has limits. There is no way to set what points in columns to force the column break? Or create several columns that are unnecessary? How column in Excel, size fixed when import us text and define where breaks have columns of text?
Google Tradutor para empresas:Google para appsTradutor sitesGlobal market Finder traducao Toolkit
Acts traducao Instantaneasobre o Google TradutorCelularComunidadePrivacidade e TermosAjudaEnviar comments
PDF does not contain columns, lines, formats, styles or other aspects of word processing or spreadsheet file formats.
This is because the PDF is decidedly not a file format of word processor or a spreadsheet or something 'like' one of these.
(see ISO 32000 for what PDF "is")
Which allows to optimize the export of the content of a page PDF is to start with that tag well formed PDF (ISO 14289-1, PDF/UA-1).
Without that export is what it is and we performs the cleanup of any necessary content using the native application for the export of files (MS Word or Excel).
Be well...
-
How to set the content of the column for lines of automatic separation
Hello guys,.
I have a problem with the column width and the content of column in a standard report. In the report are hugh entries that are not interrupted by a space character. I put my column width to a special value by usingen "style css: display block; Width: 300px; ». Now the problem is that some of the entries in the column with a longer width that the column width is set. Then they overlock the entries in the column next to them.
My question is: How to set the column lines of automatic content break after a certain number of characters?
After searching for a couple of websites and discussion thread, I found maybe a reference to the solution. I hope that it helps you to give me an answer.
A4 FORMAT LAST_NAME COLUMN
*/*
concerning
wderrWderr,
It is more a matter of HTML as a matter of APEX... You can start by looking here:
http://www.456bereastreet.com/archive/200704/how_to_prevent_html_tables_from_becoming_too_wide/Kind regards
DanBlog: http://DanielMcGhan.us/
Work: http://SkillBuilders.com/ -
Hi all
I'm Pages 5.6.2.
Do you have any idea how to do to separate a page into several columns and keeping a heading paragraph and the introduction in full page?
This question was asked in a previous version of the Page and no positive response.
Is - that this version has any improvement on this subject?
Thank you.
Lopez
This has been asked and answered repeatedly.
In 5 Pages you simply select the paragraph/s and specify the number of columns for these paragraphs in the sidebar.
Peter
-
Query that count only the column null lines
create table test
(a varchar2 (10))
b varchar2 (10),
c varchar2 (10),
d varchar2 (10),
e varchar2 (10));
SQL > DESC TEST
Name Null? Type
------------------------------- -------- ----
A VARCHAR2 (10)
B VARCHAR2 (10)
C VARCHAR2 (10)
D VARCHAR2 (10)
E VARCHAR2 (10)
SQL > SELECT * FROM TEST;
A B C D E
---------- ---------- ---------- ---------- ----------
A1 - A3 A4-
B1 - B3, B4-
C1 - C3 C4-
D1 - D4 D5
-E2 - E4 E5
I want an application that only count the rows of the column as null
A B C D E
--- ---- ----- ------ -------
1 4 2 0 3
Published by: Nilesh hole, Pune, India, on August 28, 2009 12:30select SUM(case when a is null then 1 else 0 end) ,SUM(case when b is null then 1 else 0 end) ,SUM(case when c is null then 1 else 0 end) ,SUM(case when d is null then 1 else 0 end) ,SUM(case when e is null then 1 else 0 end) from TEST /
Published by: Toon Koppelaars August 28, 2009 09:07
-
How to display the column single line with function of nested groups
SQL > select deptno, Max (sum (sal)) SalSum
2 of PEM
3 Group of deptno;
Select deptno, Max (sum (sal)) SalSum
*
ERROR on line 1:
ORA-00937: not a single group group function
Can you please help me to get the Max (sum (sal)) with Deptno...Or:
select max(deptno) KEEP (DENSE_RANK LAST ORDER BY SalSum) deptno, max(SalSum) from ( select deptno,sum(sal) SalSum from emp group by deptno );
-
Change the column in line and aggregate data
I have a table that looks like below (LHS) and need to turn in what appears on the RIGHT side:
A nice way to achieve SQL? Thanks in advance for the help!
with
data in the form of
(select State 'HE', 1 id, action "ORDERS" Union double all the)
Select 'HE', 1, 'PROVIDERS' from dual union all
Select 'HE', 2, 'ORDERS' of all the double union
Select 'HE', 3, 'PROVIDERS' from dual union all
Select 'HE', 3, 'ORDERS' of all the double union
Select 'MN', 1, 'PROVIDERS' from dual union all
Select 'MN', 1, 'ORDERS' of all the double union
Select 'MN', 2, 'ORDERS' of all the double union
Select 'RI', 1, 'ORDERS' of all the double union
Select 'RI', 1, 'PROVIDERS' from dual union all
Select 'RI', 2, 'ORDERS' of all the double union
Select 'RI', 3, 'ORDERS' of all the double union
Select 'MN', 2, 'PLACE' of union double all the
Select 'MN' 2, 'EAT' from dual union all
Select 'MN', 2, 'SLEEP' of the double
)
Select the State, '1', '2 ', ' 3 '.
of (state, id, action, row_number (select) on rn (partition by State order of identification by action))
from the data
)
Pivot (max (action) for the id in (1,2,3))
order of the State, rn
STATE 1 2 3 HE ORDERS ORDERS ORDERS HE SUPPLIERS - SUPPLIERS MN ORDERS EAT - MN SUPPLIERS ORDERS - MN - PLACE - MN - SLEEP - RI ORDERS ORDERS ORDERS RI SUPPLIERS - - Concerning
Etbin
-
Hello
I have these sample data:
ID name salary Dept Manager Commission 1 Roger 3000 Tech Bob January-1000 1 Roger 3000 Tech Bob Feb-2000 1 Roger 3000 Tech Bob Mar-3000 I need the output voltage:
ID name salary Dept Manager Commission 1 Roger 3000 Tech Bob January-1000; Feb-2000; Mar-3000 Can you please help?
Thanks in advance
SELECT id, name, salary, dept, Manager, LISTAGG (commission, ';') Within the Commission (ORDER BY id) GROUP table
GROUP BY id, name, salary, dept, Manager;
-
transpose the data in the column to the line
I want to change the columns in lines, my data is
TYPE RANK 1 A 1 AA 1 AAA 2 B 2 BB I want it in
RANK (1) RANK (2) A B AA BB AAA Please help me
Thanks for the response guys, in the meantime, I found the solution too
SELECT MAX(CASE WHEN ID=1 THEN RATING ELSE NULL END) AS RC,
MAX(CASE WHEN ID=2 THEN RATING ELSE NULL END) LAUGHED
FROM (SELECT ID, RATING, ROW_NUMBER() over (ORDER BY rowid ID PARTITION) RN)
OF RANK_TEST) X
GROUP BY RN;
Thank you very much
-
IR - CubeQuery - no limit to the maximum number of columns or lines?
In IR query processing cube, is there a limit to the maximum number of columns or lines? If so, how?
When downloading of the results, are there limits to the maximum. lol the columns or lines as well?
All documentation on its limits?
Please help someone?Columns cannot be more than 256 upto Hyperion Interactive Reporting Studio 9.2.
No, there is no limit to the maximum number of rows. It depends on the memory and available space on your machine.
Please correct me if I'm wrong.
I hope this helps.
Kind regards
Manmohan Sharma
-
Problem with long texts in the column
Hello.
I use JDeveloper 11.1.1.7.0
In a column in a table, I show the description text.
Some of them are too long, and they are truncated and shown as an ellipse.
The column and output text look like this:
<af:column sortProperty="#{bindings.MyView3.hints.Descrip.name}" sortable="false" headerText="Descripción" id="c25"> <af:outputText value="#{row.Descrip}" id="ot16"/> </af:column>
So my question is: How can I configure the column, if the text is longer than the column, change line and continue (in the same cell) as many times as necessary?
What about changing outputtext in inputtext in read-only mode?
Example: change
_______
ABC...
_______
TO
_______
ABC
DEF
IGS
JKL
_______
Thank you. Concerning
Try to set the value of the column noWrap attribute.
-
How do to convert two points separated in several lines in the report, the column values
Hi all
I want to display two separate points of values in a column, in a row of multi in report.
For example I have a Column1 in an array with the value 'A', column2 has the value "1".
I want to show in a report of three lines using these two columns as
Column1 Column2
A 1
B 1
A sHere's one way:
SQL> create table test (col1 varchar2(20), col2 number); Table created. SQL> insert all 2 into test values ('A:B:C', 1) 3 into test values ('Dg:Ezs', 2) 4 select * from dual; 2 rows created. SQL> select 2 t.col2, 3 regexp_substr(t.col1, '\w+', 1, t2.column_value) c1 4 from test t, 5 table(cast(multiset(select level 6 from dual 7 connect by level <= length(t.col1) - length(replace(t.col1, ':', '')) + 1 8 ) as sys.odcinumberlist )) t2 9 order by 2, 1; COL2 C1 ---------- -------------------- 1 A 1 B 1 C 2 Dg 2 Ezs SQL>
Published by: little-foot 31 January 2012 10:13
-
I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?
Add two new columns after than the original with space separated values column.
Select cell B1 and type (or copy and paste it here) the formula:
= IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
shortcut for this is:
B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")
or
the formula of the C1 could also be:
= IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")
Select cells B1 and C1, copy
Select cells B1 at the end of the C column, paste
-
change the color of line based on the value of column 5 Apex in the classic report
Version of the apex 5.0.0.00.31
Standard universal theme
Page theme default template
Classic report
Foldable report template
Hello
I know this question has been asked several times here, but I'm working on 5 Apex and need to know the correct way to do it in this version.
I need to change the color of the text of the entire line (no background color) based on the value in one of the columns of the classic report. I have just two conditions, if the value of column = Yes, color should be red, otherwise it must be green.
I am new to jscript and css, so appreciate if someone can tell me the solution with steps.
I have already checked this link that changes the value of the column, need to do something similar to the whole line.
https://tylermuth.WordPress.com/2007/12/01/conditional-column-formatting-in-apex/
Hi coolmaddy007-Oracle,.
Here's an example set up on the apex.oracle.com according to the specifications you gave: https://apex.oracle.com/pls/apex/f?p=35467:1
Version of the apex 5.0.0.00.31
Standard universal theme
Page theme default template
Classic report
Foldable report template
Here is how it is done:
Create a dynamic action with the following specifications:
Name: Give the appropriate name
Event: After refresh
Selection type: region
Region: select your region classic report
Condition: No strings attached
Action: Run the JavaScript Code
Fire on loading the Page: Yes
Code:
$('td[headers="JOB"]').each(function() { if ( $(this).text() === 'MANAGER' ) { $(this).closest('tr').find('td').css({"color":"red"}); } if ( $(this).text() === 'SALESMAN' ) { $(this).closest('tr').find('td').css({"color":"green"}); } if ( $(this).text() === 'CLERK' ) { $(this).closest('tr').find('td').css({"color":"blue"}); } });
NOTE: Download the selector appropriate for your knowledge $('td[headers="JOB"]') case using firebug/browser development tools.
Items concerned: leave blank.
PS: Changed the example to change the color of text instead of the background color.
I hope this helps!
Kind regards
Kiran
-
A statement UPDATE changes the line if the update changes the column even value?
HI -.
I have a main classification and the corresponding audit table. I have a trigger. I created using the suggestion:http://www.runningoracle.com/product_info.php?products_id=211
Now the problem that I am facing is that: if I run the same query (same value) update on the main table for n times (with the same data)... my audit table is updated with a new record every time. He is not able to determine that the value is the same.
My goal is to load the audit table data if the value in a cell in the main table is really have changed.
A statement UPDATE changes the line if the update changes the column even value?
Best regards
I have a main Table and the corresponding Audit Table. I have a trigger. I created using the suggestion:http://www.runningoracle.com/product_info.php?products_id=211
Why?
You try to resolve what made you what are the PROBLEM that select as the solution?
Now the problem that I am facing is that: if I run the same query (same value) update on the main table for n times (with the same data)... my audit table is updated with a new record every time.
Yes - it is EXACTLY what you say that you wanted to do and EXACTLY what the code does in this article.
He is not able to determine that the value is the same.
I think you mean that the code does NOT check if the value is the same. You can certainly change the code to do this check. But I have a question to start with your need for such a solution.
My goal is to load the audit table data if the value in a cell in the main table is really have changed.
OK - then modify the code to check EACH COLUMN and compare its NEW value to the OLD value and insert only the table of audit if SOME (or columns you care specifically) have changed.
A statement UPDATE changes the line if the update changes the column even value?
It depends on what you mean by 'change the line '. Of course to update a column with the SAME value does not change the resulting data value.
But the physical structure of the line, the location of the pieces of line and information in the header block (YVERT, etc.) will change. And, as others have said Oracle doesn't know and doesn't care, so if the new value of a column is the same as the old value will create redo, undo and the rest.
Start over and tell us what PROBLEM you're trying to solve. Then we can help you find the best way to solve it.
Maybe you are looking for
-
diffrend language keyboard.
If I visit an apple store in New York, is it then possible to buy a macbook pro with a Danish keyboard?
-
Hits search engine - shortcuts for next/previous page?
It is probably more features than of problems, but I would start thinking here. When you use a search engine (my favorite is multi-engine DogPile, URL below), usually there are a number of pages of results. At the bottom of each page, there are a lim
-
With the help of NOR-IMAQ imgSnap (ANSI C) with Windows 7 x 64
Hello I am trying to make a few acquisition base image using ANSI C to NOR-IMAQ calls (as distributed by the release of November 2009 Vision of OR). I develop on Windows 7 x 64. The Installer seems to work very well, but when I do the following call:
-
What is the elevated command prompt
I am running vista and I supported the man-ware problem but I make a point of endpoint not found on my external drives when I try to share the show upward except when I click on them, they say, folder is empty, site says here if after enforcement of
-
Help! Venue 8 does not start
I have a Tablet 8 3840 place and it seems to be in a boot loop. If you start the screen flashes for a second, then there is a line of snow at the bottom of the screen. It will go between it and the screen dark until I make a stop with button / stop