Need help about MS SQL Gate with Mess Code Data
My Database is Oracle9i, and select * from nls_database_parameters with fellow table params
PARAMETER VALUE
1 NLS_CSMIG_SCHEMA_VERSION 3
2 NLS_NCHAR_CHARACTERSET AL16UTF16
3 NLS_LANGUAGE AMERICAN
4 NLS_TERRITORY AMERICA
5 NLS_CURRENCY $
6 NLS_ISO_CURRENCY AMERICA
7 NLS_NUMERIC_CHARACTERS .,
8 NLS_CHARACTERSET UTF8
9 NLS_CALENDAR GREGORIAN
10 NLS_DATE_FORMAT DD-MON-RR
11 NLS_DATE_LANGUAGE AMERICAN
12 NLS_SORT BINARY
13 NLS_TIME_FORMAT HH.MI.SSXFF AM
14 NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
15 NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
16 NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
17 NLS_DUAL_CURRENCY $
18 NLS_COMP BINARY
19 NLS_LENGTH_SEMANTICS BYTE
20 NLS_NCHAR_CONV_EXCP FALSE
21 NLS_RDBMS_VERSION 9.2.0.5.0
22 NLS_SAVED_NCHAR_CS WE8ISO8859P1
and confing access ms sql with oracle gate by ODBC, and the ms sql characterset with Chinese_PRC_CS_AI, Chinese_PRC_CS_AS.
my pc NLS_LANG=AMERICAN_AMERICA.ZHS16GBK.
when i query oracle database chinese data is ok, but when access the chinese data in ms sql will be ????(mess code data)?
How can i confing to access mssql chinese data be normal format, pls ?
Edited by: Rain.zhang on 2008-10-8 下午3:15
hi llturro,
Thanks for answering my question. I have tried out what you suggested, but I still can't fix my problem. The following are the messages that display when I try to run my servlet. It seems that the DataSource, Connection and Statement are ok, however when it comes to the ResultSet the error message appear. What's wrong with my ResultSet coding ?
ResultSet rs = stat.executeQuery("SELECT ISBN FROM BOOKSINFO WHERE ISBN='"+primarykey+"'");
setEntityContext Method
Find by primary key
DataSource OK
Connection OK
Primary Key = 013-00-675721-9
Statement OK
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
<<no stack trace available>>
Similar Messages
-
Need help about distributed sql statement
Hello everybody
Enviroment:
Oracle 11g R1.
This Database was fine, 'till some days ago that a new system was deployed on other database. New system runs some SELECT querys to a my database using db_links. These statements are blocking some resources and 'cause that they are blocking many users of my database. I can see on Enterprise Manager this wait event : "enq: TM contention".
Now my question is, why are these querys are blocking resources and users if they are only of type SELECT??? I thought that querys that did this were DML and DDL statements.
Does this behavior is related with that those querys are executed by a distributed way (using dblinks)??
Thanks a lotuser652447 wrote:
Distributed Transactions require commit even if a Select. See the following FAQ post from Jonathan Lewis for some basic information.
http://www.jlcomp.demon.co.uk/faq/dblink_commit.html
HTHNot always true though, it depends. The article you are linking to is quite old and covers, as stated, Oracle version(s): 7.0 – 9.2. Whereas the OP is on 11.
http://download.oracle.com/docs/cd/B10500_01/server.920/a96521/ds_txns.htm
In the section "Read-Only Response"
Note that if a distributed transaction is set to read-only, then it does not use rollback segments. If many users connect to the database and their transactions are not set to READ ONLY, then they allocate *rollback space* even if they are only performing queries.
In the OP's version
http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/ds_txns003.htm#ADMIN12226
Note that if a distributed transaction is set to read-only, then it does not use undo segments. If many users connect to the database and their transactions are not set to READ ONLY, then they allocate *undo space* even if they are only performing queries.
However that doesn't account for the types of lock the OP is experiencing. -
Need help about Post goods movement with refernece to Inbound delivery
Hi All,
I am using FMs MB_CREATE_GOODS_MOVEMENT and MB_POST_GOODS_MOVEMENT and commit to create a goods movement. I am successfully creating the MM doc and also posting.But still the Inbound delivery is open for GR.Is there any other function module or BAPI that creates GR with reference to Inbound delivery and update the document flow?Or is there any parameter in the above FM that sets the inbound delivery.Kindly provide your guidance on the same.
Best Regards,
Sailaja.I used BAPI_GOODSMVT_CREATE and it posted the GR successfully and the document flow was updated also.
You have to use GM_code '01' and give the delivery number / item number w/o PO (if I gave the PO additionally, it also worked).
If still your document flow is not updated then have a look at OSS note 1050944 and check your config. -
I Need Help!!! Importing with Error Code -50
My Itunes has been working fine but when i opened it today it said my library was damaged and it saved what it could but when i tried to import the list back in it came up with "The file _____ cannot be imported An unknown error has occured -50" I read about how Mcafee might mess it up and i have aol security stuff that is powered by mcafee but i can't figure out what to do? Someone please help!!!!
My Itunes has been working fine but when i opened it today it said my library was damaged and it saved what it could but when i tried to import the list back in it came up with "The file _____ cannot be imported An unknown error has occured -50" I read about how Mcafee might mess it up and i have aol security stuff that is powered by mcafee but i can't figure out what to do? Someone please help!!!!
-
Hi, Need help about ios7 upgrade, after this upgrade I cannot watch youtube or any video with Ipad, and Iphone as well
I think my wireless rooter's setting has some problem but cannot found anything to solve,
I can watch if there is another wireless network , I tried this option in another place who has wireless network and I can watch.
Do you have any idea to do these setting , I dont have any problem when Ipad has 6.1.3 IOS,
need help
thanksThanks
I will and share the result. -
Need help about ref cursor using like table
Hi Guys...
I am devloping package function And i need help about cursor
One of my function return sys_refcursor. And the return cursor need to be
join another table in database . I don't have to fetch all rows in cursor
All i need to join ref cursor and another table in sql clause
like below
select a.aa , b.cc form ( ref_cursor ) A, table B
where A.dd = B.dd
I appeciate it in advanceMy understanding is that you have a function that returns a refcursor and is called by a java app.
Because this is a commonly used bit of code, you also want to reuse this cursor in other bits of sql and so you want to include it like table in a bit of sql and join that refcursor to other tables.
It's not as easy as you might hope but you can probably achieve this with pipelined functions.
Is it a direction that code should be going down? yes, eventually. I like the idea of pulling commonly used bits of code into a SQL statement especially into the WITH section, provided it could be used efficiently by the CBO.
Is it worth the effort given what you have to do currently to implement it? possibly not.
what else could you do? construct the sql statement independently of the thing that used it and reuse that sql statement rather than the refcursor it returns?
Message was edited by:
dombrooks -
Hi All,
Em..i just need some advice about choosing correct career path.I graduated with a first class in IT with business information science in 2009. In 2009 after looking for jobs for few months i took a manager post in a petrol station which i never wanted.(Due to the credit crunch & the Family financial reasons) .Then unfortunately i had to stay out of work for 18months due to a serious spinal code operation i had to face.now in 2011 July im fit & ready to start my life again. but im lost where to start/ which career path to choose. (i've still got the job at the petrol station as the manager)
ive liked data base management subject when i was in the University so, Ive been reading OCA-051 & interested on OCA qualification I just want to know what are the possible jobs i can apply if i get the certification? Basically what should i do to get any IT related job? :( ( i dont like programming)..
Please be kind to reply.
ps:i live in the Uk.
Thanks.872882 wrote:
Hi All,
Em..i just need some advice about choosing correct career path.I graduated with a first class in IT with business information science in 2009. In 2009 after looking for jobs for few months i took a manager post in a petrol station which i never wanted.(Due to the credit crunch & the Family financial reasons) .Then unfortunately i had to stay out of work for 18months due to a serious spinal code operation i had to face.now in 2011 July im fit & ready to start my life again. but im lost where to start/ which career path to choose. (i've still got the job at the petrol station as the manager)
ive liked data base management subject when i was in the University so, Ive been reading OCA-051 & interested on OCA qualification I just want to know what are the possible jobs i can apply if i get the certification? Basically what should i do to get any IT related job? :( ( i dont like programming)..
Please be kind to reply.
ps:i live in the Uk.
Thanks.You'll sit on your bum and ruin your back again with most IT jobs. With your government shrinking, OCA qualification won't have much worth unless you personally know someone in the private sector that needs help. An operator job with your petrol company (assuming it's not just a mom 'n pop station) would probably require heavy lifting.
IT is a good, solid, growing career path, but most of the work is still programming, and most ways up to better jobs go through that experience. You might be an exception if you have a way to join other skills with your IT education, such as business analysis or sales or web prettyfying. Perhaps the determinants are your personality and goals.
I know, it's tough, but if you are honest with yourself and check out some of the "what color is my parachute" kinds of career advice books, you can find a happy medium. There actually are some benefits in starting a career during economically troubled times, but you only see that in retrospect. You have to decide on goals, pursue them vigorously, and reevaluate when it doesn't work for you. -
need help about 1015 it says connect iphone to itunes on screen i did it but it doesnt work and says unexpected 1015
Try restoring it: Make sure you are following the instructions in this procedure to the letter. Here they are, with emphasis on some easily overlooked requirements:
Disconnect the USB cable from the iPhone, but leave the other end of the cable connected to your computer's USB port.
Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.If you cannot turn off the device using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the device turns off, release only the Sleep/Wake button.
Continue pressing and holding the Home button while you reconnect the USB cable to the device. The device should turn on.
Note: If you see the "low battery" screen, let the device charge for at least ten minutes to ensure that the battery has some charge, and then start with step 2 again.
Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears (iTunes icon and USB connector) release the Home button.
If necessary, open iTunes. You should see the "recovery mode" alert ("iTunes has detected a phone in recovery mode").
Use iTunes to restore the device.
If you do not see the "Connect to iTunes" screen, try these steps again.
If you see the "Connect to iTunes" screen but the device does not appear in iTunes, see this article and its related links.
If you have backed up the iPhone in the past, select the device in iTunes and choose "restore from backup". -
Need help about Hidden Markov Model model
I want to make classification for EEG signal using Hidden Markov Model
algorithm based on neural network.
plz need help about how to implement this algorithm using LABVIEW.
if not I want another thing to make classification.
any one know information about this topic, send me a reply
thanksHave you derrived the HMM that you want to implement?
If so, post the algorithm and we can provide comments on how to implement it using LabVIEW.
Message Edited by Ray.R on 04-12-2010 12:54 PM -
Need help about boot SUNFIRE V120
Hi all....
I need help about how to change boot from boot net to boot disk....
after i installed sun solaris 10 at my sunfire v120, then reboot the machine ... this sunfire still boot from net not from disk...
can i change it?
please i really need help ....
thanksIf its booted, try "eeprom boot-device=disk"
If your at the OBP, "setenv boot-device disk".
If that doesnt work check the value of "diag-switch?".
It could be booting off the the diag-device instead -
Need Help about 3D and revolving in illustrator
I really need help about 3D, Please tell me that How i create 3D in illustrator
i want to revolve text or shape around any object like this, any plugin? or other software required for this?
if somebody know this it will be really help full
http://rcgrafix.fizwig.com/1452732-large.jpg
http://rcgrafix.fizwig.com/1384370-large.jpg
http://rcgrafix.fizwig.com/1062180-large.jpg
Thanks
Arsiif links are not working try Copy and paste it in to your browser address bar
thank you -
Need help about the SHA Message Digest ? & what is use of Message Diagest ?
need help about the SHA Message Digest ? & what is use of Message Diagest ?
1>i have one program of making message digest
2>which requires two files name
3>one for input like txt
4> second is out put file of message digest
can any one tell what is the use of second generated file .MessageDigest md = MessageDigest.getInstance("SHA");
FileInputStream fis = new FileInputStream(args[0]);
byte[] b = new byte[1024];
int readed = -1;
while((readed = fis.read(b)) > 0)
md.update(b, 0, readed);
fis.close();
FileOutputStream fos = new FileOutputStream(args[1]);
byte[] d = md.digest();
StringBuffer sb = new StringBuffer();
for(int i = 0; i < d.length; i++) {
String str = Integer.toHexString(d[i] & 0xff);
sb.append(str.length() < 2 ? "0" + str : str);
fos.write(sb.toString().getBytes());
fos.close(); -
I purchased Creative Cloud through the Employee Purchase program. Had to reimage system. Need help reinstalling application. I have "redemption" code, but get error saying it has already been redeemed. Can you please advise how I go about getting my software reinstalled? If I was given the serial number when I redeemed, I don't have any record of it.
Thank you,
StarlaHi Starla Mehaffey,
I would suggest you to sign in with your Adobe ID during installation and your product will automatically recognize your membership details.
Refer this Link for any further assistance:- Redemption Code Help
Hope that helps,
Regards,
Rahul Tyagi -
Need help about using sqlplus_exec_template.sql
I tried to use sqlplus_exec_template.sql to execute our deployed mapping. At dos prompt I typed :
C:\>sqlplus username/[email protected] @C:\OWB\owb\rtp\sql\sqlplus_exec_template.sql
rtschema localhost SQL_LOADER CRD_APPL_MAPPING SKIP=0,LOAD=0,LOG_FILE
NAME=cvcpmapl.log,DIRECT=true,PARALLEL=false,ERRORS=50,ROWS=200,READSIZE=65536,BINDSIZ E=50000,AUDIT=true,PURGEGROUP=wb,target_store_uoid=F0E49963A42E4DB6AFF
85FFF8E05AB9E
SQL*Plus: Release 9.2.0.1.0 - Production on Fri May 16 18:32:25 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Session altered.
Role set.
Stage 1: Decoding Parameters
| location_name=localhost:1521:odb
| task_type=SQL_LOADER
| task_name=CRD_APPL_MAPPING
Stage 2: Opening Task
declare
ERROR at line 1:
ORA-20001: Task not found - Please check the Task Type, Name and Location are
correct.
ORA-06512: at line 261
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
=================================================
I am quite sure the task name and task type is correct. The task name is same as the one I saw in runtime repository schema -> table WB_RT_TASKS -> column TASK_NAME
, but I am very doubt about what should be the correct input for LOCATION, system parameter and custom parameter.
Can anyone give some help about where could I find the correct input for those parameter?
Thx in advance.
Rds
CHI 've tried to use :
sqlplus username/[email protected] @C:\OWB\owb\rtp\sql\sqlplus_exec_template.sql
rtschema OWBLOCATION SQL_LOADER CRD_APPL_MAPPING "," ","
where OWBLOCATION I have used the deploy location of the mapping for my case, created within OWB. The value is CCS_DEPLOY.
But the error is the same :
======================================================
Stage 1: Decoding Parameters
| location_name=CCS_DEPLOY
| task_type=SQL_LOADER
| task_name=CRD_APPL_MAPPING
Stage 2: Opening Task
declare
ERROR at line 1:
ORA-20001: Task not found - Please check the Task Type, Name and Location are
correct.
ORA-06512: at line 261
========================================================
could you tell me the SQL used by WB_RT_API to get the task from runtime schema. So that I could check the correct location myself.
Or how could I view the pl/sql of WB_RT_API_EXEC which is wrapped.
Thx for your help.
Rg.
CH -
Need help about roll ups for average that contains logic
--Hi everyone,
--I have posted this one on the forum before.
(how to do outer join select query for an APEX report )--I thought it works fine, but then yesterday, the tester check and said that the Average total is not correct
--the query is as below
DEFINE startmonth = "Aug 2012";
DEFINE endmonth = "Oct 2012";
WITH all_months AS
SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
, ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM ) AS next_month
from all_objects
where
rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
SELECT ph.phase_number
,TO_CHAR (am.which_month, 'Mon YYYY') AS month
, NVL(sum ( (CASE
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
THEN last_day(am.which_month)
ELSE ph.date_finished
END
) - ph.date_started + 1
) / count(def.def_id), 0) as avg_days
FROM all_months am
LEFT OUTER JOIN a_phase_membership ph PARTITION BY (ph.phase_number)
ON am.which_month <= ph.date_started
AND am.next_month > ph.date_started
AND ph.date_started <= last_day(am.which_month) -- May not be needed
AND ph.active = 1
LEFT OUTER JOIN a_engagement ce
ON ph.mpm_eng_id = ce.engagement_id
AND ce.court_name IS NOT NULL -- or something involving LIKE
LEFT OUTER join a_defendant def
ON ce.defendant_id = def.def_id
AND def.active = 1
GROUP BY ROLLUP(phase_number, am.which_month)
ORDER BY ph.phase_number, am.which_month
--result is
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Aug 2012 0
PHASE ONE Sep 2012 12
PHASE ONE Oct 2012 8
PHASE ONE 11
PHASE THREE Aug 2012 0
PHASE THREE Sep 2012 1
PHASE THREE Oct 2012 0
PHASE THREE 1
PHASE TWO Aug 2012 0
PHASE TWO Sep 2012 9
PHASE TWO Oct 2012 14
PHASE TWO 11.5
9.71428571428571428571428571428571428571
--And the tester is right, AVG days for phase one should be (12+8) /3 = 6.67 not 11, the same with phase two and three.
-- I tried to put a union select below the above which wrap it and do the average, but found that this select is too long and cumbersome.
--I have to ask for the Forum expert again, is there any way to make it look like
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Aug 2012 0
PHASE ONE Sep 2012 12
PHASE ONE Oct 2012 8
PHASE ONE 6.67
PHASE THREE Aug 2012 0
PHASE THREE Sep 2012 1
PHASE THREE Oct 2012 0
PHASE THREE 0.33
PHASE TWO Aug 2012 0
PHASE TWO Sep 2012 9
PHASE TWO Oct 2012 14
PHASE TWO 7.66
4.896... (average of Phase one, phase two, and phase three) --Here is the sample data structure (Database version is 11g)
CREATE TABLE "A_DEFENDANT"
"DEF_ID" NUMBER NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(50 BYTE),
"SURNAME" VARCHAR2(20 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"));
Sample Data
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
CREATE TABLE "A_ENGAGEMENT"
"ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
"COURT_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"DATE_REFERRED" DATE,
"DETERMINATION_HEARING_DATE" DATE,
"DATE_JOINED_COURT" DATE,
"DATE_TREATMENT_STARTED" DATE,
"DATE_TERMINATED" DATE,
"TERMINATION_TYPE" VARCHAR2(50 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
"DEFENDANT_ID" NUMBER,
CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"));
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
CREATE TABLE "A_PHASE_MEMBERSHIP"
"MPM_ID" NUMBER NOT NULL ENABLE,
"MPM_ENG_ID" NUMBER NOT NULL ENABLE,
"PHASE_NUMBER" VARCHAR2(50 BYTE),
"DATE_STARTED" DATE NOT NULL ENABLE,
"DATE_FINISHED" DATE,
"NOTES" VARCHAR2(2000 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"));
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);--Probably after this crazy project (reason: BA cannot make up her minds, and keep changing requirements about the reports, and then business want it done asap),
-- I need to buy a book and spend a lot of time to learn more about Oracle SQL Analytical function and Aggregation.
--Thanks a lot again, guys.
Ann--Thanks Jeneesh
--However, this time I found another bug relating filter the figures by court_name
DEFINE startmonth = "Aug 2012";
DEFINE endmonth = "Oct 2012";
WITH all_months_pre AS
SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
, ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM ) AS next_month
from all_objects
where
rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
all_months as
select phase_number,which_month,next_month
from all_months_pre,(select distinct phase_number from a_phase_membership)
total_data as
SELECT am.phase_number,
TO_CHAR (am.which_month, 'Mon YYYY') AS month,
nvl((CASE
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
THEN last_day(am.which_month)
ELSE ph.date_finished
END
) - ph.date_started + 1,0) days,def_id
FROM all_months am
LEFT OUTER JOIN a_phase_membership ph --PARTITION BY (ph.phase_number)
ON am.phase_number = ph.phase_number
--I have found out that the Requirement don't need these, so I comment it out
--and am.which_month <= ph.date_started
--AND am.next_month > ph.date_started
AND ph.date_started <= last_day(am.which_month)
AND ph.active = 1
LEFT JOIN a_engagement ce
ON ph.mpm_eng_id = ce.engagement_id
AND ce.court_name LIKE 'BB'
LEFT OUTER join a_defendant def
ON ce.defendant_id = def.def_id
AND def.active = 1
avg_data as
select phase_number,month,avg(days) avg_days
from total_data
group by phase_number,month
select phase_number,month,round(avg(avg_days),2) avg_days
from avg_data
group by rollup(phase_number,month)
order by 1
;--I run the select for
AND court_name like 'BB'
--then run for
AND court_name LIKE 'AA'
or court_name LIKE '%'--They all return the same result which is
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Aug 2012 0
PHASE ONE Oct 2012 12.67
PHASE ONE Sep 2012 7.2
PHASE ONE 6.62
PHASE THREE Aug 2012 0
PHASE THREE Oct 2012 5.67
PHASE THREE Sep 2012 0.33
PHASE THREE 2
PHASE TWO Aug 2012 0
PHASE TWO Oct 2012 5.75
PHASE TWO Sep 2012 3
PHASE TWO 2.92
3.85
13 rows selected --If I adjust the statement to
WITH all_months_pre AS
SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
, ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM ) AS next_month
from all_objects
where
rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
all_months as
select phase_number,which_month,next_month
from all_months_pre,(select distinct phase_number from a_phase_membership)
total_data as
SELECT am.phase_number,
TO_CHAR (am.which_month, 'Mon YYYY') AS month,
nvl((CASE
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
THEN last_day(am.which_month)
ELSE ph.date_finished
END
) - ph.date_started + 1,0) days,def_id
FROM all_months am
LEFT OUTER JOIN a_phase_membership ph --PARTITION BY (ph.phase_number)
ON am.phase_number = ph.phase_number
AND ph.date_started <= last_day(am.which_month)
AND ph.active = 1
INNER JOIN a_engagement ce
ON ph.mpm_eng_id = ce.engagement_id
AND ce.court_name LIKE 'BB'
LEFT OUTER join a_defendant def
ON ce.defendant_id = def.def_id
AND def.active = 1
avg_data as
select phase_number,month,avg(days) avg_days
from total_data
group by phase_number,month
select phase_number,month,round(avg(avg_days),2) avg_days
from avg_data
group by rollup(phase_number,month)
order by 1;--The result will be
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Oct 2012 29
PHASE ONE Sep 2012 19
PHASE ONE 24
24 --AND IF COURT_NAME = 'AA'
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Oct 2012 9
PHASE ONE Sep 2012 8.5
PHASE ONE 8.75
PHASE THREE Oct 2012 17
PHASE THREE Sep 2012 1
PHASE THREE 9
PHASE TWO Oct 2012 11.5
PHASE TWO Sep 2012 9
PHASE TWO 10.25
9.33 --It seems to me the figures now is correct. But then when there is no figures for the Phase, it will not display the phase.
-- is there any way to adjust the select statement so the result for ce.court_name LIKE 'BB' looks like
PHASE_NUMBER MONTH AVG_DAYS
PHASE ONE Oct 2012 29
PHASE ONE Sep 2012 19
PHASE ONE 24
PHASE TWO Oct 2012 0
PHASE TWO Sep 2012 0
PHASE TWO 0
PHASE THREE Oct 2012 0
PHASE THREE Sep 2012 0
PHASE THREE 0
8 The reason why I need it, because this is just one column that will be included in a union combined in the report that will looks like
PHASE_NUMBER MONTH SUM(AVG_IN_PHASE_ALL) SUM(NUM_IN_PHASE_CURR)
Phase 1 Aug 2012 0 0
Sep 2012 14.25 0
Oct 2012 11.14 1
8.46 1
Phase 2 Aug 2012 0 0
Sep 2012 18 0
Oct 2012 20.33 2
12.78 2
Phase 3 Aug 2012 0 0
Sep 2012 10 0
Oct 2012 12 0
7.33 0
9.53 3
13 rows selected And to put thing in big picture, this is the requirement from the Business Analyst
The requirements are:
The user must be able to request the extract for one or more calendar months, e.g.
May 2013
May 2013 – Sep 2013.
The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
The file must also include a row of totals.
The user must be able to request the extract for either AA or BB or Consolidated (both courts’ statistics accumulated).
Then the part that I am working on is
For each monitoring phase:
Phase name (e.g. “Phase One”)
Avg_time_in_phase_all_particip
for each phase name,
Add up days in each “phase name” Monitoring Phase, calculated as:
If Monitoring Phase.Date Finished is NULL or > month end date,
(*Month end date* Minus Monitoring Phase.Date Started Plus 1)
Otherwise (phase is complete)
(Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)
Divide by the numbers of all participants who have engaged in “phase name”.Thanks again for reading and spending time to help,
Ann
Edited by: Ann586341 on Nov 13, 2012 4:31 PM
Maybe you are looking for
-
Charge for smartphone on dumb phone line?
I have a friend with a dumb phone who just has minutes and text with Verizon. I gave her my old Droid Razr with the thought that she could still use apps when she's on wifi at home. But when she went to the Verizon dealer they told her that she wou
-
HI all we have a issue with KP06 Plannig to Cost centers and Cost elements,using Excel Upload option we have our own layout maintained in KP66 ,report painter and assigned the same in to Planning layout, it shows uploaded correctly in kp06 but some h
-
I am trying to make a Targa file with a transparent background in CS4. Searching help pages and google has given me no answers aside from saving as .gif or .png. Can anyone either step me through or redirect me to somewhere that can tell me how I ca
-
ExecuteArrayUpdate fail! help me!
Hi All, Please help me with this. I wrote a very simple code to insert data into Oracle table. But I found that, it was too slow. I try array insert feature and not succesful. When call stmt->executeArrayUpdate(3);, my program raised error immediatel
-
Oracle Forms and Oracle Reports interation without Oracle Portal
Hi to all Can I integrate the application developed in Oracle Forms and Oracle Reports without Oracle Portal with Single Sign On. and if yes then how? and if no then why? I use 9iAS relese 2 installed on machine 1 Oracle Database installed on machine