Why does SQL*Plus split query result?
My result is:
ENAME DEPTNO SAL RUNNING_TOTAL DEPARTMENT_TOTAL SEQ
CLARK 10 2450 2450 2450 1
KING 10 5000 7450 7450 2
MILLER 10 1300 8750 8750 3
ADAMS 20 1100 9850 1100 1
FORD 20 3000 12850 4100 2
JONES 20 2975 15825 7075 3
SCOTT 20 3000 18825 10075 4
SMITH 20 800 19625 10875 5
ALLEN 30 1600 21225 1600 1
BLAKE 30 2850 24075 4450 2
JAMES 30 950 25025 5400 3
ENAME DEPTNO SAL RUNNING_TOTAL DEPARTMENT_TOTAL SEQ
MARTIN 30 1250 26275 6650 4
TURNER 30 1500 27775 8150 5
WARD 30 1250 29025 9400 6
14 rows selected.
It is very annoying and I wonder if there is a way to tell SQL*Plus not to split this result into 2 sub-results.
user8931607 wrote:
It is very annoying and I wonder if there is a way to tell SQL*Plus not to split this result into 2 sub-results.Well, then you should RTFM. Discover SQL*Plus PAGESIZE property:
SQL> select ename from emp
2 /
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
ENAME
JAMES
FORD
MILLER
14 rows selected.
SQL> set pagesize 100
SQL> select ename from emp
2 /
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
SQL> SY.
Similar Messages
-
Why does SQL execute inner selected functions again in the outer select?
Hi,
Why does SQL execute inner selected functions again in the outer select?
Given:
CREATE OR REPLACE FUNCTION K_TEST
RETURN NUMBER IS
BEGIN
RETURN 1;
END;
SELECT K_TEST, K_TEST FROM DUAL;Will (logically) execute the function twice.
SELECT intest, intest
FROM (SELECT K_TEST intest FROM DUAL);Will execute the function twice too!
Why can't SQL buffer the inner result?
Does anyone have an idea on how to achieve executing the function only once? My original called function is quite heavy and returning a user defined type. Adding predicates, the function is executed 3 or 4 times!
Thanks for any tips,
K.Hello
Depending on your version of Oracle, Sub query caching could help....
XXXX> create sequence seq_1
2 /
Sequence created.
Elapsed: 00:00:00.07
XXXX> CREATE OR REPLACE FUNCTION K_TEST
2 RETURN NUMBER IS
3
4 ln_Ret NUMBER;
5
6 BEGIN
7 SELECT
8 seq_1.NEXTVAL
9 INTO
10 ln_Ret
11 FROM
12 dual;
13
14 RETURN ln_Ret;
15 END;
16 /
Function created.
Elapsed: 00:00:00.60
XXXX>
XXXX> SELECT K_TEST, K_TEST FROM DUAL;
K_TEST K_TEST
1 2
1 row selected.
Elapsed: 00:00:00.06
XXXX> SELECT K_TEST, K_TEST FROM DUAL;
K_TEST K_TEST
3 4
1 row selected.
Elapsed: 00:00:00.01
XXXX> SELECT intest, intest
2 FROM (SELECT K_TEST intest FROM DUAL);
INTEST INTEST
5 6
1 row selected.
Elapsed: 00:00:00.10
XXXX> SELECT
2 intest,intest
3 FROM
4 (
5 SELECT (SELECT K_TEST FROM dual) intest
6 FROM
7 dual
8
9 )
10 /
INTEST INTEST
7 7
1 row selected.
Elapsed: 00:00:00.03
XXXX> /
INTEST INTEST
8 8
1 row selected.
Elapsed: 00:00:00.01THis last example takes advantage of a specific optimisation for calling functions in a subquery. Not sure if it would suit your circumstance though...
Alternatively - again depending on your version - you might be able to look at function result caching...
HTH
David
Edited by: Bravid on Feb 1, 2012 12:32 PM -
Form won't open until SQL Plus finishes querying
We have Dev.6 Forms patch 5a, NT, Oracle 8.0.5.2.1. If I run a query such as select count(*) from a large table and while this is running I run a form from within form builder the runtime of the form will not come up until SQL PLUS 8.0.5.0.0 returns the result of the count(*). The form has no relation what so ever to the base table in the form.
Any ideas why this is so?Thanks for the suggestions but I don't think I explained the situation correctly.
In sql Plus i write a statement select count(*) from table A in database TEST which would take about 1 minute.
In Forms I am connected to another database TEST2 which is totally unrelated to the database with select running above. The form is a welcome form with a menu and no base tables. When I hit the run button within the form the runtime will not show up until the SQL PLUS session (on another database) has returned its results.
This is NOT normal behaviour, has anyone else experienced this. I only have Developer 6 deployment install and only Net8.
I can open other sessions using TOAD while SQL PLUS is running.
Baffled....
null -
Kodo resultset does not match sqlplus query result
We are attempting to use Kodo's vertical mapping jdo capability to allow
our application's drop down pick lists tsupport multiple languages.
With most of the pick lists/ code tables it appears to work properly.
But with 2 pick lists/ code tables the result sets do retrieved thro
kodo jdo do not match what happens thru sqlplus.
Even though the query asks for only English records, Kodo retrieve 1
record in arabic.
This does not happen in sqlplus
We are using Oracle 10.2.1 and Kodo jdo 3.3
Below is a the kodo trace and sqlplus result
Thanks!
---------------Getting picklist for class: class
gov.state.pisces.jdo.EntryStatusL language en
25375 TRACE [javawsApplicationMain] kodo.Query - executing query: select
from gov.state.pisces.jdo.EntryStatusL where visible == 1 &&
language.languageCode=='en' order by name ascending
25390 TRACE [javawsApplicationMain] kodo.jdbc.SQL - <t 12742366, conn
16761835> [15 ms] executing prepstmnt 12406210 SELECT t1.ENTRY_STATUS_ID,
t0.ID, t1.ENTRY_STATUS_CODE, t1.MODIFICATION_DATE,
t1.MODIFICATION_USER_ID, t1.OWNER, t1.VISIBLE, t0.LANGUAGE_ID,
t0.MODIFICATION_DATE, t0.MODIFICATION_USER_ID, t0.NAME, t0.OWNER FROM
COMMON.LANGUAGE t2, TRAVELER.ENTRY_STATUS t1, TRAVELER.ENTRY_STATUS_L t0
WHERE (t1.VISIBLE = ? AND t2.LANGUAGE_CODE = ?) AND t0.ID =
t1.ENTRY_STATUS_ID AND t0.LANGUAGE_ID = t2.LANGUAGE_ID ORDER BY t0.NAME
ASC [params=(int) 1, (String) en] [reused=0]
Entry Status Lang Id 29
25390 TRACE [javawsApplicationMain] kodo.jdbc.SQL - <t 12742366, conn
16761835> [0 ms] executing prepstmnt 6628690 SELECT t0.LANGUAGE_CODE,
t0.LANGUAGE_NAME, t0.LOCAL, t0.MODIFICATION_DATE, t0.MODIFICATION_USER_ID,
t0.OWNER FROM COMMON.LANGUAGE t0 WHERE t0.LANGUAGE_ID = ? [params=(long)
29] [reused=0]
Entry Status Lang Code en
Entry Status Lang Id 29
Entry Status Lang Code en
Entry Status Lang Id 6
25390 TRACE [javawsApplicationMain] kodo.jdbc.SQL - <t 12742366, conn
16761835> [0 ms] executing prepstmnt 6628690 SELECT t0.LANGUAGE_CODE,
t0.LANGUAGE_NAME, t0.LOCAL, t0.MODIFICATION_DATE, t0.MODIFICATION_USER_ID,
t0.OWNER FROM COMMON.LANGUAGE t0 WHERE t0.LANGUAGE_ID = ? [params=(long)
6] [reused=1]
Entry Status Lang Code ar
WO class gov.state.pisces.jdo.EntryStatusL
WU 6
WO ????
Below is sqlplus results
oracle@ni2 ~]$ sqlplus p_pw1
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 3 20:09:52 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
P_PW1@pisces > @/tmp/l2
6
P_PW1@pisces > r
1 SELECT
2 t0.LANGUAGE_ID,
3 t0.NAME
4 FROM COMMON.LANGUAGE t2, TRAVELER.ENTRY_STATUS t1,
TRAVELER.ENTRY_STATUS_L
t0
5* WHERE (t1.VISIBLE = 1 AND t2.LANGUAGE_CODE = 'en' ) AND t0.ID =
t1.ENTRY_ST
ATUS_ID AND t0.LANGUAGE_ID = t2.LANGUAGE_ID
LANGUAGE_ID
NAME
29
Arriving
29
Departing
29
Transit
P_PW1@pisces >Abe White wrote:
Without understanding your model it's pretty difficult to follow the
SQL. Do you use application identity? It could be a problem with your
application identity class. Also, does your base class have a class
indicator (jdbc-class-ind)? Do you do anything strange like attempt to
use the same primary key value for multiple records?We are using identity-type of "application". We are not using
jdbc-class-ind.
I will stick here wuth the entry_status codess.
Entry_status is the base and entry_status_l has language specific info
Entry status has one primary key - Entry_status_id
Entry_status_l has 2 keys id and language_id
( language_id is the primary key to the language table )
Below are the jdos and the oracle table descriptions
EntryStatus.jdo
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="gov.state.pisces.jdo">
<class name="EntryStatus" identity-type="application">
<extension vendor-name="kodo" key="jdbc-class-ind"
value="subclass-join"/>
<extension vendor-name="kodo" key="jdbc-class-map"
value="base">
<extension vendor-name="kodo" key="table"
value="TRAVELER.ENTRY_STATUS"/>
</extension>
<extension vendor-name="kodo" key="jdbc-version-ind"
value="state-image"/>
<field name="entryStatusCode">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="ENTRY_STATUS_CODE"/>
</extension>
</field>
<field name="entryStatusId" primary-key="true">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="ENTRY_STATUS_ID"/>
</extension>
</field>
<field name="entryStatusLs">
<collection element-type="EntryStatusL"/>
<extension vendor-name="kodo" key="inverse-owner"
value="entryStatus"/>
<extension vendor-name="kodo" key="jdbc-field-map"
value="one-many">
<extension vendor-name="kodo"
key="ref-column.ENTRY_STATUS_ID" value="ID"/>
<extension vendor-name="kodo" key="table"
value="TRAVELER.ENTRY_STATUS_L"/>
</extension>
</field>
<field name="entryStatusName" persistence-modifier="none">
</field>
<field name="modificationDate">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="MODIFICATION_DATE"/>
</extension>
</field>
<field name="modificationUserId">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="MODIFICATION_USER_ID"/>
</extension>
</field>
<field name="owner">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="OWNER"/>
</extension>
</field>
<field name="visible">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="VISIBLE"/>
</extension>
</field>
</class>
</package>
</jdo>
EntryStatusl.jdo
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="gov.state.pisces.jdo">
<class name="EntryStatusL" identity-type="application"
persistence-capable-superclass="EntryStatus">
<extension vendor-name="kodo" key="jdbc-class-map" value="vertical">
<extension vendor-name="kodo"
key="ref-column.ENTRY_STATUS_ID" value="ID"/>
<extension vendor-name="kodo" key="table"
value="TRAVELER.ENTRY_STATUS_L"/>
</extension>
<extension vendor-name="kodo" key="jdbc-version-ind"
value="state-image"/>
<field name="entryStatus">
<extension vendor-name="kodo" key="jdbc-field-map"
value="one-one">
<extension vendor-name="kodo"
key="column.ENTRY_STATUS_ID" value="ID"/>
</extension>
</field>
<field name="id" primary-key="true">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column" value="ID"/>
</extension>
</field>
<field name="language">
<extension vendor-name="kodo" key="jdbc-field-map"
value="one-one">
<extension vendor-name="kodo" key="column.LANGUAGE_ID"
value="LANGUAGE_ID"/>
</extension>
</field>
<field name="languageId" primary-key="true">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="LANGUAGE_ID"/>
</extension>
</field>
<field name="modificationDate">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="MODIFICATION_DATE"/>
</extension>
</field>
<field name="modificationUserId">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="MODIFICATION_USER_ID"/>
</extension>
</field>
<field name="name">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="NAME"/>
</extension>
</field>
<field name="owner">
<extension vendor-name="kodo" key="jdbc-field-map"
value="value">
<extension vendor-name="kodo" key="column"
value="OWNER"/>
</extension>
</field>
</class>
</package>
</jdo>
descriptions of tables
PMAN@pisces > desc traveler.entry_status
Name Null? Type
ENTRY_STATUS_ID NOT NULL NUMBER(35)
ENTRY_STATUS_CODE NOT NULL VARCHAR2(3 CHAR)
LEGACY_NAME VARCHAR2(50 CHAR)
VISIBLE NOT NULL NUMBER(1)
MODIFICATION_DATE NOT NULL DATE
MODIFICATION_USER_ID NOT NULL VARCHAR2(20 CHAR)
OWNER NOT NULL NUMBER(35)
PMAN@pisces > desc traveler.entry_status_l
Name Null? Type
ID NOT NULL NUMBER(35)
LANGUAGE_ID NOT NULL NUMBER(35)
NAME NOT NULL VARCHAR2(255 CHAR)
MODIFICATION_DATE NOT NULL DATE
MODIFICATION_USER_ID NOT NULL VARCHAR2(20 CHAR)
OWNER NOT NULL NUMBER(35) -
Does anyone if there is a method to split up results of a query based on a specific number to stop and split at?
For example, I want to pull out all of these numbers from my database....say 1 - 20. I want to show them on the page in order, but I would want to stop once I hit a preset number, say 12.5, then continue on. So I would need a way to show this:
My Numbers:
1,2,3,4,5,6,7,8,9,10,11,12,.5
Total equalling 12.5
Numbers after split:
.5,14,15,16,17,18,19,20
Total above 12.5
I'm basically adding numbers in my database, but need to cut it off at a certain predetermined point (in this example 12.5) and start the rest after that point.
Right now I'm using coding that tries to split the results from a users input and insert them into the database. I'm running into problems displaying that data correctly though. It seems it would make more sense to just input everything normally, then display everything and spit it there.
Any help in the right direction would be greatly appreciated. I'm stumped on this!Hmmm, I'm doing some research on the Query of Queries, I'm not sure if that will work. I'm wondering how that method would know to split an entry in the db. Because if I wanted to stop at 12.5 it would actually have to split 13 in half and give .5 to the first section and .5 to the second section.
-
Hiding SQL statement in Query Result Window
Hi everyone,
Is it possible to hide the SQL statement from a query result window? This can usually be done by click the orange triangle that is positioned to the left of the SQL string box (to expand and collapse it). The System Queries have this box collapsed per default, is it possible to have this setup as default for all queries, including the custom? If so, please let me know where this can be done.
CheersYou should do this only with SDK programming - dont allow to show the syntax. The next, but problematic way, is the code you have do inside stored procedure and call only this sp inside the query generator window - if you have there some input parameters, you should use filling variables before executing sp and get it as input parameters to sp.
-
Why Start SQL*Plus with /nolog
What is the difference between starting SQL*Plus as in
sqlplus sys as sysdba
versus
sqlplus /nolog
connect sys as sysdba
I can imagine that the second method prevents some log file from being written but sometimes logs are useful. Is there more to it than that?
Thanks,
GregoryIt's really interesting to see how a question like this gets answered. Some of what you've been told is true, some not, and most of it is a red herring...
First, using /nolog (as has been correctly stated) has nothing to do with logging. It means "start sqlplus but don't log on to any database just yet"
Second, its user or lack of has nothing to do with connecting as sys, as sysdba, or any other special connection. It means, simply and only, "start sqlplus but don't log on to any database just yet"
It has nothing to do with the ability to run a sql script.
It has nothing to do with your ability to supply a password.
One reason to use it in a *nix environment is to be able to hide the userid and/or password from someone querying processes. As was hinted at, if someone performs a 'ps -ef', they will see the full command line that started the processes. So, if you start with
$>sqlplus system/manager
a ps -f will show the username and password.
If you start with
$>sqlplus system
you will be prompted for password and ps -ef will show the username, because it was on the command line
If you start with
$>sqlplus /nolog
Then supply the username and pswd manually (or in a script), then ps -ef will only show that sqlplus is running, but will not reveal anything about the credentials used. -
PL/SQL to map query results to a column?
Is there a programmatic way to map the query result to a value in a table?
I have table A. There's a column with a carat-delimited string 0^0^1^ that I can parse with substr/instr functions. So, query that table/column for a 5th digit that sits between 5th and 6th ^ character.
There's table B. It has a 'position' column and 'key' column. How do I let the table A know that when I query table A for 5th digit, it needs to map to table B's where position=5?
thanks,Did you try to run those statements? Please do so next time.
Also the creation of table C (or is it D) and E are missing.
However, the tricky part is in deciphering table A to make up for the flawed design.
I hope this piece of SQL is helpful for you, because you could join the outcome to your other tables:
SQL> create table a
2 ( visitor_id number(*,0),
3 adate date,
4 carat varchar2(4000 byte),
5 ip_address varchar2(4000 byte),
6 state varchar2(4000 byte),
7 city varchar2(4000 byte),
8 id number(*,0) not null enable,
9 constraint "a" primary key (id)
10 )
11 /
Tabel is aangemaakt.
SQL> insert into A
2 (VISITOR_ID,ADATE,CARAT,IP_ADDRESS,STATE,city,id) VALUES(194296532,TO_DATE('2007-06-26.00.01.46',''),'-1^1^2^0^3^85741^3^0^176^0^1
^-1^41^-1^-1^US^0^-1^2^0^1^^^^^^^','71.226.9.44','az','tucson',1);
1 rij is aangemaakt.
SQL> insert into A
2 (VISITOR_ID,ADATE,CARAT,IP_ADDRESS,STATE,city,id) VALUES(37482918,TO_DATE('2007-06-26.00.01.46',''),'0^1^2^5^^78154^3^7^184^0^1^2^
17^2^1^US^1^0^1^0^0^^^^^^^','70.163.196.111','tx','san antonio',2);
1 rij is aangemaakt.
SQL> select id
2 , visitor_id
3 , i position
4 , c value
5 from a
6 model
7 return updated rows
8 partition by (id, visitor_id)
9 dimension by (0 i)
10 measures ('^' || carat || '^' c)
11 rules
12 ( c[for i from 1 to length(regexp_replace(c[0],'[^\^]'))-1 increment 1]
13 = regexp_substr(c[0],'[^\^]+',1,cv(i))
14 )
15 order by id
16 , position
17 /
ID VISITOR_ID POSITION VALUE
1 194296532 1 -1
1 194296532 2 1
1 194296532 3 2
1 194296532 4 0
1 194296532 5 3
1 194296532 6 85741
1 194296532 7 3
1 194296532 8 0
1 194296532 9 176
1 194296532 10 0
1 194296532 11 1
1 194296532 12 -1
1 194296532 13 41
1 194296532 14 -1
1 194296532 15 -1
1 194296532 16 US
1 194296532 17 0
1 194296532 18 -1
1 194296532 19 2
1 194296532 20 0
1 194296532 21 1
1 194296532 22
1 194296532 23
1 194296532 24
1 194296532 25
1 194296532 26
1 194296532 27
1 194296532 28
2 37482918 1 0
2 37482918 2 1
2 37482918 3 2
2 37482918 4 5
2 37482918 5 78154
2 37482918 6 3
2 37482918 7 7
2 37482918 8 184
2 37482918 9 0
2 37482918 10 1
2 37482918 11 2
2 37482918 12 17
2 37482918 13 2
2 37482918 14 1
2 37482918 15 US
2 37482918 16 1
2 37482918 17 0
2 37482918 18 1
2 37482918 19 0
2 37482918 20 0
2 37482918 21
2 37482918 22
2 37482918 23
2 37482918 24
2 37482918 25
2 37482918 26
2 37482918 27
2 37482918 28
56 rijen zijn geselecteerd.Regards,
Rob. -
What does "*" mean in my query result?
Hello all,
I met a problem in my query result which was some of cells in one KF column didn't display the amount but instead with * . Could anybody tell me what the wrong was?
thanks
RyanHi Ryan,
This normally happens when the key figures refers to a unit / currency and the units and currencies are different for different records in the result set of the query.
BEx couldn't sum amounts with different currency or value with different unit. hence you get a '*'. However if you put your cursor on the cell then you can actually see total amount in the cell value at the top header of the excel.
Hope it helps.
Thanks
Soumya -
Does SQL Plus recognize any type of newline character from DBMS_OUTPUT?
I am building a complex string inside a procedure and displaying with dbms_output.put_line. It works fine in SQL Developer but when I use it in SQL Plus it comes out goofy. It's been narrowed down to me using CHR(10) where I want line breaks. Is it possible to display a "formatted" varchar2 in SQL Plus as I'm expecting them? I even tried using .put with no luck.
Using:
Oracle 10.2.0.4.0
SQL Plus 10.2.0.1 / 9.2.something
Here's a small example:
set serverout on
set linesize 10
declare
lv_string varchar2(32767);
begin
for x in 1..5
loop
lv_string := lv_string || 'I AM LINE ' || to_char(x) || chr(10);
end loop;
dbms_output.put_line(lv_string);
end;
Expected Output (What I'm getting in SQL Developer):
I AM LINE 1
I AM LINE 2
I AM LINE 3
I AM LINE 4
I AM LINE 5
Actual Output (SQL Plus):
I AM LINE
1
I AM
LINE 2
I
AM LINE
3
I AM
LINE 4
I
AM LINE 5Right now I'm using a workaround, but would like to use a character (or combination of character) that SQL Plus will play nice with...if there are any.
declare
lv_string varchar2(32767);
lv_start pls_integer;
lv_end pls_integer := 0;
c_newl constant varchar2(1) := chr(10);
begin
for x in 1..200
loop
lv_string := lv_string || 'I AM LINE ' || to_char(x) || c_newl;
end loop;
loop
lv_start := lv_end + 1;
lv_end := instr(lv_string, c_newl, lv_start);
exit when lv_end <= lv_start;
dbms_output.put_line(substr(lv_string, lv_start, lv_end- lv_start));
end loop;
end;Hi,
you need to increase your linesize:
SQL> declare
2 lv_string varchar2(32767);
3 begin
4 for x in 1..5
5 loop
6 lv_string := lv_string || 'I AM LINE ' || to_char(x) || chr(10);
7 end loop;
8 dbms_output.put_line(lv_string);
9 end;
10 /
I AM LINE
1
I AM
LINE 2
I
AM LINE
3
I AM
LINE 4
I
AM LINE 5
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
SQL> set lines 255
SQL> declare
2 lv_string varchar2(32767);
3 begin
4 for x in 1..5
5 loop
6 lv_string := lv_string || 'I AM LINE ' || to_char(x) || chr(10);
7 end loop;
8 dbms_output.put_line(lv_string);
9 end;
10 /
I AM LINE 1
I AM LINE 2
I AM LINE 3
I AM LINE 4
I AM LINE 5
PL/SQL procedure successfully completed. -
Why does SQL bring back all values in a single condition quicker?
Hi All,
I've stumbled across an interesting yet frustrating problem with one of our Discoverer Reports. The problem unfortunately is related to performance, which can be a never-ending struggle, as we all know.
Scenario:
We have a report that contains multiple outer joins that retrieves information from other sub ledgers. The type of report is tabular and it has a single page item called period name. A parameter has been setup on the period name column, which allows users to specify which period they want to report on. This is a real time report transaction report.
Problem:
The report takes various times to run depending on the amount of periods selected via the parameters. Timings are shown below –
All Periods – 2 min 22 sec (36 Periods selected – 7 have data)
Apr - 0 min 43 sec (01 Periods)
Apr + May - 1 min 06 sec (02 Periods)
Apr + May + Jun - 1 min 36 sec (03 Periods)
Apr + May + Jun + Jul - 2 min 29 sec (04 Periods)
Apr + May + Jun + Jul + Aug - 3 min 15 sec (05 Periods)
Question:
I’m finding it very hard to understand why the time taken to run the report for 5 periods IS NOT quicker than running the report for all periods because the condition/where clause would have been refined?
I can confirm that the Period column is indexed. I’m not going to post the execution plans, as each are 117 rows long. I’m rather hoping some of you might have experienced something similar, and therefore able to point me in the right direction.
Thanks,
LanceHi Rod,
Looking at the SQL generated in Discoverer this is what I get for All Periods:
Where ‘…….’
AND (o227124.i227127 IN ('MAR-07','FEB-07','JAN-07','DEC-06','NOV-06','OCT-06','SEP-06','AUG-06','JUL-06','JUN-06','MAY-06','APR-06','MAR-06','FEB-06','JAN-06','DEC-05','NOV-05','OCT-05','SEP-05','AUG-05','JUL-05','JUN-05','MAY-05','APR-05','MAR-05','FEB-05','JAN-05','DEC-04','NOV-04','OCT-04','SEP-04','AUG-04','JUL-04','JUN-04','MAY-04','APR-04','MAR-04','FEB-04','JAN-04','DEC-03','NOV-03','OCT-03','SEP-03','AUG-03','JUL-03','JUN-03','MAY-03','APR-03','MAR-03','FEB-03','JAN-03','DEC-02','NOV-02','OCT-02','SEP-02','AUG-02','JUL-02','JUN-02','MAY-02','APR-02','MAR-02'))
Statistics For All Periods
351 recursive calls
0 db block gets
32301 consistent gets
61 physical reads
0 redo size
500 bytes sent via SQL*Net to client
13147 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
0 rows processed
And this is what I get for 6 Periods
AND (o227124.i227127 IN ('AUG-06','SEP-06','JUL-06','JUN-06','MAY-06','APR-06'))
Statistics For 6 Periods
351 recursive calls
0 db block gets
32301 consistent gets
7 physical reads
0 redo size
509 bytes sent via SQL*Net to client
11736 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
0 rows processed
Looking at the statistics the ‘All Periods’ query should take longer than the 6 periods, however this is not the case.
Thanks,
Lance
Message was edited by:
Lance Botha -
How does SQL*PLUS read script files
Hello!
well, it is possible to start sqlplus with an sql script file:
sqlplus user/pass@srv @my_script.sqlok, so what happens if I delete the file my_script.sql ?
My script here is about 1 GB big! sqlplus was half way done when I deleted the file.
Is the sqlplus going to stop with an error? Or just hang?
I copied the my_script.sql file now to the folder again and I think that sqlplus is still working fine. But can I be sure, that all statements in the script have been processed?
Thanks in advance!Results are OS dependent which you declined to share with us.
I suspect *NIX & not Windoze.
On Windoze, you can not delete open file.
On *NIX open file does not actually get deleted until fclose() is called.
All in all, you are OK. -
Why does SQL Developer sometimes refuse to activate the debug controls?
I can find the procedure or package that I want to work in, compile it for debug, set break points, provide the required input parameters, and sometimes SQL Developer works as expected. That is, it activates the debug control buttons (step into, step over, etc.) But, other times, it just leaves them greyed out. Why? I find this frustrating.
OK, maybe my version of SQL Developer is a bit old, but I have seen this occasionally in every version of Sql Developer I have used. I now have SQL Developer 2.1.0.63. We have an Oracle11.1.0.7 database. I have a 64-bit Windows7 desktop. I think my Java version is also a bit old, but it seems to be compatible with the EBS R12.0.6 application that I need to support. I'm not a Java expert. If I go to a C:\ prompt, and type: "java -version", It returns: "1.4.2_04".>
I now have SQL Developer 2.1.0.63.
>
Maybe so but why aren't you using the latest 3.x version? There have been many bug fixes and new functionality since the version you are using.
>
I think my Java version is also a bit old
>
You think? Java 7 is out so version 1.4.2 is definitely old. And especially if you support EBS because I think R12 itself uses Java 1.5
You may want to check the EBS forum
Java/JRE Version compatabile for R12.0.6
And now you have an Oracle 11.1 database?
Here is the official link that has the jdbc and oracle version support
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#02_02
>
See section - Which JDBC drivers support which versions of Javasoft's JDK?
11.1.0 OCI and THIN Driver - JDK 1.5.x and JDK 1.6.x
Please note that JDK 1.4 is not supported by the 11 drivers.
>
Did you notice that last line?
You may want to rethink your plan to use those older versions of Java and SQL Developer. -
Why does SQL Developer sometimes not allow me to "Disconnect"?
Sometimes when I'm ready to close SQL Developer, I try to get out gracefully, but the "Disconnect" option for the only connection I have open is greyed out. Why? The only option I know then is to close SQL Developer by clicking the "x" in the upper, right corner.
My version of SQL Developer is a bit old: I have SQL Developer 2.1.0.63. We have an Oracle11.1.0.7 database. I have a 64-bit Windows7 desktop. I think my Java version is also a bit old, but it seems to be compatible with the EBS R12.0.6 application that I need to support. I'm not a Java expert. If I go to a C:\ prompt, and type: "java -version", It returns: "1.4.2_04".Actually, I think the link Alessandro posted is helpful. I cannot reproduce the behavior on Win XP, but can on Linux (somewhat). That is, Properties gets greyed out at times, but not Disconnect or Apply Filter. Retrying the right-click resolves the problem, as he notes.
So I assume my point (1) would be more nearly correct if restated as "Bug or timing issue".
As for (3), I really cannot give a good example. If I open a Tool menu item like Monitor SQL or Monitor Sessions on, say, the SYSTEM user, the Disconnect option is not greyed out and if used will close all the open windows for that connection. If I run Debug on a package/procedure/function, Disconnect also remains enabled. Clicking on it produces a "Cannot Disconnect" dialog warning with this text: "The database connection cannot be closed while an active debugging session exists". Perhaps I'm mistaken entirely, or just confused after seeing that behavior on some older version of SQL Developer
-Gary -
Why does SQL Developer insist on opening up the package header?
When expanding a package (clicking the '+') SQL Developer keeps opening up the package header (at least the first time you click it). I'm very rarely interested in viewing the header and it's annoying to have all those tabs open.
See SQL Dev 2.1 RC1 - Expanding packages under Schema Browser
Don't know if dev filed a bug against this, so to be sure you'd have to log a SR on Metalink/MOS.
Regards,
K.
Maybe you are looking for
-
Error when substracting 2 dates in Packgage using toad
Hi there , I am having a problem when calculating dates in a package usiong Toad. I have my function : FUNCTION PORTFOLIO_MEMO_RPT_Sql ( schema_name IN VARCHAR2 , select_business_date IN DATE ) RETURN VARCHAR2 SELECT DISTINCT Case when
-
Access plot colors programmatically
Hi all, When plotting multiple plots on the same axes, Labview automatically assigns each plot a different colour. How can I programmatically access this colour sequence (an array?) and set it with an array of colours I choose? Regards, Jamie Using L
-
Lightroom disk image won't open
I've downloaded the Lightroom 4.4 disk image twice (to the default download folder) but neither will open on my Snow Leopard Mac. I get a message that it is "not recognized". What's the remedy?
-
Error Activating Plugin for OpenText LiveLink
SES 10.1.8.3 I am trying to activate the identity plugin for OpenText Livelink. Global-Settings->Activate Identity Plugin Class Name oracle.search.plugin.security.identity.llcs.LLCSIdentityPluginManager Jar file ../llcs/LL
-
Syncing calendars without docking. Is it possible?
I'm finding that I change my iCal often during the day, but if I don't have my iPhone plugged in to sync, that I often find myself out somewhere with in accurate calendar info. Since the thing has wifi, wouldn't it be nice if the iPHone could sync up