Problem with query to find data offset
Hello PL/SQL gurus and Experts.I am not able to extract the data with the following table structure-
drop table T2;
create table T2(Stream, Trade, Fees) as select
'MECHNICAL', 'Primary', '5534500' from dual union all select
'ELECTRICAL', 'Secondary', '5285500' from DUAL union all select
'MECHNICAL', 'Secondary', '2364535' from dual union all select
'ELECTRICAL', 'Primary', '1734540' from DUAL union all select
'MBE', 'Secondary', '3424500' from dual union all select
'ELECTRONICS', 'Primary', '5004567' from DUAL union all select
'ELECTRONICS', 'Secondary', '4543200' from DUAL union all select
'COMPUTERS', 'Secondary', '5534500' from DUAL union all select
'CIVIL', 'Primary', '2345500' from DUAL union all select
'CIVIL', 'Secondary', '4456500' from DUAL union all select
'COMPUTERS', 'Primary', '9542500' from DUAL;
I want to extract the data in the following format-Stream Trade Fees
MECHNICAL Primary 5534500
Secondary 2364535
ELECTRICAL Primary 1734540
Secondary 5285500
ELECTRONICS Primary 5004567
Secondary 4543200
CIVIL Primary 2345500
Secondary 4456500
MBE Primary
Secondary 3424500
Total 34693342
Now if I use the following query-SELECT CASE WHEN LAG(Stream||Trade) OVER (ORDER BY Stream, Trade, Fees) = Stream||Trade THEN NULL ELSE Stream END Stream
, CASE WHEN LAG(Stream||Trade) OVER (ORDER BY Stream, Trade, Fees) = Stream||Trade THEN NULL ELSE Trade END Trade
, CASE WHEN LAG(Fees) OVER (partition by Stream||Trade ORDER BY Stream, Trade, Fees) = Fees THEN NULL ELSE Fees END Fees
FROM ( select distinct Stream, Trade, Fees from T2 ORDER BY Stream, Trade, Fees);
SELECT NVL2(LAG(Trade) OVER (PARTITION BY Stream, Trade ORDER BY Stream, Trade, Fees),Null,Trade) Trade,
NVL2(LAG(Stream) OVER (PARTITION BY Stream, Trade ORDER BY Stream, Trade, Fees),Null,Stream) Stream,
Fees
from (select distinct Stream, Trade, Fees from T2)
Kindly help me...Thank you all for your time and effort in advance.
use the below. There would be better ways to achieve, I find it easier.
with filtered as
(
select case row_number() over(partition by stream order by trade)
when 1 then stream
else null end stream2,trade,fees
from t2
order by stream,trade
)
select stream2 stream, trade, to_number(fees)
from filtered
union all
select 'Total', null, sum(fees)
from t2;
STREAM TRADE TO_NUMBER(FEES)
----------- --------- ----------------------
CIVIL Primary 2345500
Secondary 4456500
COMPUTERS Primary 9542500
Secondary 5534500
ELECTRICAL Primary 1734540
Secondary 5285500
ELECTRONICS Primary 5004567
Secondary 4543200
MBE Secondary 3424500
MECHNICAL Primary 5534500
Secondary 2364535
Total 49770342
I hope that it meets your needs. If this isn't the case, then please don't forget to provide the expected results, because we have to guess, if you still want to exit expected Original or there is a diversion in it.
Tags: Database
Similar Questions
-
need help with query can find data back please help.
Hi guys I have a table such as
and I have a data as suchCREATE TABLE "FGL" ( "FGL_GRNT_CODE" VARCHAR2(60), "FGL_FUND_CODE" VARCHAR2(60), "FGL_ACCT_CODE" VARCHAR2(60), "FGL_ORGN_CODE" VARCHAR2(60), "FGL_PROG_CODE" VARCHAR2(60), "FGL_GRNT_YEAR" VARCHAR2(60), "FGL_PERIOD" VARCHAR2(60), "FGL_BUDGET" VARCHAR2(60) )
I need bascially to get the total of the budget column. However this is not as simple as it sounds good (at least not for the me.) totals carried forward to the new period. you will notice that you have a period column. Basically, what im is thatInsert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');
fgl_grant_year 10 1 period = account 7600 its $100 and $100 for the period 2, you see $ 100 more, it wants to not be added to this is the door on the balance. that is $100.
So im trying to write a query that basically does the following.
IM considering a period for the sake of this example let period 1 I get anything else. I find that the greates contributes dumpster year the amount for the period 14 (which corresponds to the total of the previous year) and add it to the amount of the current year. in this case period 1 grnt_year 11
the expected result is therefore $700
do not forget that I am not given a just a period of the year.240055 240055 7240 4730 02 10 14 200 240055 240055 7600 4730 02 10 14 100 240055 240055 7600 4730 02 11 1 400
any help you guys can give would be immensely appreciated. I tried to get this to work for more than 3 days now.
Finally broke down and put together this post
Published by: mlov83 on Sep 14, 2011 20:48Hello
Thanks for posting the CREATE TABLE and INSERT statemnts; It is very useful.
I'm not sure that understand your needs.
The correct output will be just one line:TOTAL_BUDGET ------------ 700
or will it be 3 ranks that you posted? I guess you want just line after line.
Do you mean that you are given a period (for example, 1).
First you have to find the largest gfl_grnt_year which is related to this period (in this case, 11).
Then you need to add fgl_budget lines that have to be
(1) the specific period and the largest fgl_grnt_year, or
(2) perriod = 14 and the previous fgl_grnt_year (in this case, 10).
Is this fair?If so, here's a way to do it:
WITH got_greatest_year AS ( SELECT fgl.* -- or whatever columns are needed , MAX ( CASE WHEN fgl_period = :given_period THEN fgl_grnt_year END ) OVER () AS greatest_year FROM fgl ) SELECT SUM (fgl_budget) AS total_budget -- or SELECT * FROM got_greatest_year WHERE ( fgl_grnt_year = greatest_year AND fgl_period = :given_period ) OR ( fgl_grnt_year = greatest_year - 1 AND fgl_period = 14 ) ;
If you want the 3 lines you have posted, then change the main SELECT clause to ' SELECT * ' (or, instead of *, youcan the columns you want to see the list).
-
Problem with the filtering of data
Hello!
I have a problem with filtering the data in my table and don't know how to solve it properly.
I created a tabular presentation, my table, a few text fields that are used as input for the various columns of the filter and a filter button that submits the page.
The problem appeared when I try to filter a column that has null values in the table and is editable... it's that I have found.
When I press the button I get no line, although there should be some.It's the submitted query:
Select
"MSR_PRD_ID,"
"SRC_STM_ID,"
"ID."
"ISIN"
...
of ' #OWNER # '. " IZV_SLOG_DET ".
WHERE
Lower (MSR_PRD_ID) = low (nvl (: P7_X_MSR_PRD_ID, MSR_PRD_ID)) and
Lower (SRC_STM_ID) = low (nvl (: P7_X_SRC_STM_ID, SRC_STM_ID)) and
lower (ISIN) = low (nvl (: P7_X_ISIN, ISIN)) and
...
The nvl function is used so that if the user leaves the field blank it filters by fields that have entry only.
Does anyone know how I could get around this?
Kind regardsIvan
LOWER (NVL (ISIN, 'Y')) = LOW (NVL (: P7_X_ISIN, BASS (NVL (ISIN, 'Y'))))
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Apress.com/9781430235125
https://Apex.Oracle.com/pls/Apex/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
-------------------------------------------------------------------
-
Problem with analytical function for date
Hi all
ORCL worm:
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 11.2.0.2.0 Production."
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I have a problem with the analtical for the date function. I'm trying to group records based on timestamp, but I'm failing to do.
Could you please help me find where I'm missing.
THXThis is the subquery. No issue with this. I'm just posting it for reference. select sum(disclosed_cost_allocation.to_be_paid_amt) amt, substr(reference_data.ref_code,4,10) cd, to_char(external_order_status.status_updated_tmstp, 'DD-MON-YYYY HH24:MI:SS') tmstp, DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID id FROM Deal.Fee_Mapping_Definition , Deal.Fee_Index_Definition , Deal.Fee_Closing_Cost_Item, Deal.Closing_Cost, Deal.Document_Generation_Request, deal.PRODUCT_REQUEST, deal.External_Order_Request, deal.External_Order_Status, deal. DISCLOSED_CLOSING_COST, deal.DISCLOSED_COST_ALLOCATION, deal.reference_data WHERE Fee_Mapping_Definition.Fee_Code = Fee_Index_Definition.Fee_Code AND Fee_Index_Definition.Fee_Index_Definition_Id = Fee_Closing_Cost_Item.Fee_Index_Definition_Id AND Fee_Closing_Cost_Item.Closing_Cost_Id = Closing_Cost.Closing_Cost_Id AND CLOSING_COST.PRODUCT_REQUEST_ID = Document_Generation_Request.Product_Request_Id AND closing_cost.product_request_id = product_request.product_request_id AND Product_Request.Deal_Id = External_Order_Request.Deal_Id AND external_order_request.external_order_request_id = external_order_status.external_order_request_id AND external_order_request.external_order_request_id = disclosed_closing_cost.external_order_request_id AND DISCLOSED_CLOSING_COST. DISCLOSED_CLOSING_COST_ID = DISCLOSED_COST_ALLOCATION.DISCLOSED_CLOSING_COST_ID AND Fee_Index_Definition.Fee_Index_Definition_Id = Disclosed_Closing_Cost.Fee_Index_Definition_Id AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id = Reference_Data.Reference_Data_Id AND Document_Generation_Request.Document_Package_Ref_Id IN (7392 ,2209 ) AND External_Order_Status.Order_Status_Txt = ('GenerationCompleted') AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id IN ( 7789, 7788,7596 ) AND FEE_MAPPING_DEFINITION.DOCUMENT_TYPE_REF_ID = 1099 AND Document_Generation_Request.Product_Request_Id IN (SELECT PRODUCT_REQUEST.PRODUCT_REQUEST_id FROM Deal.Disclosed_Cost_Allocation, Deal.Disclosed_Closing_Cost, DEAL.External_Order_Request, DEAL.PRODUCT_REQUEST, Deal.Scenario WHERE Disclosed_Cost_Allocation.Disclosed_Closing_Cost_Id = Disclosed_Closing_Cost.Disclosed_Closing_Cost_Id AND Disclosed_Closing_Cost.External_Order_Request_Id = External_Order_Request.External_Order_Request_Id AND External_Order_Request.Deal_Id = Product_Request.Deal_Id AND product_request.scenario_id = scenario.scenario_id AND SCENARIO.SCENARIO_STATUS_TYPE_REF_ID = 7206 AND product_request.servicing_loan_acct_num IS NOT NULL AND product_request.servicing_loan_acct_num = 0017498379 --AND Disclosed_Cost_Allocation.Disclosed_Cost_Allocation_Id = 5095263 ) GROUP BY DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID, External_Order_Status.Status_Updated_Tmstp, Reference_Data.Ref_Code, disclosed_cost_allocation.to_be_paid_amt order by 3 desc, 1 DESC; Result: 2000 1304-1399 28-JUL-2012 19:49:47 6880959 312 1302 28-JUL-2012 19:49:47 6880958 76 1303 28-JUL-2012 19:49:47 6880957 2000 1304-1399 28-JUL-2012 18:02:16 6880539 312 1302 28-JUL-2012 18:02:16 6880538 76 1303 28-JUL-2012 18:02:16 6880537 But, when I try to group the timestamp using analytical function, select amt ,cd ,rank() over(partition by tmstp order by tmstp desc) rn from (select sum(disclosed_cost_allocation.to_be_paid_amt) amt, substr(reference_data.ref_code,4,10) cd, to_char(external_order_status.status_updated_tmstp, 'DD-MON-YYYY HH24:MI:SS') tmstp, DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID id FROM Deal.Fee_Mapping_Definition , Deal.Fee_Index_Definition , Deal.Fee_Closing_Cost_Item, Deal.Closing_Cost, Deal.Document_Generation_Request, deal.PRODUCT_REQUEST, deal.External_Order_Request, deal.External_Order_Status, deal. DISCLOSED_CLOSING_COST, deal.DISCLOSED_COST_ALLOCATION, deal.reference_data WHERE Fee_Mapping_Definition.Fee_Code = Fee_Index_Definition.Fee_Code AND Fee_Index_Definition.Fee_Index_Definition_Id = Fee_Closing_Cost_Item.Fee_Index_Definition_Id AND Fee_Closing_Cost_Item.Closing_Cost_Id = Closing_Cost.Closing_Cost_Id AND CLOSING_COST.PRODUCT_REQUEST_ID = Document_Generation_Request.Product_Request_Id AND closing_cost.product_request_id = product_request.product_request_id AND Product_Request.Deal_Id = External_Order_Request.Deal_Id AND external_order_request.external_order_request_id = external_order_status.external_order_request_id AND external_order_request.external_order_request_id = disclosed_closing_cost.external_order_request_id AND DISCLOSED_CLOSING_COST. DISCLOSED_CLOSING_COST_ID = DISCLOSED_COST_ALLOCATION.DISCLOSED_CLOSING_COST_ID AND Fee_Index_Definition.Fee_Index_Definition_Id = Disclosed_Closing_Cost.Fee_Index_Definition_Id AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id = Reference_Data.Reference_Data_Id AND Document_Generation_Request.Document_Package_Ref_Id IN (7392 ,2209 ) AND External_Order_Status.Order_Status_Txt = ('GenerationCompleted') AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id IN ( 7789, 7788,7596 ) AND FEE_MAPPING_DEFINITION.DOCUMENT_TYPE_REF_ID = 1099 AND Document_Generation_Request.Product_Request_Id IN (SELECT PRODUCT_REQUEST.PRODUCT_REQUEST_id FROM Deal.Disclosed_Cost_Allocation, Deal.Disclosed_Closing_Cost, DEAL.External_Order_Request, DEAL.PRODUCT_REQUEST, Deal.Scenario WHERE Disclosed_Cost_Allocation.Disclosed_Closing_Cost_Id = Disclosed_Closing_Cost.Disclosed_Closing_Cost_Id AND Disclosed_Closing_Cost.External_Order_Request_Id = External_Order_Request.External_Order_Request_Id AND External_Order_Request.Deal_Id = Product_Request.Deal_Id AND product_request.scenario_id = scenario.scenario_id AND SCENARIO.SCENARIO_STATUS_TYPE_REF_ID = 7206 AND product_request.servicing_loan_acct_num IS NOT NULL AND product_request.servicing_loan_acct_num = 0017498379 --AND Disclosed_Cost_Allocation.Disclosed_Cost_Allocation_Id = 5095263 ) GROUP BY DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID, External_Order_Status.Status_Updated_Tmstp, Reference_Data.Ref_Code, disclosed_cost_allocation.to_be_paid_amt order by 3 desc, 1 DESC); Result: 312 1302 1 2000 1304-1399 1 76 1303 1 312 1302 1 2000 1304-1399 1 76 1303 1 Required output: 312 1302 1 2000 1304-1399 1 76 1303 1 312 1302 2 2000 1304-1399 2 76 1303 2
Rod.Hey, Rod,
My guess is that you want:
, dense_rank () over (order by tmstp desc) AS rn
RANK means you'll jump numbers when there is a link. For example, if all 3 rows have the exact same last tmstp, all 3 rows would be assigned number 1, GRADE would assign 4 to the next line, but DENSE_RANK attributes 2.
"PARTITION x" means that you are looking for a separate series of numbers (starting with 1) for each value of x. If you want just a series of numbers for the entire result set, then do not use a PARTITION BY clause at all. (PARTITION BY is never required.)
Maybe you want to PARTITIONNER IN cd. I can't do it without some examples of data, as well as an explanation of why you want the results of these data.
You certainly don't want to PARTITION you BY the same expression ORDER BY; It simply means that all the lines are tied for #1.I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Simplify the problem as much as possible.
Always tell what version of Oracle you are using.
See the FAQ forum {message identifier: = 9360002}Published by: Frank Kulash, August 1, 2012 13:20
-
Problem with transmission of the data in table between a driver and a method.
I'm having a problem with a project for school. We want to take the data in a table, we create in our driver, pass it to the method, do something for her and return the data to the driver. Well, I still get the same error message and after looking at dozens of sites, it seems that I think that I have the correct code... but I still get the same error message. Here is the error message that I've been doing.
* ola1driver.java:35: get() in ola1method may apply to (char [] [])
x.get (Dar);
(upwards arrow pointing between x and get) *.
I'd appreciate any help I'm leaving research to simply looking at my code to try to find the error. My wife things I'm going nuts at the moment.
Here are my two files, the first is the driver and the second method
Take a 2D array and send the data to a method, and then put it back
import java.util.Scanner;
class ola1driver
{
Public Shared Sub main (string args [])
{
Entrance to the parser = new Scanner (System.in);
ola1method x = new ola1method();
Char [] [] dar = new char [10] [100];
char dat_input;
Set up the loop at the entrance a table of 10 x 100 with data imported from a dat file
for (int i = 0; i < 10; i ++)
{
for (int j = 0; j < 100; j ++)
{
dat_input = input.next () .charAt (0);
Dar [i] [j] = dat_input;
}
}
Send the array to the method and displays the original table to compare the return data
x.Set (Dar);
for (ip int = 0; ip < 10; ip ++)
{
for (int jp = 0; jp jp; < 100 ++)
{
System.out.printf ("%n", dar [ip] [jp]);
}
}
To get the data of the method and then print the data in the table opposite
x.get (Dar);
for (int r = 0; r < 10; r ++)
{
for (int c = 0; c < 100; c ++)
{
System.out.printf ("%n", dar [r] [c]);
}
}
}
}
Now the method;
Method to receive a 2D painting, reverse the data and then put it back
class ola1method
{
Char [] [] ar = new char [10] [100];
Char [] [] rar = new char [10] [100];
public void set (char [] [] ar)
{
/ * To reverse the entries in the table
to prove that real return
data was transferred between the driver
and the method * /
IR int = 0;
for (int i = 9; I have > 0; i-)
{
for (int j = 100; j > 0; j-)
{
int jr = 0;
RAR [ir] [Jr.] is ar [i] [j];.
Jr ++;
}
IR ++;
}
}
Return the data to the driver
public char [] [] get()
{
return of rar;
}
}
Published by: Seamus on February 20, 2011 08:25
Published by: Seamus on February 20, 2011 08:26Seamus wrote:
I thought that I sent my method by using the x.set table, and then by calling the reversed with the x.get table.x.Set (someArray) in fact to 'send an array to the method '.
And if x.get () is declared to return an array, then, Yes, it indeed 'retrieve a table. "
However, these are two completely different methods. The get method doesn't know something on the table sent via the set method unless the game puts a place who knows himself. For example, something like this:
public class X { private int[] arr; public void set(int[] arr) { this.arr = arr; } public int[] get() { reverse arr and return it } } public class Main { public static void main(String[] args) { int[] arr1 = {1, 2, 3}; X x = new X(); x.set(arr); int[] arr2 = x.get(); } }
However, this seems a bit unusual. It is not clear from your initial post, but looks like it is supposed to be a single method that takes the array and it reverses. If so, you could either simply invert the table and returns nothing, since the variable of the appellant and the parameter of the method will all be pointing to the same table object, or you could return a reference to the table that you have received and reversed, or you can copy the table, reverse the copy and return a reference to that.
I don't know what your needs are, but the point is that it is more common to call a single method to do something like that, rather than separate set() and get() methods.
Edited by: jverd February 20, 2011 09:36
Edited by: jverd February 20, 2011 09:37
-
problem with query select in the search
Hello
Here I use MYSQL database and when I insertind to the database date, it saves as "2009-11-10 00:00:00 ' and when I used to do this show in dateformat as November 10, 2009".
Here's the problem occurs, when I write a search like query
Select recruitername, interviewdate, skillset
details
where interviewdate = #form.interviewdate #.I'm not a problem with the date. could u please help me how to solve this problem.
Or, better yet, a
with a type date. WHERE interviewdate =
-
Problem with query issuing service
Hello
I had a problem with sub query with the cast function.
Any help appreciated reallly.SQL> SELECT 2 CAST ( ( ( (COUNT ( 3 CASE 4 WHEN ServiceRequest_ec.WasCaseClosed = 1 5 THEN 1 6 END) )* 100) / (COUNT (DISTINCT ServiceRequest_ec.case_id)) ) AS nvarchar) AS Average 7 FROM ServiceRequest_ec 8 INNER JOIN cases_ec 9 ON ServiceRequest_ec.case_id = cases_ec.case_id 10 INNER JOIN contacts_ec 11 ON ServiceRequest_ec.contact_id = contacts_ec.contact_id 12 INNER JOIN users_ec 13 ON contacts_ec.user_id = users_ec.user_id 14 INNER JOIN departments_ec 15 ON contacts_ec.department_id = departments_ec.department_id 16 WHERE 1 = 1; END) )* 100) / (COUNT (DISTINCT ServiceRequest_ec.case_id)) ) AS nvarchar) AS Average * ERROR at line 6: ORA-00902: invalid datatype SQL> spool off
Thanks in advance
Published by: user512743 on December 8, 2008 03:40I find a lot of difference in your script. Just run this part and let us know if it is running or not->
SELECT CAST( ( COUNT( CASE WHEN ServiceRequest_ec.WasCaseClosed = 1 THEN 1 END ) * 100 )/( COUNT( DISTINCT ServiceRequest_ec.case_id ) ) AS nvarchar2(30) ) AS Average FROM ServiceRequest_ec INNER JOIN cases_ec ON ServiceRequest_ec.case_id = cases_ec.case_id INNER JOIN contacts_ec ON ServiceRequest_ec.contact_id = contacts_ec.contact_id INNER JOIN users_ec ON contacts_ec.user_id = users_ec.user_id INNER JOIN departments_ec ON contacts_ec.department_id = departments_ec.department_id WHERE 1 = 1 GROUP BY contacts_ec.user_id, users_ec.UserName , users_ec.firstname , users_ec.lastname , contacts_ec.department_id , departments_ec.name;
Maybe you run a partial query of much more complex query. And does not separate the two successfully. After you receive this error - I guess.
Just run my solution and let us know.
Kind regards.
LOULOU.
-
Problem with iterator and EJB data control
My project components:
JDeveloper 12.1.3
Back end & the intermediate layer, JPA, EJB 3, controls data EJB
JSF pages simple front end (no fragment), bounded task flow
Hello
I have a weird problem with iterators in my project, project using EJB 3 & JPA and EJB data controls
When the user come to a page (this page is part of a stubborn workflow) and add a record to a table (linked to an iterator) and without saving changes, leave the page (means output delimited task flow)
do something else and again back to the first page iterator always keep this line is entry and it cause problems in my system
If I close the browser and come to this page for sure the line is not there
I expect when the user leaving a stubborn workflow each thing belongs to this workflow should be deleted. Is this true?
Or someone has the same problem? Any suggestions / or work around?
Respect of
Mohsen
Have you read the link I posted? Have you named the BA a transactional data control?
When you leave the workflow you issue a rllback and the new line should have disappeared.
Timo
-
ESXi5 - problems with NFS and the data copy store
Hello world
I recently moved into a solution fully virtualized for my network, 3 x 5 ESXi servers running on our GigE network.
First of all, I use all free software from VMware, so vCentre etc is out of the question.
I have major problems when you try to copy files between:
- NAS (NFS) to ESXi 5 host
- ESXi host to the NAS (NFS) 5
- And using VMware converter between ESXi 5 hosts converter Standalone
The problem is that whenever I'm transfer between hosts I am struck with the horrible network performance. Even if I use GigE adapters and switches between my hosts I will receive no more than 12 Mbps speed of transfer real (100 Mbit/s connect?).
On the flipside, if I use virtual guests on the same exact host I can happily transfer data between my NAS (NFS) servers with speeds between 60-150MBps ~ (1000 Mbps).
Examples:
Speed of 10 Mbps of transfer of ESXi_1 copy OF NFS data store share ~
Server2008 (comments, located on ESXi_1) copy OF NFS 75MBps transfer rate ~.
Server2011 SBS (comments, located on ESXi_2) copy OF Windows share 2008 (ESXi_1) transfer speed 120MBps. ~
ESXi_2 copy OF NFS data store share transfer rate 5MBps ~.
Attached (wtf.png) example:
I copy a file that is located on our NFS share first, it's a 3 GB file to the copy within guest OS (2008), it is indicated in blue - top speed of 80MBps
I copy the same exact NFS share for the host (datastore1), this is indicated in red - top speed of 7.5Mbps
The third transfer/s (green) is between the customers of windows on different hosts, transfer a 6 GB file as well as a copy of the 360 MB file - transfers two happily send to GigE speeds with a peak around 40MBps
I can reflect these results across the three servers without modification. Copies between you will be able to run well enough (not exactly 100% use of GigE) but at the moment where I try to do something to the data store it will just choke at all about a 100 Mbps connection speed.
The final image (wot.png) confuses me beyond belief. I would try to explain what is happening here:
- This image shows two times the same exact file transfers, except even machine PHYSICS
- The first (red) transfer between the ESXi_2 host server and the NFS share using the browser data store and direct download - its top speed is around 8MBps
- The second (green) transfer between a guest server 2008 running on ESXi_2, download the same file exactly at the exact location using vSphere Client. I mean the same EXACT file; It connects to the NFS drive by the data store ESXi_2 (NFS share).
Why on earth can my comments directly download a file on a data store connected to NFS GigE clocked and yet the same exact host cannot go anywhere near corresponding to these speeds?
As indicated in the title, the problem seems to happen whenever I use ESXi datastore browser on the host computer using vSphere Client or between browser datastore ESXi to/from an NFS share.
No one knows what might happen?
Is there some sort of restriction on the transfer of files between a host and shared NFS ESXi 5? Whence this bottleneck?
Thanks in advance for all the help/ideas that guys can throw my way.
P.S. Sorry for the wall of text, I really wanted to give as much information. as possible.
What type of storage you have locally on the host computer?
I have seen this problem with write-through controllers: http://wahlnetwork.com/2011/07/20/solving-slow-write-speeds-when-using-local-storage-on-a-vsphere-host/
-
Need help with query between 2 dates
Hello
I did not SEE in a long time and need help with a simple query.
I have a table of DB access with 3 fields, name, date and number
What I want is to create a query to retrieve all the names between 2 dates
When I ask the date field, the results are showing in this formats 2013-07-12 00:00:00
Here's my query
< cfquery datasource = 'mydb' name = 'test' >
SELECT name from myTable
where edate between ' 2011-01-01 00:00:00 ' AND ' 2013-01-01 00:00:00 '
< / cfquery >
< cfoutput query = 'test' >
#name #.
< / cfoutput >
What I get is this error
ODBC = 22005 (assignment error) error code
[Microsoft] [ODBC Microsoft Access driver] Type mismatch of data in the expression of the criteria.
Don't know what I'm doing wrong here.
Please let me know.
Thank you
SELECT ename
FROM MyTable
WHERE edate BETWEEN
AND
#ename #.
-
Problem with the locale and date serialization in java
Hello
I have a serious problem with Flex dates and need a solution as soon as possible. I have a Flex 2 front end that uses remote java objects to talk to the database. I have a Flex 2 DateFields form. The dates of these are stored in the datebase. However I need the dates to be stored exactly as users them selects regardless of the locale.
What is happening at the moment is we are developing in Ireland and in selecting a date, filling an actionscript VO which is in turn transformed into a java VO (on a server in the United States) and when the date is stored in the database is one day before the date that we have selected. It seems that the flash player uses the locale with a time of midnight (GMT) users. When place the conversion to the EAST, it stores the date (GMT - 5), which causes the being Eve.
I changed my flex code to set the date at 12: 00 time even if he converts and subtracts 5 hours it will always be the same date. But this does not work, it seems to work sometimes and not others and is very inconsistent. I can't understand why it works sometimes.
Its makes me mental - someone has experienced this problem or did someone knows a solution PLEASE?
Thank youI'm not very familiar with your specific question, but I wonder if a combination of store dates as the first milliseconds since midnight January 1, 1970, universal time, stored as a string and then when presenting the data are aware, locale would solve the problem.
-
Problem with query (Date)
I have a query that works very well on a bt database when I run the same question him on another database returns an error
Query
Select a.COL1
of tab1 a
where a.col2 in (select b.col1
tab2 b
where b.col2 = 'EDF '.
and b.col3 = 'ABCD')
and a.COL2 = '7875750'
and a.COL3 = "KJD" and
a.part_date) = 23 November 2009 12:00:00 AM ';
Error:
ORA-01858: a non-digit character was found here where was waiting for a digital
The strange part is... its fine on a db of work and give more top of the error on the new database configuration recently... I tried to use the to_date bt it always returns an error
Help, pleaseThe problem is twofold.
(1) suboptimal SQL
(2) dependent data "bug".
You change the code, change the data or live with this error -
Problems with lines due double date/time in the query
Hello
I'm trying to draw a list of the counties of the test sample. I want only 1 rank by the test result so that I can build a report in Cognos showing the rate of an outcome determined as a percentage of the total causes a range of dates.
My problem is that I get duplicate for the same result rows: in the example below, I have 2 to 5 lines for each result instead of only 1 for each result. I have this reduced up to caused by the date - the date is the same, but the times are different, if several lines are drawn. I tried to use tronque(), among other things, but although the output now shows the same date without the time part, duplicate rows are always drawn.
Any help would be appreciated!
This is the code for the query:
SELECT DISTINCT io.lab_id AS "LAB ID", l.name AS "LAB NAME", mtr.marketingtest_id AS "TEST ID", mtl.name AS "TEST NAME", mtr.marketingresult AS "MARKETING RESULT", COUNT(DISTINCT mtr.sample_id) AS "NO OF SAMPLES", TRUNC(os.statusdate) AS "STATUS DATE", os.orderstatuscodes_id AS "ORDER STATUS", io.redoorderid AS "REDOORDERID", mtl.locale_id AS "LOCALE" FROM igen_sample s INNER JOIN igen_igenityorder io ON s.igenityorder_id = io.igenityorder_id INNER JOIN igen_orderstatus os ON io.igenityorder_id = os.igenityorder_id INNER JOIN igen_marketingtestresult mtr ON s.sample_id = mtr.sample_id INNER JOIN igen_lab l ON io.lab_id = l.lab_id INNER JOIN igen_marketingtestlocale mtl ON mtr.marketingtest_id = mtl.marketingtest_id WHERE mtl.locale_id = 1 AND os.orderstatuscodes_id IN (8, 9) AND mtr.marketingtest_id = 84 AND os.statusdate BETWEEN '24-OCT-2011' AND '31-OCT-2011' GROUP BY mtr.marketingtest_id, mtl.name, mtr.marketingresult, os.statusdate, os.orderstatuscodes_id, io.lab_id, l.name, io.redoorderid, mtl.locale_id ORDER BY mtl.name
Hello
893078 wrote:
HelloI'm trying to draw a list of the counties of the test sample. I want only 1 rank by the test result so that I can build a report in Cognos showing the rate of an outcome determined as a percentage of the total causes a range of dates.
My problem is that I get duplicate for the same result rows: in the example below, I have 2 to 5 lines for each result instead of only 1 for each result. I have this reduced up to caused by the date - the date is the same, but the times are different, if several lines are drawn. I tried to use tronque() among others...
TRUNC looks like what you want. If you want a single line per calendar day, or need to GROUP BY TRUNC (os.statusdate).
AND os.statusdate >= TO_DATE ( '24-OCT-2011' , 'DD-MON-YYYY' ) AND os.statusdate < TO_DATE ( '31-OCT-2011' , 'DD-MON-YYYY' ) + 1 GROUP BY mtr.marketingtest_id , mtl.name , mtr.marketingresult , TRUNC (os.statusdate) -- <== CHANGED , os.orderstatuscodes_id , io.lab_id , l.name , io.redoorderid , mtl.locale_id ORDER BY mtl.name
If os.statusdate is a DATE, don't try to compare it to a VARCHAR2, as 24 October 2011 "." Compare DATEs to other DATEs.
Furthermore, GROUP BY product automatically separate results. If all GROUP expressions in the SELECT clause, there is not need to say SELECT DISTINCT .
Published by: Frank Kulash, November 23, 2011 09:34
-
Problem with query between Dates:
Hello again,
The following query gives some problems in that the line where 'CURRENT_DATE' is between 'START_DATE' and ' end_date.
The query returns the records close to these dates, but some missing on the end_date. I was wondering if there is 'of time to play here? How is that only the date component used for research?
Select * from)
SELECT TO_CHAR (LEAVE. Start_date, 'DD-MON-YY') AS Start_Date,
TO_CHAR (LEAVE. End_date, 'DD-MON-YY') AS end_date,.
TO_CHAR (CURRENT_DATE, 'DD-MON-YY') SUCH AS CURRENT_DATE,
LEAVE.NAME as the NAME,
LEAVE.ID as ID,
LEAVE. DAY by day,
LEAVE. SUPERVISOR supervisor,
LEAVE. LEAVE_TYPE,
"LEAVE".
WHERE CURRENT_DATE BETWEEN start_date AND end_date
)
Kind regards
Steve WelchTry this:
WHERE the trunc (CURRENT_DATE) BETWEEN trunc (start_date) AND trunc (end_date)
-
Problem with "Query" parameter data pump
Hello guys,.
My information in the table are less than
Name of the schema: CT_COM
Table name: order_session
The current size of the table = ~ 75
Total number of rows in the table: 3847904-> select count (*) from CT_COM.order_session;
Total number of lines with condition: 734042 (orders over 1 January 08)-> select count (*) from CT_COM.order_session where updated_date < = 31 December 07 ';
Now, I'm taking an export in which I want to capture all the orders that are placed before 1 January 08. Here's the query I use on a DB of RHEL server. I 10.2.0.3 db on this server.
expdp "" / as sysdba "" logfile = FULL_TABLE:order_session_upto_dec_31_07.log query = CT_COM.order_session dumpfile=FULL_TABLE:order_session_upto_dec_31_07_%U.dmp:------"" where updated_date------<------= \'31-DEC-07\'\ ' filesize = 2 G job_name = order_session_upto_dec_31_07 "
Export: Release 10.2.0.3.0 - Production on Wednesday, August 4, 2010 16:11
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Release 10.2.0.3.0 - Production
Departure 'SYS '. "' ORDER_SESSION_UPTO_DEC_31_07 ': ' / * AS SYSDBA' dumpfile=FULL_TABLE:order_session_upto_dec_31_07_%U.dmp logfile = FULL_TABLE:order_session_upto_dec_31_07.log query = CT_COM.order_session:" "where updated_date < = 31 December 07 ' ' filesize = 2 G job_name = order_session_upto_dec_31_07"
Current estimation using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Table main 'SYS '. "' ORDER_SESSION_UPTO_DEC_31_07 ' properly load/unloaded
******************************************************************************
Empty the files together for SYS. ORDER_SESSION_UPTO_DEC_31_07 is:
/Backup/export/tables/order_session_upto_dec_31_07_01.dmp
Job 'SYS '. "" ORDER_SESSION_UPTO_DEC_31_07 "carried out at 16:11:31
Query runs fine without error. However if you look at the output above it exports all lines. I keep seeing Total estimation using BLOCKS method: 0 KB. -What did I do wrong?
I even tried the same scenerio with table scott.emp and I see the same behavior. Did I miss something in my where clause or is this a bug?
Expdp $ Linux-223: (bonus) "" / as sysdba "" dumpfile=full_table:a%U.dmp logfile = FULL_TABLE:a.log query = scott.emp:------"' where sal------> 2000------' filesize = 2 G job_name = b.job"
Export: Release 10.2.0.4.0 - Production on Wednesday, August 4, 2010 15:11:31
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Departure 'SYS '. "' B ': ' / * AS SYSDBA' dumpfile=full_table:a%U.dmp logfile = FULL_TABLE:a.log query = scott.emp:" where sal > 2000 "filesize = 2 G job_name = b.job
Current estimation using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Table main 'SYS '. "' B ' properly load/unloaded
******************************************************************************
Empty the files together for SYS. B is:
/tmp/A01.dmp
Job 'SYS '. "' B ' managed to 15:12:46
Any help will be appreciated.
-MM
Published by: UserMM on August 4, 2010 14:48It has nothing to do with your request, it has to do with the rest of your order expdp. You specify a schema on the table, or you specified an export scheme so default datapump is the schema to run the task. As you export the work as "sys" it will only export objects belonged to sys. Since datapump does not export the sys objects, nothing get exported. You want to add
schemas = CT_COM
or
tables = CT_COM.order_session
Thank you
Dean
Maybe you are looking for
-
Microsoft Natural Ergonomic Keyboard wireless 7000
I just bought and installed this keyboard, which seems to have a major shortcoming on the keyboards of MS proevious - there is no indicator light indicating when num, caps lock, shift, and lock are on - is there a way around this? Thank you very much
-
Why my digital output give 1V instead of 5V?
I have a PCI-6030E. When I look at its digital output to port0/$line0, I see 1V instead of 5V when it is 'high '. He read 0V when 'low '. Any ideas? Amit
-
Update on closure stuck button icon
The icon to update on my close button is stuck as if: This has happened for about a week or two, even if the computer has not been used regularly for a while. Window cannot find more important updates and has been checking regularly. When I hit shutd
-
Samsung laptop hard drive failure
2 years ago, I bought a laptop for my son. The hard drive has failed a few weeks previously. I bought a new hard drive but have made the Pc didn't come with all Windows 8.0 disk. How can I get a copy of win 8 and the software recognizes the product k
-
where is playing strong option on the new drive to download?
Where is playing strong option on the new drive to download?