How to Suppress The Output of a SQL Query In Oracle 11gR2
Hi Friends,
I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
For example:
SQL> set timing on;
SQL> SELECT objProp FROM aradmin.arschema WHERE (schemaId = 175);
OBJPROP+
--------------------------------------------------------------------------------+
*6\60006\4\0\\60008\40\0\60009\4\0\\60010\4\0\\60018\4\0\\600*
*22\4\68\1\63\AR:jRL#*
Elapsed: 00:00:00.00
The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
Please help me at the earliest.
Regards,
Arijit
>
I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
>
How would that even be useful?
A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it?
Similar Messages
-
How to write the output of an SQL query to a text file?
I am using Oracle 11g and SQL plus.
I have a large table called rating.
Whenever I do
SQL> select * from rating;
The output goes much beyond what the SQL Plus screen can show. I want to therefore store the output of this query into a text file.
How can this be done? Please help. Thanks.SQL> SPOOL results.txt
SQL> select * from rating;
SQL> SPOOL OFF -
How to Use the Procedures in a Sql Query
Hi Friends,
Can anyone help me out whether can we use the procedure in the sql query..
if yes help me out with an example
my requirement is
i have one sql query .. in which i need to use the procedure which returns multiple values... how can i overcome it,can anyone help me out for this..
for your reference i am pasting the sql query
SELECT paf.person_id
FROM per_all_assignments_f paf START WITH paf.person_id = p_person_id
AND paf.primary_flag = 'Y'
AND paf.assignment_type IN('E', 'C')
AND l_effective_date BETWEEN paf.effective_start_date
AND paf.effective_end_date
CONNECT BY PRIOR paf.supervisor_id = paf.person_id
AND paf.primary_flag = 'Y'
AND paf.assignment_type IN('E', 'C')
AND l_effective_date BETWEEN paf.effective_start_date
AND paf.effective_end_date
and paf.person_id not in (>>>I HAVE TO USE THE PROCEDURE HERE<<<<);
Thanks in advanceWe never saw your procedure, but maybe you could wrap it in a function
SQL> create or replace procedure get_members(in_something IN number, out_members OUT sys_refcursor)
is
begin
open out_members for
'select level member_id from dual connect by level <= :num' using in_something;
end get_members;
Procedure created.
SQL> create or replace type numbers as table of number;
Type created.
SQL> create or replace function members(in_something IN number)
return numbers
as
member_cur sys_refcursor;
members numbers;
begin
get_members(in_something, member_cur);
fetch member_cur bulk collect into members;
close member_cur;
return members;
end;
Function created.
SQL> select * from table(members(4));
COLUMN_VALUE
1
2
3
4
4 rows selected.Variant on same using piplined function
SQL> create or replace function members_piped(in_something IN number)
return numbers pipelined
as
member_cur sys_refcursor;
rec number;
begin
get_members(in_something, member_cur);
loop
fetch member_cur into rec;
exit when member_cur%notfound;
pipe row(rec);
end loop;
close member_cur;
return;
end;
Function created.
SQL> select * from table(members_piped(4));
COLUMN_VALUE
1
2
3
4
4 rows selected.
SQL> drop function members_piped;
Function dropped.
SQL> drop function members;
Function dropped.
SQL> drop type numbers;
Type dropped.
SQL> drop procedure get_members;
Procedure droppedEdit:
Sorry Blu, had not seen you already posted similar thing
Edited by: Peter on Jan 27, 2011 5:38 AM -
How to measure the performance of a SQL query?
Hello,
I want to measure the performance of a group of SQL queries to compare them, but i don't know how to do it.
Is there any application to do it?
Thanks.You can use STATSPACK (in 10g its called as AWR - Automatic Workload Repository)
Statspack -> A set of SQL, PL/SQL, and SQL*Plus scripts that allow the collection, automation, storage, and viewing of performance data. This feature has been replaced by the Automatic Workload Repository.
Automatic Workload Repository - Collects, processes, and maintains performance statistics for problem detection and self-tuning purposes
Oracle Database Performance Tuning Guide - Automatic Workload Repository
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/autostat.htm#PFGRF02601
or
you can use EXPLAIN PLAN
EXPLAIN PLAN -> A SQL statement that enables examination of the execution plan chosen by the optimizer for DML statements. EXPLAIN PLAN causes the optimizer to choose an execution plan and then to put data describing the plan into a database table.
Oracle Database Performance Tuning Guide - Using EXPLAIN PLAN
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#PFGRF009
Oracle Database SQL Reference - EXPLAIN PLAN
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9010.htm#sthref8881 -
How to read the output of 'tarantella license query' command?
I'm trying to track my license usage (to better determine when to buy new licenses, and to track usage over time).
When I issue the 'tarantella license query command, this is typical of the output I see:
[root@sgdserver ~]# /opt/tarantella/bin/tarantella license query
License usage at: Mon Feb 11 14:03:53 EST 2008
Type In use / Total
Base 6 / 230
UNIX 4 / 230
Mainframe 0 / 230
Windows 0 / 230
AS/400 0 / 230
[root@sgdserver ~]#What is the above saying? Is it saying that I am using 10 licenses out of my 230, or am I just using 6 licenses? In other words, do I add up the numbers or just use the highest one? Or do I just have to worry about the 'Base' license number?
Thanks.The base license is the number of users that are logged into a webtop.
From there you count then connectivity type.
So you have 6 webtop licenses out of 230 consumed and of those 4 users have launched UNIX sessions out of 230 you have licensed.
hope this helps. -
How to use the result of a sql query for a max () function
Hi
I wrote a query on which i wrote
"select max(id) from users "
how can i use the returned value.
if i made the var name ="userid"
can it be userid.rows[0] or what.
thnx for any helpHi!
The result of this query will be the max ID of users' IDs.
Let say we have:
String sql="select max(users.id) from users";
Statement st = ctx.conn.createStatement();
ResultSet rs = st.executeQuery(sql);
rs.next();
So you can get the max Id in the following way:
int maxId=rs.getInt("id");
Regards,
Rossi -
Hi,
I recently came across the option in PSSDiag configuration utility to collect data using the "SQL 2005 tempdb Space and Latching" option. I executed this on a test server and it generated the file {servername}_TempDBAnalysis_Startup.out.
This contains the output of a set of queries that are run in a 10s loop.
I have two questions regarding this output.
1. Are there any of the analytical tools in SQLNexus or PAL that display, summarize, or trend this data in any way? I do not see any but would like to confirm with the forum.
2. If there are no analytical outputs, is there any summary out on the web of how to analyze this data, how to import it into a db, or how to interpret the output of each individual query?
Thanks in advance for any assistance in this matter!Hi Lorrin,
You can reference the below links.
Tool to help you analyze SQL Server SQLDIAG and PSSDIAG output
How to use SQLDiag, SQLNexus and PAL tools to analyze performance issues in SQL Server
If you have any feedback on our support, please click
here.
Eric Zhang
TechNet Community Support -
Pass the result of a SQL Query as table_name for another SQL Query
Hi All,
How to pass the result of a SQL Query as parameter to another SQL Query
Eg: I am doing the steps below.
1) select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ'
2) I want to pass the table_name from step 1 above as parameter to another query "select * from TAB1"
ThanksNaveen B wrote:
Hi All,
How to pass the result of a SQL Query as parameter to another SQL Query
Eg: I am doing the steps below.
1) select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ'
2) I want to pass the table_name from step 1 above as parameter to another query "select * from TAB1"
ThanksYou should craete PL/SQL code with cursor which will accept a parameter and call that cursor inside the first one
But if the first sql returns only one row, you can do it with simple sql code
select * from (select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ')- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/] -
How to suppress the html comment at start of output
Hi,
Does anyone know how to suppress the html comment that ITS inserts at the beginning of the response content.
i.e.:
<!--
This page was created by the
SAP Internet Transaction Server (ITS, Version 6100.1030.61.1891, Build 610.611891, Virtual Server SY1, WGate-AGate Host aauwsd00, WGate-Instance SY1)
Template: znc_xworktime/99/xml.html -->
This appears to be causing havoc with the applet's XML parser...
org.jdom.input.JDOMParseException: Error on line 8: XML declaration may only begin entities.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:468)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
at com.alcatel.ontap.applets.timesheet.TimesheetTableLoader.run(TimesheetTableLoader.java:75)
Caused by: org.xml.sax.SAXParseException: XML declaration may only begin entities.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3364)
at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:1140)
at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1266)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:654)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
... 2 moreCheck out OSS Note No.747818
You can use the ~no_its_header parameter to deactivate the default
header that is generated. As soon as this parameter contains any value,
header generation is suppressed. In ITS 6.20, you can set the parameter
with the AdminTool. You will find the relevant switch under
Security-General.
If the ITS is integrated into the WebAS (SAP Netweaver 04 and higher),
you must maintain the parameter in the ICF service. Note that you have
to maintain the parameter individually for each service.
Regards
Raja -
How to generate the output of a BSP application in PDF format?
Hi,
I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
Could you please share your valuable thoughts on this?
Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
Thanks,
John>
I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
>
How would that even be useful?
A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it? -
Saving the output of a .sql file in .csv format
Hi,
I am saving the output of a .sql file in .csv format. But the problem is , the record of few columns have "new line" character in it, so when it is getting saved in .csv format, those records are coming in multiple rows, but they should come in one single row in single block. Please advise how to overcome this problem.
Regards,
NirajHi Guys,
I guess, there is a misunderstanding.
He is talking about the issue caused as a result of the data containing a "CRLF" ( Carriage return Line feed ) .
That is mainly a data issue.
The query i presume, must be right.
I guess you should be able to fix it using some string functions.
Some thing similar to this
CREATE TABLE ASH (NAME VARCHAR2(10))
SELECT REPLACE(NAME, CHR(13)||CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(13), 'ISH') FROM ASH;
depending on the type of new line whether it is CR or LF. or CRLF.
Regards
Ashish/- -
How to copy the output of procedure to a view or table
Hi...
I created a procedure using Hana Studio and it returns the multiple rows as output.
My query is , how to copy the output to a table or view when it is called like this "cal _SYS_BIC.procedureName "
Please go through the following image:
How to copy the output content to a table or view....
Thank u...Hi Mohan,
The logic is like, you can attach a view(so called column view) to any procedure which returns a result set. SO, instead of calling the procedure using CALL statement, you can simply query the VIEW to get the result set. Internally the procedure will be executed.
Have a look here :
http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf
Eg :
You create a procedure using a result view ProcView to return its results.
CREATE PROCEDURE ProcWithResultView(IN id INT, OUT o1 CUSTOMER) LANGUAGE SQLSCRIPT
READS SQL DATA WITH RESULT VIEW ProcView
AS
BEGIN
o1 = SELECT * FROM CUSTOMER WHERE CUST_ID = :id;
END;
You call this procedure from an SQL statement as follows.
SELECT * FROM ProcView WITH PARAMETERS ('placeholder' = ('$$id$$', '5'));
Hope this helps you to solve the issue
Sreehari -
How to store the output of a analog to digital converter into an 2D array
Hi
I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.nitinkajay wrote:
I want to know how to store the output of a analog to digital converter into an 2D labview array.
How exactly are you performing 'Analog to Digital'???
Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT. -
How to download the output of a report along with column header
Hi,
Could someone please tell me on how to download the output of a report along with column header to .txt format. A download option needs to be given to the user using physical and logical file names .The report basically contains header details and item details and requirement is to download the same format into an .txt format.Hello,
Try this FM:
Data: being of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
end of itab.
data:begin of fld_tab occurs 0,
fld_name(20),
end of fld_tab.
fld_tab = 'Material'.
append fld_tab.
fld_tab = 'Material Desc'.
append fld_tab.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'C:\1.txt '
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES = fld_tab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Naimesh -
How to use the Output clause for the updated statment
How to use the output clause for the below update stament,
DECLARE @MyTableVar table(
sname int NOT NULL)
update A set stat ='USED'
from (select top 1 * from #A
where stat='AVAILABLE' order by sno)A
Output inserted.sname
INTO @MyTableVar;
SELECT sname
FROM @MyTableVar;
Here am getting one error incorrect syntax near Output
i want to return the updated value from output clausesee
http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Maybe you are looking for
-
in our office we have 2 x 16GB 3G IPHONES. one was bought 6 weeks ago, the other 2 weeks ago. both are updated to latest 2.0.2 update. in our office we have wireless, one has perfect signal and is connected and the other which is no more than 1foot a
-
2700 classic / how to install the nokia/ovi maps s...
Hello i figured that some nokia 2700 come with map software (i know it dont have gps) ,but you browse offline .mine dont have it but i saw it had the folders for the maps. when i go to http://europe.nokia.com/support/product-support/maps-support/comp
-
How to use keyword tags effectively in pse 8
No matter what I try, have not been able to make keyword tags work effectively. Have followed all directions from books and others. Even customer support was not able to help. The problem is that tagged photos will not show up by themselves. All othe
-
Hi, Can anyone explain me, how to use KANBAN for production ?
-
Hi every body, I want to make the exe file. I know how to create the executeable jar file. In programme, I have used some properties file. Therefore my exe file should consists of jre,some properties file and jar file. I have found a no. of tools lik