One Row Missing
Hi All,
I have a VO. That has 5 rows. Following is my snippet. It always prints information for 4 rows only. Why is it missing the 5 th row. I have checked, FirstName is present in all 5 rows.
vo.executeQuery();
while (vo.hasNext()) {
TableUsersViewRowImpl tableUserRow = (TableUsersViewRowImpl)vo.next();
System.out.println("Hello "+tableUserRow.getFirstName() );
}
Tried vo.first() before while loop. still one row is missing. any other solution ?
thanks,
pp
Similar Messages
-
Missing rows / output only one row in a Report after applying patchset 2
Hi.
We use Reports Builder for 10g R2. We had the problem with our AS 10g R2 on windows 2003, that some reports creates duplicate rows when it is a ASCII report (desformat = delimited), see Bug 3340546.
Now we apply Patchset 2 on a local machine, to test the functionality. It fix the problem (look in metalink doc ID 398955.1 under "2.12 Oracle Reports Developer Bugs")-
But now most csv reports creates only one row instead of multiple rows.
We run reports on our local machine with OC4N and local started Form (via Forms Builder) to generate the reports (local started report server) from DevSuite).
When we start the reports with desformat=delimited the txt-file has only the header row and one data row (instead of multiple ones).
And when we generate the same report with desformat=delimiteddata it looks fine and generates all rows as expected.
We found neither here in the forum or in metalink knowledge base nor on the internet.
Have you any suggestions for us how to fix this problem?
Using delimiteddata is now acceptable solution for us, because delimited is easier to use.
Thanks for your help!Hey folks.
We have solved the problem. :)
We applied PatchSet2 for 10gR2. But we don´t know how the csv-report outputs only 1 data-row instead of several rows.
Than we create a similar report (with the same sql-query) as a new one with the reports builder assistant.
This one works pretty fine. So we looked for the attributes and see the "max. number datasets for each site" and it was in the new one set to 0 and in our old one set to 1.
So we change this and ... the old one works pretty fine! :)
So the problem is, that this attribute does not had any consequences in the old version. But since we update with PatchSet 2 it respect this attribute but we don´t "see" it.
Hope this helps others. -
Xml to Oracle (Update more than one row)
Hi,
I want to update more than one row in table from .xml file. My xml file is as follows:
<ROOT>
<PROFILE PROFILEMASTER_PKEY="54" DB_MSTR_PKEY="2" PROFILE_NAME="Bhushans" DELIMETER="~" PRE_PROCESSOR="1" POST_PROCESSOR="10" PRE_PROCESSOR_TYPE="1" POST_PROCESSOR_TYPE="2" GROUPID="2" />
<PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="FEEDVALIDATION_ID" DATA_TYPE="NUMBER" DATA_SIZE="22" START_POSITION="12" END_POSITION="22" COLUMNORDER="1" PROFILEDETAILS_PKEY="399"/>
<PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="CHANGE_TYPE" DATA_TYPE="VARCHAR2" DATA_SIZE="1" START_POSITION="12" END_POSITION="144" COLUMNORDER="5" PROFILEDETAILS_PKEY="403"/>
<OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="@" PROFILE_CFILE_PKEY="337" />
<OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="~" PROFILE_CFILE_PKEY="336" />
</ROOT>
To update according to xml file, I have written following procedure. My procedure updates the table if u r updating 1 row. If you try to update more than 1 row, I mean .xml file contains more than 1 row then my procedure doesn't work. Please help to solve this problem.
Procedure:
create or replace procedure fm_prc_xml_dup_up
as
f utl_file.file_type;
s varchar2(2000);
v varchar2(3000);
xml XMLType;
v_pmpk number;
v_sdtl_pk number;
chng_typ VARCHAR2(20);
type r1 is ref cursor;
rcur r1;
v1 varchar2(120);
v2 number;
begin
f := utl_file.fopen('CITI', 'S.XML', 'R');
loop
utl_file.get_line(f, s);
v := v || ' ' || s;
end loop;
exception
when no_data_found then
utl_file.fclose(f);
xml := xmltype(v);
SELECT extract(xml, 'ROOT/CHANGE/@CHANGETYPE').getstringval()
INTO CHNG_TYP
FROM DUAL;
UPDATE FM_PROFILEMAST
set db_mstr_pkey = extract(xml, 'ROOT/PROFILE/@DB_MSTR_PKEY').getnumberval(),
profile_name = extract(xml, 'ROOT/PROFILE/@PROFILE_NAME').getstringval(),
file_type = extract(xml, 'ROOT/PROFILE/@FILE_TYPE').getstringval(),
delimiter = extract(xml, 'ROOT/PROFILE/@DELIMETER').getstringval(),
pre_processor = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR').getstringval(),
post_processor = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR').getstringval(),
pre_processor_type = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR_TYPE').getstringval(),
post_processor_type = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR_TYPE').getstringval(),
groupid = extract(xml, 'ROOT/PROFILE/@GROUPID').getstringval(),
change_type = 'U',
change_by = chng_typ,
change_dt = default,
active_flag = default
WHERE profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval();
UPDATE FM_PROFILEDET
SET target_source_table = extract(xml, 'ROOT/PROFILEDETAILS/@TARGET_SOURCE_TABLE').getstringval(),
column_name = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_NAME').getstringval(),
data_type = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_TYPE').getstringval(),
data_size = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_SIZE').getnumberval(),
start_position = extract(xml, 'ROOT/PROFILEDETAILS/@START_POSITION').getnumberval(),
end_position = extract(xml, 'ROOT/PROFILEDETAILS/@END_POSITION').getnumberval(),
change_by = chng_typ,
change_dt = default,
columnorder = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMNORDER').getstringval(),
column_format = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_FORMAT').getstringval(),
nullable = extract(xml, 'ROOT/PROFILEDETAILS/@NULLABLE').getstringval(),
change_type ='U',
active_flag = default
WHERE profiledetails_pkey = extract(xml, 'ROOT/PROFILEDETAILS/@PROFILEDETAILS_PKEY').getstringval();
UPDATE FM_PROFILE_CFILE
SET profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval(),
ldr_syntx_dtls_pkey = extract(xml, 'ROOT/OPTIONS/@LDR_SYNTX_DTLS_PKEY').getstringval(),
val = extract(xml, 'ROOT/OPTIONS/@OPTIONVALUE').getstringval(),
change_by = chng_typ,
change_dt = default,
sub_line_seq = extract(xml, 'ROOT/OPTIONS/@SUB_LINE_SEQ').getstringval(),
change_type = 'U',
active_flag = default
where profile_cfile_pkey = extract(xml, 'ROOT/OPTIONS/@PROFILE_CFILE_PKEY').getnumberval();
END;Hi Bhushan,
one where clause is missing in the main update.
update fm_profiledet
set (....)
=(select ....)
where id in (select your profiledetails_pkey from the xml). <--this where clause were missing.
if xml extracting is too slow(xml very large) then you can create a procedure where exract your data from the xml and then update rows in for loop.
something like this
create procedure up_xmls(p_xml xmltype) is
cursor cur_xml(p_xml xmltype) is
select ......<--here you extract your xml
begin
for r_row in cur_xml(p_xml) loop
update fm_profiledet set target_source_table=r_row.target_source_table
where profiledetails_pkey=r_row.profiledetails_pkey;
end loop;
end;this should work:
SQL> drop table fm_profiledet;
Table dropped.
SQL> create table fm_profiledet(
2 profiledetails_pkey number
3 ,target_source_table varchar2(100)
4 ,column_name varchar2(100)
5 ,data_type varchar2(100)
6 ,data_size number
7 ,start_position number
8 ,change_type varchar2(100)
9 )
10 /
Table created.
SQL>
SQL>
SQL> insert into fm_profiledet
2 values(399,'test','test1','test2',1,2,'A')
3 /
1 row created.
SQL>
SQL>
SQL> insert into fm_profiledet
2 values(403,'test3','test4','test5',3,4,'B')
3 /
1 row created.
SQL> insert into fm_profiledet
2 values(443,'test3','test4','test5',3,7,'B')
3 /
1 row created.
SQL>
SQL>
SQL> select * from fm_profiledet;
PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE DATA_SIZE START_POSITION CHANGE_TYP
399 test test1 test2 1 2 A
403 test3 test4 test5 3 4 B
443 test3 test4 test5 3 7 B
SQL>
SQL> create or replace directory xmldir as '/home/ants';
Directory created.
SQL>
SQL>
SQL>
SQL> update fm_profiledet fm
2 set (target_source_table,column_name, data_type, data_size, start_position,change_type)
3 =(
4 select target_source_table
5 , column_name
6 , data_type
7 , data_size
8 , start_position
9 , change_type
10 from(
11 select
12 extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
13 , extractValue(value(x),'/PROFILEDETAILS/@TARGET_SOURCE_TABLE') target_source_table
14 , extractValue(value(x),'/PROFILEDETAILS/@COLUMN_NAME') column_name
15 , extractValue(value(x),'/PROFILEDETAILS/@DATA_TYPE') data_type
16 , extractValue(value(x),'/PROFILEDETAILS/@DATA_SIZE') data_size
17 , extractValue(value(x),'/PROFILEDETAILS/@START_POSITION') start_position
18 ,'U' change_type
19 from
20 table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
21 ,nls_charset_id('AL32UTF8'))
22 , '/ROOT/PROFILEDETAILS'))) x
23 ) s
24 where s.profiledetails_pkey=fm.profiledetails_pkey)
25 where
26 fm.profiledetails_pkey in (select
27 extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
28 from
29 table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
30 ,nls_charset_id('AL32UTF8'))
31 , '/ROOT/PROFILEDETAILS'))) x
32 );
2 rows updated.
SQL>
SQL>
SQL> select * from fm_profiledet;
PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE DATA_SIZE START_POSITION CHANGE_TYP
399 FM_FEEDVAL FEEDVALIDA NUMBER 22 12 U
IDATION_LU TION_ID
403 FM_FEEDVAL CHANGE_TYP VARCHAR2 1 12 U
IDATION_LU E
443 test3 test4 test5 3 7 B
SQL> spool off;Ants
Message was edited by:
Ants Hindpere -
How do I sort my whole spreadsheet based on one row?
I'm using Numbers on my iPad to inventory a school's computer systems. I'm kind of doing it slowly as I get time, so I'm not inventorying in any particular order. I just go in a room when I get a chance and then inventory everything in it.
I have different columns for room, asset #, make, model, serial, inventory date
Just a few minutes ago, I was trying to sort my sheet by the asset # so I could see what gaps I have in the asset numbers. I selected the top bar and it highlights the whole column. Then I select sort and it only sorts the one column, which then totally screws up my sheet because my asset numbers are next to different random PCs that I just happened to inventory first. So, of course, I undo it. But I would like to be able to sort by asset # and have it sort all the cells based on the asset #, or sort by make or model and then I could see all the computers with a certain make or model and where they're at. There has to be a way to do this.I probably said it backwards. I've been calling them columns... I think I mean rows. The rows have data up and down. I want to sort it so the lowest values at the top and highest values at the bottom. But I want all the other cells to stay sorted. Right now if I just select sort for the row, it sorts the one row and not the rest of them so it totally messes up my sheet.
It's just an inventory that I have a field that says make, model, asset #, serial, room #, etc.
I'd like to sort by asset # to see all the PCs and if I have a gap. Then I'd like to sort it by room number so when I walk in a room, I can tell if I missed a PC in the room and verify what I have. Then I might want to sort by the year row when we decide to upgrade so I can put all the oldest PCs first. But if it just sorts the row and not all the other columns in the row, it totally messes up my sheet. It just puts my years of pc from oldest to newest but didn't sort the rest of the fields. In Excel, if I do that, it sorts all the fields based on the one row.
I'm not sure how to give you a screenshot off my ipad. -
Oracle database link to MySQL select only one row
Hello,
I have created a connection from the Oracle batabase 11.2 to a MySQL database via database link. The following statement shows, that 35 rows are in the mySQL table:
SQL> select count(*) from "main_pages"@MOREWEB;
COUNT(*)
35
But a normal select statement only return 1 row.
SQL> select "subject" from "main_pages"@MOREWEB;
subject
Übersicht: Referenzen
I am using the mysql-connector-odbc-3.51.30-winx64 driver. A newer version cann't be installed because on Windows Server 2008 R2 I get an error with an missing dll-file. The DataDirect-ODBC-driver is not possible, because we like to use the free MySQL-database an DataDirect only support the enterprise edition.
I also have tried to limit the HS_OPEN_CURSORS or dont limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one row.
HS Init.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = moreweb
HS_FDS_TRACE_LEVEL = ON
HS_FDS_FETCH_ROWS=1
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
HS tracefile
Oracle Corporation --- MITTWOCH NOV 05 2014 13:56:22.066
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- MITTWOCH NOV 05 2014 13:56:22.066
Version 11.2.0.1.0
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "ON"
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "1"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using mpgw as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
SQL text from hgopars, id=1, len=36 ...
00: 53454C45 43542043 4F554E54 282A2920 [SELECT COUNT(*) ]
10: 46524F4D 20606D61 696E5F70 61676573 [FROM `main_pages]
20: 60204131 [` A1]
Deferred open until first fetch.
Performing delayed open.
SQL text from hgopars, id=1, len=40 ...
00: 53454C45 43542041 312E6073 75626A65 [SELECT A1.`subje]
10: 63746020 46524F4D 20606D61 696E5F70 [ct` FROM `main_p]
20: 61676573 60204131 [ages` A1]
Deferred open until first fetch.
Performing delayed open.
Please can help me someone.
Thanks.
Biancamxallen wrote:
Bianca,
If you log directly into MySQL and issue the same query (select "subject" from "main_pages";) what data is returned?
I looks to me that you count is the number of rows in the entire table "main_pages"
while you select is for the data in the "subject" column only.
This seems to indicate that you have just one row in that subject column.
Regards,
Matt
WHAATT?
What do you mean by "just one row in that subject column"?
That makes no sense at all. A row is a row. A column is a part of a row. All rows have all columns, though not all columns of all rows will necessarily have an assigned value. Lacking a WHERE clause to filter rows, any SELECT should return all rows. -
ORA-01427: single-row subquery returns more than one row -- no solution
Hello to all:
I have to tables:
Table a anwender (Email,Dept). --> all fields are filled
Table b dingo (Name,email,dept) --> all fields are filled
I now want to update the table a with the data from table b:
update anwender a set a.abteilung = ( select distinct b.abteilung from dingo b where b.email = a.email);
Then I got the error: ORA-01427: single-row subquery returns more than one row
Every dept is about 100x in the database, so it is clear that i got more than one row back. But how can I update the table now?Okay, I got several duplicates, and I deletet a lot of data in my database.
Now I want to remove all entries with more than one departments per mail adresses.
a
select email,count(abteilung) from dingo group by email having count(abteilung)>1 order by count(abteilung)
shows me all the fake mailadresses.
But a
delete from dingo where email in (select email,count(abteilung) from dingo group by email having count(abteilung)>1 order by count(abteilung) );
gives me a
SQL Error: ORA-00907: missing right parenthesis
I´m very confused now ...
Oops, now I got the solution:
delete from dingo where email in (select email from (select email,count(abteilung) from dingo group by email having count(abteilung)>1 )) ;
Edited by: user8309218 on Dec 18, 2009 6:24 AM -
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? -
How to return one ROW with Multiple value seperated by Colon in a SQL Query
Hi,
I have a SQL query as mentioned.
select deptno
from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
10:20:30:40.......Thanks,
DeepakIn 10g:
select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
from dept;
DATA
10:20:30:40with apologies for the abuse of XML... -
How to Plot number and string in one row (data logger counter via MODBUS) ?
hi all i made data log quantity using Digital Counter via modbus (RS-485) to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
i have problem about plot the number & string in one row, as shown on the picture below :
how to move that string on one row ? i attach my vi.
Thanks~
Solved!
Go to Solution.
Attachments:
MODBUS LIB Counter.vi 39 KBHi rhiesnand,
right now you add 2 new rows to your array.
The solution is to concatenate both row parts to one bigger 1D array before adding that array as new row to your 2D array!
Like this:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to Plot number and string in one row (data logger counter) ?
hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
i have problem about plot the number & string in one row, as shown on the picture below :
how to move that string on one row ? i attach my vi.
Thanks~
Attachments:
MODBUS LIB Counter.vi 39 KBDuplicate and answered - http://forums.ni.com/t5/LabVIEW/How-to-Plot-number-and-string-in-one-row-data-logger-counter-via/m-p...
-
Hi guys, I got a black out. I got this situation:
Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int) insert into forum values ('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0), ('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0), ('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0), ('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0), ('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0), ('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0), ('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440), ('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640), ('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
I had to run a huge union all taking data fro ACons, BCons, CCons, no way to do link or other stuff, we're talking about millions rows, different servers..anyway. I got this situation. Now I need an output like:
Buenos Aires 1 2014 100 330 300
Toronto 1 2014 400 1100 640
Pratically Icity, Imonth, Iyear, Acons, Bcons, Ccons in one rows and not in three difefrent rows. I already did this stuff a lot of time but I'm going underpressure by another side ( a Cube that doesn't update correctly).
Any suggestion? Thanks everyone.Are you looking for the below? If not, please let us know:
Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int)
insert into forum values
('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0),
('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0),
('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0),
('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0),
('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0),
('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0),
('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440),
('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640),
('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
Select Icity,IMonth,Iyear,MAX(ACons),MAX(BCons),MAX(cCons) From Forum
Group by Icity,IMonth,Iyear
Drop table Forum -
Multiple record in one row..
Hi experts,
I want to merge multiple row from same table into one row... is it possible? if so then how??
Regards,
SKPSure, it's possible
create table scott.a
as
select 1 a, 2 b from dual
union all
select 3 a, 4 b from dual
create table scott.b
(a number, b number, c number, d number)
insert into scott.b
select a1.a,a1.b,a2.a,a2.b from scott.a a1, scott.a a2
where a1.a = 1 and a2.a = 3
P.S. Sorry, at first misunderstood the task
Message was edited by:
Dmytro Dekhtyaryuk -
Query below is returning data in multiple rows, I want to display them as one row:
select
event_id,
data_type_cd,
quantity
from Event,Data_types
where event_id = 1234
and event.DATA_TYPE_ID = data_types.DATA_TYPE_ID
(I want to display data_type_cd concatenated with quantity as every code had different quantity)> Sample data is:
> Data_type_id Quantity
> ------------------ ----------
> 1 34
> 2 67
> 15 35
> 20 23
> I want to display as:
> 1 34 2 67 15 35 20 23
if you want all the rows in one column see this given example below:
SQL> select t.*
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
DATA_TYPE_ID QUANTITY
1 34
2 67
15 35
20 23
SQL> select substr(sys_xmlagg(xmlelement(col, ' ' || data_type_id||' '||quantity)).extract('/ROWSET/COL/text()').getclobval(), 2) new_disp
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
NEW_DISP
1 34 2 67 15 35 20 23
SQL> -
Concatenating values in one row
I need to write a function that will give me a concatenated list of all the records where gurmail_matl_code_mod like '8%'
This query is giving me those results:
GURMAIL_PIDM CODE1 CODE2
1135711
1135711 8IBD
1135711 8IBW
I want something like this 1135711 8IBW 8IBD in one row.
select
gurmail_pidm,
max(decode(rn,1,gurmail_matl_code_mod )) code1,
max(decode(rn,2,gurmail_matl_code_mod )) code2
from (select gurmail_pidm,
gurmail_matl_code_mod,
row_number() over (partition by gurmail_pidm order by gurmail_matl_code_mod desc) rn
from
(select gurmail_pidm,gurmail_matl_code_mod
from saturn.spriden,
general.gurmail
where spriden_pidm = gurmail_pidm
and spriden_change_ind is null
and gurmail_matl_code_mod like '8%'
and gurmail_pidm = 1135711
and GURMAIL_DATE_PRINTED is null
and gurmail_matl_code_mod is not null))
group by gurmail_pidm, gurmail_matl_code_mod How I can modify this query or let me know if you have other ideas..
Thank youHello
try this,
SQL> with tab as(Select 1135711 GURMAIL_PIDM, Null CODE1 from dual Union All
2 Select 1135711 GURMAIL_PIDM, '8IBD' CODE1 from dual Union All
3 Select 1135711 GURMAIL_PIDM, '8IBW' CODE1 from dual)
4 SELECT GURMAIL_PIDM || sys_connect_by_path(CODE1,' ') Result
5 FROM (SELECT GURMAIL_PIDM
6 ,code1
7 ,row_number() over(Partition BY GURMAIL_PIDM Order BY GURMAIL_PIDM) rn
8 FROM tab)
9 WHERE connect_by_isleaf = 1
10 Start With rn = 1
11 Connect BY Prior rn = rn - 1;
RESULT
1135711 8IBW 8IBDHope this helps
Christian Balz -
Hellou
I need help in SQLPLUS. I need to prompt into the file one row of information like this:
0000004202;;00151564;[email protected];160120071333
this -> 0000004202;;00151564;[email protected]; is just static text
this -> 160120071333 is date in format (ddmmyyyyHHMM)
And I need it in one row
prompt 0000004202;;00151564;[email protected]; select to_char(sysdate,'ddmmyyyyHH24MM') from dual
does not work
Can you help me?
I used something Like this:
spool file
declare cas_aktual VARCHAR(12);
begin
select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
dbms_output.enable;
dbms_output.put_line('blabla'||cas_aktual||'konec');
end;
spool OFF
But it isn't work too>
I used something Like this:
spool file
declare cas_aktual VARCHAR(12);
begin
select to_char(sysdate,'ddmmyyyyHH24MM') into
cas_aktual from dual;
dbms_output.enable;
dbms_output.put_line('blabla'||cas_aktual||'konec');
end;
spool OFF
But it isn't work tooYou need a forward-slash character ("/") right after the PL/SQL block to allow sqlplus to run the contents of the buffer.
test@ora>
test@ora> spool c:\test.log
test@ora>
test@ora> declare cas_aktual VARCHAR(12);
2 begin
3 select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
4 dbms_output.enable;
5 dbms_output.put_line('blabla'||cas_aktual||'konec');
6 end;
7 /
blabla300720081207konec
PL/SQL procedure successfully completed.
test@ora>
test@ora> spool OFF
test@ora>
test@ora> host type c:\test.log
test@ora>
test@ora> declare cas_aktual VARCHAR(12);
2 begin
3 select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
4 dbms_output.enable;
5 dbms_output.put_line('blabla'||cas_aktual||'konec');
6 end;
7 /
blabla300720081207konec
PL/SQL procedure successfully completed.
test@ora>
test@ora> spool OFF
test@ora>
test@ora>isotope
Maybe you are looking for
-
Street route maintanance in third party system
Dear All, I have mapped street route in SAP by using Tcode EL40, But I want the orders to be downloaded in thrid party system in the same order in the way the street route has been maintaned. I am downloading the orders using getlist bapi for meter r
-
Smartforms : Repeation of data on the smartforms, but in ABAP is correct.
Hi all, I am fetching the data on the smartforms by ABAP program, but when it is comming on the smartforms, it is repeat. In the ABAP program, i have a internal table which is contain the some fields, and in the smartforms, i am using the table ->Pro
-
Hierarchy loading in Import Manager
Hi, I have the following scenario to load Hierarchy but Import Manager is throwing an error message ' Duplicate in Clomn-2". However the same structure I am able to make in Data Manger manually for a 3 level hierarchy which confirm that hierarchy tab
-
BC Sets for Product Compliance
Hi guys, We are looking at option of copying customization table values using BC sets for Product Compliance. I don't think we can use BC sets for Incident Management and Risk Assessment part. However I know you can use BC sets for product compliance
-
"Managed Photos" Folder on MAC
I have a "Managed Photos" folder in my LR folder. It contacts a empty folder structure that looks similar to the folder tree where I store my original photos. I'm wondering if this folder was related to my beta install... Do you think it would be saf