Multiple rows
Hi,
Table stores have multiple prices,I iwant to display store name once with multiple price,also it display rows from another tables.
select display store name for all rows.
Select st.str_name,st.price,lc.location_cd,p.pro_name from stores st,location lc,products p
Where st.str_id=lc.str_id
And st.prd_id = p.id
thanks.
DUPLICATE THREAD
multiple rows
Similar Messages
-
Query for Multiple Rows as XML
Ok I've seen this topic in the forums, but have failed to get this to work within my process. Basically I have a process that has a user fill out a form, and upon submittal the form writes it's information to a database (via a data connection within the form that invokes a separate process upon submittal.), once this is done the main process is invoked and it's first step is to query that same database and bring back the data in a lower (now exposed) portion of the form that contains certain fields that track the issue history. The query brings back the xml document and I store it in an xml variable (xml_output). I then take this information and use the Set Value object to assign the returned nodes values to the location fields in the form. This works if the query returns only one row. But once the form is moved beyond the initial Task Assignment, (first user), and query returns more than just one row, the added nodes to not show up on the form, i.e I still just get information about the first row in my form. From what I've read the form should be able to recognize the xpath expression, and bring back all the nodes, by in a sense using instance manager to create an instance for each node on the form. My question is how can I get this to work. Jasmin if your still out there... Help!
Also We're using Adobe LiveCycle ES 8.0
created the process using Workbench
the form was reader enabled and saved as a dynamic PDF.
Thanks
MikeOk have done the binding of the schema to the form, and I'm getting the information to flow as it's supposed to. The problem I'm having now, (I know I'm having a bunch.) is that once I've placed the form into my process, and I use the set value operation to pre-fill information I get the form to flow, but the rest of the information that was previously filled in is blank. So I have checked the variable and nothing wrong there. It appears the problem is how I'm using the set value operation. If I don't use the set value operation, the form retains it's information. And if I use the set value by trying to set the subform value, the form retains it's information, but no pre-fill. I'm going to try to be a little more detailed here. The xml that is returned looks like this:
0016-03-30
Mike
Public Works
alone in the dark
Type sleep
-1
Council
FYI
Important
Flowed and positioned are actual subforms on the form that have their properties set as their names indicates. The entire path is /form1/Page1/flowed/positioned . The way I was able to get the form to flow correctly upon the injection of this xml data, was to bind the subforms in the form in this manner, positioned[*]. Designer didn't place the [*] for me so I had to do this myself. But once I previewed the document, the form pre-populated and created the necessary number of subforms and placed information into the fields correctly.
Now on the process side, I have created an xfaform variable that stores the form (bound to xsd.) information, and another xml variable that stores the query return that looks like the xml listed above (has an xsd associated with it for navigating xpath). My first operation performs the query (JDBC- Query Multiple Rows as XML) and stores it into the xml variable. The next step of the process is the Set Value operation which is supposed to inject the xml data retrieved from the query into the form. Initially I tried the an xpath similar to the following:
/process_data/object/data/form1/page1/flowed/positioned = /xml_data/flowed/positioned.
No dice. On this one the form retains the information filled out by the user (didn't explain this earlier, the form is filled out first, and upon submittal the process starts.), but doesn't pre-populate the bottom part of the form. Next I tried the following xpath:
/process_data/object/data/form1/page1/flowed = /xml_data/flowed/positioned.
This time it retained the form information which was filed in by the user, but the bottom part is becomes hidden! Didn't understand this. But I started to kinda think that I had to navigate he xpath in order to correctly inject the xml into the form. That being said my next attempt was:
/process_data/object/data/form1/page1 = /xml_data
My thinking was that if on location, I stop at page1, the xml in the variable will allow it to navigate correctly through the form. Well it worked, but too well. The top part of the form is blank, but the bottom portion is pre-populated correctly. Now I'm stuck. Not sure how to get the rest of the information in the form. I thought about creating variables form each of the fields and then re-populating them after the injection of xml, but that didn't seem practical. I'm almost positive it's something I'm not doing correctly with xpath. Anyway, thanks for all your help on this.
Mike -
Multiple Rows Update / Refresh Toplink Query when database trigger involved
Hi everybody!
I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
1. Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
2. Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
Thanks in advance,
Alejandro TI didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
As I said, I never used it so that's pure theory. Someone else might know better, though. -
Multiple rows insertion - need help
Hello all,
I need to insert multiple rows in a table with a single query and the number of rows is 269470.
There are 3 columns in the table. One of the columns is determined by another sub query which returns multilple(269470) rows and the other 2 columns remain same for all.
I came up with the following query but need a loop to make it run multiple time(269470 times).
insert into EMLUSRRECV
(user_id, storeent_id, receiveml)
values
((select user_id from users where user_id not in (select distinct user_id from EMLUSRRECV) and CURR = 'USD' and rownum = 1), 11154, 1);
Thanks in advance.
Edited by: 924585 on Feb 20, 2013 7:19 PM924585 wrote:
Hello all,
I need to insert multiple rows in a table with a single query and the number of rows is 269470.
There are 3 columns in the table. One of the columns is determined by another sub query which returns multilple(269470) rows and the other 2 columns remain same for all.
I came up with the following query but need a loop to make it run multiple time(269470 times).
insert into EMLUSRRECV
(user_id, storeent_id, receiveml)
values
((select user_id from users where user_id not in (select distinct user_id from EMLUSRRECV) and CURR = 'USD' and rownum = 1), 11154, 1);
Thanks in advance.
Edited by: 924585 on Feb 20, 2013 7:19 PMwhy not just:
insert into emlusrrecv
select user_id, 11154, 1
from users
where user_id not in (select user_id from EMLUSRRECV)
and CURR = 'USD' and rownum = 1) -
Multiple rows Converge to Single row and join
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
Thank you,
Aj
CREATE TABLE DTL_TABLE
ids VARCHAR2 (10),
period VARCHAR2 (10),
course VARCHAR2 (10),
names VARCHAR2 (10),
title VARCHAR2 (10),
TYPE VARCHAR2 (10)
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'jim',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'john',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'kale',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'officer',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'prof',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'inclass');
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'online');
COMMIT;
CREATE TABLE id_table
ids VARCHAR2 (10),
period VARCHAR2 (10),
loc VARCHAR2 (10),
dept VARCHAR2 (10),
code VARCHAR2 (10)
INSERT INTO id_table
VALUES ('1',
'2010',
'nj',
'101',
'cc');
COMMIT;Aj09 wrote:
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
SELECT TBL.id,
DTLperiod,
course,
names,
title,
TYPE,
Loc,
Dept,
Code
FROM ID_TABLE TBL,
DTL_TABLE DTL
WHERE TBL.ID = DTL.ID
AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names -
The simplest way for plsql procedure to return multiple rows
Hi,
What is the simplest way for plsql procedure to return multiple rows (records). There are many combination of ways to do it but I am looking for a solution that is appropriate for plsql beginners. Many solutions use cursors, cursor variables, collections and more that kind of things that are complex on the face of it. Is it somehow possible to achieve the same with less effort?
Sample query would be: SELECT * FROM EMPLOYEES;
I want to use returned rows in APEX to compose APEX SQL(in that context plsql) report.
It is enough to use just SELECT * FROM EMPLOYEES query in APEX but I want to use plsql procedure for that.
Thank you!Hi,
It depends :-).
With +...that is appropriate for plsql beginners...+ in mind... it still depends!
The list of techniques (ref cursors, cursor variables, collections, arrays, using explict SQL) you have referenced in your post can be made to work. but...
+Is it somehow possible to achieve the same with less effort?+ Less effort : That needs to be defined (measured). Especially in the context of pl/sql beginners (who is a beginner?) .
What is the level of "programming experience" ?
What is the level of understanding of "Relational Result set" as processible in Oracle?
If you are looking for
Process_the_set_of rows_in APEX () kind of capabilitywhich "abstracts/hides" relation database from developers when working on relation database, it may not be the best approach (at least strategically). Because I believe it already is abstracted enough.
I find REF CUROSOR most effective for such use, when the "begginer" has basic understanding of processing SQL result set .
So in a nut shell, the techniques (that you already are familiar with) are the tools available. I am not aware of any alternative tools (in pure Oracle) that will simplify / hide basics from develpers.
vr,
Sudhakar B. -
Hi, need some help on XML and XSD.
say I have a table in the database with 3 columns: a, b, c
on my XDP form, I have a table, like a spreadsheet, with 3 columns too: x, y, z
and it has 10 rows.
I want to pre-fill the form with 10 rows of data,
so, in my Process's action profile,
I use JDBC's query multiple rows to get the first 10 records of my database table.
how do I put these 10 rows of data into the table on my form?
TIA for helping me.
Happy New Year!Step1: Use SQL Query Multiple results as XML activity
Step2: Define the output of SQL activity to look similar to
<table>
<row>row1 value</row>
<row>row2 value</row>
<row>row3 value</row>
<row>row4 value</row>
<row>row5 value</row>
<row>row6 value</row>
<row>row7 value</row>
<row>row8 value</row>
<row>row9 value</row>
<row>row10 value</row>
</table>
Step3: arrange your forms fields (Table and rows) in the same way as mentioned above.
Nith -
Help me with returing multiple rows - Query
I am trying to return multiple rows and i need help with my query.
and most important of all one of the requirement is the following:
SERVICE LEVEL has categories Sergeant, Bonus I, All Deputies, Deputy Bailiff, Deputy Lockup, Deputy Bailiff Security, Custody Assistant,
Security Officer, Security Assistant, Security Officer and Security Assistant, Private Security, ALL, All Sworn)
Note: Service Level “All Deputies” includes Deputy Bailiff, Deputy Bailiff Security and Deputy Lockup
*“All Sworn”: includes Sergeant, Bonus I, All Deputies, Deputy Bailiff, Deputy Lockup, Deputy Bailiff Security*
//this code doesn't work cuz case- when statement return only one row. but it works for singles such as 'Sergeant'
select *
from in_service
where rank IN (CASE TRIM(UPPER(:SL))
WHEN 'ALL DEPUTIES' THEN
(SELECT DISTINCT RANK FROM IN_SERVICE
WHERE UPPER(RANK) LIKE 'DEPUTY%')
WHEN 'ALL SWORN' THEN
(SELECT DISTINCT RANK FROM IN_SERVICE
WHERE UPPER(RANK) LIKE 'DEPUTY%' OR
UPPER(RANK) = 'SERGEANT' OR
UPPER(RANK) = 'BONUS 1')
WHEN 'ALL' THEN
(SELECT DISTINCT RANK FROM IN_SERVICE
WHERE UPPER(RANK) LIKE 'DEPUTY%' OR
UPPER(RANK) = 'SERGEANT' OR
UPPER(RANK) = 'BONUS 1' OR
UPPER(RANK) LIKE 'SECURITY%' OR
UPPER(RANK) = 'CUSTODY ASSISTANT' OR
UPPER(RANK) = 'PRIVATE SECURITY')
end ) I was able to get multiple rows for 'ALL' and specified category like 'Sergeant' or 'Bonus I' from the code below, but NOT for 'All Deputies' for example which includes Deputy Bailiff, Deputy Bailiff Security and Deputy Lockup. I know CASE, WHEN does NOT return multiple rows, but i am having problems writing the query to make it work for all categories as the requirements mentioned above.
WHERE RANK IN (SELECT RANK FROM (SELECT RANK, 'ALL' ALL_SERVICE
FROM IN_SERVICE
UNION ALL
SELECT RANK, RANK
FROM IN_SERVICE) WHERE ALL_SERVICE = :SL)Please help.
Thanks in advanceIf you define your service_level as a table then it will be much easier.
with service_level
as
select 'ALL' parent_lvl, 'Sergeant' srv_lvl from dual union all
select 'ALL', 'Bonus I' from dual union all
select 'ALL', 'Deputy Bailiff' from dual union all
select 'ALL', 'Deputy Lockup' from dual union all
select 'ALL', 'Deputy Bailiff Security' from dual union all
select 'ALL', 'Custody Assistant' from dual union all
select 'ALL', 'Security Officer' from dual union all
select 'ALL', 'Security Assistant' from dual union all
select 'ALL', 'Security Officer and Security Assistant' from dual union all
select 'ALL', 'Private Security' from dual union all
select 'All Deputies', 'Deputy Bailiff' srv_lvl from dual union all
select 'All Deputies', 'Deputy Bailiff Security' from dual union all
select 'All Deputies', 'Deputy Lockup' from dual union all
select 'All Sworn', 'Sergeant' srv_lvl from dual union all
select 'All Sworn','Bonus I' from dual union all
select 'All Sworn','All Deputies' from dual union all
select 'All Sworn','Deputy Bailiff' from dual union all
select 'All Sworn','Deputy Lockup' from dual union all
select 'All Sworn','Deputy Bailiff Security' from dual
select *
from in_service
where rank IN (
select srv_lvl
from service_level
where upper(parent_lvl) = upper(:SL)
or upper(srv_lvl) = upper(:SL)
) -
Help :add multiple rows from Resultset to ArrayList ?
My query returns one column and multiple rows. In Java code , I am trying to get this data in array or arraylist through ResultSet
ex:
item_num
p001
p002
p003
when I print, it only gets the item in the first row.
ArrayList myArrayList = new ArrayList();
resultset = preparedstatement.executeQuery();
if (resultset.next())
myArrayList.add(new String(resultset.getString("item_num")));
Print:
for (int j = 0 ; j < myArrayList.size() ; j++ )
System.out.println((String)myArrayList.get(j)); --this prints only the first item.
can someone assist ?changing if to while fixed it.
-
Return Code - Query for Multiple Rows as XML
Hi,
I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this:
{ call MyStoredProc(?) }
This works great, the stored procedure always returns a record set (with or without records). I use this activity rather than "Call Stored Procedure" because I can transform the record set into XML right away within this activity. Unfortunately any exception arising from invoking this stored procedure cannot be handled within the workflow as this activity does not have an exception handler (lightning bolt). In an attempt to handle at least some exceptions we have decided to use try/catches within the stored procedures and return different error codes. Now the problem I am faced with is that there is no way to retrieve the returned code within any of the SQL activities. We don't want to have to write an execute script for each of these SQL calls. Is there any way to do this? Seems like I'm 95% there.
Thanks
NicThanks for the offer, unfortunately we would need something certified by Adobe.
Nic -
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 to create a function that returns multiple rows in table
Dear all,
I want to create a funtion that returns multiple rows from the table (ex: gl_balances). I done following:
-- Create type (successfull)
Create or replace type tp_gl_balance as Object
PERIOD_NAME VARCHAR2(15),
CURRENCY_CODE VARCHAR2(15),
PERIOD_TYPE VARCHAR2(15),
PERIOD_YEAR NUMBER(15),
BEGIN_BALANCE_DR NUMBER,
BEGIN_BALANCE_CR NUMBER
-- successfull
create type tp_tbl_gl_balance as table of tp_gl_balance;
but i create a function for return some rows from gl_balances, i can't compile it
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
return
(select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period);
end;
I also try
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period;
return;
end;
Please help me solve this function.
thanks and best reguardhi,
Use TABLE FUNCTIONS,
[http://www.oracle-base.com/articles/9i/PipelinedTableFunctions9i.php]
Regards,
Danish -
Hi all,
I've a requirement where in I've to get multiple rows from a query.
The resultset should be something like this:
SELECT A
FROM dual;
A
1
2
3
4
5
6
7
8
9
10
Thanks in anticipation
RK RajuI'm not completely certain I understand the question. Just in case you're asking for something as simple as this ...
select rownum from all_objects where rownum <= 10;You didn't say what version you were using either (shame on you). You could use a collection or a pipeline depending on your version ...
create or replace type ttab_number is table of number;
create or replace function f_collection
return ttab_number is
tab_number ttab_number := ttab_number();
begin
for i in 1 .. 10 loop
tab_number.extend;
tab_number(tab_number.count) := i;
end loop;
return tab_number;
end f_collection;
select *
from table(f_collection)
create or replace function f_pipeline
return ttab_number
pipelined is
begin
for i in 1 .. 10 loop
pipe row(i);
end loop;
return;
end f_pipeline;
show errors
select *
from table(f_pipeline) -
Drill Down between 2 stacked column chart with multiple rows.
Hi,
Can anyone please help me.
1) i have to create stacked column chart with Region and cout of calls for previous 3 quarters.
2) the 2nd stacked column should display the priority with the count of calls for the respective selection of region on the 1st chart..
to achieve this,
i'm using 2 stacked column charts and 1 lebel baseb menu.
from this i can able to get the drill down from label based menu to 2nd stacked column chart but i couldn't able to done the same from 1st stacked coumn chart.
Becoz my data is multiple row for each quarter.
please suggest me to achieve the drill down between 2 stacked column charts.
assume that my data like below.:
coulmns for 1st stacked column chart : Region, Q2,Q3 &Q4
Region Q2 Q3 Q4
Other 3658 3497 497
NA - North
America 3 3 1101
APJK 1 4 597
UK 324
EMEA North 1 1 288
CORPORATE 1 5 215
LA -
Latin America1 2 208
EMEA 1 199
EMEA South 1 1 169
Coulmns for 2nd coumn chart: Region, Priority, Q2,Q3,Q4 ()which is derived from 1st table.
Region Priority Q2 Q3 Q4
Other D: End of Next Day 1568 1613 239
Other C: End of Day 983 893 119
Other A: 2 Hour 631 610 70
Other B: 4 Hour 396 318 56
NA -
North AmericaD: End of Next Day 2 2 514
APJK D: End of Next Day 3 297
NA -
North AmericaC: End of Day 284
NA -
North AmericaA: 2 Hour 1 170
UK D: End of Next Day 157
APJK C: End of Day 1 1 152
Other E: 3 - 5 Business Days 68 58 13
EMEA North D: End of Next Day 1 136
CORPORATE D: End of Next Day 4 107
NA - North America B: 4 Hour 1 104
LA - Latin America D: End of Next Day 1 1 86
EMEA D: End of Next Day 86
UK C: End of Day 85
APJK A: 2 Hour 79
EMEA South D: End of Next Day 72
EMEA North A: 2 Hour 69
EMEA North C: End of Day 56
APJK B: 4 Hour 55
EMEA C: End of Day 1 53
LA - Latin America C: End of Day 54
UK A: 2 Hour 49
EMEA South C: End of Day 1 44
CORPORATE A: 2 Hour 1 43
CORPORATE C: End of Day 44
LA - Latin America A: 2 Hour 1 42
EMEA South A: 2 Hour 1 32
EMEA B: 4 Hour 30
UK B: 4 Hour 30
EMEA A: 2 Hour 27
EMEA North B: 4 Hour 1 26
NA -
North AmericaE: 3 - 5 Business Days 25
LA - Latin America B: 4 Hour 23
EMEA South B: 4 Hour 20
CORPORATE B: 4 Hour 17
APJK E: 3 - 5 Business Days 13
Other F: 6 - 10 Business Days 6 4
Other G: 11 - 20 Business Days 6 1Hi Srinivas,
I'm using label based menu "filterd rows" only but i couldn't bind the drill down with the 1st stacked column chart.
for mor details:
1) i'm having 2 stacked coumn charts & 1 lebel based menu but eventhough i couldn't able to achieve.
if i select the lebel based values then the 2nd stacked column charts is giving detailed valus but if i keep my mouse on the 1st stacked column chart the there is no changes on the 2nd chart..
somewhere i'm mising the binding data between 1st stacked coumn chart & lebel based menu on drill down part.
Becoz i'm having multiple rows. so can you please try your and send me the xlf file using your concept. -
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 -
Depicting multiple rows' data in one row
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkeybut if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 Zlotkeypls. help me to sort out the above sought o/p.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p in easily readable format, but couldn't do that.
Edited by: Shariful on Sep 20, 2009 4:28 AM
Edited by: Shariful on Sep 20, 2009 4:29 AMHi,
Shariful wrote:
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'
if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkey
but if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 ZlotkeyIf you want all the emp_ids and names concatenated into one big VARCHAR2 column, that's called String Aggregation
[AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
You can format that one big column so that it looks like separate columns.
If you want each emp_id and name in its own column, that's called Pivoting .
Look up "pivot" for various techniques. If you do not know exactly how many rows were in the original query (and therefore how many columns you'll need in the output), then it will require Dynamic SQL , which can be complicated.
Unfortunately, when you do search for "pivot", mlost of the hits will be things like "Search for pivot and you'll get lots of examples".
Re: Help for a query to add columns is one that actually has some information. It was a question very much like yours.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p and query in easily readable format, but couldn't do that.Type these 6 characters:
(small letters only, inside curly brackets) before and after formatted text, to preserve spacing.
Maybe you are looking for
-
Unable to uninstall Starter Editions 3.0 and 3.01
I have previously had Starter Edition 3.0 installed on my Windows XP O.S. but it was deleted in error. Use of the "Search" facility shows that there are NO Photoshop folders or files now installed in my system. I downloaded Starter Edition 3.2. with
-
Digital video camera compatible list
hi, i cant seem to find the list here for compatible digital video cameras with mac. i really like the JVC hard drives, but have read here there is a loss of quality, and they are hard to work with IDVD????? thank you
-
Hi , How to exclude the index,synomys,grants,statistics while doing import using DBMS_DATAPUMP. Could anyone pls give me the syntax to exculde those things . Thanks JP
-
Clone stamp tool help / Nobody can help me!
OK so here is my problem, i have been serching and posting this on every forum on adobe i can find, and still nobody can help me! Im getting so frustrated! Ok I'm editing this image and I would like to use the clone stamp tool to color something the
-
Halo, I am totally new to java..Iam basically an electronics student..havnt been to the computer science stream much..I am in need of some help in java..in fact the whole code itself..our project requires building a java application that can show a s