Columns adjustment in one row
Hello,
I hope some1 can help me for these.
I am using apex 3.1.2 ver
My first question: how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?
e.g
aaaaaaaaaaaaaaa( ) bbbbbbbbbbbbbb ( ) ccccccccccccccccc ( ) ddddddddddd( )
second question?
how can i display second column value based on first column value before saving the page?
e.g. aaaaaaa(1) bbbbbbbb(should display text value based on first column)
for example 1 - abc
2 - def
3 - ghi and so on.
last question? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?
Many thx.
kind regards,
Irha10 wrote:
how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?In item property change "Begin on new Line " to "Yes"
Irha10 wrote:
how can i display second column value based on first column value before saving the page?01. You have to create a branch to same page
02. Submit the page using any event (such as button press or something). So when you enter details to first item and then press button then page will submit and reload the same page.
03. In the page create a before region process and check whether second item is not null and third item is null then populate third item. Then first item is not null and second item null then populate second item.
Irha10 wrote:
? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?You can use a java script and enable and dissable item based on any condition such as value of another item
Example
if ($x('P16_YYY').value !='SOME VALUE')
$x('P16_XXX').disabled = true;
}else
$x('P16_XXX').disabled = false;
}
Similar Messages
-
Hello,
Tell Me how i can show a single column data in one row.
10
20
30
To
10,20,30If you are OK with displaying comma separated list or column data you could:
SQL> select ltrim(sys_connect_by_path(ename,','),',') ename_list
2 from (
3 select ename,
4 row_number() over(order by 1) rn,
5 count(*) over() cnt
6 from emp
7 )
8 where rn = cnt
9 start with rn = 1
10 connect by rn = prior rn + 1
11 /
ENAME_LIST
SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,MILLER,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,CLARK
SQL> To display as separate columns you would need to either know number of rows:
SQL> select min(case rn when 1 then ename else null end) ename1,
2 min(case rn when 2 then ename else null end) ename2,
3 min(case rn when 3 then ename else null end) ename3,
4 min(case rn when 4 then ename else null end) ename4,
5 min(case rn when 5 then ename else null end) ename5,
6 min(case rn when 6 then ename else null end) ename6,
7 min(case rn when 7 then ename else null end) ename7,
8 min(case rn when 8 then ename else null end) ename8,
9 min(case rn when 9 then ename else null end) ename9,
10 min(case rn when 10 then ename else null end) ename10,
11 min(case rn when 11 then ename else null end) ename11,
12 min(case rn when 12 then ename else null end) ename12
13 from (
14 select ename,
15 rownum rn
16 from emp
17 )
18 /
ENAME1 ENAME2 ENAME3 ENAME4 ENAME5 ENAME6 ENAME7 ENAME8 ENAME9 ENAME10 ENAME11 ENAME12
SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES
SQL> or use dynamic SQL.
SY. -
How to display Column data in one row
Hello,
I have one Employee with 4 effective date displayed in one column. Effective date is drived by Reason of : New Hire, Rehire, Transfer etc.
I want to show the effective dates for one reason in one single row. For example a person was rehired 4 times it will show as
1006555 6/12/2006 1/2/2007 6/11/2007 5/12/2008 12/29/2008 5/17/2010
It's currntly showing as:
AUDITEFFECTIVEDATE_3
6/12/2006
1/2/2007
6/11/2007
5/12/2008
5/17/2010Well that's a little tougher... For a solution to work, you're going to need to find a way to differentiate between the the specific hiring events. Without seeing what data is available, I'd say start looking at the use of running totals... or in this case a running count.
Set it up to reset on EmployeeID and count each "event", incrimenting up with each instance.
Then your formula would look more like this...
IF {EventType} = "Rehire" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
This issue then becomes an issue of space on the report. You end up wasting 1/2 of your horizontal space trying to allot for one odd ball... You'll also get to re-work the report if the same employee goes for rounds 5, 6 or 7...
HTH,
Jason -
I wanted to display the multiple rows in one row but column should be diff
Hi
Could any body help me regarding this query how to write to get the multiple rows in one row.
eg.
i have one table tab1(eno number,ename varchar2,uid1 varchar2,uid2 varchar2,uid3 varchar4)
but when i am runing the query I am getting multiple record against one eno number because of uid1,uid2,uid3
suppose value of table is
eno ename uid1 uid2 uid3
1 a u1
1 a u2
1 a u3
when i am quering it is coming same as above but I want in one row
eno ename uid1 uid2 uid3
1 a u1 u2 u3
can any onle help me how to write the query for this requirement.
thanks
saifwhich is hard coded in my code? Here another approach, but fail for c as there is no information for the value of a column: does 1 in u1 means col 1, etc.
/* Formatted on 2012/05/29 16:29 (Formatter Plus v4.8.8) */
WITH t AS
(SELECT 1 col1, 'a' col2, 'u1' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'a' col2, 'u2' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'a' col2, 'u3' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'b' col2, 'u1' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'b' col2, 'u3' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'b' col2, 'u2' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'c' col2, 'u1' col3
FROM DUAL
UNION ALL
SELECT 1 col1, 'c' col2, 'u3' col3
FROM DUAL)
SELECT xx.col1, xx.col2, MAX (DECODE (xx.rn, 1, col3)) AS uid1, MAX (DECODE (xx.rn, 2, col3)) AS uid2,
MAX (DECODE (xx.rn, 3, col3)) AS uid3
FROM (SELECT t.col1, t.col2, t.col3, ROW_NUMBER () OVER (PARTITION BY col1, col2 ORDER BY col3) rn
FROM t) xx
GROUP BY col1, col2;output:
COL1 COL2 UID1 UID2 UID3
1 a u1 u2 u3
1 b u1 u2 u3
1 c u1 u3
Edited by: ʃʃp on May 29, 2012 2:30 AM -
Merge Two Rows of a table to One row but into two columns
Hi
I Am struck in writing a query to merge two rows into two columns of one row.
Here is the Sample data i am working with,
Col 1 Col 2 Col3 Col4 Col Col6
5000 573-3000 2 0 Phone
5000 573-3036 1 0 Fax
5000 893-5703 3 0 WOrk
3000 232-5656 1 0 Phone
3000 353-5656 2 0 FAx
Here Col,Col3,Col4 form the Key.
now wht i am trying to do is to Merge these type of rows put them into Columns P,F,W,E respectively to achive a Structure as below
Col1 P F W
5000 573-3000 573-3036 893-5703
3000 232-5656 353-5656
Can you please help me how could i do this.
I am pretty ordinary at writing SQL's.
Thanks a Lot in Advance
Message was edited by:
SreebhushanSearch the forum for PIVOT and you'll find plenty of examples.
-
Need a report column to hold data for one row only
Hey Guys,
I have a report which has a column that links to another page in my APEX application.
There is a requirement where only one of the rows in this report needs to have a link so I need the column to show the page link for one row and one row only.
The report will have about 5 rows at a time so is there a way to just make this link appear for the one row(it will be the top row) in the column attirbute in APEX? or can this be done in the SQL for the report?
Any help is much appreciated
Thanks
-MarkHi
The only way (I believe) to do this is within the SQL. Then you just wrap the column in a CASE statement and if it meets your criteria then build up the link and if not then display normally.
Something like this...
SELECT ename,
CASE WHEN empno = 7839
THEN '<a href="f?p='||:APP_ID||':4:'||:APP_SESSION||'::NO::P4_TARGET_ITEM:'||empno||'" >'||empno||'</a>'
ELSE TO_CHAR(empno)
END empno
FROM empCheers
Ben -
Showing report data columns into two rows instead of one row using SSRS 2012
Hi All,
I have a ssrs report with 13 columns and I want to show those 13 columns data into two rows instead of showing in one row. please send me step by step process.
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
1 ABC A C
xyz xyz123 york
PA 12345
homephone cellphone workphone company
1234567890 4567890123 0123456789 ABC,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
2 XYZ X Z
abc abc123 lewisburg
PA 54321
homephone cellphone workphone company
4567890123 0123456789 1234567890 xyz,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
3 BCD B D
123abc xyz123 leesburg PA
54123
homephone cellphone workphone company
4567895623 0783456789 1238967890 Hey,Inc
Thanks in advance,
RH
sqlDo a right mouse click on the left, gray row marker => "Insert Row"=> "Inside Group
- Above or Below", then you get a second detail row.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
One column one row w/ separator to be hierarchical columns
Dear Gurus,
I want to present the "+one column/one row data+"
F:\JDeveloper\Tut\TIJ4-code\generics\watercolors\Watercolors.javaas this follow:
id parent_id
Watercolors.java watercolors
watercolors generics
generics TIJ4-code
TIJ4-code Tut
Tut JDeveloper
JDeveloper F:Id better using an sql rather than pl/sql.
regards,I think you'd struggle to do this in SQL alone, unless you use some fancy MODEL clause or Michaels can come up with some nifty XML solution. I would probably go with some PL/SQL as a pipelined function...
SQL> create table treedata as
2 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Adding Window Event Listener. Working with MDI.swf' as cp from dual union all
3 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Finger Icon.swf' from dual union all
4 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Key Icon.swf' from dual union all
5 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Containing Information on Fingers.swf' from dual union all
6 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Handling Shift Press.swf' from dual union all
7 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 1).swf' from dual union all
8 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 2).swf' from dual union all
9 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyCode.swf' from dual union all
10 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 1).swf' from dual union all
11 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 2).swf' from dual union all
12 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Key Systemization .swf' from dual union all
13 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Saving Information on Keys.swf' from dual union all
14 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating the Main Window (the Class MainWindow).swf' from dual union all
15 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Class Constructor.swf' from dual union all
16 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Fill.swf' from dual union all
17 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 1).swf' from dual union all
18 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 2).swf' from dual union all
19 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 1).swf' from dual union all
20 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 2).swf' from dual union all
21 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Highlighting Icons.swf' from dual union all
22 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method run.swf' from dual union all
23 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method setVisible.swf' from dual union all
24 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Registering Keyboard in the Main Window of Application .swf' from dual union all
25 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\The Methods new_icon and new_fingericon.swf' from dual union all
26 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Adding Keyboard Listener to the Application.swf' from dual union all
27 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating Methods to Test the Efficiency of the User''s work.swf' from dual union all
28 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class ExerciseGUI.swf' from dual union all
29 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class Lessons and Working with It in the Class ExerciseGUI.swf' from dual union all
30 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Handling Pressed Keys.swf' from dual union all
31 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Improving Graphical Interface of the Class ExerciseGUI.swf' from dual union all
32 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Setting Position and the Sizes of the Main Window.swf' from dual union all
33 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Statistics.swf' from dual union all
34 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Graphical Interface of the Class ExerciseGUI.swf' from dual union all
35 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Keyboard Events.swf' from dual union all
36 select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Working with Main Window Menu. Positioning the Main Window.swf' from dual
37 /
Table created.
SQL>
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE pth IS TABLE OF VARCHAR2(32767);
2 /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION tree RETURN pth PIPELINED IS
2 l_maxlen NUMBER;
3 l_parent_path VARCHAR2(255);
4 type t_output is table of varchar2(32767) index by pls_integer;
5 l_output t_output;
6 l_cnt NUMBER := 0;
7 PROCEDURE show_children(p_path IN VARCHAR2, p_lvl IN NUMBER, p_tree IN VARCHAR2) IS
8 l_ch_path_cnt number;
9 CURSOR cur_children_elements IS -- non path children
10 select replace(cp,p_path) as ch
11 from treedata
12 where instr(replace(cp,p_path),'\') = 0
13 order by 1;
14 CURSOR cur_children_paths IS -- path children
15 select pth
16 ,row_number() over (order by pth) as rn
17 ,count(*) over () as cnt
18 from (
19 select distinct substr(replace(cp,p_path),1,instr(replace(cp,p_path),'\')) as pth
20 from treedata
21 where instr(cp,p_path) > 0
22 and instr(replace(cp,p_path),'\') > 0
23 order by 1
24 );
25 BEGIN
26 select count(*)
27 into l_ch_path_cnt
28 from treedata
29 where instr(cp,p_path) > 0
30 and instr(replace(cp,p_path),'\') > 0;
31 for c in cur_children_elements
32 loop
33 l_cnt := l_cnt + 1;
34 if l_ch_path_cnt = 0 then
35 l_output(l_cnt) := replace(replace(substr(p_tree,1,length(p_tree)-2)||' ','+',' '),'-',' ')||' '||c.ch;
36 else
37 l_output(l_cnt) := replace(replace(p_tree,'+',' '),'-',' ')||' '||c.ch;
38 end if;
39 end loop;
40 if l_ch_path_cnt = 0 then
41 l_cnt := l_cnt + 1;
42 l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2);
43 else
44 l_cnt := l_cnt + 1;
45 l_output(l_cnt) := p_tree;
46 end if;
47 for p in cur_children_paths
48 loop
49 if p.rn != p.cnt then
50 l_cnt := l_cnt + 1;
51 l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'+-'||substr(p.pth,1,length(p.pth)-1);
52 show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'| | ');
53 else
54 l_cnt := l_cnt + 1;
55 l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'\-'||substr(p.pth,1,length(p.pth)-1);
56 show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||' ');
57 end if;
58 end loop;
59 END;
60 BEGIN
61 -- first display the common parent path
62 select max(length(txt)) as max_ln
63 into l_maxlen
64 from (
65 select substr(cp,1,rn) as txt
66 from treedata, (select rownum rn from dual connect by rownum <= 255)
67 group by substr(cp,1,rn)
68 having count(*) = (select count(*) from treedata)
69 );
70 select substr(cp,1,l_maxlen)
71 into l_parent_path
72 from treedata
73 where rownum = 1;
74 PIPE ROW(l_parent_path);
75 -- now recurse the data
76 show_children(l_parent_path, 1, '| ');
77 for i IN 1..l_cnt
78 loop
79 PIPE ROW(l_output(i));
80 end loop;
81 RETURN;
82 END tree;
83 /
Function created.
SQL>
SQL> select * from table(tree);
COLUMN_VALUE
F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\
| Adding Window Event Listener. Working with MDI.swf
| Creating the Main Window (the Class MainWindow).swf
| Working with Main Window Menu. Positioning the Main Window.swf
|
+-Creating Supplementary Classes
| | Creating Finger Icon.swf
| | Creating Key Icon.swf
| | Creating the Class Containing Information on Fingers.swf
| | Creating the Class Handling Shift Press.swf
| | Creating the Class KeyCode.swf
| | Creating the Class for Key Systemization .swf
| | Creating the Class for Saving Information on Keys.swf
| |
| +-Creating the Class KBLayout
| | Creating the Class KBLayout (Part 1).swf
| | Creating the Class KBLayout (Part 2).swf
| |
| \-Creating the Class KeyIcon
| Creating the Class KeyIcon (Part 1).swf
| Creating the Class KeyIcon (Part 2).swf
|
+-KeyboardGUI
| | Class Constructor.swf
| | Creating Methods Responsible for Icon Fill.swf
| | Highlighting Icons.swf
| | Overriding the Method run.swf
| | Overriding the Method setVisible.swf
| | Registering Keyboard in the Main Window of Application .swf
| | The Methods new_icon and new_fingericon.swf
| |
| +-Creating Methods Responsible for Icon Highlight
| | Creating Methods Responsible for Icon Highlight (Part 1).swf
| | Creating Methods Responsible for Icon Highlight (Part 2).swf
| |
| \-Defining Some Static Variables
| Defining Some Static Variables (Part 1).swf
| Defining Some Static Variables (Part 2).swf
|
\-The Class ExerciseGUI
Adding Keyboard Listener to the Application.swf
Creating Methods to Test the Efficiency of the User's work.swf
Creating the class ExerciseGUI.swf
Creating the class Lessons and Working with It in the Class ExerciseGUI.swf
Handling Pressed Keys.swf
Improving Graphical Interface of the Class ExerciseGUI.swf
Setting Position and the Sizes of the Main Window.swf
Statistics.swf
Working with Graphical Interface of the Class ExerciseGUI.swf
Working with Keyboard Events.swf
51 rows selected.
SQL> -
Is it possible to Lock just one column value in a row?
Is it possible to Lock just one column value in a row
A Java Developer has just asked me if it is possible to Lock just one column value in a row in Oracle
select ename from emp where empno=7369 for update;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
will lock the entire row with empno=7369.
But is it possible to lock one column value from this row, like SAL=800 ?
Edited by: J.Kiechle on Jan 8, 2009 10:45 PMJ.Kiechle wrote:
Is it possible to Lock just one column value in a rowNo. Locking granularity is a row. -
Merging rows into one row but into SEPARATE Columns
Hello Gurus,
I have searched alot on OTN and many other places, but no where I could get the solution of how can we merge rows into one row but separate column. For example
Consider the below scenario
"DEPARTMENT", "EMP","NAME","SUBJECT"
"Electronics","1","Sam","LIC"
"Electronics","2","Pam","VLSI"
"Electronics","3","Tom","C"
"Mech","1","Abu","Thermo"
"Mech","4","Lina","Machines"Now, I need the output like
Based on Department as Group By Clause
"DEPARTMENT", "EMP1","NAME1","SUBJECT1","EMP2","NAME2","SUBJECT2","EMP3","NAME3","SUBJECT3"
"Electronics","1","Sam","LIC","2","Pam","VLSI","3","Tom","C"
"Mech","1","Abu","Thermo","4","Lina","Machines"
The row data to be loaded into separate columns. Name of the column is not an issue... can be anythingIn all the forums which I went through I could find them loading into a single column, but not into respective separate columns.
Any help would be much appreciated.
Thanks848265 wrote:
Frank,
I saw your name nearly n number of times, as I went through many forums today... And the link which you have just posted, I went through it today afternoon.
Could you please explain this bit taken from your dynamic pivot post.
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;Many Thanks.You only need that when you need column aliases based on the actual data (and you explicitly said you don't need that) or when can't put an upper bound on the number of columns to be displayed. If that doesn't apply to this problem, then don't use any kind of dynamic SQL (like the code above); it makes the job much more difficult, less efficient and less robust.
Here's what the code above is doing.
If you were hard-coding a query that showed the number of people in each job, and you knew that the possible jobs were 'ANALYST', 'CLERK' and 'MANAGER', then you might hard-code a query like this:
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager
FROM scott.emp
GROUP BY deptno
;If the jobs had different names, or if there were not 3 different jobs, then you would have to change the lines in the SELECT clause that start with ", COUNT ( CASE ...".
The code you posted is from an example of dynamic SQL, where you first run a Preliminary Query . (What you posted above is, in fact, the complete preliminary query.) The output of that preliminary query is exactly the variable part of the real query, such as:
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS managerYou then use this output as part of your main query. In other words, you can write something today that will generate exacrly as many columns as you need next year, with names from the data as it is next year. How? because you're not writing the full query today. The variable part will be written by the preliminary query when it runs next year. -
In the app "Numbers" I want to paste in many rows in to columns. And each row separated. Now it's getting all in one column when I try to paste.
Fact is that I have a 4 pages list with about 50 rows of single words and I want all that in columnsHey joshuafromisr,
If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
http://support.apple.com/kb/HT1925
or here:
Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
http://support.apple.com/kb/HT1923
Best,
David -
Display only one row for distinct columns and with multiple rows their valu
Hi,
I have a table having some similar rows for some columns and multiple different rows for some other columns
i.e
o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
9825000111 01-jan-06 'a' 980515464 01-feb-06 c
9825000111 01-jan-06 'a' 991543154 02-feb-06 d
9825000111 01-jan-06 'a' 154845545 10-mar-06 a
What i want is to display only one row for above distinct row along with multiple non distinct colums
ie
o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
9825000111 01-jan-06 'a' 980515464 01-feb-06 c
991543154 02-feb-06 d
154845545 10-mar-06 a
regards,
KumarRe: SQL Help
-
Query for one row of each distinct column value
lets say theres table employee with columns name, id, and title. How do you get one row for each distinct title. Whatever row it is doesnt matter as long as your result set covers every possible employee title. How can I do this? thanks
Hi,
I think you're asking about a Top-N Query .
Since you didn't post a version of your table, I'll use scott.emp to illustrate.
The following query shows exactly one row of output for each distinct job:
WITH got_r_num AS
SELECT empno, ename, job
, ROW_NUMBER () OVER ( PARTITION BY job
ORDER BY ename
) AS r_num
FROM scott.emp
SELECT empno, ename, job
FROM got_r_num
WHERE r_num = 1
;Output:
` EMPNO ENAME JOB
7902 FORD ANALYST
7876 ADAMS CLERK
7698 BLAKE MANAGER
7839 KING PRESIDENT
7499 ALLEN SALESMANThe rows you see are actual rows from the table, not aggregates. That is, you can be certain that there is a row in the table with empno=7902, ename='FORD' and job='ANALYST'.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
If the desired results are not unique, that is, if you'd be equally satisfied with a number of different result sets, then post a couple of examples from the same sample data. -
How to upload as one row in xmltype column using sqlloader
I have the file test.xml which has data as shown below
<?xml version="1.0" encoding="ISO-8859-1">-<ops> <op><op_type>A</op_type><ent_type>A</ent_type></op>
<op><op_type>A</op_type><ent_type>A</ent_type></op>
</ops>
I need the entire data to be loaded as one row to a xmltype column.
How can I do this using sqlloader?
I tried the following, but it works only if everything is in one line.
LOAD DATA
INFILE 'test.xml'
INTO TABLE poc
(content char(1000) ENCLOSED BY '<ops>' AND '</ops>')
Is there an EOF option?XML questions (and answers) are better suited to the XDB forum...
XML DB
But in answer to your question, I don't think sqlloader is the best tool to be using for loading XML data into your database. The XDB forum has loads of examples of how to load XML into database tables. -
Resulting grid does not contain at least one row, one column and one POV
I have upgraded to 9.3.3 recently.
We have a front end app which will run MDX queries to retrieve data.
Sometimes based on the users selections MDX query might get back nothing i.e will get #missing across all rows/columns and this works fine with the existing 9.3.1 essbase server.
If I run the same query against a 9.3.3 essbase cube I get the error "Resulting grid does not contain at least one row, one column and one POV. If you have any suppress row options selected pls clear them."
I DO NOT have Supress missing data/zero enabled. Not sure why I get this error even though I dont have that option enabled.
Essbase 9.3.3 on HP-UX ITanium 11.31
APS 9.3.3 on win 2003 R2
Smartview 9.3.3 - also tried with smartview 9.3.1.6 and see the same error.
Any suggestions to fix this issues?The front end is using a VBA command "hypexecutequery" and with 9.3.3 essbase I get a return code -9 which means Operation was cancelled as per the smartview doc.
In 9.3.1 essbase I get the return code 0 which means the query is fine even if it does not return any data.
The query I am using now will return nothing as it is a check to see if there is any data. But with 9.3.3 Essbase I get an error code -9 which looks like it does not like the syntax or something.
Any suggestions?
Maybe you are looking for
-
Item category determination error
Hi all, we are basically working on SAP R/3 4.6c and SAP CRM 4.0 environment. and we are trying to maintain the same item categories in SAP CRM 4.0 as they are in R/3. when we are maintaining item category determinations in CRM 4.0 the system is thro
-
Purchase Order not created for a Shopping Cart
We have a few Shopping Carts created in SRM which did not transmit as PO to our backend R/3 system. This happened because our R/3 system went down for a couple of hours and the Shopping Carts were created during this time. We tried to submit these Sh
-
Please for give my ignorance, I know nothing about unix. I am taking a course on Solaris fundementals in a couple of weeks and I am trying to get a jump on the class by having a working version by the time it starts. I just DL'd the CD images and bur
-
Retrive two byte string from indesign document
Hello All , I want to retrive two byte character string from indesign document. The way I use to retrive text from indesign I get it in WideString format which is 32 bit value. When I convert WideString to PMString I get string which represent charac
-
how do I create a PDF from my scanner/printer