Eliminating the weekends and the user defined holidays.
Hi, this is my query so far:WITH cla_case AS
(SELECT 1 event_no, to_date('01/10/2011','dd/mm/yyyy') discover_date, to_date (' 02/10/2011 ',' dd/mm/yyyy') notification_date of all the double union)
Select double union all 2 event_no, to_date('02/10/2011','dd/mm/yyyy') discover_date, to_date('03/10/2011','dd/mm/yyyy') notification_date
SELECT 3 event_no, to_date('03/10/2011','dd/mm/yyyy') discover_date, to_date('04/10/2011','dd/mm/yyyy') notification_date double
),
cla_event AS
(SELECT 1 event_no, to_date (' 02/10/2011 ',' dd/mm/yyyy') incident_date of all the double union)
SELECT event_no 2, to_date (' 02/10/2011 ',' dd/mm/yyyy') incident_date of all the double union
SELECT 3 event_no, to_date('03/10/2011','dd/mm/yyyy') incident_date of the double
)
SELECT
round (cc.notification_date - GREATEST (cc.discover_date, ce.incident_date)) Days_To_Report
Of
cla_case cc,
cla_event this
WHERE
CC.cla_event_no = ce.cla_event_no
Problem is that I must first eliminate the weekends and holidays then. I read on creating a calendar where you list the holidays, but I have no idea how to do this.
Here is the link for the South African holidays: http://www.blaauwberg.net/public_holidays.php it's for 2010-2012. I'm going to need in 2008, but I find this info at a later stage.
Thank you!
Banner:
Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production."
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Hello
So, if you have already run the insert
INSERT
INTO
non_working_days
( day,
day_type
)
SELECT
NEXT_DAY(TO_DATE('01/01/2008','DD/MM/YYYY') + 7 * (rownum -1),'SATURDAY') day,
'WEEKEND' day_type
FROM
dual
connect by
level <=500
UNION ALL
SELECT
NEXT_DAY(TO_DATE('01/01/2008','DD/MM/YYYY') + 7 * (rownum -1),'SUNDAY') day,
'WEEKEND' day_type
FROM
dual
connect by
level <=500
/
1000 rows created.
all you need to do is remove this bit of the query
non_working_days AS
( SELECT NEXT_DAY(TO_DATE('01/01/2008','DD/MM/YYYY') + 7 * (rownum -1),'SATURDAY') day, 'WEEKEND' day_type FROM dual connect by level <=500 UNION ALL
SELECT NEXT_DAY(TO_DATE('01/01/2008','DD/MM/YYYY') + 7 * (rownum -1),'SUNDAY') day,'WEEKEND' day_type FROM dual connect by level <=500
)
Everything that was done was to create a table on the fly for the purpose of showing the issue. If your query can be simply
WITH cla_case AS
( SELECT 1 cla_event_no, to_date('01/10/2011','dd/mm/yyyy') discover_date, to_date('10/10/2011','dd/mm/yyyy') notification_date from dual union all
SELECT 2 cla_event_no, to_date('02/10/2011','dd/mm/yyyy') discover_date, to_date('13/10/2011','dd/mm/yyyy') notification_date from dual union all
SELECT 3 cla_event_no, to_date('03/10/2011','dd/mm/yyyy') discover_date, to_date('14/10/2011','dd/mm/yyyy') notification_date from dual
),
cla_event AS
( SELECT 1 cla_event_no, to_date('02/10/2011','dd/mm/yyyy') incident_date from dual union all
SELECT 2 cla_event_no, to_date('03/10/2011','dd/mm/yyyy') incident_date from dual union all
SELECT 3 cla_event_no, to_date('04/10/2011','dd/mm/yyyy') incident_date from dual
)
SELECT
e.cla_event_no,
e.days_to_report,
e.days_to_report - COUNT(nwd.day) working_days_to_report
FROM
(
SELECT
cc.cla_event_no,
GREATEST(cc.discover_date,ce.incident_date) start_date,
cc.notification_date end_date,
round(cc.notification_date - GREATEST(cc.discover_date,ce.incident_date)) Days_To_Report
FROM
cla_case cc,
cla_event ce
WHERE
cc.cla_event_no = ce.cla_event_no
) e
LEFT OUTER JOIN non_working_days nwd
ON( nwd.day BETWEEN TRUNC(e.start_date) AND TRUNC(e.end_date))
GROUP BY
e.cla_event_no,
e.days_to_report
/
Tags: Database
Similar Questions
-
How to operate the user defined table ddl transformations?
How can I run (Oracle Data Modeller 4.1.0.873) my transformations of the user-defined table ddl (for the creation or - map source files). (In tools-> rules of design and Transformations-> Table DDL transform his only Test and debugging for an entity)
Is it possible to have a new button in the toolbar to start my generations DDL?
Hello
There is a brief description in the file sqldeveloperdatamodelerscripting.docx located in the directory datamodeler\datamodeler\xmlmetadata\doc of your DM 4.1 instalation.
Somehow you can read also here Oracle SQL Developer Data Modeler 4.1 user - defined DDL generation using transformation scripts
You can use the script for the purposes of testing only, otherwise the output of this script will be included in the DDL if script 'Active' selected value and ago marked to be included in this generation of tables
Philippe
-
How to remove the user defined color chart in illustrator cc
How can I remove groups swatch defined by the user in the menu in illustrator CC drop down 'open the Swatch Library? I'm on a Mac Book Pro 13.
Hi Peter,.
You can navigate to: Applications > Adobe Illustrator CC 2015 > Presets > en_US > color chart, and there, you can manually delete the user defined color chart.
Thank you
OM
-
List of tables of objects or the user-defined type columns
Hello
SQL > select * from v version $;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I have n number of tables in my db, since I have several
tables containing "user defined type columns.
so, how can I get/list db objects that contains the user-defined type columns only.
Please suggest me on this
Kind regards
FaizDear Sir
I have n number of tables in my db,from that i have several tables which contains"user defined type columns" so how could i get/list the db objects which contains user defined type columns only. Kindly suggest me on this
Use this
select tab.table_name , tab.column_name , tab.data_type from user_tab_columns tab , user_types typ where tab.data_type = typ.type_name order by tab.table_name ;
Best regards
Mohamed Houri
-
Flash Wrapper and access user-defined variables
I'm working on creating a Flash AS3 wrapper to combine several files cpativate. I am able to retrieve system variables, but I'm not able to recover the user-defined variables. I have a variable that is defined by the user in my Captivate called passedScore, in my Flash script, I have the following...
var mcLesson1:MovieClip;
btnHit.addEventListener (MouseEvent.CLICK, test);
var vLoader:Loader = new Loader();
vLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, swfLoaded);
vLoader.load (new URLRequest ("untitled1.swf"));
function swfLoaded(e:Event):void {}
mcLesson1 = MovieClip (vLoader.contentLoaderInfo.content);
vLoader.contentLoaderInfo.removeEventListener (Event.COMPLETE, swfLoaded);
addChild (mcLesson1);
}
function test(event:MouseEvent):void
{
feedback1. Text = mcLesson1.cpInfoCourseName;
feedback2. Text = mcLesson1.m_VarHandle.passedScore;
}
retroaction1 correctly displays the name of the course, however, for feedback2 it errors saying a term are indefinite (referring to m_VarHandle)
try to use mcLesson1.cpEIGetValue ('m_VarHandle.passedScore');
-
Question of the user defined Type (UDT)
Hello
The attached file is NEITHER sample to call a VB6 vi.
The following is declared in the declaration section:
' Global declarations
Dim lvapp As LabVIEW.Application
Dim vi LabVIEW.VirtualInstrumentWhen I paste these statement in another project (that I'm working on), I get an error 'undefined user-defined type '.
Can someone point out to me were in the sample, these type definitions are declared?
Thank you
Rafi
PS the attachment is indeed xxx.rar and not xxx.zip. I changed the name because .rar has not been accepted. Please rename .rar
Thank you
I forgot to mark references to my project
Project--> references--> LabView. Type library of xxx
Thank you
-
How to write to the file in the user defined interval
Hello
I am trying to find a way to take samples of data in a stream of measures of constraint which came to Labview to a NI 9237 module. These samples must be written to a file for later analysis. The vi must be able to record a data explosion according to an interval defined by the user and sampling frequency.
For example, save at 10 Hz up to 10 seconds every 15 minutes.
My attempt to do this is attached (as you can probably see I'm a newbie to Labview).
In my example, I used a random generator to simulate my data to the NI 9237. Using a loop for, I tried to get the vi to write 5 data points in the file. However he writes the same data point in the file 5 times, instead of 5 successive observations.
Finally, I'd like the vi to write data in the file for a period of time (10 seconds) instead of writing a set number of data points.
Please can someone tell how should I do to achieve this?
Thank you very much
Something like that?
-
How to use the negation in the user defined rules?
Hello
Can you please show me an example using negation in the rule set by the user? I created a rule like below (the rule says that if a patient has a fever problem and not having penicillin hypersensitivity, then recommend medication1):
INSERT INTO mdsys.semr_myMedicineRB VALUES ('rule1',
' (? p RDF: type: Patient) (? p: present? c1) (? c1 RDF: type: fever) (? c2 RDF: type: Penicillin_Hypersensitivity)',
"(NOT_EXISTS (p: present c2))',
' (? p: recommendation: medication1)',
SEM_ALIASES (SEM_ALIAS (",'http://www.example/medicine#')));
The rule correctly applied in the modules. However, I cannot move to the phase of creation entailment and got errors:
ORA-29532: Java call terminated by eception Java exception: java.sql.SQLException: parameter IN or OUT to missing index: 1
ORA-06512: at the 'MDSYS. SDO_SEM_INF_INTERNAL', line 16453
ORA-06512: at the 'MDSYS. SDO_SEM_INFERENCE', line 302
ORA-06512: at the 'MDSYS. SDO_SEM_INFERENCE', line 352
ORA-06512: at the 'MDSYS. RDF_APIS', line 118
ORA-06512: at line 2
29532 00000 - "Java call terminated by eception Java exception: %s."
* Cause: A mistake or a Java exception has been reported and could not be
solved by Java code.
* Action: Modify Java code, if this behavior is not expected.
According to the post
, it seems that negation is not supported in rules defined by the user. Can you please advice how to implement the negation in the rules defined by the user? Thank you very much in advance.Hong
Salvation Hong,
Negation is not supported in rules defined by the user. If you need a work-around, please follow the suggestion in the post you referenced.
If you use Oracle Database Release 12 c, user-defined inference can certainly manage negation.
It will be useful,
Zhe Wu
-
How to remove the user defined color chart
Hello I use a mac and CS5.5, I just want to know how to remove user-defined shades.
Help and everywhere in the forums, I searched and there are a few answers, I followed along but so far none of them worked.
Please help me if you can.
Thank you
In the Finder, choose go > go to folder type in "~/Library" (without the quotes), it's the tilde key (the wavy line next to the number 1 on the keyboard), and then the anti-slash-library.
This will open the library folder of the user for the Mac operating system.
(With OS 10.6.8 or more you can simply access the disk hard/Users / [you] / library because the library folder is not hidden, unless you use Mac OS 10.7 or newer)
Now, go to / Application Support/Adobe/Adobe Illustrator CS5.1/en_us/Swatches
You will see the files defined by the user, if they have been saved to the default location. If they were not saved to the default location, you will have to search your hard drive for the file names.
-
How to upgrade the user defined material cost type of cost specific org
Hello
We need to update material cost sub-elements of something to an org specific and defined by the user type of cost.
I inserted a line of example in the CST_ITEM_CST_DTLS_INTERFACE and open interface "mass update material operating costs", but the program does not deal with all the lines, the rest 1 Process_flag.
insert into cst_item_cst_dtls_interface
(inventory_item_id,
organization_id,
id_ressource,
usage_rate_or_amount,
cost_element_ID,
Process_Flag,
last_update_date,
last_updated_by,
CREATION_DATE,
created_by
)
values
(96023,
343,
52538,
0.00208012,
1,
1,
SYSDATE,
fnd_global.user_id,
SYSDATE,
fnd_global.user_id
)
Can someone help me with this, thanks.
Concerning
YohanI think that there is some confusion.
"Edit material costs of mass" program is used to apply the new rate of activity to the issue of costs. To do this, you don't have to insert records in the interface. You should define/update activity rates new use of the screen.To process the records in the interface of cost tables, you must run the program of 'importation cost process.
For more details, see http://download.oracle.com/docs/cd/A60725_05/html/comnls/us/cst/settas06.htm
Hope that answers your question
Sandeep Gandhi
OMKAR Technologies Inc.
Techno-Functional consultant -
Hi, experts,
I wrote a sql query to get the amount after calculation.
It runs correctly, and no error returned.SELECT A.FORM_NO, C.SKUCODE, B.QUANTITY * ( CASE WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) = 2008 AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) = 2008 THEN TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) - TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) +1 WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) = 2008 AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) > 2008 THEN 12- TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) + 1 WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) < 2008 AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) = 2008 THEN TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) < 2008 AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) > 2008 THEN 12 ELSE 0 END )/((TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) - TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY'))) *12 + TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) - TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) + 1 ) AS QUAN FROM FORM_TBL A, QUANTITY_TBL B, SKU_TBL C WHERE A.FORMNO = B.FORMNO AND B.SKU = C.SKU;
I would change for a user-defined function.
BUT IT CANNOT BE COMPILIED.create or replace function get_quantity (pi_year number, pi_year_diff number, pi_form_no varchar2, pi_skucode varchar2) return number is po_quantity number; begin SELECT ( B.QUANTITY * ( CASE WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) = (pi_year + pi_year_diff) AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) = (pi_year + pi_year_diff) THEN TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) - TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) +1 WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) = (pi_year + pi_year_diff) AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) > (pi_year + pi_year_diff) THEN 12- TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) + 1 WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) < (pi_year + pi_year_diff) AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) = (pi_year + pi_year_diff) THEN TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) WHEN TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY')) < (pi_year + pi_year_diff) AND TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) > (pi_year + pi_year_diff) THEN 12 ELSE 0 END )/((TO_NUMBER(TO_CHAR(A.END_DATE,'YYYY')) - TO_NUMBER(TO_CHAR(A.START_DATE,'YYYY'))) *12 + TO_NUMBER(TO_CHAR(A.END_DATE,'MM')) - TO_NUMBER(TO_CHAR(A.START_DATE,'MM')) + 1 )) into po_quantity FROM FORM_TBL A, QUANTITY_TBL B, SKU_TBL C WHERE A.FORMNO = B.FORMNO AND B.SKU = C.SKU and c.skucode = pi_skucode and a.form_no = pi_form_no; return po_quantity; end;
The error is a recursive sql error
ORA-00604: an error has occurred at the SQL level 1 recursive
I think that there is no syntax error.
What is the reason?
Thank you very much!What is your DB version. If you are using 11g then can be consider that
http://www.DBA-Oracle.com/sf_ora_00604_error_occurred_and_recursive_sql_level_string.htm
-
Querying the user-defined types
I have a chart in which one of the columns is a user-defined data type:
The type 'MYTYPE' is a simple object that contains a field: a CLOB called MESSAGE:SQL> describe my_table ... USER_DATA MYTYPE
When I do a "select *...» "in this table, the USER_DATA column appears as"MYTYPE (oracle.sql.CLOB@898c2d).SQL> describe mytype Name Null? Type ------ ----- ---- MESSAGE CLOB
I know that for CLOB and BLOB fields, Developer SQL let me double click on the value and display the content. But for type like this defined by the user that contains a field, I can't navigate the data members of type. I find myself wanting to do something like a 'select user_data.message from my_table", but this is not a valid syntax. Is there a way to query a given specific member of this type defined by the user with the rest of the columns in the table, I can display the CLOB member instead of a representation of the object? If not, is it possible to configure SQL Developer to allow me to browse the data members of types defined by the user? TOAD has a feature like that but I would only use SQL Developer and it is a table that I work with on a regular basis.csimons,
Try this:
select t1.user_data.message from eimgr.aq_rtv_docs_out_table t1 where rownum = 1;
See you soon
Edited by: Frenchwood on September 22, 2009 22:38
-
The user defined timers to introduce e-mails in request workflows
Hello.
Everyone you have suggestions for how to generate reminder (task e-mail) e-mail messages according to the requirements of time user?
This is the scenario; We have a process complete planned work involving several parties.According to the planned work client process final approval/rejection may or may not be needed and the time required depends on the demand for scheduled jobs.
I have not found a way how to get the e-mail tasks or delay the enabled tasks based on scheduled start/end time, time limits or custom date/time fields. And because it is dynamic information, using OLA, ALS seems to manage the necessary need for flexibility either.
A method that works somewhat but is very weak in that it can be easily missed, is having a special branch out to a separate task of late leading to a task send.
He however didn't prompt/force users to visit the task late and is therefore easily missed. To HRT I work then need to add another task before the delay task to ask the user to change the delay still active task. Very awkward in my opinion. Especially since this workflow will be 2-3 these timers.Can anyone think of a better solution for this (ideally, not involving development that our management is strongly against these.)
Thank you
PS, we're always on 9.1.2 (if 9.1.8 seems stable we could upgrade his in the near future)
Hello
FP7 delay task having been slightly improved. More options for delay have been added in order to use any field time of application as the basis for delay task. I can guess that could be useful in your case.
And Yes, if you decide updated the system, then I strongly suggest stright goes forward to v.9.1.8. Although it has some problems, but not so big in FP7.
If you want to always (will be) for sticking with the current version, try other options as well:
* Change the delay task parameters (according to request field?) by using a Custom Action (stored Proc or a query) within a task of conditional branching:
* Use the SQL to update the settings of task as requered. This can be difficult and might not work properly due to cached data.
* Use custom voting service to manage the tasks/notification of the delay in your workflow. This solution requires programming skills, but you will have much more freedom for the things you can do.
And sorry if I don't have your question just because it seems a bit complicated (at least for me).
-
How to change the user defined objects in oracle
Hi all
Can someone tell me how to change objects defined by the user in oracle.
Thank you
Prakash PYou have created other objects that depend on your type? If so, according to the error message, you can use the keyword of the WATERFALL to change dependent objects
SQL> ed Wrote file afiedt.buf 1 CREATE OR REPLACE TYPE phone_t AS OBJECT ( 2 a_code CHAR(3), 3 p_number CHAR(8), 4* extension VARCHAR2(5)) ; SQL> / Type created. SQL> create type phone_arr as table of phone_t; 2 / Type created. SQL> alter type phone_t 2 modify attribute extension varchar2(10) 3 cascade; Type altered.
Justin
-
Red dot on the user-defined variables.
At the risk of looking like an episode of Seinfeld, there is a red dot on some of my variables defined by the user, does anyone know what this could be?
Thanks for any help,
Hello
The red dot means that the variable is set in the defined variable. Without the dot variables are in the variable defined the same as in the definition of the default variable.
Take a bow
Willam
Maybe you are looking for
-
Hello! I work with cRIO and I want to simulate signal sine on FPGA of entry. I read this tutorial http://zone.ni.com/devzone/cda/tut/p/id/7445 , BUD I do not understand how to simulate signal sine on my FPGA entry. The main problem is how to create a
-
Impossible to install Vista updates
I use Vista 32 bit, family premium, SP1, latest installed update is KB955430. Download and install the updates seem to work - until the moment where my system wants to "configurations". Here, the system stops and removes the installed updates. What I
-
Windows xp Telnet client Vs Windows Vista telnetclient
Telnet client on windows xp: Telnet CLI modem responds as expected Telnet client in windows vista: Same modem telnet CLI do not answer as it does in Windows Xp
-
Hi all. I recently bought a Dell studio 1737 in which windows vista family premium is already installed. A few days back, I was installing drivers that were installed successfully. When I activate my window, he asked for the product key which has bee
-
TZ SOHO firmware update and firewall issues
I just updated my SOHO to 6.2.5.0 - 25n Now, I get an error when you try to add a firewall access rule. It doesn't matter which service I use, I get an error. I've never seen these errors before and Ive worked with SonicWALLS years. Ive had this prob