Plz help me rectify this query
Hi,
I am trying to use a OR condition in NOT IN clause, is the SQL statement correct way:
select name from master_list where ((id not in (select id from deleted_list)) OR (id not in (select id from inactive_list)))
I there are two tables which contain ids which should be in not in clause.
Thanks,
Raja
Hi,
Whenever you post fomatted text on this site (and code should always be formatted), type these 6 characters:
{code}
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
What is the problem?
Are you getting an error message?
Why not post the error message?
Are you getting the wrong results?
Post some sample data, and the results you want to get from that data.
NOT IN will never be TRUE if the sub-query includes any NULL rows. I can't tell if that's possible with your tables or not..
Similar Messages
-
Hi,
Can you’ll please help me with this query.
Here is a little bit of background:
One title can have multiple items associated with it.
Table: TITLE has the master list of titles. TITLE_ID is the primary key.
Table: ITEM has the master list of all items. ITEM_ID is the primary. This table also has the TITLE_ID which stores title for this item.
Table: ITEM_STATUS has fields ITEM_ID and STATUS_ID. This field contains statuses for items. But not all items contained in the table ITEM are in this table.
I want to find TITLE_ID’s whose all items (all ITEM_ID in table ITEM having same value for TITLE_ID) have a particular status (for example STATUS_ID = 2) in table ITEM_STATUS.
Let’s say TITLE_ID = 1 has 5 items in table ITEM_ID and only 4 items out of it in table ITEM_STATUS with STATUS_ID = 2, then this TITLE_ID should not come. OR
Let’s say TITLE_ID = 1 has 5 items in table ITEM_ID and all these 5 items are in table ITEM_STATUS but only 1 has STATUS_ID = 2, then this TITLE_ID should also not come
In the above case only if all 5 items are contained in table ITEM_STATUS have STATUS_ID = 2 then this TITLE_ID should be reported by the query.
What should be the query like for this one, I am fairly new to SQL so plz guide me.
Thank you,
RajaI haven't tested the query below. Try it and let me know for any issues:
SELECT DISTINCT t.title_id
FROM title t,
item i,
item_status its
WHERE t.title_id = i.title_id
AND i.item_id = its.item_id
AND NOT EXISTS (
SELECT 1
FROM item_status its1
WHERE its1.item_id = i.item_id
AND status_id <> 'YOUR_ITEM_STATUS'
) -
Plz help in tuning this query......
SELECT "LAN","VEF_REF_NO","VF_TYPE_CODE","APPLICANT_TYPE","MANDATORY","OPTIONAL","COMPLETE","DT_COMPLETED","REFIRENO","ROLE","USER_ID","DT_LASTUPDATED","TEMPLATEFIRED"
FROM T_VER_STRATEGY_DETAILS M
WHERE VF_TYPE_CODE =1 AND
APPLICANT_TYPE ='A' AND
DT_LASTUPDATED=
(SELECT MAX(DT_LASTUPDATED)
FROM T_VER_STRATEGY_DETAILS
WHERE LAN = M.LAN AND
VF_TYPE_CODE =1 AND APPLICANT_TYPE ='A')
This seems to be a correlated query.
i tried using combined index on
(VF_TYPE_CODE ,APPLICANT_TYPE ,DT_LASTUPDATED)
and another index on
(LAN,VF_TYPE_CODE ,APPLICANT_TYPE ) but the plan or cost remains unchained.
plz help[url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long...
-
Plz help to make this query......very urgent
I ve two tables <br>
<br>
First one is <b>grn_dtl</b> containing following fields <br> <br> <br>
<u><b>
item_code ent_dt qty doc_no </u></b><br>
11001318 09/09/2003 5 56300501 <br>
11001318 11/09/2004 9 56300502 <br>
11001318 12/05/2005 2 56300503 <br>
11001319 22/06/2004 0 56300504 <br>
11001320 09/06/2005 0 56300505 <br>
11001320 11/08/2004 8 56300506 <br>
11001320 30/05/2005 4 56300507 <br>
11001320 21/06/2003 1 56300508 <br>
11001321 25/09/2004 1 56300509 <br>
11001321 15/07/2004 1 56300510 <br>
11001321 01/08/2004 2 56300511 <br>
11001322 02/06/2004 1 56300512 <br>
11001322 22/06/2004 2 56300513 <br>
11001323 12/09/2004 1 56300514 <br>
11001323 08/05/2004 4 56300515 <br>
11001323 17/08/2004 5 56300516 <br>
11001323 28/06/2004 2 56300517 <br>
<br><br>
second one is <b>item_mst</B> containing following fields <br>
<br>
<u><b>
item_code description leadtim kanbandate</u></b><br>
11001318 aaaaaaaaaaa 15 22/04/2004<br>
11001319 aaaaaaaaaaa 15 02/12/2004<br>
11001320 aaaaaaaaaaa 15 14/07/2005<br>
11001321 aaaaaaaaaaa 15 23/02/2004<br>
11001322 aaaaaaaaaaa 15 05/10/2004<br>
11001323 aaaaaaaaaaa 15 17/05/2004<br>
11001324 aaaaaaaaaaa 15 27/12/2004<br>
11001325 aaaaaaaaaaa 15 07/08/2004<br>
<br><br><br><b>
From the above two tables I want the combine SQL query which will display item_code its description ,kanbandate from item_mst table and will also display the minimum ent_dt of each corresponding item_code alongwith the qty and doc_no.the item_code should not be repeated .<br>
I want to run the query from sql query analyzer</b><br><br>
the result should be like this<br><br>
<b></u>item_code desc ent_dt qty doc_no</b></u>
<br>
11001318 aaaaaaaaaaa 09/09/2003 5 56300501<br>
11001319 aaaaaaaaaaa 22/06/2004 0 56300504<br>
11001320 aaaaaaaaaaa 21/06/2003 1 56300508<br>
11001321 aaaaaaaaaaa 15/07/2004 1 56300510<br>
11001322 aaaaaaaaaaa 02/06/2004 1 56300513<br>
11001323 aaaaaaaaaaa 08/05/2004 4 56300515<br>
<br>
<br>
plz help me out ASAP
null
Message was edited by:
aanchal_2008can you try this,
SELECT DISTINCT im.item_code,
im.descR,
gd.ent_dt,
gd.qty,
gd.doc_no
FROM item_mst im,
grn_dtl gd
WHERE im.item_code = gd.item_code (+)
AND NOT EXISTS (
SELECT 'later detail'
FROM grn_dtl gd2
WHERE gd2.item_code = gd.item_code
AND gd2.ent_dt > gd.ent_dt)
ITEM_CODE DESCR ENT_DT QTY DOC_NO
11001318 aaaaaaaaaaa 2/12/2005 6 563005
11001319 aaaaaaaaaaa 6/22/2004 0 563005
11001320 aaaaaaaaaaa 6/9/2005 0 563005
11001321 aaaaaaaaaaa 12/5/2005 5 563005
11001322 aaaaaaaaaaa 6/22/2004 2 563005
11001323 aaaaaaaaaaa 9/12/2004 1 563005
11001324 aaaaaa
11001325 aaaaaa
8 rows selected -
i need to get each manager name, his department name and for each year that is for 81,82,83,84 count of employee's under that manager from emp and dept tables .
thanks in advance
select distinct deptno, TO_CHAR (HIREDATE, 'YY'), count(*) from emp group by TO_CHAR(HIREDATE, 'YY'), DEPTNO ORDER BY TO_CHAR(HIREDATE, 'YY'), DEPTNO;
the above query returns me count of employees ,year and deptno
SELECT DISTINCT E2.ENAME , E1.ENAME, E1.DEPTNO, E1.MGR, E1.EMPNO, E1.SAL, D.DNAME, D.LOC FROM EMP E1, EMP E2, DEPT D WHERE E1.MGR = E2.EMPNO AND E1.DEPTNO = D.DEPTNO ORDER BY E1.DEPTNO;
this query returned me manager names and employees under them
Message was edited by:
user450660At that point you're not too far off, you have most of what you need. In general, any time you see the use of DISTINCT it's a sign that either your query or your data model isn't designed quite right.
SELECT m.ename,
d.dname,
TO_CHAR (e.hiredate, 'YY') AS hire_year,
COUNT(*) AS emp_count
FROM emp e, emp m, dept d
WHERE e.mgr = m.empno
AND m.deptno = d.deptno
GROUP BY
m.ename,
d.dname,
TO_CHAR (e.hiredate, 'YY'); -
Plz help me in this query for the tree
hi All
I want to bulid tree that start with for example
schema name "scott"
then table "dept,emp
then ename in table emp
root scott
parent dept
child emp_name
please help me in the query ?user222 wrote:
any help my dearsIf you can draw one simple tree example. Then it will be easy to create query. Because i am confuse about the output. Just draw one example of your desired output tree. Then it will help to find solution.
And while writing query or any example so use the 6 digit before and after your query or example to keep the formatting in orignal format. Otherwise it becomes hard to read.
For more information see FAQ on right corner for page.
-Ammad -
Plz help in building this query .
dear gurus i have problem i have two tables namely purchases
product_id,invoice_no,invoice_date,purchase_rate,quantity
and
sales
product_id,invoice_no,invoice_date,sales_rate,quantity
i have to select sales.product_id,sales.quantity*sales.sales_rate and average of (purchase_rate*purchae.quantity) i.e average purchase price of particular product i.e. group by product_id and purchase price in between particular dates but i m unable to find any good soloution. any help plz
nullI'm not sure I understand your grouping goal, but...
select sales.product_id,
sales.quantity*sales.sales_rate sttl
pur.avgp
from sales
(select avg ( purchase_rate *
quantity) avgp,
product_id
from purchases
group by product_id) pur
where sales.product_id = pur.product_id
and sales.invoice_date between
'04-jun-1999' and '05-may-2001';
If you need more complex grouping, you can add it. -
query
create table third_party
(customer_id varchar2,
third_party varchar2,
foreign key (third_party) references account(type),
foreign key (customer_id) references customer(customer_id),
primary key(customer_id,third_party));
Error
ORA-00906: missing left parenthesisPlease see this ..these are done
create table account
(account_no number primary key,
type varchar2(10),
balance number(20) );
create table registered_account
( account_no number primary key,
customer_id varchar2(10),
foreign key (account_no) references account(account_no),
foreign key (customer_id) references registered_users(customer_id) );
create table registered_users
(customer_id varchar2(20) primary key,
user_id varchar2(10),
login_password varchar2(10),
foreign key (customer_id) references customer(customer_id));
create table transaction
(transaction_id number primary key,
to_account number,
from_account number,
tr_date date,
amount number,
customer_id varchar2(10),
foreign key (to_account) references account(account_no),
foreign key (from_account) references account(account_no),
foreign key (customer_id) references customer(customer_id));
create table has
(customer_id,
account_no,
foreign key (customer_id) references customer(customer_id),
foreign key (account_no) references account(account_no),
primary key(customer_id,account_no));
create table customer
(customer_id varchar2(20)primary key,
name varchar2(15),
address varchar2(50),
city varchar2(20),pin number(6),
dob varchar2(10),ph_no number(10));
The following is nt working
create table third_party
(customer_id varchar2(20),
third_party varchar2(10),
foreign key (third_party) references account(type),
foreign key (customer_id) references customer(customer_id),
primary key(customer_id,third_party)); -
Accent insensitive Search - plz help me correcting this query
Hello,
I just realized that with that query, if I search for "Montreal" (without the accent), I have all the following results, which is what I want
SELECT
"ID","TIT"
from "REGDOSSIERS" "RDO"
where
TRANSLATE(UPPER("TIT"),'ÀÂÉÈÊÎÔÛÙÜ','AAEEEIOUUU')
like upper(nvl(replace('%' || "P1_REPORT_SEARCH || '%',' ','%'),"TIT"))
RESULTS
TIT
Annuaires Lovell (Montréal et banlieue)
Juridiction royale de Montréal. Dossiers, 1677-1769
Montreal Witness, 1845-1938
{code}
But how to change it so when I look for: "Montréal" (with the accent) , I have also the same results? Right now, with Montréal, I have nothing
thanks,
Roseline
Edited by: Roseline on 2009-10-01 18:58
Edited by: Roseline on Oct 1, 2009 7:34 PMIf you are on Oracle 10g you can use regexp expressions to do the search.
Example
with testdata as (select 'Montreal' txt from dual
union all select 'Montréal' txt from dual
union all select 'Montreâl' txt from dual
union all select 'Montreaux' txt from dual)
/* end of test data creation */
select txt from testdata
where regexp_like (txt, 'Montr[[=e=]]al');
txt
Montreal
Montréal[[=e=]] would be an equivalence class for the letter "e" and includes also searches for é, è, ê etc.
The best solution mainly depends how your search string is build.
If you just want to sort, then the nlssort function would be useful.
Mentioning Nlssort I remembered there is a much better way to implement Accent insensitive search. You just need to set your NLS_SORT parameter correctly. Either to BINARY_AI (the AI means accent and case insensitiv) or add _AI to your nls langage.
example
ALTER SESSION SET NLS_COMP=LINGUISTIC;
alter session set nls_sort = 'FRENCH';
with testdata as (select 'Montreal' txt from dual
union all select 'Montréal' txt from dual
union all select 'Montreâl' txt from dual
union all select 'Montreaux' txt from dual)
/* end of test data creation */
select txt from testdata
where txt = 'MONTREAL';
no rows selects
/* now change the nls sorting */
alter session set nls_sort = 'FRENCH_AI';
with testdata as (select 'Montreal' txt from dual
union all select 'Montréal' txt from dual
union all select 'Montreâl' txt from dual
union all select 'Montreaux' txt from dual)
/* end of test data creation */
select txt from testdata
where txt = 'MONTREAL';
txt
Montreal
Montréal
MontreâlEdited by: Sven W. on Oct 2, 2009 8:34 AM
Edited by: Sven W. on Oct 2, 2009 10:22 AM - corrected misleading regexp example. -
Plz help to make this query......
I ve two table <br>
<br>
First one is grn_dtl containing following fields <br> <br> <br>
<u><b>
item_code ent_dt qty doc_no </u></b><br>
11001318 09/09/2003 5 56300501 <br>
11001318 11/09/2004 9 56300502 <br>
11001318 12/05/2005 2 56300503 <br>
11001319 22/06/2004 0 56300504 <br>
11001320 09/06/2005 0 56300505 <br>
11001320 11/08/2004 8 56300506 <br>
11001320 30/05/2005 4 56300507 <br>
11001320 21/06/2003 1 56300508 <br>
11001321 25/09/2004 1 56300509 <br>
11001321 15/07/2004 1 56300510 <br>
11001321 01/08/2004 2 56300511 <br>
11001322 02/06/2004 1 56300512 <br>
11001322 22/06/2004 2 56300513 <br>
11001323 12/09/2004 1 56300514 <br>
11001323 08/05/2004 4 56300515 <br>
11001323 17/08/2004 5 56300516 <br>
11001323 28/06/2004 2 56300517 <br>
<br><br>
second one is <b>item_mst</B> containing following fields <br>
<br>
<u><b>
item_code description leadtime kanbandate</u></b><br>
11001318 AIR FILTERS 15 22/04/2004<br>
11001319 AIR FILTER KIT DSK 15 02/12/2004
11001320 AIR FILTER FOR 3.0 15 14/07/2005
11001321 AIR FILTER NA 21323130 15 23/02/2004
11001322 AMPERE METER DC-0-50 15 05/10/2004
11001323 ACTUATER KIT 15 17/05/2004
11001324 ACTUATOR HOSE 15 27/12/2004
11001325 AIR GUN MEDIUM 15 07/08/2004
from the above two tables I want the query which will display item_code its description ,kanbandate from item_mst table and will also display the minimum ent_dt of each correspondingselect m.item_code,m.description,m.kanbandate,min(d.end_dt)
from item_mst m,grn_dtl d
where m.item_code = d.item_code
group by m.item_code,m.description,m.kanbandate -
Hi Friends
Here is my query,
I am changing the tcode FBL3N to add one extra field into it and to display data in the name1 field for the spcific entries in the selection screen,
After selecting the All item radio button and giving the range in the select-options when i am pressing F8 it is giving me the correct output,after that when i am trying to display the name1 field by selecting the ctrl+f8 button and pressing the apply button it is giving me the error as
"An internal error has arisen in the form routine ANALYZE_ACT_FIELDCAT
for program RFITEM_INC.
This is due to inconsistencies between table T021S (special fields) and
structure RFPOSEXT."
I changed everything to Y* but still it is giving the error.
Plz help me in this if someone face the same prob or someone having idea on this.
Thanks a lot in Advance
Mrutyun^Hi Mrutyunjaya,
Did you manage to resolve this error?
Thanks and Regards
Pras -
Hi,
I'm using below query in procedure.It's taking more more time can some one help to tune this query or advice to rewrite the query.
Databse :10.1
SELECT 'Reading Comprehension' TEST_NAME,T.TEST_END_DATE TEST_SESSION_DATE,
C.POOL_VERSION_ID, I.CREATED_ON POOL_CREATED_DT,
C.ITEM_ID, C.ITEM_RESPONSE_ID, S.STUDENT_ID_PK, C.RESPONSE_KEY, C.IS_CORRECT RESPONSE_IS_CORRECT,
T.SCORE SCALE_SCORE, C.RESPONSE_DURATION, P.ITEM_KEY,
T.TEST_SESSION_DETAIL_ID, SYSDATE CREATED_ON
-- BULK COLLECT INTO TV_PSYCHO_DET
FROM
CAT_ITEM_PARAMETER P, CAT_ITEM_USER_RESPONSE C, TEST_SESSION_DETAIL T,
TEST_SESSION S, ITEM_POOL_VERSION I, TEST_DETAIL D
,INSTITUTION E
WHERE TRUNC(T.TEST_END_DATE) BETWEEN TO_DATE('01-11-09','dd-mm-yy') AND TO_DATE('30-11-09','dd-mm-yy')
AND D.TEST_NAME = 'Reading Comprehension'
AND T.TEST_SESSION_STATUS_ID = 3
AND I.POOL_AVAILABILITY='Y'
AND P.PRETEST=0 AND C.RESTART_FLAG=0
AND T.TEST_DETAIL_ID = D.TEST_DETAIL_ID
AND S.TEST_SESSION_ID = T.TEST_SESSION_ID
AND C.TEST_SESSION_DETAIL_ID = T.TEST_SESSION_DETAIL_ID
AND S.INSTITUTION_ID=E.INSTITUTION_ID
AND SUBSTR(E.INSTITUTION_ID_DISPLAY,8,3) <> '000'
AND I.ITEM_ID = C.ITEM_ID
AND P.ITEM_ID = I.ITEM_ID;expln plan
Plan hash value: 3712814491
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart|
Pstop |
| 0 | SELECT STATEMENT | | 50857 | 7151K| 93382 (1)| 00:18:41 | |
|
|* 1 | FILTER | | | | | | |
|
|* 2 | HASH JOIN | | 50857 | 7151K| 93382 (1)| 00:18:41 | |
|
| 3 | PARTITION HASH ALL | | 2312 | 23120 | 25 (0)| 00:00:01 | 1 |
5 |
|* 4 | TABLE ACCESS FULL | CAT_ITEM_PARAMETER | 2312 | 23120 | 25 (0)| 00:00:01 | 1 |
5 |
|* 5 | HASH JOIN | | 94938 | 12M| 93356 (1)| 00:18:41 | |
|
|* 6 | TABLE ACCESS FULL | ITEM_POOL_VERSION | 9036 | 132K| 30 (0)| 00:00:01 | |
|
|* 7 | TABLE ACCESS BY GLOBAL INDEX ROWID | CAT_ITEM_USER_RESPONSE | 9 | 279 | 18 (0)| 00:00:01 | ROWID |
ROWID |
| 8 | NESTED LOOPS | | 45349 | 5270K| 93325 (1)| 00:18:40 | |
|
|* 9 | HASH JOIN | | 4923 | 423K| 11377 (1)| 00:02:17 | |
|
|* 10 | INDEX FAST FULL SCAN | INSTI_ID_NAME_COUN_DISP_IDX | 8165 | 111K| 18 (0)| 00:00:01 | |
|
|* 11 | HASH JOIN | | 4923 | 355K| 11359 (1)| 00:02:17 | |
|
|* 12 | TABLE ACCESS BY GLOBAL INDEX ROWID| TEST_SESSION_DETAIL | 4107 | 148K| 6804 (1)| 00:01:22 | ROWID |
ROWID |
| 13 | NESTED LOOPS | | 4923 | 278K| 6806 (1)| 00:01:22 | |
|
|* 14 | INDEX RANGE SCAN | TEST_DETAIL_AK_1 | 1 | 21 | 2 (0)| 00:00:01 | |
|
|* 15 | INDEX RANGE SCAN | TEST_SESSION_DETAIL_FK2_I | 39737 | | 102 (0)| 00:00:02 | |
|
| 16 | PARTITION HASH ALL | | 1672K| 25M| 4546 (1)| 00:00:55 | 1 |
5 |
| 17 | TABLE ACCESS FULL | TEST_SESSION | 1672K| 25M| 4546 (1)| 00:00:55 | 1 |
5 |
|* 18 | INDEX RANGE SCAN | CAT_ITEM_USER_RESP_IDX1 | 18 | | 3 (0)| 00:00:01 | |
|
Predicate Information (identified by operation id):
1 - filter(TO_DATE('01-11-09','dd-mm-yy')<=TO_DATE('30-11-09','dd-mm-yy'))
2 - access("P"."ITEM_ID"="I"."ITEM_ID")
4 - filter("P"."PRETEST"=0)
5 - access("I"."ITEM_ID"="C"."ITEM_ID")
6 - filter("I"."POOL_AVAILABILITY"='Y')
7 - filter(TO_NUMBER("C"."RESTART_FLAG")=0)
9 - access("S"."INSTITUTION_ID"="E"."INSTITUTION_ID")
10 - filter(SUBSTR("E"."INSTITUTION_ID_DISPLAY",8,3)<>'000')
11 - access("S"."TEST_SESSION_ID"="T"."TEST_SESSION_ID")
12 - filter(TRUNC(INTERNAL_FUNCTION("T"."TEST_END_DATE"))>=TO_DATE('01-11-09','dd-mm-yy') AND "T"."TEST_SESSION_STATUS_ID"=3
AND TRUNC(INTERNAL_FUNCTION("T"."TEST_END_DATE"))<=TO_DATE('30-11-09','dd-mm-yy'))
14 - access("D"."TEST_NAME"='Reading Comprehension')
15 - access("T"."TEST_DETAIL_ID"="D"."TEST_DETAIL_ID")
18 - access("C"."TEST_SESSION_DETAIL_ID"="T"."TEST_SESSION_DETAIL_ID")
43 rows selected.Edited by: user575115 on Dec 18, 2009 12:31 AMWhen you see something like ...
7 - filter(TO_NUMBER("C"."RESTART_FLAG")=0) It means that Oracle had to do a conversion for you since you aren't using the proper data type in your query.
That would mean IF there is an index on that column, it won't be useable... -
Plz help in optimizing the query
I have a query which is written to cater to the scenario that the entered start and end date do not overlap with the start and end date already present in the database records. Can someone help in optimizing this query. all inclusion and exclusion scenario's have to be taken care of.
the query is as follows:
SELECT COUNT(*) FROM CLAS WHERE TRIM(UPPER(CLAS_CDE)) =UPPER('timecheck') AND TRIM(UPPER(CLAS_TYPE_CDE))=UPPER('TEST_3')
AND TRIM(UPPER(LANG_CDE))=UPPER('en')
AND (
(END_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR
(START_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR (
(START_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
AND
(END_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR(('09/13/2007' BETWEEN TO_CHAR(START_DT,'MM/DD/YYYY') AND TO_CHAR(END_DT,'MM/DD/YYYY'))
AND ('09/15/2007' BETWEEN TO_CHAR(START_DT,'MM/DD/YYYY') AND TO_CHAR(END_DT,'MM/DD/YYYY'))
);I format your code in different way:
SELECT COUNT(*)
FROM CLAS
WHERE TRIM(UPPER(CLAS_CDE)) = UPPER('timecheck')
AND TRIM(UPPER(CLAS_TYPE_CDE))=UPPER('TEST_3')
AND TRIM(UPPER(LANG_CDE))=UPPER('en')
AND (
(END_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR
(START_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR (
(START_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
AND
(END_DT BETWEEN TO_DATE('09/13/2007','MM/DD/YYYY') AND TO_DATE('09/15/2007','MM/DD/YYYY'))
OR (
('09/13/2007' BETWEEN TO_CHAR(START_DT,'MM/DD/YYYY') AND TO_CHAR(END_DT,'MM/DD/YYYY'))
AND
('09/15/2007' BETWEEN TO_CHAR(START_DT,'MM/DD/YYYY') AND TO_CHAR(END_DT,'MM/DD/YYYY'))
);First thought that cross my mind it to check if changing this:
UPPER('timecheck') to simple:
'TIMECHECK' and do the same with other expressions with UPPER function.
Peter D. -
i am using
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
Please help to simplify this query. I also want to make this as a procedure.
select
RH.resort as RH_RESORT,
RH.rate_code as RH_RATE_CODE,
RD.rate_detail_id as RD_RATE_DETAIL_ID,
RD.rate1 as RD_RATE1,
RD.rate2 as RD_RATE2,
RD.rate3 as RD_RATE3,
RD.rate4 as RD_RATE4,
RD.rate5 as RD_RATE5,
RRC.room_category as RM_CAT,
initcap(RRMCAT.long_description) as RM_DESC,
RH.DAY1,
RH.DAY2,
RH.DAY3,
RH.DAY4,
RH.DAY5,
RH.DAY6,
RH.DAY7,
RH.WEEKEND1,
RH.WEEKEND2,
RH.WEEKEND3,
RH.WEEKEND4,
RH.WEEKEND5,
RH.WEEKEND6,
RH.WEEKEND7
from pms_rate_header RH,
pms_rate_detail RD,
pms_rate_room_cat RRC,
resort_room_category RRMCAT
where RH.inactive_date is NULL
and RH.RESORT='FABGOI'
and RH.RATE_CODE ='CRRRACK'
and ('15-Jan-2007' >= RH.BEGIN_DATE
and '16-Jan-2007' <= RH.END_DATE)
and RD.rate_header_id=RH.rate_header_id
and RD.inactive_date is NULL
and ('15-Jan-2007' >= RD.BEGIN_DATE
and '16-Jan-2007' <= RD.END_DATE)
and RRC.rate_detail_id=RD.rate_detail_id
and RRC.resort=RH.resort
and RRMCAT.resort=RH.resort
and RRMCAT.room_category=RRC.room_category
and RRC.inactive_date is NULL
and RRMCAT.inactive_date IS NULL
regards
lee1212where RH.inactive_date is NULL
and RH.RESORT='FABGOI'
and RH.RATE_CODE ='CRRRACK'
and ('15-Jan-2007' >= RH.BEGIN_DATE
and '16-Jan-2007' <= RH.END_DATE)
and RD.rate_header_id=RH.rate_header_id
and RD.inactive_date is NULL
and ('15-Jan-2007' >= RD.BEGIN_DATE
and '16-Jan-2007' <= RD.END_DATE)
and RRC.rate_detail_id=RD.rate_detail_id
and RRC.resort=RH.resort
and RRMCAT.resort=RH.resort
and RRMCAT.room_category=RRC.room_category
and RRC.inactive_date is NULL
and RRMCAT.inactive_date IS NULL
in the above part i am finding repeated joins and lot of 'and's
i want to know any line can be eliminated or the the query can be rewritten in a simple way without affecting it's accuracy?
regards
Lee1212 -
Plz help me on this very simple error
hello everybody...i'm very new to java programming...i'm unable to execute my program though it has been compiled...my coding is something like this and is very easy>>
class abc
public static void main(String [] args)
System.out.println("hello");
and at the time of execution...this error is shown up>>
C:\Documents and Settings\Ishan\Desktop>java abc
Exception in thread "main" java.lang.NoClassDefFoundError: abc
Caused by: java.lang.ClassNotFoundException: abc
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: abc. Program will exit.
plz help me on this. thanks.Follow the instructions in this tutorial:
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
See problem solutions here:
http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html
Maybe you are looking for
-
Looking for a working app lock for BB Torch.
My kids love to use my phone. I want an app that has the option of locking sms, pictures or other media. The app I bought, totally didn't work. I thought it worked fine, asks for passwords, then when I got a text message I clicked on the new text mes
-
Aperture 3: Missing "Open in 32-bit mode" checkbox
If you installed Aperture 3 from a disc (vs. installing and registering through the Trial version), then if you do a "Get Info" on the Aperture 3 application, you'll notice that the "Open in 32-bit mode" checkbox is completely missing. To restore thi
-
Funds Management - Reconstruct payment data
Hello, I have implement Funds Management with Multi-Year Budget Execution and update profile 00101 (posting date) and realize that my commitment item for vendor account was 40 and not 60 so I have some invoices that are not updated with the payment i
-
Implementing trial version of air application
I am developing an air application in which i need to create its trial version which can expires after 14 days of its usage. I want to restrict same user to reinstall trial version. Registring user's IP address is not the right solution.I want to reg
-
Need to re-download Premiere [was:Downloads]
I need to re-download Premier - have lost it from my computer - can see my order on the Website but cannot see where to download it again from - Thku