Formatting output result set
I Have a query
select x.cert_no, x.rec_code, count(*) from
select cert_no,rec_code,PRIMARY_LANGUAGE_CODE,race_code
from med_subscriber
union
select cert_no,rec_code,PRIMARY_LANGUAGE_CODE,race_code
from subscriber
union
select cert_no,to_char(to_number(rec_code)+9) rec_code,PRIMARY_LANGUAGE_CODE,race_code
from den_subscriber
) x group by x.cert_no, x.rec_code having count(*) >1 ;
Which returns,
CERT_NO REC_CODE COUNT(*)
000000106 10 2
000017616 10 2
000032169 10 2I want the result set as
CERT_NO REC_CODE PRIMARY_LANGUAGE_CODE RACE_CODE COUNT(*)
000000106 10 EN 9 2
000000106 10 XX 9 2
000017616 10 JJ 2
000017616 10 JJ 6 2
000032169 10 2
000032169 10 PP 0 2Please help
Thank you.
Perphaps like this.
with dat as (
select '000000106' CERT_NO, 10 REC_CODE,'EN' PRIMARY_LANGUAGE_CODE, 9 RACE_CODE from dual union all
select '000000106', 10, 'XX', 9 from dual union all
select '000017616', 10, 'JJ', null from dual union all
select '000017616', 10, 'JJ', 6 from dual union all
select '000032169', 10, null, null from dual union all
select '000032169', 10, 'PP', 0 from dual
select cert_no, rec_code, primary_language_code, race_code
, count(*) over (partition by cert_no ) "Count"
from dat
CERT_NO REC_CODE PR RACE_CODE Count
000000106 10 EN 9 2
000000106 10 XX 9 2
000017616 10 JJ 2
000017616 10 JJ 6 2
000032169 10 2
000032169 10 PP 0 2
6 rows selected.HTH
SS
Similar Messages
-
Interactive Reporting Reports - Same Rpt Format, but Different Result Set
I have created a report using result set 1. I've saved that, but want to copy it & use the same format/columns to create a new report using a different result set (the result sets have the same data, but one is filtered). Is there an easy way to change the name of the result set being used w/o re-creating the entire report columns & all?
TerriI am in the Dashboard Studio - Optimize Utility. When I select that report (or any of the others), the Reparent button is grayed out on the toolbar. I've also tried right-clicking on the report and it's grayed out there as well. Any ideas?
-
Database control: how to read output of sproc that returns result set
I have a stored procedure that returns a result set. Should I use a RowSet control to wrap this, or a database control, or neither? Am I better off with straight JDBC in a Java control?
Thanks.Sorry for missing the point totally...
DOKTL also contains long text for FM parameters...
This is a modified version of your code that retrieves the long text and displays it...
DATA: parameter TYPE TABLE OF swotfupar,
ls_parameter LIKE LINE OF parameter,
search_string TYPE doktl-object,
texttab type table of doktl-doktext with header line.
PARAMETERS: fubaname TYPE swcontdef-abapname
DEFAULT 'POPUP_TO_CONFIRM',
pa_lang TYPE sy-langu.
START-OF-SELECTION.
CALL FUNCTION 'SWO_QUERY_FUNCTION_PARAMETERS'
EXPORTING
functionmodule = fubaname
TABLES
function_parameters = parameter
* EXCEPTIONS
* FUNCTION_NOT_FOUND = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT parameter INTO ls_parameter.
CONCATENATE ` ` "30 spaces
ls_parameter-parameter INTO search_string.
OVERLAY search_string WITH fubaname.
SELECT doktext FROM doktl INTO TABLE texttab
WHERE id = 'FU'
AND langu = pa_lang
AND object = search_string.
WRITE:/ 'Long Text for', ls_parameter-parameter.
LOOP AT texttab.
NEW-LINE.
WRITE: AT 10 texttab COLOR COL_HEADING.
ENDLOOP.
ENDLOOP.
Hope this helps you
Regards,
Dushyant Shetty -
How to pass a result set as an output parameter
I have a function that will be used as a web service. It invokes a stored procedure - ideally I'd like to pass the result set from the SP out as a result set to the client consuming the web service. Is this do-able or am I in dreamland?
What you typically do is iterate thru the RS, turning each row of data into a business object and adding all the business objects to a list or some other collection. Then close the result set. Return that collection of business objects to the client.
-
Sql Developer 3.1 - Exporting a result set in xls generates and empty file
Ever since upgrading to the Production version SQL Developer 3.1 (3.1.07) it appears that there is an issue when attempting to export a result set as a .xls format.
If I attempt to export in .xls format, the exported file is an empty file (i,e no output). When I change the export type to txt, csv or xlsx the results are exported as expected.
This appears to be a bug introduced in the Production version as I was successfully able to perform these tasks on the various 3.1 EA releases.
Am I alone in this, have I misconfigured something or is this a bug?I keep having problems exporting to XLSX - mostly in cases where the data is voluminous and the format would be preferable over plain XLS as it does not have the 65krows limit ;-{ The data is read to the data grid (sometimes fast, sometimes much slower and "in chunks"), then the "task progress" won't move anymore, and the export file remains empty; If I cancel the task, trying to export again results in a message stating that sqldeveloper still has the output file locked.
-
SQL Developer formatted output
Hello,
Could you please help me in getting the formatted output on Oracle sql developer tool, I am not able to find andy options to set
I have copy paste the result from this tool to excel, I am getting plain text out put, I have more columns and readablity is not there
Regards,
Neil
Edited by: NeilCSE on Apr 6, 2010 6:01 AMHi,
try this.
I am on windows
SQL> spool c:\emp_text.txt;
Started spooling to c:\emp_text.txt
SQL> select ename||'|'||empno from emp;
ENAME||'|'||EMPNO
JAMES|7900
FORD|7902
MILLER|7934
SMITH|7369
ALLEN|7499
WARD|7521
JONES|7566
MARTIN|7654
BLAKE|7698
CLARK|7782
SCOTT|7788
KING|7839
TURNER|7844
ADAMS|7876
14 rows selected
SQL> spool off;
Stopped spooling to c:\emp_text.txtThen open in excel as delimeted by |
Regards,
Bhushan -
Xcelsius with XMLA or XML Query Result Set
Hi Experts,
I want a direct connection from Xcelsius to my BW-Data. Because the new connection, coming with Fix Pack 2.1 is only avaiable for EHP 1 for NW 7.0 I tried to configure with XMLA and XML Query Result Set.
This Document tells the necessary steps: How to integrate Xcelsius 2008 with SAP NetWeaver BI without Integration Kit.pdf.
When I test my XML connection over http://<host>:<port>/TXmla/srvlet/TestXmla my Cubes will display.
So I do a Webservice-Connection with WSDL-URL. At Input-Values there are some entries like CUBE_NAME, CATALOG_NAME...
Output values arent avalible. How do I use these elements to show my Data in Xcelsius?
My Problem with the XML Query Result Set Connection is, that when I Log On to VC the following error appears:
You are not authorized to view the requested resource.
So I get the authorisationobjects: S_DEVELOP and S_RS_COMP as describe in 'How To... Resolve Visual Composer Issues'.
What values have I to enter by S_RS_COMP? And how can I enter my External Service in S_SERVICE. At the type WS the service isnt't avaiable.
Regards,
JanTo use XMLA web service you need a wrapper function build to convert the XMLA output to the Xcelsius format. There are some documents available in SDN on how to do this.
You can use Live Office or Query as a Web service option to connect from Xcelsius to BW.
S_RS_COMP is the query ID which you are trying to access, S_SERVICE you can either give * or try to set up authorization log and see the expected value. -
Formatting output to a file? 1.4.2
I am writing an application that writes result sets from an oracle 10g database query. This output combines both text and numeric.
I cannot figure out how to justify the output to the right or left or force the fields to use a set amount of space regardless of the width of the text.
As a result I get an outfile with perfectly lined up columns except for the one or two where instead of a four digit number there is a single number. This change in width shifts all of the output over.
My customer goes nuts over this, surely there is a way to format output?OK, I tried today, I really did, I just can't get my brain around how to do what I need to accomplish so here is a pseudo example and i am hoping someone can shed some light.
My application is abstract to enable easy addition of instances of automated reports.
I have a 2d array that contains the column names for a given query. [0] = column name, [1] = space to be applied after results are added to a string buffer.
So, something like this:
StringBuffer entireQueryResults = new StringBuffer();
String[][] QueryColumns = someObject.getQueryColumnNames();
ResultSet currResults = someObject.getResultset();
while(currResults.next()){
String currRow = "";
for(int i = 0; i < QueryColumns.length; i++){
currRow = currRow + currResults.getString(QueryColumns[0])+currResults.getString(QueryColumns[i][1])+"\n";
entireQueryResults.append(currRow);
Now, the problem is that there are columns in the queries that have digits, these can range from a single val to 5 and while 98% of them are 3 digits there are random instances where they are a single digit or even a -1. When this happens it throws the output way off and makes it difficult to read in the resulting email report.
How can I incorporate this into a MessageFormat or ChoiceFormat object to make the output pretty ? -
Numver format for readonly setted af:inputText
Hello All,
<af:inputText id="itTtlDue" readOnly="true" value="#{bindings.return.inputValue}"
required="#{bindings.return.hints.mandatory}"
columns="#{bindings.return.hints.displayWidth}"
maximumLength="#{bindings.return.hints.precision}">
How can I set display format for above tag?
Note:
When I execute above tag with a numerical value as "25.333333333336" , then it display as 25.333333333336.
So it correct..!
But how can I display it with formated output as #######.## (So result should be 25.33)
Thanks.Hi
you can use <af:convertNumber> tag with pattern attribute inside the your inputText
<af:inputText id="itTtlDue" readOnly="true" value="#{bindings.return.inputValue}"
required="#{bindings.return.hints.mandatory}"
columns="#{bindings.return.hints.displayWidth}"
maximumLength="#{bindings.return.hints.precision}">
<af:convertNumber pattern=""#######.##>
</af:inputText> -
Report Control and Multiple Datasets/Result Sets
I have four results sets, Plan, Forecast, Actual and SPLY per eight different product lines. I want to add conditional formatting of background color if actual is above or below Plan and/or Forecast. The report needs to export properly to Excel.
Is there a way I can use one control rather than multiple text boxes to display the data, allow for conditional formatting and export to Excel.? Thanks!
Environment:
SSRS 2010
SQL Server 2012Hi blairv,
If I understand correctly, you have a dataset in the report which include four fields: Plan, Forecast, Actual and SPLY. Each filed contains eight values.
In SQL Server Reporting Services (SSRS), we can use table, matrix or list display report data in cells. The cells typically contain text data such as text, dates, and numbers but they can also contain gauges, charts, or report items such as images.
Reference: http://technet.microsoft.com/en-us/library/dd220592.aspx
In your case, we can use expression to configure these items background color. Please refer to the following steps:
Click a specific text box in the report. Click BackgroundColor prompt in the Properties dialog box.
Click Expression prompt. And fill with expression below:
=IIF(Fields! Actual.Value>Fields! Plan.Valeu Or Fields! Actual.Value>Fields! Forecast.Valeu,”Red”,”Blue”)
Reference: http://msdn.microsoft.com/en-us/library/ms157328.aspx
If there are any miunderstanding, please feel free to let me know.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
WAD : Result set is too large; data retrieval restricted by configuration
Hi All,
When trying to execute the web template by giving less restiction we are getting the below error :
Result set is too large; data retrieval restricted by configuration
Result set too large (758992 cells); data retrieval restricted by configuration (maximum = 500000 cells)
But when we try to increase the number of restictions it is giving output. For example if we give fiscal period, company code ann Brand we are able to get output. But if we give fical period alone it it throwing the above error.
Note : We are in SP18.
Whether do we need to change some setting in configuration? If we yes where do we need to change or what else we need to do to remove this error
Regards
KarthikHi Karthik,
the standard setting for web templates is to display a maximum amount of 50.000 cells. The less you restrict your query the more data will be displayed in the report. If you want to display more than 50.000 cells the template will not be executed correctly.
In general it is advisable to restrict the query as much as possible. The more data you display the worse your performance will be. If you have to display more data and you execute the query from query designer or if you use the standard template you can individually set the maximum amount of cells. This is described over [here|Re: Bex Web 7.0 cells overflow].
However I do not know if (and how) you can set the maximum amount of cells differently as a default setting for your template. This should be possible somehow I think, if you find a solution for this please let us know.
Brgds,
Marcel -
Result set does not fit; it contains too many rows
Dear All,
We are in BI7 and running reports on Excel 2007. Even though number of rows limitation in Excel 2007 is more than 1Million, when I try to execute a report with more than 65k records of output, system is generating output only for 65k rows with message "Result set does not fit; it contains too many rows".
Our Patch levels:
GUI - 7.10
Patch level is 11
Is there any way to generate more than 65000 rows in Bex?
Thanks in advance...
regards,
Raju
Dear Gurus,
Could you please shed some light on this issue?
thanks and regards,
Raju
Edited by: VaraPrasadraju Potturi on Apr 14, 2009 3:13 AMVara Prasad,
This has been discussed on the forums - for reasons of backward compatibility I do not think BEx supports more that 65000 rows .... I am still not sure about the same since I have not tried out a query with more that 65K rows on excel 2007 but I think this is not possible... -
How to add a dummy row in the result set of a SELECT statement.
Hello Everyone -
I have requirment to add a dummy row in the result set of a SELECT statement.
For e.g. lets say there is a table Payment having following colums:
Payment_id number
status varchar2(10)
amount number
payment_date date
so here is the data :-
Payment_id Status Amount payment_date
1 Applied 100 12/07/2008
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
Here is my SQL
Select * form payment where payment_date >= 01/01/2009
Output will be
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
My desired output is below
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
2 Reversed -200 01/ 06/2009 ------(Dummy Row)
Thrid row here is the dummy row which I want to add when status is "Reversed"
I would be very thankful for any kind of help in this regard ...
Thanks,
GauravCartesion joining against a dummy table is a useful method of creating a dummy row:
with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
--- end of mimicking your table
dummy as (select 'Reversed' col1, 1 rn from dual union all
select 'Reversed' col1, 2 rn from dual)
select mt.cust_id,
mt.payment_id,
mt.status,
decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
mt.payment_date
from my_tab mt,
dummy
where mt.status = dummy.col1 (+)
order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
CUST_ID PAYMENT_ID STATUS AMOUNT PAYMENT_DATE
1 1 Applied 100 07/12/2008
1 2 Reversed 200 06/01/2009
1 2 Reversed -200 06/01/2009
1 3 Applied 300 06/01/2009
2 1 Applied 100 07/12/2008
2 2 Reversed 200 05/01/2009
2 2 Reversed -200 05/01/2009
2 3 Applied 300 06/01/2009
2 4 Reversed -400 06/01/2009
2 4 Reversed 400 06/01/2009
2 5 Applied 500 07/01/2009Edited by: Boneist on 07-Jan-2009 23:10
NB. You may have to mess around with the ordering if that's not come back in the order you wanted. You didn't mention what the rules were for any expected ordering though, so I've made up my own *{;-)
Also, I added an identifier (cust_id) to differentiate between different sets of payments, since that's usually the case. Remove that if it's not applicable for your case. -
Reading a string containing special character from a result set
My Code....
PrintStream p = new PrintStream(fout);
if (connection == null)
connection = getConnection();
CallableStatement proc = connection.prepareCall("{call testing_read()}");
rs = proc.executeQuery();
while ( rs.next() )
String page2 = rs.getString(1);
System.out.println(page2);
rs.getString(1); is a string value eg. 'Rebekah \n Govender' that is being set in a stored procedure.
The output of my program is :'Rebekah \n Govender' , i need for it to read the special characters, and produce this output :
Rebekah
Govender
Without using a result set , it works fine.
eg.
String page2 = 'Rebekah \n Govender'
System.out.println(page2);
Will give an output of :
Rebekah
Govender
I need to read values from the results set, pls help me someone....
Please help....String page2 = rs.getString(1).replace("\\n", "\n"); When you include source code in your posts, please enclose it in CODE tags. There's a button for that above the input textarea.
ThE-MaRaC wrote:
Hi,
you can try something like this:
import java.io.UnsupportedEncodingException;;
* Main class, manages the complete game
public class Main {
public static void main(String[] args) {
String page2 = "Rebekah \n Govender";
try {
page2 = new String(page2.getBytes("ISO-8859-1"), "ETF-8");
} catch (UnsupportedEncodingException e) {}
System.out.println(page2);
}Regards,
Hercog MarioThat is a disgusting hack which you shouldn't be recommending to anyone, and it's totally irrelevant here anyway. Also, as written, it does absolutely nothing because you misspelled "UTF-8" and you swallowed the exception that would have told you so. -
Error while retrieving result set in JTFGRID.
Hi ,
We have developed a custom form where there are various search parameters. Contract Number being one of them. The result set consists of various fields like Contract ID, Contract Number, Contract Number modifier etc. This result is deriving its data from a custom view based on the contract id of the contract selected and populating in the grid.
The issue is the result set is coming only for few contracts and for some it is throwing the below error:
APP-JTF- 210604: Program Error: Please inform your system admin or support representative that:
jtf_grid.populate package reports error :
An unexpected error occurred in jtf_grid.populate
grid :<customgridname>
datasource:<customdatasource>
The following information is available
<null>
The error is most likely in the form or the metadata definition . Please check the following alert for the error code.
The error stack is (first 1000 bytes):
ORA-01722: invalid number
ORA-06512: at "APPS.JTF_GRIDDB" , line 837
ORA-06512: at "APP.JTF_GRIDDB" , line 878
The datatype of the contract id of all the contracts is same. Not sure what the issue is.
Please provide your inputs on the above. If this is not the correct forum for this query then please let me know the correct one.
Thanks a lot,
IshaniBhuvan12 wrote:
suggest me any best practices to create large Excel files.Best practice is to revisit the requirement that suggest an excel file is a solution in the first place. Excel is for humans. Humans don't do well consuming large amounts of data. So either create a machine readable format or create a summerized format for humans.
Maybe you are looking for
-
Definitive thread for iphone not being recognized in itunes in PCs
I have the problem many have mentioned that the iphone is not recognized by itunes at all. I have tried completely uninstalling iTunes, quicktime, anything apple, and deleting the folders. I have tried messing with the plugs, different USB ports. I h
-
I cannot get on the internet by proxy suddently...
All of the problem happend Suddenly!!!!!!!! i met some problem... All of the problem is not appear in Windows 1. I cannot get on the internet by proxy... I try firefox, google-chrome, konqueror, all of them cannot, but opera can. I dont' do anything
-
AQ tables have DATE columns in 9i and TIMESTAMP in 10g
Hi, I created a queue table on 9i and 10g database's using eg: dbms_aqadm.create_queue_table(queue_table => 'TEST', queue_payload_type => 'RAW', multiple_consumers => TRUE, compatible => '8.1.3'); But in 9i ENQ_TIME DATE and 10g ENQ_TIME TIMESTAMP(6)
-
Inbound PO idoc - orders05 and PORDCR
Hi I am sending PO from SAP A to SAP B In SAP B i am getting error 51- enter purchase organisation i am using message type PORDCR and idoc type orders05 when i check in we02...there is no field called EKORG...however there is a segment E1EDK14 with q
-
Subtotal and grand total for two fields(iseg-buchm and iseg-erfmg)
hi experts, how to do subtotal and grand total for two fields (iseg-buchm and iseg-erfmg).please help me on solving the problem.