Different result executing by EXEC and by job
Greetings!
I've got simple procedure:
CREATE OR REPLACE PROCEDURE alertlog.check_log IS
IP_ADDRESS VARCHAR2(16);
BEGIN
SELECT sys_context('USERENV','IP_ADDRESS') INTO IP_ADDRESS FROM sys.dual;
FOR alert_conn IN (SELECT alert_date,alert_text FROM alert_log WHERE alert_date > SYSDATE - 20/1440 and REGEXP_LIKE(alert_text,'ORA-'))
LOOP
INSERT INTO ALERT_LOG_CONT@EMGRID VALUES (IP_ADDRESS,alert_conn.alert_date,alert_conn.alert_text);
END LOOP;
UPDATE SID_LIST@EMGRID SET LAST_UPLOAD=SYSDATE WHERE IPADDR=IP_ADDRESS;
COMMIT;
END;
And Job
BEGIN
sys.dbms_scheduler.create_job(
job_name => '"ALERTLOG"."CHECK_LOG_JOB"',
job_type => 'PLSQL_BLOCK',
job_action => 'begin
alertlog.check_log;
end;',
repeat_interval => 'FREQ=MINUTELY;INTERVAL=15;BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN;BYHOUR=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23',
start_date => to_timestamp_tz('2010-12-01 13:09:57 Europe/Moscow', 'YYYY-MM-DD HH24:MI:SS TZR'),
job_class => '"DEFAULT_JOB_CLASS"',
auto_drop => FALSE,
enabled => FALSE);
sys.dbms_scheduler.set_attribute( name => '"ALERTLOG"."FFF"', attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);
sys.dbms_scheduler.set_attribute( name => '"ALERTLOG"."FFF"', attribute => 'job_weight', value => 1);
sys.dbms_scheduler.enable( '"ALERTLOG"."FFF"' );
END;
When I run EXEC alertlog.check_log in sqlplus the result is good:
IPADDR EVENT_DATE ERROR_LINE
10.20.17.38 2010-12-01 13:19:01.0 ORA-TEST
But when it is being run by job - it doesn't get an ip address:
IPADDR EVENT_DATE ERROR_LINE
2010-12-01 13:19:01.0 ORA-TEST
What am I doing wrong?
Update:
And it also doesn't update SID_LIST@EMGRID by
UPDATE SID_LIST@EMGRID SET LAST_UPLOAD=SYSDATE WHERE IPADDR=IP_ADDRESS;
Edited by: Skalny on 01.12.2010 13:41
Herald ten Dam wrote:
SELECT sys_context('USERENV','IP_ADDRESS') INTO IP_ADDRESS FROM sys.dual;In a job this will give no value back, because a job is run inside the database and has no client connection, so IP_ADDRESS will be null. That's why your update doesn't work.
For a job you can use UTL_INADDR.GET_HOST_ADDRESS.Thank you for explanation.
Similar Messages
-
Does anyone know why I would get different results from V$Rman_Backup_job_details and V$Rman_Status on the same instance?
Image of Quries: www.hydell.com/OracleBackupDifferences.png
Dates Returned For Latest Backup
V$Rman_Status = 10/13/2011
V$Rman_Backup_job_details = 7/24/2011
Which view is the best to use for monitoring backups?
Thanks in advance for the help.
Roboracle.dba.89 wrote:
Please show the script and that might help look into this. Also the timezone of the OS shows EST. And cron shows the scheduled time at 12hrs. It should run at 12:00 EST hours and not GMT.
Also please post output for below queries. Are backups run from the same node? (If RAC)
select value from dba_scheduler_global_attribute where attribute_name = 'DEFAULT_TIMEZONE';
Hi,
This is the backup script
#Set Variables
ORACLE_HOME=/projects1/oramroprod/oracle/product/10.2.0/db_4
ORACLE_SID=MROPROD
PATH=$PATH:$ORACLE_HOME/bin
btype="FULL"
RMAN_BACKUP_LOC=/data1/RMAN/MROPROD
export ORACLE_HOME
export ORACLE_SID
export PATH
export btype
tag="$ORACLE_SID"_"$btype"
#Print commands and their arguments as they are executed
set -x
SDATE=`date +%m%d%y`
STIME=`date +%H%M%S`
DD=`date +%d%m%y`
#Create daily backup directories
mkdir -p $RMAN_BACKUP_LOC/datafiles_backup/bkp_${DD}
mkdir -p $RMAN_BACKUP_LOC/controlfile_backup/bkp_${DD}
mkdir -p $RMAN_BACKUP_LOC/arch_backup/bkp_${DD}
mkdir $RMAN_BACKUP_LOC/logs
#Take backup
rman target / nocatalog log=$RMAN_BACKUP_LOC/logs/rman_${btype}_backup_${SDATE}_${STIME}.log << EOF1
change archivelog all crosscheck;
run {
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
backup as compressed backupset incremental level 0 database tag '$tag' format '$RMAN_BACKUP_LOC/datafiles_backup/bkp_${DD}/%d_%s_%p';
backup as compressed backupset archivelog all not backed up 1 times FORMAT '$RMAN_BACKUP_LOC/arch_backup/bkp_${DD}/ARCH_%d_%s_%p';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$RMAN_BACKUP_LOC/controlfile_backup/bkp_${DD}/%F';
delete noprompt obsolete;
delete noprompt archivelog all completed before 'sysdate-2';
EXIT;
EOF1
This is not RAC.
SQL> select value from dba_scheduler_global_attribute where attribute_name = 'DEFAULT_TIMEZONE';
VALUE
GMT -
Different result in frame viewer and canvas
I´m doing some color correction with the 3 way CC tool and i´m having troubles with Frame Viewer: the results are not the same in the Canvas and Frame Viewer. The colors in Frame Viewer are a little bit more saturated and they are also a bit darker.
I figured out that it happens in a lot of different configurations (Mac Pro, Imac and macbook Pro) but just with Snow Leopard.
This problem doesn't exist in Tiger and i haven't the opportunity to test it with leopard.
I found a topic in this forum support, where a guy had the same problem, he solved with the excess luma command, but it doesn't make sense, infact I still have this problem.
I think that this is a software problem and also quite big, btw what i want to know is, which reference is more accurate?
Time Viewer or canvas?sdd84 wrote:
...what i want to know is, which reference is more accurate?
Time Viewer or canvas?
Neither.
FCP is showing you a low res proxy of the image. Final Cut Pro does this because it is about concentrating on the flow of your story, not color fidelity. That is less demanding on the CPU.
To color correct accurately, your system needs to be connected to a calibrated external video monitor (or at the vey least, an excellent TV) fed by a qualified capture card such as those from AJA, Black Magic or Matrox. -
Different Results with Powershel v2 and v3
Hope someone can help me determine why there is a difference in my data between v2 and v3 of Powershell. I do my development on my laptop which has version 3 installed, but the script is executed on a server which has version 2 installed.
#create directory searcher object and set it's porperties
$searcher = New-Object DirectoryServices.DirectorySearcher
# (!userAccountControl:1.2.840.113556.1.4.803:=2) - Filters out disabled accounts
$searcher.Filter = '(&(objectCategory=person)(objectClass=user)(!samaccountname=ITS-*)(!userAccountControl:1.2.840.113556.1.4.803:=2))'
$searcher.PageSize = 5
$searcher.SearchRoot = "LDAP://OU=District Offices,DC=myDomain,DC=com"
#load only the following properties
$params = @("samaccountname","sn","givenname","mail","physicaldeliveryofficename","department","title","manager","distinguishedname")
foreach($param in $params)
$searcher.PropertiesToLoad.Add($param) | Out-Null
try
$found = $searcher.FindAll()
$found | ForEach-Object {
if (($_.Properties["distinguishedname"] -notlike "*,OU=Generic User Accounts*") -and ($_.Properties["title"] -notlike "*Consultant*") `
-and ($_.Properties["title"] -notlike "*Commissioner*") -and ($_.Properties["title"] -notlike "*Security Guard*") `
-and ($_.Properties["title"] -notlike "*OSC*") -and ($_.Properties["title"] -notlike "*DCC*Temp*") -and ($_.Properties["samaccountname"] -ne "tbjohn") `
-and (($_.Properties["mail"] -ne "")))
$filtered += $_
Running this script on my machine produces the data that the user is looking for. When I run it on the server, there are users in the data file that should not be. In the filter statement if I change
-and (($_.Properties["mail"] -ne "")))
#TO BE
-and (($_.Properties["mail"] -ne $null)))
Then those users are removed, but then other users are included and I haven't figured out why yet. Why would there be a difference, with the above script? I would think that should work in any version but obviously that is not true.
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technetjrv, with your modifications, things look to be going great, but again I am having an issue between version 3 and version 2 of powershell
I have the following code in a file
$searcher = New-Object DirectoryServices.DirectorySearcher
$searcher.Filter = '(&(objectCategory=person)(objectClass=user)(mail=*)(!samaccountname=ITS-*)(!userAccountControl:1.2.840.113556.1.4.803:=2))'
$searcher.PageSize = 5
$searcher.SearchRoot = "LDAP://OU=District Offices,DC=MyDomain,DC=com"
#load only the following properties
$params = @("samaccountname","sn","givenname","mail","physicaldeliveryofficename","department","title","manager","distinguishedname")
foreach($param in $params)
$searcher.PropertiesToLoad.Add($param) | Out-Null
# Filtered results to exclude certain OU's
$filtered = @()
try
$filtered += $searcher.FindAll() | Where {
$_.Properties["distinguishedname"][0] -notmatch ",OU=Generic User Accounts" `
-and $_.Properties["title"][0] -notmatch "Consultant|Commissioner|Security Guard|OCS|DCC.*Temp" `
-and $_.Properties["samaccountname"][0] -ne "tbjohn"
$filtered.Count
catch
Write-Host "Error occured $_"
exit
I then did two different tests. In a command window I run the following
C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -Version 3.0 -ExecutionPolicy RemoteSigned -File F:\PS_Scripts\ADTest.ps1
The results here return the count of 2485, yet if I force it to use version two with the following command
C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -Version 2.0 -ExecutionPolicy RemoteSigned -File F:\PS_Scripts\ADTest.ps1
The results returned is an error stating "Cannot index into a null array", is there a difference in the DirectorySearcher object in version 2.0 compared to version 3.0?
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technet -
To_char displays different results on sql client and server
Hi,
I am executing the below query on my database with 8.1.7.4 version:
SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
The following result is displayed:
T
7
When the same query is being run through sqlplus client(9.2.0.3) connecting to the same database, following result is being displayed:
SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
T
6
Could anyone please explain me why is this difference and what parameter setting needs to be made to get the same result.
Thanks in advance,
VishwanathOr from the territory part of NLS_LANG OS variable :
oracle@xxx:/home/oracle# echo $NLS_LANG
AMERICAN_AMERICA.UTF8
oracle@xxx:/home/oracle# sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.8.0 - Production on Mon Oct 22 10:44:59 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
T
7
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
oracle@xxx:/home/oracle# export NLS_LANG=AMERICAN_FRANCE.UTF8
oracle@xxx:/home/oracle# sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.8.0 - Production on Mon Oct 22 10:45:38 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
T
6
SQL>Check it on both sites (client and server).
Nicolas. -
In my experimental photo album page I originally defined the
styles in a
separate .CSS file. However this appeared to be incompatible
with the
requirement to have the session_start (); statement at the
start of the file, so
I then defined the styles locally. Now I have found that a
style which gives
padding to the right of an image no longer works in IE6,
although Dreamweaver
shows the expected result.
I have made two very simple test files to demonstrate this:
http://localhost/Corybas/Cydalba/Test/Test_page_8[1
http://localhost/Corybas/Cydalba/Test/Test_page_8[2
In Test_page_8[1].htm styles are defined by the include file
../Spl2.ccs, which
is included using the following statement in the head:
<link href="../Spl2.css" rel="stylesheet" type="text/css"
/>
The include file reads:
/* Test.css for Cydalba project */
.img_left { float:left; border:none; padding-left:0;
padding-bottom:0;
padding-top:0; padding-right:10px; }
p { font-family: "Times New Roman", Times, serif; color:
#f00000;
margin-bottom: 0.25em; margin-top: 0px; border: 0; }
In Test_page_8[2].htm styles are defined locally, using the
following lines at
the start of file:
<style type="text/css">
/* Test.css for Cydalba project */
.img_left { float:left; border:none; padding-left:0;
padding-bottom:0;
padding-top:0; padding-right:10px; }
p { font-family: "Times New Roman", Times, serif; color:
#f00000;
margin-bottom: 0.25em; margin-top: 0px; border: 0; }
</style>
With IE6 Test_page_8[1] gives the expected padding between
the images and the
adjacent text, but Test_page_8[2] does not. The para
definition appears to work
correctly in both cases.
Can anyone explain this?
ClancyHi Rob,
I am making a wild guess here...the reason could be that the internal tables or variables declared as part of Global data (if any) must be refreshed in your FM code.
Regards,
Sumant. -
Color Correction: different result in Frame Viewer and Canvas
Hi all:
I´m doing some color correction with the 3 way CC tool and i´m having troubles with Frame Viewer: the results are not the same in the Canvas and Frame Viewer. The colors in Frame Viewer are a little bit more saturated and they are also a bit darker. I´ m talking about the half Frame Viewer that is supposed to show me the final result after the color correction.
Mi footage is in HDV 720 25p. Anyone know what is happening????You'll probably find them lined up at your Chevy dealer.
View>Range Check>Excess Luma. -
Different Risk Analysis Results with 10.0 and 10.1
Hello,
I do not understand why I get different results with 10.0 and 10.1. Exactly the same ruleset is applied!
Definition in 10.0 and 10.1:
Analyzed Role (which definitely contains the SOD):
Version GRC 10.0 finds the SOD S_FI14 and displays it. In 10.1 nothing is displayed...Any ideas what's the problem?
Regards
PeterWe had similar issues with 10 and 10.1.
We applied an SAP Note about logical groups and the ruleset, it did not work.
What did work:
When performing Risk Analysis, remove the Ruleset selection criteria (use the minus button). -
Different results from MAX and Labview
Hi all,
We did an impact testing a couple of days ago, and I got very big acceleration (the peak is about 300g, which is much larger than the estimated value).
And then I tried a small imact test in the lab using a steel plate which is less than 1 lb to impact a steel ruler, I still got big peak number (more than 200g, which is impossible). And then I tried the small impact test again by using MAX, the peak number is about 12g, and the curve seems like pretty reasonable. I was wondering why I got different results by using MAX and Labview?
Also, sometimes when I connect the SCXI-1001 to the computer, it says the USB is malfuntion and cannot be recgonized by the computer, and turns out the driver file does not exists. But most of the time, it works very well and the driver file does exists. Why this happened?
Thanks.
Yuanjyuan wrote: but I want to clike one "run button" and get data from strain gage, LVDT, accelerometer at the same time and our tesing duration is just about a few seconds. And also I didn't find a place where I can record the data in MAX
You can do that. A task can only have the same types of inputs, meaning Analog Input, Analog Output, Digital Input, Digital Output, etc. Different sensors are just read with Analog Inputs. So they all can be in the same task. In MAX, just set up a task a configure each channel as it should be. Then use that single task in your LabVIEW code.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Different results for same query on different servers
1. database being converted from 7.3.4 to 9.2
2. query is executed on both servers
3. different results!
The tables and data are the same, and indexes are setup on new server. EXPLAIN PLAN was run on both but with (predictably) widely different results.
I know, not much detail here, but has anyone ever ran into anything like this?
Thanks,
PatFolks,
Here is the relevant information for this problem. The attributes have been changed for confidentiality. If you need any other information let me know.
Thanks,
Pat
Query:
SELECT
one,two,three,four,a.five,six,seven,
a.eight,a.nine,
to_char(ten,'99999.99'),to_char(eleven,'99999.99'),
to_char(twelve,'99999.99'),to_char(thirteen,'99999.99'),
fourteen,fifteen,sixteen,seventeen,eighteen,
nineteen,twenty,twentyone
FROM
table1 a,
table2 b
WHERE
a.five = b.five
AND one = 'X'
AND six = ' '
AND three != 12345
AND three IN
(SELECT DISTINCT
three
FROM table3
WHERE
one = 'X'
AND twentytwo = 'XYZ'
AND twentythree != 0
AND twentyfour != 0
AND twentyfive = 'Y'
AND (a.five IN
(SELECT DISTINCT
five
FROM table1
WHERE
one = 'X'
AND three IN (12345)
Table1:
one varchar2(1) not null PK
two varchar2(20) not null PK
three number(5) not null PK
four number(2) not null PK
five number(6) not null PK
six varchar2(4) not null PK
seven number(4) not null
eight varchar2(8) not null
nine date not null
ten number(7,2)
eleven number(7,2)
twelve number(7,2)
thirteen number(7,2)
Table2:
five number(6) not null PK
fourteen varchar2(5) not null
fifteen varchar2(5) not null
sixteen varchar2(2) not null
seventeen varchar2(35) not null
eighteen varchar2(4) not null
nineteen varchar2(2)
twenty varchar2(1)
twentyone number(6)
Table3:
one varchar2(1) not null PK
twentytwo varchar2(12) not null PK
two varchar2(20) not null PK
three number(5) not null PK
four number(2) not null PK
twentysix number(2) not null PK
twentyfive varchar2(1) not null
nine date not null
twentythree number(13,8) not null
twentyfour number(12,8) not null
twentyseven varchar2(1) not null
eight varchar2(8) not null
Explain - Oracle9i (default, with CBO):
SELECT STATEMENT
RECURSIVE EXECUTION SYS_LE_3_0
RECURSIVE EXECUTION SYS_LE_3_1
TEMP TABLE TRANSFORMATION
HASH JOIN
HASH JOIN
HASH JOIN
TABLE ACCESS FULL SYS_TEMP_0FD9D6603_AB874A
TABLE ACCESS BY INDEX ROWID TABLE1
BITMAP CONVERSION TO ROWIDS
BITMAP AND
BITMAP MERGE
BITMAP KEY ITERATION
TABLE ACCESS FULL SYS_TEMP_0FD9D6603_AB874A
BITMAP CONVERSION FROM ROWIDS
INDEX RANGE SCAN TABLE1INDEX03
BITMAP MERGE
BITMAP KEY ITERATION
TABLE ACCESS FULL SYS_TEMP_0FD9D6602_AB874A
BITMAP CONVERSION FROM ROWIDS
INDEX RANGE SCAN TABLE1INDEX04
TABLE ACCESS FULL SYS_TEMP_0FD9D6602_AB874A
TABLE ACCESS FULL TABLE2
Query results - Oracle9i (with CBO):
X|A | 1| 0| 22| | 1|08-MAR-02|XYZ | | 24.00| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|B | 2| 1| 22| | 7|04-DEC-01|XYZ | | 3.25| 8.00| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|C | 3| 1| 22| | 1|14-AUG-02|XYZ | | 10.35| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|D | 4| 1| 22| | 6|11-JUL-02|XYZ | | .00| 13.90| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
(approximately 4550 rows returned)
Explain - Oracle9i (ALTER SESSION SET OPTIMIZER_METHOD=RULE;):
SELECT STATEMENT
MERGE JOIN
SORT JOIN
NESTED LOOPS
NESTED LOOPS
VIEW VW_NSO_1
SORT UNIQUE
TABLE ACCESS BY INDEX ROWID TABLE3
INDEX RANGE SCAN TABLE3INDEXPK
TABLE ACCESS BY INDEX ROWID TABLE1
INDEX RANGE SCAN TABLE1INDEX03
TABLE ACCESS BY INDEX ROWID TABLE2
INDEX UNIQUE SCAN TABLE2INDEXPK
SORT JOIN
VIEW VW_NSO_2
SORT UNIQUE
TABLE ACCESS BY INDEX ROWID TABLE1
INDEX RANGE SCAN TABLE1INDEX03
Explain - Oracle 7.3.4:
SELECT STATEMENT
MERGE JOIN
SORT JOIN
NESTED LOOPS
NESTED LOOPS
VIEW
SORT UNIQUE
TABLE ACCESS BY ROWID TABLE3
INDEX RANGE SCAN TABLE3INDEX03
TABLE ACCESS BY ROWID TABLE1
INDEX RANGE SCAN TABLE1INDEX03
TABLE ACCESS BY ROWID TABLE2
INDEX UNIQUE SCAN TABLE2INDEXPK
SORT JOIN
VIEW
SORT UNIQUE
TABLE ACCESS BY ROWID TABLE1
INDEX RANGE SCAN TABLE1INDEX03
Query results - Oracle 7.3.4:
X|A | 1| 0| 22| | 1|08-MAR-02|XYZ | | 24.00| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|B | 2| 1| 22| | 7|04-DEC-01|XYZ | | 3.25| 8.00| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|C | 3| 1| 22| | 1|14-AUG-02|XYZ | | 10.35| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|D | 4| 1| 22| | 6|11-JUL-02|XYZ | | .00| 13.90| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
(approximately 1150 rows returned)
Indexes (used):
TABLE1INDEX03 (three)
TABLE1INDEX04 (five)
TABLE2INDEXPK (five)
TABLE3INDEXPK (one,twentytwo,two,three,four,twentysix)
Discussion:
Notice the repeating result for X,E,5,5,23,.... in the Oracle9i retrieval using CBO.
The execution of this query returned approximately four times the number of rows as
Oracle 7.3.4 using RBO. This is a function of how many "fours" there are in table3
that have matching "threes and fours" in table1. If you put a DISTINCT clause at the
very front of the query (SELECT DISTINCT one,two,three ....) then the result is
accurate and the same as Oracle 7.3.4. In one execution of this query, 27,000 rows
are expected to be returned, but the server returned over 1 million rows!
When RBO was used on Oracle9i, the results were identical to the ones on Oracle 7.3.4. -
Bridge CS6 - Smart Collections Different Result Everytime
I recently was using a Smart Collection to review selects and I would come up with different results as I openend and closed folders that were a part of Smart Collection file base. Its as if my files hadn't been correctlty indexed or were not being indexed until I opened a folder and selected a file to view.
Is there a way to make sure my files are being indexed or is reseting the Prefs the only way to do this?You can either visit each folder and wait until the spinning arrow is finished indexing, which takes awhile.
Another way is to do a search at the start of the directory (it searches down) and check include non-indexed files. You can see what folder it is on in the lower left corner. THis will take awhile also, but you can do the search when you are not using the computer and just let it run. If you have to stop it before it is done, note where it is at and then start search there next time. -
[PrintService] Weird and different behavior on my Mac and my PC
Hi
I've been struggling with a printing problem for now more than 20 hours and i decided to go back to the beginning.
So first, before trying to print any random String, i want to check what can print my printers connected.
Since i was having problems, i am trying both on my Mac and my PC.
Both are connected to my network using Ethernet.
Here is my code
DocFlavor[] triedFlavors = {
DocFlavor.STRING.TEXT_PLAIN,
DocFlavor.STRING.TEXT_HTML,
DocFlavor.INPUT_STREAM.AUTOSENSE,
DocFlavor.STRING.INPUT_STREAM.TEXT_PLAIN_UTF_8,
DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8,
DocFlavor.INPUT_STREAM.STRING.TEXT_PLAIN
InputStream is = new ByteArrayInputStream(test.getBytes());
BufferedInputStream bis = new BufferedInputStream(is);
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
printRequestAttributeSet.add(new Copies(1));
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
DocAttributeSet docAttributeSet = new HashDocAttributeSet();
//docAttributeSet.add(MediaSizeName.ISO_A4);
for (Attribute attribute : docAttributeSet.toArray()) {
System.out.println("Attribute Set:" + attribute.toString());
for (DocFlavor flavor : triedFlavors) {
System.out.println("Flavor chosen:" + flavor.toString());
PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, docAttributeSet);
System.out.println("Available printers for this flavor and this attribute set : " + services.length);
for (PrintService service : services) {
System.out.println("Available: " + service.toString());
} I get with my PC:
Flavor chosen:text/plain; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 0
Flavor chosen:text/html; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 0
Flavor chosen:application/octet-stream; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 7
Available: Win32 Printer : \\CATE\IMP_CATE
Available: Win32 Printer : \\SRV-PRINT\4-XCOULEUR
Available: Win32 Printer : \\SRV-PRINT\5-X-Couleur
Available: Win32 Printer : \\SRV-PRINT\5-XCOULEUR
Available: Win32 Printer : \\Srv-print\6-OPERA
Available: Win32 Printer : \\Srv-print\6-RICOH
Available: Win32 Printer : Microsoft Office Document Image Writer
Flavor chosen:text/plain; charset="utf-8"; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 0
Flavor chosen:text/plain; charset="utf-8"; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 0
Flavor chosen:text/plain; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 0 And with my Mac:
Flavor chosen:text/plain; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 2
Available: IPP Printer : 6-OPERA
Available: IPP Printer : 6-RICOH
Flavor chosen:text/html; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 0
Flavor chosen:application/octet-stream; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 2
Available: IPP Printer : 6-OPERA
Available: IPP Printer : 6-RICOH
Flavor chosen:text/plain; charset="utf-8"; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 2
Available: IPP Printer : 6-OPERA
Available: IPP Printer : 6-RICOH
Flavor chosen:text/plain; charset="utf-8"; class="java.io.InputStream"
Available printers for this flavor and this attribute set : 2
Available: IPP Printer : 6-OPERA
Available: IPP Printer : 6-RICOH
Flavor chosen:text/plain; charset="utf-16"; class="java.lang.String"
Available printers for this flavor and this attribute set : 2
Available: IPP Printer : 6-OPERA
Available: IPP Printer : 6-RICOH As you can notice, i get totally different results between my PC and my MAC.
As a matter of fact, when i try to get all the flavors available on 6-OPERA, i get more or less 12 falvors available (when i try the test code from my PC) and 150 when i try the test code from my MAC.... i dont understand!!!
I want to get more flavors available for 6-OPERA on my PC!!!
so please help me understand this little problem
Edited by: nicdo77 on Jan 15, 2008 12:13 PMProbably the easiest way to use an iPod on both Mac and Windows computers is to format the iPod (using iPod Updater) using the PC. This will force your iPod to use the Windows file system (FAT32) which both the Mac and PC can read from and write to without the help of additional software. Of course then all your software updates for the iPod will have to be done on Windows. If you need to use a Mac (HFS+) formatted iPod on a Windows PC, you'll need to install some 3rd party software such as XPlay 2.0 (which you can get from MediaFour Software). This will enable your Windows PC to read a Mac-formatted iPod.
-
XSLT producing different results via debugger and xslt.Transform()
I'm producing the body of an email via an xsl. I've been having a problem with the html nested inside a <table> tag not displaying correctly. With a bit of help from the good folks over at the asp.net forums, I've tracked the problem down to getting
different results if I run the xsl via the debugger or via a compiled transform.
When I debug the xsl it produces
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr>
<th width="50%" align="center"><b>Issue</b></th>
<th width="50%" align="center"><b>Resolution</b></th>
</tr>
<tr>
<td>Missing Acknowledgement date</td>
<td><p> Test test</p></td>
</tr>
<tr>
<td>Missing Agent and/or Seller signature</td>
</table>
And that's absolutely correct and displays perfectly if I save the result as an html file. But when I use xslt.Transform(..), where xslt is a compiled transform, it produces
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr><th width="50%" align="center"><b>Issue</b></th><th width="50%" align="center"><b>Resolution</b></th></tr>
<tr>
<td>
Missing Acknowledgement date
</td>
<td></td>
</tr>
</table>
</p><p> Test test</p></td></tr><tr>
<td>Missing Agent and/or Seller signature</td>
<td>
</table>
And to make it even more interesting, that extra </table> tag and the misplaced table data only occur on the first table row, but the table rows are generated by an xsl:for-each.
The relevant bit of the xsl is:
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr>
<th width="50%" align="center">
<b>Issue</b>
</th>
<th width="50%" align="center">
<b>Resolution</b>
</th>
</tr>
<xsl:for-each select="emailbody/checklist/item">
<xsl:if test="string-length(select='issue')>0">
<tr>
<td>
<xsl:value-of select="issue" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="resolution" disable-output-escaping="yes" />
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
The code that generates the compiled transform and the (incorrect) output is:
Dim xslt As XslCompiledTransform = New XslCompiledTransform(True)
'Dim xslt As XslTransform = New XslTransform
xslt.Load(templatePath)
Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
Dim strbldrXML As StringBuilder = New StringBuilder()
Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
xslt.Transform(objXmlReader, objXmlWriter)
I've checked that templatePath is pointing to the right file, and the source file I'm debugging the xsl against was copied from the xmlData parameter, so I know the same stuff is getting fed into it.
I've been chasing this for days, and I'm about ready to quit and go get a job at a fast food joint. I'm not wonderful with xsl in general, or xsl in .NET in particular. Somebody PLEASE tell me I'm doing something stupid....
Rebecca M. RiordanThanks for the replay, Fred, but that wasn't the problem.
I still don't know what the problem was, but in putting together a sample for review, I cleaned up the code a little (I inherited this), and while it
appears to be functionally identical, it's working now. Since we're scheduled to go live on Friday, I'm gonna just take the win ;)
In the unlikely event that anybody's curious, the original, non-functional code, looked like this:
Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
Dim templatePath, emailBody As String
templatePath = Me.templatePath & "\" & templateType & ".xsl"
Dim xpd As New XPathDocument(New StringReader(xmlData))
Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
xslt.Load(templatePath)
Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
Dim strbldrXML As StringBuilder = New StringBuilder()
Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
xslt.Transform(objXmlReader, objXmlWriter)
emailBody = strbldrXML.ToString()
Return emailBody
End Function
In cleaning it up, I wrote this:
Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
Dim templatePath As String = Me.templatePath & templateType & ".xsl"
xslt.Load(templatePath)
Dim reader As XmlReader = XmlReader.Create(New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData)))
Dim outSB As StringBuilder = New StringBuilder()
Dim writer As XmlWriter = XmlWriter.Create(outSB)
xslt.Transform(reader, writer)
Dim emailBody As String = outSB.ToString()
Return emailBody
End Function
As I said, they look functionally identical to me, but obviously they're not, because the second one works....
Rebecca M. Riordan -
Execute the same query twice, get two different results
I have a query that returns two different results:
Oracle Version : 10.2.0.1.0
I am running the following query on the Oracle server in SQL*Plus Worksheet.
SELECT COUNT(*)
FROM AEJOURNAL_S1
WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
AND DESC2 LIKE '%'
AND DESC1 LIKE '%'
AND DESC2 LIKE '%'
AND ETYPE LIKE '%'
AND MODULE LIKE '%'
AND LEVELL = '11-WARNING'
ORDER BY ORDD DESC;
The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
This query runs against a view. The view does a transpose of data from a table.
Below is the view AEJOURNAL_S1
SELECT
CHAR_TIME,
CHAR_INST,
BATCH_ID,
MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
FROM CHAR_BATCH_DATA
WHERE subbatch_id = 1774
GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
Thanks for looking,
Danuser2188367 wrote:
I have a query that returns two different results:
Oracle Version : 10.2.0.1.0
I am running the following query on the Oracle server in SQL*Plus Worksheet.
SELECT COUNT(*)
FROM AEJOURNAL_S1
WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
AND DESC2 LIKE '%'
AND DESC1 LIKE '%'
AND DESC2 LIKE '%'
AND ETYPE LIKE '%'
AND MODULE LIKE '%'
AND LEVELL = '11-WARNING'
ORDER BY ORDD DESC;
The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
This query runs against a view. The view does a transpose of data from a table.
Below is the view AEJOURNAL_S1
SELECT
CHAR_TIME,
CHAR_INST,
BATCH_ID,
MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
FROM CHAR_BATCH_DATA
WHERE subbatch_id = 1774
GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
Thanks for looking,
DanIn fact you the first time you ran the query the data has been retrived from disk to memory , in the second time the data is already in memory so the respnse time should be faster ,but if you chagne any condition or column or letter case the optimizer will do the first step (data will be retrived from disk to memory ) -
Strange query plans, and so different results from a view.
In my database (11g), I have a currency exchange rate table, which contains all currencies and their exchange rate to USD. I need to have a number of different exchange rates - To GBP, EUR, etc...
To accomplish this I have created a view, which has one union statement of all the USD exchange rates, with the same data joined back on itself to give the exchange rates based on their exchange rate to USD - ie: SELECT b1.Date, b1.Currency AS FromCurrency, b2.Currency as ToCurrency, b1.Rate/b2.Rate as Exchange Rate FROM Rates b1, Rates b2 on b1.Date = b2.Date
This view works fine when I query it, and returns the data as I expect.
I have a second view that is joined to this view to give a return of the amount in each currency for reporting. This view seems to work correctly when I narrow down the search requirements and have a small set of data.
The issue I am having is when I query the second view and get it to return all the data. Instead of receiving 4 rows per transaction (I am only interested in 4 exchange rates for display) I typically receive up to 2 rows. The first record is for the conversion to USD, the second record is for the conversion to the supplied currency. The issue is that this exchange rate actually includes the aggregate for all 3 other requested currencies (not the USD).
So instead of getting something like:
Amt RC BC (Amt = Amount, RC = Reporting Currency. BC = Base Currency)
60 GBP GBP
80 EUR GBP
100 USD GBP
1000 ZAR GBP
60 GBP USD
80 EUR USD
100 USD USD
1000 ZAR USD
I get the following set of results:
1140 GBP GBP
100 USD GBP
100 USD USD
Has anyone come accross something similar or have any ideas on how I can resolve this?
Thanks
PS: I can get both sets of results from the same view depending on the filter criteria. Also if I convert the exchange rates into a table, it then returns the correct results as expected.943081 wrote:
The idea is to seek help in solving the problem. I was hoping that perhaps someone had experienced the same thing - different results for "effectively" the same query:Well, that's the issue... without additional info, it's not clear what issue you were seeing.
SELECT * FROM view WHERE Date = '01 January, 2012'
verse
SELECT * FROM view WHERE Date > '31 December, 2011' ORDER BY DateNow it's a bit clearer. That second query is not "effectively" the same as the first query. If the date column is in DATE format, then you ought to have a to_date() around the date string to explicitly convert it into a date so you can do date-to-date comparisons correctly. Also, DATE datatype stores times as well as dates, so asking for data matching midnight of a specific date is different than asking for data greater than midnight of the previous day.
If the date string is a string, then ... well, the string "31 December 2011" is greater than the string "31 August 2013", despite it being an earlier date. This is why making sure you're using the right datatype for the job is important - a date is different to a string that just happens to contain a date.
DateID
I have no objection to using a Date but always struggle to understand what someone means when they tell me "06/07/2012" - granted if the day is above 12 or the same day and month I don't have a problem - but it still leaves 121 days a year that are confusing. sure, but just because you find outputting the display (or rather, someone else's output) confusing doesn't mean you still shouldn't use the correct datatype. Store things as a date, and you can then output it in whatever format you like. Try doing that with a string or a number.
Don't say it doesn't happen as I got a birthday card from a company in May this year when I have specifically entered my date of birth as being the 5 of a month (name drop down box on their website)!Just because someone else doesn't understand how to work with dates correctly doesn't mean you can't! It's not exactly rocket science, after all!*{;-)
Maybe you are looking for
-
XSLT mapping, how can I include a Runtime Constants in target message
Hi, I would like in my XSLT mapping, to have an attribute include the MessageID. From my understanding of the online help [http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm|http://help.sap.com/saphelp_nw04/hel
-
I have an iPad that is loaded with music that I actually burned the cd's into iTunes on a computer at work a couple of years ago. I switched jobs some time ago so I no longer have access to that computer. Is there anyway to get that music into my iT
-
While trying to reinstall ITunes on my HP Laptop I get the message - Service 'Apple Mobile Device' failed to start. Verify that you have sufficient privilages to start system services! What now??
-
Structure for Receiver Jdbc adapter for multiple tables
Hi, For Receiver JDBC adapter,Standard structure structure as Statement Tablename(TABLE1) Action Access Can i make a structure like Statement Tablename(TABLE1) Action Access fields.... Tablenam
-
How do you change the fuse in a UK Apple 5w USB Power Adapter?
How do you change the fuse in a UK Apple 5w USB Power Adapter? Ours has stopped working and we presume it must be an internal fuse, but how do you access it as there is no 'slots' as on the 12w version? All UK power devices must be fused to comply wi