Unmatched Query

Hi Guru
I am facing a problem where i am unable to fetch records
Table : Lami
fields workordernom , reelno
Table : slitting_d
fields : workordernom , reelno
I am updating a SLITTING_D table with Lami table where the records are not matching.
Under one workordernom there will be reelnos
same reelno can repeat in other workordernom also . but now when i am givingthe following query it will not show the records if once i had taken the reel no
where as i want to put the condition that if workordernom + reelno
can you please suggest me the right way to get the records.
SELECT ALL LAMI.REELNO, LAMI.DOCNO,LAMI.ISSUEQTY,LAMI.ISSUEQTYMTR,LAMI.ITEM_CODE,LAMI.ITEM_NAME
FROM LAMI
left join SLITTING_D on LAMI.REELNO = SLITTING_D.REELNO
where (((SLITTING_D.REELNO) is null))
AND
     DOC='PTN' AND
     WORKORDERNOM =:SLITTING_H.WORKORDERNOM
ORDER BY REELNO
Workordernom = 1256
REELNO
101
201
202
203
301
302
303
401
402
501
502
503
601
602
workordernom = 1258
REELNO
101
201
202
401
402
501
502
503
601
602

some rules for sql-questions (which are also better posted in the sql/plsql-forum)
1. post create table statements
2. post insert statements to create some sample data
3. post the desired output

Similar Messages

  • Find Unmatched Query Help

    Hello
    We'd like to make a "find unmatched query" (similar to Microsoft Access); so, we created an outer join via Discoverer Administrator, and in Discoverer Desktop we tried to include a condition were only the rows with null value for a field in the outer joined table were shown.
    The problem is that Discoverer also uses "(+)" for the null condition:
    outerjoined_field(+) is null
    This is why we are not getting the expected result.
    Even if i import the sql withouth the (+) for the null condition, Discoverer adds the (+)
    Is there a way to make a "find unmatched query"? (get all the information in table A where A.ID doesn't exist in B.ID)
    Thanks in advance
    More details:
    1. Version: 9.0.2
    2. Query generated by Discoverer:
    SELECT COUNT(RTR_LKP_CLIENTE.ID_CLIENTE), COUNT(RTR_MAT_MAESTRO_POL_2.DES_POLIZA)
    FROM RTR_ADMIN.RTR_LKP_CLIENTE RTR_LKP_CLIENTE, RTR_ADMIN.RTR_MAT_MAESTRO_POL_2 RTR_MAT_MAESTRO_POL_2
    WHERE ( ( RTR_MAT_MAESTRO_POL_2.DES_POLIZA = RTR_LKP_CLIENTE.DES_POLIZA(+) ) ) AND ( RTR_LKP_CLIENTE.ID_CLIENTE(+) IS NULL ) AND ( RTR_MAT_MAESTRO_POL_2.DES_PREF_DIVISION = 'C1' )
    3. Desired query:
    SELECT COUNT(RTR_LKP_CLIENTE.ID_CLIENTE), COUNT(RTR_MAT_MAESTRO_POL_2.DES_POLIZA)
    FROM RTR_ADMIN.RTR_LKP_CLIENTE RTR_LKP_CLIENTE, RTR_ADMIN.RTR_MAT_MAESTRO_POL_2 RTR_MAT_MAESTRO_POL_2
    WHERE ( ( RTR_MAT_MAESTRO_POL_2.DES_POLIZA = RTR_LKP_CLIENTE.DES_POLIZA(+) ) ) AND ( RTR_LKP_CLIENTE.ID_CLIENTE IS NULL ) AND ( RTR_MAT_MAESTRO_POL_2.DES_PREF_DIVISION = 'C1' )

    Ok, thank you very much
    I didn't know that Discoverer used (+) only in some cases; using "field is null" is generated as "field (+) is null", but using OR is a good alternative, also using "field in (null)" worked fine, although i find it a little tricky.
    Thanks again, bye

  • Query to Identify Data in One Table Not In Another Table

    I need to create a query that will return the records in one table that are not in another table.  Here is the structure of my data tables:
    tbl_Practice – contains information about management practices.  The primary key field is “ID” which is an autonumber field.
    tbl_Controls – contains information about internal controls associated with the management practices.  The primary key is “ID” which is an autonumber.
    tbl_PracticeJoin – this is a table that contains the mapping of controls to practices.  Some practices can have multiple controls assigned to them and some controls can be mapped to multiple practices. 
    This table’s primary key is “ID” which is an autonumber field.  The only other data included in this table are the primary keys of the practice and control.  Those field names are “PracticeIDFK” and “ControlIDFK”.
    In this application, the user will normally enter practices and controls at the same time; however, there may be instances where a control is entered and it is not known at that time what practice(s) it should
    be mapped to.  I want to be able to run a query that will show me any controls that are in the tbl_Controls which are not in tbl_PracticeJoin.  I would like to be able to do the same with the practice table. 
    Thanks.

    The easiest way to do this is through the 'Find Unmatched Query Wizard'.
    On the Create tab of the ribbon, click Query Wizard.
    Select 'Find Unmatched Query Wizard'.
    Click OK.
    Select tbl_Controls, then click Next >.
    Select tbl_PracticeJoin, then click Next >.
    Select ID in tbl_Controls and ControlIDFK in tbl_PracticeJoin (if the wizard hasn't already done so automatically), then click Next >.
    Add the fields from tbl_Controls that you want to see to the list on the right; click >> if you want to add them all at once. Then click Next >.
    Access proposes a name for the query; you can edit the name if you wish.
    Click Finish.
    You can do the same for tbl_Practice and tbl_PracticeJoin, with PracticeIDFK instead of ControlIDFK.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • [급]9iAS에서 plsql toolkit을 이용하여 procedeure 작성문제

    * 질문한 사람 : kbhwa
    * 질문 등록일 : 2001-09-03 20:02:02
    * 조회 : 47554
    * 답변 : 1건 (junee)
    -- 질문 내용 --
    OAS에서는
    PROCEDURE cosy2101
    num_entries IN NUMBER,
    name_array IN OWA.vc_arr,
    value_array IN OWA.vc_arr,
    reserved IN OWA.vc_arr
    ) IS
    begin
    end
    와 같이 작성하여 브라우저에서 호출하게 되면 잘 작동이 됩니다.
    그러나 9IAS 1.0.2.2 에서 동일하게 작성후 브라우저에서 호출을 하게 되면 '페이지를 찾을 수 없습니다.'라는 메시지만 나타남니다.
    물론 PLSQL toolkit은
    $ORACLE_HOME/Apache/modplsql/owa/owaload.sql script를 실행하였구요.
    PL/SQL Gateway configuration 도 정상적으로 설정이 되어 있습니다.
    파라메터의 owa.vc_arr 부분을 그냥 VARCHAR2로 바꾸면 잘 실행이 됩니다.
    무엇이 문제인지요?
    -- 답변 내용 --
    1. junee 님의 답변
    oas에서는
    http://<;host>/<virtual_path>/flex_param?x=1&y=2
    으로 가능하였으나,
    9iAS에서는
    http://<;host>/<virtual_path>/!flex_param?x=1&y=2
    으로 사용하셔야 합니다.
    아래 문서를 참고하세요
    flex_param procedure
    =====================
    create or replace procedure flex_param
    (num_entries in number,
    name_array in owa.vc_arr,
    value_array in owa.vc_arr,
    reserved in owa.vc_arr)
    is
    begin
    htp.htmlOpen;
    htp.headOpen;
    htp.title('Unmatched query string example');
    htp.headClose;
    htp.bodyOpen;
    htp.header(1, 'Unmatched query string example');
    htp.p('Query string has '|| num_entries || ' name-value pairs.');
    htp.dlistopen;
    for counter in 1..num_entries loop
    htp.dlistTerm(name_array(counter));
    htp.dlistDef(value_array(counter));
    end loop;
    htp.dlistClose;
    htp.bodyClose;
    htp.htmlClose;
    end;

  • Php to plsql

    can some one help me in converting this php code to plsql procedure to handle response code from authorize.net' gateway's response so that i can call it like
    http://mysite.com/!my_proc
    < ?php
    // Get the subscription ID if it is available.
    // Otherwise $subscription_id will be set to zero.
    $subscription_id = (int) $_POST['x_subscription_id'];
    // Check to see if we got a valid subscription ID.
    // If so, do something with it.
    if ($subscription_id)
    // Get the response code. 1 is success, 2 is decline, 3 is error
    $response_code = (int) $_POST['x_response_code'];
    // Get the reason code. 8 is expired card.
    $reason_code = (int) $_POST['x_response_reason_code'];
    if ($response_code == 1)
    // Approved!
    // Some useful fields might include:
    // $authorization_code = $_POST['x_auth_code'];
    // $avs_verify_result = $_POST['x_avs_code'];
    // $transaction_id = $_POST['x_trans_id'];
    // $customer_id = $_POST['x_cust_id'];
    else if ($response_code == 2)
    // Declined
    else if ($response_code == 3 && $reason_code == 8)
    // An expired card
    else
    // Other error
    ?>

    this is how i did it
    created a procedure as per [thanks to Ping-Tsai Chung|http://myweb.brooklyn.liu.edu/pchung/dynamicParameters.sql.htm]
    CREATE or REPLACE PROCEDURE processQuery (
    --, num_entries IN NUMBER
    ,name_array IN OWA.vc_arr
    ,value_array IN OWA.vc_arr
    --, reserved IN OWA.vc_arr
    IS
    BEGIN
    htp.htmlopen;
    htp.headopen;
    htp.title('Unmatched query string example');
    htp.headclose;
    htp.bodyopen;
    htp.header(1, 'Unmatched query string example');
    htp.print('Query string has ' || name_array.count ||
    ' name-value pairs.');
    htp.dlistOpen;
    FOR counter IN 1 .. name_array.count
    LOOP
    htp.dlistTerm(name_array(counter));
    htp.dlistDef(value_array(counter));
    insert into my_table.......
    values(value_array(counter)
    END LOOP;
    htp.dlistClose;
    htp.bodyclose;
    htp.htmlclose;
    END;
    then called this procedure in url as
    http://mydomain.com:8081/apex/!processQuery

  • Unmatched Records Query

    Hi Folks - I have a table of students and a table of student test scores. I want to create a query that lists students that do not have a score. Do-able?
    Michael

    Hi,
    You can write a function like this in a variable.
    let the variable be ABC.
    ABC = [student] where(isnull([test score])), where [student] is the dimension and [test score] is the key figure.This will bring up the students with no Test Scores.
    Hope this will help you.
    Regards,
    ArunKG

  • Query to find unmatch records

    i have 2 tables AHH and ASH. both contain similar columns. primary key on table ASH is based on account number and location id. I want a query to select rows from AHH that are not present in ASH (based on account number and location_id as primary key).
    select distinct(h.AHH_N_ACCOUNT_NUM),h.AHH_V_LOCATION_ID from
    AHH,ASH
    where
    (AHH_N_ACCOUNT_NUM <> ASH_N_ACCOUNT_NUM and
    AHH_V_LOCATION_ID <> ASH_V_LOCATION_ID)
    This query returns all rows in AHH. Can anyone provide me with correct query?

    This is other way of doing it:
    create table ahh (srl number (3),acc_num number(4),loca_id number(4));
    insert into ahh values(1,100,1000);
    insert into ahh values(1,200,2000);
    insert into ahh values(1,300,3000);
    insert into ahh values(1,400,4000);
    create table ash (srl number(3),acc_num number(4),loca_id number(4));
    insert into ash values(1,100,1000);
    insert into ash values(1,200,2000);
    select b.acc_num
    ,b.loca_id
    ,a.srl
    from
         ASH A,
         AHH B
    where
    A.acc_num(+)=b.Acc_num
    and a.loca_id(+)=b.loca_id
    and a.srl is not null;
    ACC_NUM LOCA_ID SRL
    400 4000
    300 3000

  • Need help in SQL query to get only distinct records

    Hi all.
    I am new to oracle SQL and i want to write a query to get only distinct values from 2 tables.
    for example i hade 2 tables table1(employee_id,employee_no,grade) and another table2 with same structure.
    for example data in table1 is
    Employeeid employeeno Grade
    1 101 A
    1 101 B
    1 101 E
    1 101 D
    and data in table 2 is
    Employeeid employeeno Grade
    1 101 A
    1 101 B
    1 101 E
    i want to display only the fourth row like the data that doesnt exist in table2 i,e (1 101 D)
    I had too much records in both tables and i jst want to see the records that is in table 1 not in table 2 only.
    employeeid and employeeno are the same in both tables
    I hope u understand my query. I user left outer join and right outer join bt it displays all the results that and matching and unmatching. I want jst unmatched records.
    Any help is highly Appreciated.
    Thanx in Advance.
    I am using oracle 10G on windows

    Try MINUS:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries004.htm#i2054381
    SQL> -- generating sample data:
    SQL> with t1 as (
      2  select 1 employeeid, 101 employeeno, 'A' grade from dual union
      3  select 1, 101, 'B' from dual union
      4  select 1, 101, 'E' from dual union
      5  select 1, 101, 'D' from dual
      6  )
      7  ,  t2 as (
      8  select 1 employeeid, 101 employeeno, 'A' grade from dual union
      9  select 1, 101, 'B' from dual union
    10  select 1, 101, 'E' from dual
    11  )
    12  --
    13  -- actual query:
    14  --
    15  select employeeid
    16  ,      employeeno
    17  ,      grade
    18  from   t1
    19  minus
    20  select employeeid
    21  ,      employeeno
    22  ,      grade
    23  from   t2;
    EMPLOYEEID EMPLOYEENO G
             1        101 D
    1 row selected.

  • Need help with comparing Query data

    See Attached query
    I need to only show Sales Employee Name that does NOT match Email
    Example: Sales Employee Name KSLM-130
                      E-Mail does NOT start with the same KSLM-130 @ XXX.com
    In other words need to report on unmatched Sales Employee Name to Email Name.
    Thank you!

    Hi!
    Try this. It might work for you.
    SELECT
    T0.[CardCode], T0.[CardName], T2.[SlpCode], T1.[Name], T1.[E_MailL], T2.[SlpName]
    FROM OCRD T0 
    INNER JOIN OCPR T1 ON T0.CardCode = T1.CardCode
    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
    WHERE LEFT(T1.[E_MailL],LEN(T2.[SlpName])) <> T2.[SlpName]
    Regards,

  • Acess 2010 - Finding unmatched records

    I need to compare the contents of Table A & Table B.
    Table A has 2 columns - Invoice Number and Vendor Number
    Table B has 2 columns - Invoice Number and Vendor Number
    Table A data
    1, A
    1, B
    2, A
    3, A
    3, B
    Table B data
    1, A
    1, C
    2, A
    3, A
    3, C
    My 'unmatched' result set should be:
    1, C
    3, C
    How do I create an Access 2010 query that would give me these results?

    You can use the query below to find the different records between these two tables.
    select * from B
    where not exists
    select * from A
    where B.[Invoice Number]=A.[Invoice Number] and b.[Vendor Number]=a.[Vendor Number]
    Create->Query Design->right the 'query1',click 'sql view' .And then copy the query into it.
    Wind Zhang
    TechNet Community Support

  • Error while running a query-Input for variable 'Posting Period is invalid

    Hi All,
    NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
    I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
    Diagnosis
    Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
    System Response
    Procedure
    Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
    Procedure for System Administration

    OK.
    Well, if the variable is not used in any interval selection, then I would say "something happened to it".
    I would make a copy of the query and run it to check if I get the same problem with period 12.
       -> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
    If so, then try removing the variable completely from the query and hardcode restriction to 12.
       -> If problem still persists, I would have to do some thinking.
    If problem is gone, then add the variable again. Check.
       -> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
    If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
    Good luck!
    Jacob
    P.S: what fisc year variant are you using?
    Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM

  • Logical database in adhoc query

    Hello All,
    Can anyone tell me what is the logical database in adhoc query?

    Hi
    When you create a query , you have to select an infoset. Infoset can be considered as a source from which data is populated in the Query Fields.
    Infosets are created from Transaction SQ02.
    There can be four methods through which an Infoset can become a source of data:
    1.  Table join ( By joining two or more tables from Data dictionary)
         example: Joining tables PA0001 and PA0006 on Pernr to get a one resultant dataset
    2. Direct read of Basis Table ( Like PA0001 as a source for data in Infoset )
    3. Logical Database ( A Pre-written Program by SAP that extract data from clusters, tables taking care of authorizations and validity periods)
    Example : Logical database PNP, PNPCE (Concurrent Employement),PCH ( LDB for Personnel Development Data)
    Custom Logical DBs can be created in T_Code SE-36.
    4. Data Retrieval by a Program ( Custom code written by ABAP developers which will collect and process data) . This program has a corresponding Structure in data dictionary and the fields of this structure will be used in query)
    Reward Points, if helpful.
    Regards
    Waseem Imran

  • Query help on Goods Receipt Query with AP Invoice

    Looking for a little help on a query.  I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice).  I think my problem is in my where clause, I plagerized an SAP query to show GR and AP from a PO as a start.  SBO 2005 SP01.  Any help would be great appreciated.  Thanks
    SELECT distinct 'GR',
    D0.DocStatus,
    D0.DocNum ,
    D0.DocDate,
    D0.DocDueDate,
    D0.DocTotal,
    'AP',
    I0.DocStatus,
    I0.DocNum ,
    I0.DocDate,
    I0.DocDueDate,
    I0.DocTotal,
    I0.PaidToDate
    FROM
    ((OPDN  D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry)
    full outer join
    (OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry)
    on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
    WHERE
    (D1.BaseType=22 AND D1.DocDate>='[%0]' AND D1.DocDate<='[%1]')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry
    FROM PDN1 WHERE BaseType=22 AND DocDate>='[%0]' AND DocDate<='[%1]'))

    Hi Dalen ,
    I  believe it is because of the condition
    (D1.BaseType=22 AND D1.DocDate>='%0' AND D1.DocDate<='%1')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry FROM PDN1 WHERE PDN1.BaseType=22 AND DocDate>='%0' AND DocDate<='%1'))
    Try changing
    D1.BaseType=22 OR D1.DocDate>='%0' AND D1.DocDate<='%1
    PDN1.BaseType=22 OR DocDate>='%0' AND DocDate<='%1'))
    Lets see what would be the result . Lets have some fun with troubleshooting
    See what would be the difference in the result .
    Thank you
    Bishal

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • Query help : Query to get values SYSDATE-1 18:00 hrs to SYSDATE 08:00 hrs

    Hi Team
    I want the SQl query to get the data for the following comparison : -
    Order Created is a Date Column , and i want to find out all the values from (SYSDATE-1) 18:00 hours to SYSDATE 08:00 hours
    i.e.
    (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 08:00:00.
    Regards

    Hi, Rohit,
    942281 wrote:
    If i want the data in the below way i.e.
    from (SYSDATE-1) 18:00 hours to SYSDATE 17:59 hours ---> (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 07:59:00.If you want to include rows from exactly 18:00:00 yesterday (but no earlier), and exclude rows from exatly 08:00:00 today (or later), then use:
    WHERE   ord_dtl.submit_dt  >= TRUNC (SYSDATE) - (6 / 24)
    AND     ord_dtl.submit_dt  <  TRUNC (SYSDATE) + (8 / 24)
    So can i use the below format : -
    ord_dtl.submit_dt BETWEEN trunc(sysdate)-(6/24) and trunc(sysdate)+(7.59/24) . Please suggest . .59 hours is .59 * 60 * 60 = 2124 seconds (or .59 * 60 = 35.4 minutes), so the last time included in the range above is 07:35:24, not 07:59:59.
    If you really, really want to use BETWEEN (which includes both end points), then you could do it with date arithmentic:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - (6 / 24)
                      AND         TRUNC (SYSDATE) + (8 / 24)
                                               - (1 / (24 * 60 * 60))but it would be simpler and less error prone to use INTERVALs, as Karthick suggested earlier:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - INTERVAL '6' HOUR
                      AND         TRUNC (SYSDATE) + INTERVAL '8' HOUR
                                               - INTERVAL '1' SECONDEdited by: Frank Kulash on Apr 17, 2013 9:36 AM
    Edited by: Frank Kulash on Apr 17, 2013 11:56 AM
    Changed "- (8 /24)" to "+ (8 /24)" in first code fragment (after Blushadown, below)

Maybe you are looking for

  • Abstract Class can't be instantiated

    Hi I'm getting the following error messages while compiling. Does any one have any idea how to get RID of it? ERROR MESSAGES: EditableHeaderTableExample2.java:48: inner class EditableHeaderTableExample2. MyComboRenderer is an abstract class. It can't

  • MDM catalog integration with SRM 7.0

    Hi all, We will be upgrading from SRM 5.0 to SRM 7.0 We currently have CCM .....Few questins on catalog enablement for us with SRM 7: 1.With SRM 7,0,can we use CCM oor MDM is the only option??? 2.Is it better to have MDM as a seperate server and enab

  • Buying "apple iPad camera connection kit" HELP

    If I brought the "apple iPad camera connection kit" which includes (a SD card port and a USB port) . And I use it on my iPad 2 can I plug in a USB memory stick in the USB pot on one of the connections in the kit, and transfer images from my iPad to t

  • Empty page in webdynpro application

    Hi All, When i am trying to execute the webynpro application in se80 it i showing the empty page.It is not raising any error message and not giving any short dump.Simply it is showing an empty. When i try to execute the standard applications also.It

  • Airport Utility Won't Open

    When I try to open Airport Utility, I get a message "You can't open the application Airport Utility because it is not supported on this architecture". Ive browsed this forum and haven't found a fix for this so I downloaded the newest version of Airpo