Connect by in R2 return strange result.
Step to reproduce:
1.
create or replace type TST_OBJ_REC as object (
ID Integer,
Parent_ID Integer,
OValue Integer
);2.
create or replace type TST_OBJ_TBL as table of TST_OBJ_REC;3.
create table TST_TBL as select * from TABLE(TST_OBJ_TBL (
TST_OBJ_REC(ID => 1, Parent_ID => -1, OValue => 1),
TST_OBJ_REC(ID => 2, Parent_ID => 1, OValue => 2),
TST_OBJ_REC(ID => 3, Parent_ID => 2, OValue => 3)
));Query on table:
select * from tst_tbl a
connect by prior a.id = a.parent_id
start with a.id = 2All fine:
ID PARENT_ID OVALUE
2 1 2
3 2 3
Query from object:
select * from (TABLE(TST_OBJ_TBL (
TST_OBJ_REC(ID => 1, Parent_ID => -1, OValue => 1),
TST_OBJ_REC(ID => 2, Parent_ID => 1, OValue => 2),
TST_OBJ_REC(ID => 3, Parent_ID => 2, OValue => 3)
))) a
connect by prior a.id = a.parent_id
start with a.id = 2Result different !!
ID PARENT_ID OVALUE
2 1 null
3 2 null
select A.* from (TABLE(TST_OBJ_TBL (
TST_OBJ_REC(ID => 1, Parent_ID => -1, OValue => 1),
TST_OBJ_REC(ID => 2, Parent_ID => 1, OValue => 2),
TST_OBJ_REC(ID => 3, Parent_ID => 2, OValue => 3)
))) a
connect by prior a.id = a.parent_idstart with a.id = 2
ID PARENT_ID OVALUE
null null null
select A.*, connect_by_isleaf from (TABLE(TST_OBJ_TBL (
TST_OBJ_REC(ID => 1, Parent_ID => -1, OValue => 1),
TST_OBJ_REC(ID => 2, Parent_ID => 1, OValue => 2),
TST_OBJ_REC(ID => 3, Parent_ID => 2, OValue => 3)
))) a
connect by prior a.id = a.parent_id
start with a.id = 2ID PARENT_ID OVALUE connect_by_isleaf
null null null 1
And final
select id, parent_id, oValue, connect_by_isleaf from (TABLE(TST_OBJ_TBL (
TST_OBJ_REC(ID => 1, Parent_ID => -1, OValue => 1),
TST_OBJ_REC(ID => 2, Parent_ID => 1, OValue => 2),
TST_OBJ_REC(ID => 3, Parent_ID => 2, OValue => 3)
))) a
connect by prior a.id = a.parent_id
start with a.id = 2ID PARENT_ID OVALUE connect_by_isleaf
2 1 2 0
3 2 3 1
This behaviour normal ? In 11R1 All ok.
Edited by: D.Andreychik on 07.06.2010 7:38
Edited by: D.Andreychik on 07.06.2010 7:40
Please read the FAQ and learn how to use tags to make your listing readable.
Then update your post so it will be properly formatted. Thank you.
Similar Messages
-
Help - count function returns strange results
hi everyone,
here's my scenario: i'm trying to get the NUMBER OF REPORTS and NUMBER OF
IMAGES GROUP BY MONTH from the two tables below.
REPORT
reportid(*primary key)
date
IMAGE
reportid(*foreign key referring to report's table)
image
sample output:
MONTH NO.OF REPORTS NO. OF IMAGES
feb 01 10 9
mar 01 12 8
my SQL goes like this:
select to_char(date, 'month-yy'),
count(REPORT.reportid), count(IMAGE.reportid)
from REPORT, IMAGE
where REPORT.reportid = IMAGE.reportid
group by to_char(date, 'month-yy')
the above sql yielded strange results, number of images is equal to the number of reports, which is of course wrong! as one report may or may not contain one or more image.
i dont know what's wrong with the above statement, but if i were to group it
by REPORTID and DAY rather than MONTH, then amazingly it works! what's
wrong with the count, why does it give me the same result if i group by
MONTH.
can anyone shed some light on this?try using the following example:
Table TEST_REPORT
RPTID RPTDATE
1 02-JAN-01
3 02-JAN-01
2 02-JAN-01
5 11-FEB-01
6 11-FEB-01
7 11-FEB-01
Table TEST_IMAGE
RPTID IM
1 1
2 1
3 1
SQL:
select to_char(rptdate,'MON-YYYY'),
sum(decode(a.rptid,null,0,1)) report_cnt,
sum(decode(b.rptid,null,0,1)) image_cnt
from test_report a, test_image b
where a.rptid = b.rptid(+)
group by to_char(rptdate,'MON-YYYY');
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by skcedric:
hi everyone,
here's my scenario: i'm trying to get the NUMBER OF REPORTS and NUMBER OF
IMAGES GROUP BY MONTH from the two tables below.
REPORT
reportid(*primary key)
date
IMAGE
reportid(*foreign key referring to report's table)
image
sample output:
MONTH NO.OF REPORTS NO. OF IMAGES
feb 01 10 9
mar 01 12 8
my SQL goes like this:
select to_char(date, 'month-yy'),
count(REPORT.reportid), count(IMAGE.reportid)
from REPORT, IMAGE
where REPORT.reportid = IMAGE.reportid
group by to_char(date, 'month-yy')
the above sql yielded strange results, number of images is equal to the number of reports, which is of course wrong! as one report may or may not contain one or more image.
i dont know what's wrong with the above statement, but if i were to group it
by REPORTID and DAY rather than MONTH, then amazingly it works! what's
wrong with the count, why does it give me the same result if i group by
MONTH.
can anyone shed some light on this? <HR></BLOCKQUOTE>
null -
ResultSet returning strange results for BIGINT datatype, using rs.getLong()
In a MySQL db I have a value of 10 for the BIGINT primary key column 'account', which is auto-incrementing.
The result of rs.getLong("account") is:
4.294967305E9
Not exactly the answer I was looking for. The other column, 'phoneNum', also a BIGINT, and also using rs.getLong("phoneNum") is returning correctly.
And ideas why?The number in question is 4,294,967,305. There was another thread here recently about MySQL using numbers that are just slightly above 2^32 (which is 4,294,967,296) in auto-increment columns.
-
ProxyHistory returns strange results
Hi,
I am trying to programmatically access the mailbox into which I most recently proxied via the GUI.
From what I understand, a call to Groupwise.Account.Application.ProxyHistory should return a collection of mailboxes into which I recently proxied via the Groupwise GUI. When I iterate over the returned collection, some of the mailboxes are missing or are replaced by other mailboxes in the list.
For example, my Proxy list on the Groupwise GUI shows:
Me
Proxy...
1. UserA
2. UserB
3. UserC
4. UserD
5. UserE
6. UserF
7. UserG
8. UserH
9. UserI
A call to the ProxyHistory function returns:
1. Me
2. Me
3. Me
4. UserD
5. UserE
6. UserE
7. UserG
8. UserG
9. UserG
Is this discrepancy a known issue? Is there a workaround for this problem?
Thank you,
MThere's no such method
There's
getProxyListRequest
If that's what you mean. But no method called ProxyHistory
OTOH, there's such an animal in OBJECT API. Perhaps you should post on
that forum.
On 7/20/2010 12:05 PM, MK wrote:
> Hi,
> I am trying to programmatically access the mailbox into which I most
> recently proxied via the GUI.
> From what I understand, a call to
> Groupwise.Account.Application.ProxyHistory should return a collection of
> mailboxes into which I recently proxied via the Groupwise GUI. When I
> iterate over the returned collection, some of the mailboxes are missing
> or are replaced by other mailboxes in the list.
> For example, my Proxy list on the Groupwise GUI shows:
> Me
> Proxy...
> 1. UserA
> 2. UserB
> 3. UserC
> 4. UserD
> 5. UserE
> 6. UserF
> 7. UserG
> 8. UserH
> 9. UserI
> A call to the ProxyHistory function returns:
> 1. Me
> 2. Me
> 3. Me
> 4. UserD
> 5. UserE
> 6. UserE
> 7. UserG
> 8. UserG
> 9. UserG
> Is this discrepancy a known issue? Is there a workaround for this problem?
> Thank you,
> M -
[Solved] pacman -Qtdq is returning strange results - Please Help!
Hi guys,
I'm having an issue with the pacman command -
#pacman -Qtdq
It has been spitting out some VERY odd results. Here
[anders@Freki ~]$ pacman -Qtdq
abs
agave
alsa-utils
archlinux-artwork
arj
aspell-en
audacity
autoconf
automake
bacula
banshee
beanshell
bleachbit
bluefish
calibre
cryptsetup
dash
dosfstools
ekiga
expect
fakeroot
feh
file-roller
firefox
flex
gcalctool
gconf-editor
gedit
git
gksu
gnome-color-manager
gnome-disk-utility
gnome-media
gnome-nettool
gnome-power-manager
gnome-utils
gpart
gparted
grub2-bios
gstreamer0.10-bad-plugins
gtk-doc
handbrake
hardinfo
heirloom-mailx
hsqldb-java
hunspell-en
hyphen-en
icedtea-web
initscripts
inkscape
iputils
jfsutils
less
libdvdcss
libmspack
libmythes
libreoffice-base
libreoffice-calc
libreoffice-draw
libreoffice-extension-ct2n
libreoffice-extension-diagram
libreoffice-extension-google-docs
libreoffice-extension-hunart
libreoffice-extension-nlpsolver
libreoffice-extension-numbertext
libreoffice-extension-oooblogger
libreoffice-extension-pdfimport
libreoffice-extension-presentation-minimizer
libreoffice-extension-presenter-screen
libreoffice-extension-report-builder
libreoffice-extension-scripting-beanshell
libreoffice-extension-scripting-javascript
libreoffice-extension-scripting-python
libreoffice-extension-typo
libreoffice-extension-validator
libreoffice-extension-watch-window
libreoffice-extension-wiki-publisher
libreoffice-gnome
libreoffice-impress
libreoffice-math
libreoffice-sdk-doc
libreoffice-writer
libwpg
licenses
lm_sensors
logrotate
lucene
lvm2
man-db
man-pages
mdadm
mesa-demos
mousetweaks
mythes-en
nano
ntfsprogs
openshot
os-prober
pacman
parcellite
patch
pcmciautils
perl-passwd-md5
pkg-config
pstoedit
python2-gtkspell
python2-numpy
rdesktop
reiserfsprogs
samba
skype
skype-call-recorder
sound-juicer
soundconverter
subversion
sudo
syslog-ng
telepathy-butterfly
telepathy-gabble
telepathy-haze
telepathy-idle
telepathy-salut
telepathy-sofiasip
texlive-core
thunderbird
tomboy
tomoyo-tools
truecrypt
ufw
unace
unetbootin
uniconvertor
unrar
vala
vi
vigra
vino
virtualbox
virtualbox-additions
wgetpaste
which
wicd-gtk
xchat
xdotool
xf86-video-ati
xfsprogs
xorg-twm
xorg-utils
xorg-xclock
xorg-xinit
xsane-gimp
xscreensaver
xterm
I first noticed this when I removed lxde and awesome after I was done playing with them and pacman took out pkgs necessary to run gnome. As you can see some x pkgs are listed as orphans, along with things that were not orphans before, like abs and firefox. My orphan list used to be only a few items long because gwibber apparenly has some build items that are no longer needed after install like dee and vala.
I've tried reinstalling the listed pkgs, ALL of my installed pkgs, and nothing. It keeps reporting this same string of pkgs and it is making me afraid to remove xscreensaver (the one thing on the list I don't want to keep) because I am afriad of pacman taking out too many pkgs. Installs seem to be working just fine, and I only use pacman to install pkgs on this system, I always use
sudo pacman -S pkgname
or
sudo pacman -U /path/to/aur/pkg
and I only update via
sudo pacman -Syu
So is there any way to "rebuild" the dependancy tree that I don't know about? I looked thourgh the Wiki and did not see anything.
Could I have removed a pkg(s) that has broken Pacman's dependancy tree?
Is there any more info that you guys might need to help me out with this?
- Thanks for any help,
Anders H
Last edited by Anders H (2012-02-14 09:34:13)For some reason theses packages are installed as a dependency for another package, but they're not required by any package.
Can you post the output of e.g. 'pacman -Qi less'?
-D, --database
Modify the package database. This operation allows you to modify
certain attributes of the installed packages in pacman’s database.
At the moment, you can only change the install reason using
--asdeps and --asexplicit options.
[karol@black ~]$ pacman -Qi less
Name : less
Version : 444-3
URL : http://www.greenwoodsoftware.com/less
Licenses : GPL3
Groups : base
Provides : None
Depends On : ncurses pcre
Optional Deps : None
Required By : None
Conflicts With : None
Replaces : None
Installed Size : 220,00 KiB
Packager : Allan McRae <[email protected]>
Architecture : i686
Build Date : pon, 6 lut 2012, 03:25:08
Install Date : czw, 9 lut 2012, 21:09:29
Install Reason : Explicitly installed
Install Script : No
Description : A terminal based program for viewing text files
[karol@black ~]$ pacman -Qi less | grep -e "Required By" -e "Install Reason"
Required By : None
Install Reason : Explicitly installed
[karol@black ~]$ pacman -Qdt
[karol@black ~]$ pacman -D --asdeps less
less: install reason has been set to 'installed as dependency'
[karol@black ~]$ pacman -Qi less | grep -e "Required By" -e "Install Reason"
Required By : None
Install Reason : Installed as a dependency for another package
[karol@black ~]$ pacman -Qdt
less 444-3
I've changed the install reason and now 'less' shows up as an orphan. -
LibreOffice Calc - insertion of current date returns strange result
Hey,
When i want to insert the current date with the command TODAY() i get a result like this:
25.[~bu250i0t] Oktober 2011
The [~bu250i0t] is obviously what annoys me! How do i get it away?
CheersWhy the language? My mother tongue happens to be German, nothing wrong about that!
I just want to get rid of the digits and letters within the date...
Last edited by gunjah292 (2011-10-25 16:54:38) -
IsTransactionDirty returns strange results ?
Jclient, if I insert a record and then I call as follows:
boolean result = panelBinding.isTransactionDirty();
or
boolean result2 = panelBinding.findIterBinding("testIter").getApplicationModule().getTransaction().isDirty();
System.out.println(result + " " + result2);
Output:
true false
does anyone know why the results are not the same ?Jclient, if I insert a record and then I call as follows:
boolean result = panelBinding.isTransactionDirty();
or
boolean result2 = panelBinding.findIterBinding("testIter").getApplicationModule().getTransaction().isDirty();
System.out.println(result + " " + result2);
Output:
true false
does anyone know why the results are not the same ? -
CONNECT BY query doesn't return any results...
Hi All
I am trying to execute this CONNECT BY query...but it does not return any result.
Could anyone please suggests what am I doing wrong. Or how should I modify the query to get the results.
SELECT Distinct dt.DID FROM DEPT dt left outer join EMPLOYEE emp on dt.DID = emp.DID WHERE dt.parentid in (SELECT DEPT.DID FROM DEPT CONNECT BY PRIOR DEPT.DID = DEPT.PARENTID START WITH DEPT.PARENTID in (2000,-2000)) or dt.parentid=2000
Any help would be really really appreciated.
Thanks and Regards
-JosefTake the nested query and run it in SQL developer (or SQL Plus) against the database directly. Does it give any results? That query returning no results is the most likely cause of the problem.
-
Strange result from insert into...select query
Hello guys,
I need your preciuos help for a question maybe simple, but that I can't explain by myself!
I have a query of "insert into...select" that, as I have explained in the title, returns a strange result. In facts, If I execute ONLY the SELECT statement the query returns the expected result (so 2 rows); instead If I execute the entire statement, that is the "insert into...select", the query returns 0 rows inserted!!
Following an example of the query:
INSERT
INTO TITOLI_ORI
COD_TITOLO_RICCONS ,
D_ESTRAZIONE ,
COD_SOCIETA ,
COD_PIANO_CONTABILE ,
COD_CONTO_CONTABILE ,
COD_RUBRICATO_STATISTICO_1 ,
COD_NDG ,
NUM_ESEGUITO ,
CUR_IMPORTO_RICCONS ,
CUR_IMPORTO_BICO ,
FLG_MODIFICATO ,
CUR_NON_ASSEGNATO ,
FLG_QUOTATO ,
COD_CATEG ,
TIP_COPERTURA ,
TIPTAS_TITOLO
SELECT NEWID,
'28-feb-2111',
COD_SOCIETA,
COD_PIANO_CONTABILE,
COD_CONTO_CONTABILE,
COD_RUBRICATO_STATISTICO_1,
COD_NDG,
NUM_ESEGUITO,
CUR_VAL_IMPEGNI,
'ABC' as CUR_IMPORTO_BICO,
0 as FLG_MODIFICATO,
NULL as CUR_NON_ASSEGNATO,
FLG_QUOTATO,
COD_CATEG,
TIP_COPERTURA,
TIP_TASSO
FROM
(SELECT S.COD_SOC AS COD_SOCIETA,
S.TIP_PIANO_CNTB AS COD_PIANO_CONTABILE,
S.COD_CONTO_CNTB AS COD_CONTO_CONTABILE,
S.COD_RUBR_STAT AS COD_RUBRICATO_STATISTICO_1,
TRC.COD_RAGGR_IAS AS COD_RAGGRUPPAMENTO_IAS,
TRC.COD_NDG AS COD_NDG,
TRC.COD_ESEG AS NUM_ESEGUITO,
CAST((TRC.IMP_PLUS_MINUS_VAL/TRC.IMP_CAMB) AS FLOAT) AS CUR_VAL_IMPEGNI,
TRC.TIP_QUOTAZ AS FLG_QUOTATO,
TRC.COD_CAT_TIT AS COD_CATEG,
TIP_COP AS TIP_COPERTURA,
T.TIP_TASSO AS TIP_TASSO
FROM S_SLD_CNTB S
INNER JOIN
(SELECT DISTINCT COD_SOC,
TIP_PIANO_CNTB,
COD_CONTO_CNTB,
COD_RUBR_STAT ,
COD_INTER_TIT AS COD_INTER
FROM S_COLLEG_CONTO_CNTB_TIT
WHERE COD_SOC = 'ME'
) CCC
ON S.COD_SOC = CCC.COD_SOC
AND S.TIP_PIANO_CNTB = CCC.TIP_PIANO_CNTB
AND S.COD_CONTO_CNTB = CCC.COD_CONTO_CNTB
AND S.COD_RUBR_STAT = CCC.COD_RUBR_STAT
INNER JOIN S_TIT_RICCONS TRC
ON CCC.COD_INTER = TRC.COD_INTER_TIT
AND CCC.COD_SOC = TRC.COD_SOC
AND TRC.COD_RAGGR_IAS = RTRIM('VALUE1 ')
AND TRC.COD_RAGGR_IAS NOT IN ('VALUE2')
AND TRC.DES_TIP_SLD_TIT_RICCONS IN ('VALUE3')
AND TRC.DES_MOV_TIT = RTRIM('VALUE4 ')
AND TRC.COD_CAT_TIT = RTRIM('VALUE4 ')
AND TRC.COD_INTER_TIT = RTRIM('VALUE5')
AND '28-feb-2011' = TRC.DAT_RIF
LEFT JOIN S_TIT T
ON T.COD_INTER_TIT = TRC.COD_INTER_TIT
AND T.COD_SOC = TRC.COD_SOC
AND '28-feb-2011' = T.DAT_RIF
INNER JOIN S_ANAG_SOGG AG
ON TRC.COD_NDG = AG.COD_NDG
AND AG.COD_SOC = TRC.COD_SOC
AND '28-feb-2011' = AG.DAT_RIF
WHERE S.DAT_RIF = '28-feb-2011'
AND (S.FLG_ANULL_BICO = 0
OR S.FLG_ANULL_BICO IS NULL)
AND S.COD_SOC = 'V6'
AND LENGTH(RTRIM(S.COD_CONTO_CNTB)) = 10
AND S.TIP_PIANO_CNTB = 'V7'
AND TRC.IMP_PLUS_MINUS_VAL < 0
AND SUBSTR(S.COD_CONTO_CNTB,1,7) IN (RTRIM('VALUE8 '))
Thanks a lotRight, I have executed this steps:
- I have changed the query with the select count(*)
- Changed the insert into with the select count(*)
- Executed the insert into
These are the result:
SQL> select count(*) from TITOLI_ORI2;
COUNT(*)
1
BUT:
SQL> select * from TITOLI_ORI2;
A
0
The insert into that I've modified is this:
INSERT INTO bsc.TITOLI_ORI2
select count(*)
FROM
(SELECT bsc.NEWID,
TO_DATE('28-feb-2111','DD-MON-YYYY') as data,
COD_SOCIETA,
COD_PIANO_CONTABILE,
COD_CONTO_CONTABILE,
COD_RUBRICATO_STATISTICO_1,
COD_NDG,
NUM_ESEGUITO,
CUR_VAL_IMPEGNI,
'ABC' AS CUR_IMPORTO_BICO,
0 AS FLG_MODIFICATO,
NULL CUR_NON_ASSEGNATO,
FLG_QUOTATO,
COD_CATEG,
TIP_COPERTURA,
TIP_TASSO
FROM
(SELECT S.COD_SOC AS COD_SOCIETA,
S.TIP_PIANO_CNTB AS COD_PIANO_CONTABILE,
S.COD_CONTO_CNTB AS COD_CONTO_CONTABILE,
S.COD_RUBR_STAT AS COD_RUBRICATO_STATISTICO_1,
TRC.COD_RAGGR_IAS AS COD_RAGGRUPPAMENTO_IAS,
TRC.COD_NDG AS COD_NDG,
TRC.COD_ESEG AS NUM_ESEGUITO,
CAST((TRC.IMP_PLUS_MINUS_VAL/TRC.IMP_CAMB) AS FLOAT) AS CUR_VAL_IMPEGNI,
TRC.TIP_QUOTAZ AS FLG_QUOTATO,
TRC.COD_CAT_TIT AS COD_CATEG,
TIP_COP AS TIP_COPERTURA,
T.TIP_TASSO AS TIP_TASSO
FROM bsc.S_SLD_CNTB S
INNER JOIN
(SELECT DISTINCT COD_SOC,
TIP_PIANO_CNTB,
COD_CONTO_CNTB,
COD_RUBR_STAT ,
COD_INTER_TIT AS COD_INTER
FROM bsc.S_COLLEG_CONTO_CNTB_TIT
WHERE COD_SOC = 'ME'
) CCC
ON S.COD_SOC = CCC.COD_SOC
AND S.TIP_PIANO_CNTB = CCC.TIP_PIANO_CNTB
AND S.COD_CONTO_CNTB = CCC.COD_CONTO_CNTB
AND S.COD_RUBR_STAT = CCC.COD_RUBR_STAT
INNER JOIN bsc.S_TIT_RICCONS TRC
ON CCC.COD_INTER = TRC.COD_INTER_TIT
AND CCC.COD_SOC = TRC.COD_SOC
AND TRC.COD_RAGGR_IAS = RTRIM('HFT ')
AND TRC.COD_RAGGR_IAS NOT IN ('GPO')
AND TRC.DES_TIP_SLD_TIT_RICCONS IN ('DISPONIBILI')
AND TRC.DES_MOV_TIT = RTRIM('CONSEGNARE ')
AND TRC.COD_CAT_TIT = RTRIM('OBBLIGAZIONE ')
AND TRC.COD_INTER_TIT = RTRIM('334058')
AND '28-feb-2011' = TRC.DAT_RIF
LEFT JOIN bsc.S_TIT T
ON T.COD_INTER_TIT = TRC.COD_INTER_TIT
AND T.COD_SOC = TRC.COD_SOC
AND '28-feb-2011' = T.DAT_RIF
INNER JOIN bsc.S_ANAG_SOGG AG
ON TRC.COD_NDG = AG.COD_NDG
AND AG.COD_SOC = TRC.COD_SOC
AND '28-feb-2011' = AG.DAT_RIF
WHERE S.DAT_RIF = '28-feb-2011'
AND (S.FLG_ANULL_BICO = 0
OR S.FLG_ANULL_BICO IS NULL)
AND S.COD_SOC = 'ME'
AND LENGTH(RTRIM(S.COD_CONTO_CNTB)) = 10
AND S.TIP_PIANO_CNTB = 'IS'
AND TRC.IMP_PLUS_MINUS_VAL < 0
AND SUBSTR(S.COD_CONTO_CNTB,1,7) IN (RTRIM('P044C11 '))
Another time the strange result returns!!
And I've created the table TITOLI_ORI2 as create table TITOLI_ORI2 (a number); to contain the number result of the query. -
Report obsolete returns diff results when backups are UNAVAIL vs AVAIL
Hello from Nova Scotia, Canada:
I'm wondering if someone out there who lives and breaths rman (10gR2) for a living can shed some light...
We are finding that report obsolete (as well as delete obsolete) are returning different results depending on if our backups
are AVAILABLE or UNAVAILABLE.
In our shop, our backups are changed to UNAVAILABLE because they get moved to a different location later, but delete
obsolete doesn't seem to work as expected unless the backups are AVAILABLE.
I am pasting some output below to demonstrate my point. Basically, in the output you are about to see, I'm showing you
my retention policy and I'm listing the backups that I have (and you can see their status is "A" for available). Then I do a
'report obsolete' command to show you what is considered obsolete (3 files are - which is what I expected). Then I change
all my backups to unavailable. Then I list all my backups again and show you that their status has changed to "U" for unavailable.
Then I do 'report obsolete' again and as you can see, I get different results! Can someone explain this to me?? I have RTFManuals
and no where does it say that availability is a factor that can impact determining what is obsolete. You also see in the output
below what version we're using (10.2.0.4.0) and that we are using a recovery catalog.
If someone would like to see additional information, feel free to ask, I'm more than happy to help you help me.
I should also mention this is a 2 node rac on linux.
Many Thanks.
========================================================
$ rman target / catalog rrc/rg@RRC
Recovery Manager: Release 10.2.0.4.0 - Production on Tue May 11 22:06:21 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: IPCSD (DBID=1703825384)
connected to recovery catalog database
RMAN> show retention policy;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
64093 B F A DISK 05/10/2010 03:06:52 2 1 NO HOTBKUP201005100300_DB
64122 B A A DISK 05/10/2010 03:08:41 1 1 NO HOTBKUP201005100300_ARCHLOGS
64361 B F A DISK 05/10/2010 21:56:33 2 1 NO HOTBKUP201005102149_DB
64362 B F A DISK 05/10/2010 21:56:37 1 1 NO HOTBKUP201005102149_DB
64390 B A A DISK 05/10/2010 21:58:02 1 1 NO HOTBKUP201005102149_ARCHLOGS
64508 B F A DISK 05/11/2010 03:07:01 2 1 NO HOTBKUP201005110300_DB
64509 B F A DISK 05/11/2010 03:07:10 1 1 NO HOTBKUP201005110300_DB
64544 B A A DISK 05/11/2010 03:07:47 1 1 NO HOTBKUP201005110300_ARCHLOGS
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 1 days
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
Backup Set 64093 05/10/2010 03:06:51
Backup Piece 64097 05/10/2010 03:06:51 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_2_CP_1_DB
Backup Set 64093 05/10/2010 03:04:01
Backup Piece 64096 05/10/2010 03:04:01 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_1_CP_1_DB
Backup Set 64122 05/10/2010 03:08:41
Backup Piece 64125 05/10/2010 03:08:41 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1351_PC_1_CP_1_ARCHLOGS
RMAN> change backup unavailable;
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_1_CP_1_DB recid=1533 stamp=718599624
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_2_CP_1_DB recid=1534 stamp=718599846
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1351_PC_1_CP_1_ARCHLOGS recid=1536 stamp=718600043
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1354_PC_1_CP_1_DB recid=1539 stamp=718667376
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1354_PC_2_CP_1_DB recid=1540 stamp=718667600
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB recid=1541 stamp=718667797
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1356_PC_1_CP_1_ARCHLOGS recid=1542 stamp=718667821
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1357_PC_1_CP_1_DB recid=1543 stamp=718686020
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1357_PC_2_CP_1_DB recid=1544 stamp=718686253
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1358_PC_1_CP_1_DB recid=1545 stamp=718686430
changed backup piece unavailable
backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1359_PC_1_CP_1_ARCHLOGS recid=1546 stamp=718686452
Changed 11 objects to UNAVAILABLE status
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
64093 B F U DISK 05/10/2010 03:06:52 2 1 NO HOTBKUP201005100300_DB
64122 B A U DISK 05/10/2010 03:08:41 1 1 NO HOTBKUP201005100300_ARCHLOGS
64361 B F U DISK 05/10/2010 21:56:33 2 1 NO HOTBKUP201005102149_DB
64362 B F U DISK 05/10/2010 21:56:37 1 1 NO HOTBKUP201005102149_DB
64390 B A U DISK 05/10/2010 21:58:02 1 1 NO HOTBKUP201005102149_ARCHLOGS
64508 B F U DISK 05/11/2010 03:07:01 2 1 NO HOTBKUP201005110300_DB
64509 B F U DISK 05/11/2010 03:07:10 1 1 NO HOTBKUP201005110300_DB
64544 B A U DISK 05/11/2010 03:07:47 1 1 NO HOTBKUP201005110300_ARCHLOGS
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 1 days
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
Backup Set 64362 05/10/2010 21:56:37
Backup Piece 64366 05/10/2010 21:56:37 /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
RMAN>I just want to point out that the one obsolete file just contains a Control File and a SPFILE, as shown below:
BS Key Type LV Size Device Type Elapsed Time Completion Time
64362 Full 17.64M DISK 00:00:02 05/10/2010 21:56:37
BP Key: 64366 Status: UNAVAILABLE Compressed: NO Tag: HOTBKUP201005102149_DB
Piece Name: /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
Control File Included: Ckp SCN: 15213106404 Ckp time: 05/10/2010 21:56:35
SPFILE Included: Modification time: 05/09/2010 18:00:42---------------
**** END *****
Edited by: user478914 on May 12, 2010 3:03 AM
Edited by: user478914 on May 12, 2010 3:24 AMThanks for reading my post. Here is the result of doing the crosscheck command.
Problem still exists. Someone correct me if I'm wrong but I believe crosscheck does
nothing because all my backups are listed as unavailable, so there is nothing for it to do.
Any other thoughts or suggestions?
This problem is driving me bonkers. I have read the Backup and Recovery Basic Guide and Advanced Guide,
googled the web, searched OTN, searched Metalink and I can't find anything on the topic of backup
piece availability affecting obsolescence. Many thanks.
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
64361 B F U DISK 05/10/2010 21:56:33 2 1 NO HOTBKUP201005102149_DB
64362 B F U DISK 05/10/2010 21:56:37 1 1 NO HOTBKUP201005102149_DB
64390 B A U DISK 05/10/2010 21:58:02 1 1 NO HOTBKUP201005102149_ARCHLOGS
64508 B F U DISK 05/11/2010 03:07:01 2 1 NO HOTBKUP201005110300_DB
64509 B F U DISK 05/11/2010 03:07:10 1 1 NO HOTBKUP201005110300_DB
64544 B A U DISK 05/11/2010 03:07:47 1 1 NO HOTBKUP201005110300_ARCHLOGS
64761 B F U DISK 05/12/2010 03:06:23 2 1 NO HOTBKUP201005120300_DB
64762 B F U DISK 05/12/2010 03:06:30 1 1 NO HOTBKUP201005120300_DB
64792 B A U DISK 05/12/2010 03:08:13 1 1 NO HOTBKUP201005120300_ARCHLOGS
RMAN> crosscheck backup;
using channel ORA_DISK_1
RMAN> report obsolete recovery window of 1 days;
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
Backup Set 64362 05/10/2010 21:56:37
Backup Piece 64366 05/10/2010 21:56:37 /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
Backup Set 64509 05/11/2010 03:07:10
Backup Piece 64520 05/11/2010 03:07:10 /oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1358_PC_1_CP_1_DB
RMAN> -
Database is only returns one result
I'm trying to count the number of calls & low priorty call from my account table in my databate. There is only one call so far in it. Call = 1 but its priorty is Low so Low should also be 1. I have check my sql in the Database and it return 1 result but in my program Low still = 0.
Connection conn;
String theNoCallsSQL = "Select call_no From Call ";
String thePLowSQL = "Select call_no From Call where priorty = 'Low' ";
int NoCalls = 0;
int Low = 0;
ResultSet rsetNoCall;
ResultSet rsetLow;
rsetNoCall = stmt.executeQuery(theNoCallsSQL);
while(rsetNoCall.next() == true)
NoCalls ++;
rsetLow = stmt.executeQuery(thePLowSQL);
while(rsetLow.next() == true)
Low ++;
conn.close();
ArrayList myStatsList = new ArrayList();
CallsStats myStats = new CallsStats();
myStats.setNoCall(NoCalls);
myStats.setNoLow(Low);
return myStatsList;Haven't you heard about debugging? The simplest forum of debugging to answer your question would be to insert a line like this:System.out.println("Low++ executed");immediately before the line that saysLow++;Or you could use System.out to display the value of Low immediately beforemyStats.setNoLow(Low);The possibilities are endless.
-
Strange result using Oracle Text
Hello, I am receiving a strange exception with this sql query
SELECT * FROM gob_attachment
WHERE CONTAINS (gob_a_document, 'java') > 0
It's giving me
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
ORA-00942: table or view does not exist
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and
take appropriate action.
After some googling I've disovered that problem could be in index, but I looked at the table and index seems ok to me.
Create script for index is looking like this
CREATE INDEX FTSI_GOB_A_DOCUMENT ON GOB_ATTACHMENT (GOB_A_DOCUMENT) INDEXTYPE IS CTXSYS.CONTEXT;
Only thing which is strange to me is that when I look to Edit Table in Table properties in SQL Developer I can see that Operational Status of index is FAILED. Does anyone know what does it mean?Maybe DB rights?
Edited by: 918345 on 2.3.2012 1:40
Edited by: 918345 on 2.3.2012 1:44No, I don't see any message related to this matter in there. I also tried to recreate the index and now the query is working, but it's not returning any results.
So I did this
drop index blob_index
create index blob_index on docs_mixedmedia(doc_contents) indextype is ctxsys.context
I've also discovered that we are storing unsupported datatype(DOCX), because it's supported from version 11 and we are running on 10g, could this lead to empty result of queries? -
Same Query returning different result (Different execution plan)
Hi all,
To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
The query :
SELECT *
FROM schema.table@database a
WHERE column1 IN ('3')
AND column2 = '101'
AND EXISTS
(SELECT null
FROM schema.table2 c
WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
Rows Row Source Operation
0 NESTED LOOPS (cr=31 r=0 w=0 time=4894659 us)
4323 SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
4336 TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
0 REMOTE (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
Rows Row Source Operation
3702 HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
22556 REMOTE (cr=0 r=0 w=0 time=401176 us)
4336 TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
It'is a bug or i have missed somthing ?
PS: The two table are no subject to insert or update statement.
Oracle version : 9.2.0.2.0
System version : HP-UX v1
Thanks.H.Mahmoud wrote:
Oracle version : 9.2.0.2.0
System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version) -
Returning a result set/record from a dynamic query
There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?
Welcome to the Oracle forum....
CREATE OR REPLACE PACKAGE curspkg_join AS
TYPE t_cursor IS REF CURSOR ;
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
END curspkg_join;
Create the following Oracle package body on the Oracle server:
CREATE OR REPLACE PACKAGE BODY curspkg_join AS
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
IS
v_cursor t_cursor;
BEGIN
IF n_EMPNO <> 0
THEN
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO
AND EMP.EMPNO = n_EMPNO;
ELSE
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO;
END IF;
io_cursor := v_cursor;
END open_join_cursor1;
END curspkg_join;
Dim Oraclecon As New OracleConnection("Password=pwd;" & _
"User ID=uid;Data Source=MyOracle;")
Oraclecon.Open()
Dim myCMD As New OracleCommand()
myCMD.Connection = Oraclecon
myCMD.CommandText = "curspkg_join.open_join_cursor1"
myCMD.CommandType = CommandType.StoredProcedure
myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
Dim myReader As OracleDataReader
Try
myCMD.ExecuteNonQuery()
Catch myex As Exception
MsgBox(myex.Message)
End Try
myReader = myCMD.Parameters("io_cursor").Value
Dim x, count As Integer
count = 0
Do While myReader.Read()
For x = 0 To myReader.FieldCount - 1
Console.Write(myReader(x) & " ")
Next
Console.WriteLine()
count += 1
Loop
MsgBox(count & " Rows Returned.")
myReader.Close()
Oraclecon.Close()
The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
HTH
Girish Sharma -
I have a Xquery statement that works as expected on Oracle 10.2.0.5 but does not return any results on Oracle 10.2.0.4.
Is this the result of a badly written query? A bug in 10.2.0.4?
Is there a way to rewrite the query so that is does work on 10.2.0.4?
Testcode:
declare
l_xml xmltype;
-- Select layers with TileMatrixSet EPSG:28992
cursor c_layer(p_xml xmltype) is
select t.*
from xmltable(xmlnamespaces(default 'http://www.opengis.net/wmts/1.0'
,'http://www.opengis.net/ows/1.1' as "ows"
,'http://schemas.opengis.net/gml' as "gml"
,'http://www.w3.org/1999/xlink' as "xlink"
,'http://www.w3.org/2001/XMLSchema-instance' as "xsi")
,'for $d in //Layer[TileMatrixSetLink/TileMatrixSet="EPSG:28992"] return $d' passing
p_xml columns title varchar2(100) path 'ows:Title'
,format varchar2(100) path 'Format'
,style xmltype path 'Style') as t;
begin
l_xml := xmltype.createxml('<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
version="1.0.0">
<Contents>
<Layer>
<ows:Title>brtachtergrondkaart</ows:Title>
<ows:Identifier>brtachtergrondkaart</ows:Identifier>
<Style isDefault="true">
<ows:Identifier>_null</ows:Identifier>
</Style>
<Format>image/png8</Format>
<TileMatrixSetLink> <TileMatrixSet>EPSG:28992</TileMatrixSet>
</TileMatrixSetLink> </Layer>
<Layer>
<ows:Title>top10nl</ows:Title>
<ows:Identifier>top10nl</ows:Identifier>
<Style isDefault="true">
<ows:Identifier>_null</ows:Identifier>
</Style>
<Format>image/png8</Format>
<TileMatrixSetLink> <TileMatrixSet>EPSG:28992</TileMatrixSet>
</TileMatrixSetLink> </Layer>
<Layer>
<ows:Title>bgt</ows:Title>
<ows:Identifier>bgt</ows:Identifier>
<Style isDefault="true">
<ows:Identifier>_null</ows:Identifier>
</Style>
<Format>image/png8</Format>
<TileMatrixSetLink> <TileMatrixSet>EPSG:28992</TileMatrixSet>
</TileMatrixSetLink> </Layer>
</Contents>
</Capabilities>');
for r_layer in c_layer(l_xml)
loop
dbms_output.put_line(r_layer.title);
end loop;
end;Result on 10.2.0.5:
brtachtergrondkaart
top10nl
bgtThis one's strange indeed.
I can reproduce on 10.2.0.4 and one of the following seems to fix it :
1) Specifying the column list in the SELECT, instead of t.* :
-- Select layers with TileMatrixSet EPSG:28992
cursor c_layer(p_xml xmltype) is
select t.title, t.format, t.style
from xmltable(or,
2) Using an extended FLWOR expression :
for $d in //Layer
where $d/TileMatrixSetLink/TileMatrixSet = "EPSG:28992"
return $dMaybe you've already noticed but the problem only occurs within a PL/SQL context.
The same query run from SQL is OK.
Maybe you are looking for
-
Songs on iPod no longer show up in iTunes
I have the latest iPod Touch with 100 songs on it. Suddenly, (because this hasn't been a problem before), only three songs show up on iTunes in the computer (MacBook Pro). Why can't I see all 100 songs on iTunes like before? They are on the iPod. I h
-
Hi gurus, when i saved billing document it is saying error in account determination. When we are posting to G/L account which G/l account i have to post (What is the name-description)
-
Transferring data to new (replacement) hard drive using time machine
My MacPro has crashed and after replacing the motherboard with no improvement, Apple thinks I will likely need a new hard drive. The cost of new drive and labor to install it is covered by Apple Care, but not for the technician to transfer to the new
-
Hi, all , I had certain queries which need to be clarified ,given below- 1)Apart from controlling operations, what r the other purpose of control key?? 2) What is key figures and what is it function? 3)In calibration order, is it required to do TECO
-
How can I work in several languages in Macbook pro late 2011
Well I am a student that is currently using differnt languagues in the macbook pro I need to write in spanish and english at the same time I mean.. I sometimes have to be working with a document in english and one other in spanish and it's really har