Oracle Between Operator works

Hi All,
user_key is of varchar2(50) datatype
Table values
user_key
600050001
600050002
600050003
600050004
600050005
600238902
select distinct user_key from app_user where user_key between '600050005' and '600050001';
no output
select distinct user_key from app_user where user_key between '6000500005' and '600050005'
my output
600050001
600050002
600050003
600050004
600050005
can anyone explain how between operator works... ???????

Hi,
althought this is the forum about Oracle Text, we can answer. But better is to use the SQL forum, [url http://forums.oracle.com/forums/forum.jspa?forumID=75]Oracle SQL Forum.
But the answer, "Between and" works just as as greater than and a smaller than pair. But the evaluation is from begin to end.
with x as (select 1 xx from dual union all select 2 from dual union all select 21 from dual}
select *
from  x
where xx between 30 and 1
;This will return no rows (your example 1), because the 30 is bigger than the 1, so Oracle evaluates only 30 and it has no rows
with x as (select 1 xx from dual union all select 2 from dual union all select 21 from dual}
select *
from  x
where xx between 1 and 30
;This will lead to 3 rows (your example 2). Because Oracle starts with 1 and goes to 30. All three rows are valid.
So the boundaries from Between And are included.
Herald ten Dam
http://htendam.wordpress.com
Hopes thi

Similar Messages

  • Trouble with Between operator and Order by clausule

    Hello, can somebody help me?
    I have this setup:
    create table test (cod varchar2(10));
    insert into test (cod) values ('1');
    insert into test (cod) values ('2');
    insert into test (cod) values ('3');
    insert into test (cod) values ('4');
    insert into test (cod) values ('5');
    insert into test (cod) values ('49');
    insert into test (cod) values ('CN0047');
    commit
    Then this query:
    SQL> select * from test order by 1;
    COD
    CN0047
    1
    2
    3
    4
    49
    5
    7 filas seleccionadas.
    SQL> select * from test order by 1 desc;
    COD
    5
    49
    4
    3
    2
    1
    CN0047
    7 filas seleccionadas.
    SQL> select * from test where cod between 'CN0047' AND '49';
    no row selected
    SQL> select * from test where cod between '49' AND 'CN0047';
    COD
    5
    49
    CN0047
    Why Between operator works different than Order by?
    This query: select * from test where cod between 'CN0047' AND '49';
    Shouldn't return CN0047, 1, 2, 3, 4 and 49?
    Thanks in advance.
    Joel Orta

    This may help;
    SQL> --
    SQL> -- ******************** NLS SORT ********************
    SQL> --  
    SQL> select * from v$nls_parameters where parameter = 'NLS_SORT'
    parameter            value              
    NLS_SORT             BINARY             
    1 row selected.
    SQL> select * from test order by 1
    COD      
    1        
    2        
    3        
    4        
    49       
    5        
    CN0047   
    7 rows selected.
    SQL> alter session set NLS_SORT = FRENCH
    Session altered.
    SQL> select * from v$nls_parameters where parameter = 'NLS_SORT'
    parameter            value              
    NLS_SORT             FRENCH             
    1 row selected.
    SQL> select * from test order by 1
    COD      
    CN0047   
    1        
    2        
    3        
    4        
    49       
    5        
    7 rows selected.
    SQL> --
    SQL> -- ******************** NLS COMP ********************
    SQL> --
    SQL> select * from v$nls_parameters where parameter = 'NLS_COMP'
    parameter            value              
    NLS_COMP             BINARY             
    1 row selected.
    SQL> select * from test where cod between '49' AND 'CN0047'
    COD      
    5        
    49       
    CN0047   
    3 rows selected.
    SQL> alter session set NLS_COMP = ansi
    Session altered.
    SQL> select * from v$nls_parameters where parameter = 'NLS_COMP'
    parameter            value              
    NLS_COMP             ANSI               
    1 row selected.
    SQL> select * from test where cod between '49' AND 'CN0047'
    no rows selected

  • Difference in between operator in oracle 8i and 9i version

    Is their any difference between the functioning of Between operator in 8i and 9i?

    I agree that there should be no differences in behavior of the between operator from version 8.1 to 9.2. If you can run the same query with the same data on the two versions and get different results then you would need to look for version specific, possibly platform specific, bugs on metalink.
    HTH -- Mark D Powell --

  • ORA-03113: end-of-file error inconsitently from Oracle AQ operation

    Hi
    Here is the weird error we get when we use any Oracle AQ operation. This is very very inconsistent. This is the final pl/sql level code called from sqlplus. Exact code works sometimes and fails other times. We have no explanation why or what we are doing wrong. Any help/ideas from anyone will help
    Thanks
    sqlplus details:
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Jul 23 14:37:56 2003
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    SQL> connect txg/xxxxxx@joep2k
    Connected.
    SQL> declare
    2
    3 enqueue_options DBMS_AQ.enqueue_options_t;
    4 message_properties DBMS_AQ.message_properties_t;
    5 message_handle RAW(16);
    6 message pt_transaction;
    7
    8 BEGIN
    9
    10 -- Message := pt_transaction(0,
    11 -- p_trans_type, p_country, p_account_id, p_io_id,
    12 -- p_core_obj_id, p_orig_trans_id);
    13
    14 message := pt_transaction(0,
    15 2, 'US', 5, 131811,
    16 1639956, 0);
    17
    18 message_properties.priority := 40;
    19
    20 begin
    21 DBMS_AQ.ENQUEUE(queue_name => 'txg.tg_q_transaction',
    22 Enqueue_options => enqueue_options,
    23 Message_properties => message_properties,
    24 Payload => message,
    25 Msgid => message_handle);
    26 end;
    27
    28 END;
    29 /
    declare
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel

    I don't think this would help, but we experienced similar strange behavior on 9.2.0.3 running on HP unix. We were simply not able to stop queue: issuing command dbms_admadm.stop_queue(... resulted in error "Not connected". Seems to me like AQ daemon problem - restart of something. We didn't check logs and since user tests are running and queue itself works, even didn't restart database.
    But you can check logs and tracefiles for any weird messages.
    Also these two database options comes in mind:
    -- setup "aq_tm_processes" at least to 4 (because of some bug)
    -- same applies to "job_queue_processes" (also at least 4)
    Let me know if it works.
    Myrra

  • Oracle Alert not working on Oracle e-Business Suite 11.5.10

    Dear All,
    Oracle Alert was working on Oracle e-Business Suite 11.5.10 with Postfix server. But now
    we changed to MS exchange server instead of postfix server then onwards the alert is not working. I done the configuration according to MS Exchange server, inbound/outbound Server Name/reply-to-Address/added relay host.
    Test Notification Mailer is working fine, but the alert is not working.
    please anyone help me on this.
    regards,
    sva

    Hi Hussien,
    I done the diagnostic test got this warning
    WARNING - The profile option 'RESP_ID' does not exist
    ACTION - Set the 'RESP_ID' profile option. Consult Oracle Alert user guide for more details on this profile option.
    WARNING - The profile option 'EMAIL_ADDRESS' does not exist
    ACTION - To use the 'EMAIL_ADDRESS' profile option value as the :MAILID value, it must be created and set as the 'EMAIL_ADDRESS' profile option and perform some additional setup steps. Please consult Oracle Alert user guide for more details. If the 'EMAIL_ADDRESS' profile option has not been created, or if its value is null, Oracle Alert uses the operating system userid or the application username of the user who triggered the event, depending on the value set for the 'Default User Mail Account' option in the Oracle Alert Options form.
    When I done the oracle alert test it completed with normal. but not sending the mail.
    in the view output ->>
    ************************************************************************* (ROUTINE=alepaa) (FILE=alr/src/except/alepea.c) (LINE=1058)
    Performing alert "aaTest" (ROUTINE=alepaa) (FILE=alr/src/except/alepea.c) (LINE=1060)
    Connecting to "APPS" (ROUTINE=alepaa) (FILE=alr/src/except/alepea.c) (LINE=1114)
    Performing action set "aaPrintActionSet" (ROUTINE=alepea) (FILE=alr/src/except/alepea.c) (LINE=277)
    Performing action "aaPrint" (ROUTINE=alsasm) (FILE=alr/src/sendmail/alspma.c) (LINE=560)
    I don't know whether the configuration is correct in Alert Manager -> System -> options
    Oracle application 11.5.10 is running on HP Unix(DB,conc. server,reports ..) and Redhat linux 4 ( forms,web server)
    please help me on this.
    regards,
    sva

  • Differences between Commit work, Logical Unit of Work and Roll back work

    Hi all,
    Can any one explain me in details what is the difference between Commit Work, Logical Unit of Work and Roll back work. Pls explain by providing some example.
    and also explain me where and when these are used and what are the importance of using these.
    Thanks in advance.
    Regards
    Ramana Prasad.T

    Hi Ramana Prasad,
    A Logical Unit of Work (LUW or database transaction) is an inseparable sequence of database operations which must be executed either in its entirety or not at all. For the database system, it thus constitutes a unit.
    LUWs help to guarantee database integrity. When an LUW has been successfully concluded, the database is once again in a correct state. If, however, an error occurs within an LUW, all database changes made since the beginning of the LUW are canceled and the database is then in the same state as before the LUW started.
    An LUW begins
    o each time you start a transaction
    o when the database changes of the previous LUW have been confirmed (database
    commit) or
    o when the database changes of the previous LUW have been cancelled (database rollback)
    An LUW ends
    o when the database changes have been confirmed (database commit) or
    o when the database changes have been canceled (database rollback)
    COMMIT WORK.
    Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that
    all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and
    all database locks are released.
    COMMIT WORK also
    calls the subroutines specified by PERFORM ... ON COMMIT * executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK ) specified in these subroutines or started just before,
    processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK ,
    cancels all existing locks (see SAP locking concept ) if no update requests exist,
    closes all open database cursors (see OPEN CURSOR ) and
    resets the time slice counter to 0.
    COMMIT WORK belongs to the Open SQL command set.
    Return code value
    The SY-SUBRC is set to 0.
    ROLLBACK WORK.
    Closes a logical processing unit by reversing all database changes made since the last COMMIT .
    You use this statement if you cannot be certain that all the database changes have been executed correctly.
    The update routines are not performed.
    ROLLBACK WORK belongs to the Open SQL command set.
    Note
    If the ROLLBACK statement occurs within a SELECT loop, the processing cannot continue because the database cursor is invalid. After the ROLLBACK statement, you should therefore ensure that all SELECT processing has been explicitly terminated.
    <b>Plz. Avoid Duplicate Threads.</b>
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Weblink syntax for 'between' operator

    I have created a weblink that works fine with the gt and eq operator but I would like to use the 'bet' between operator. I tried entering the 2 values separated by a comma, semi-colon, surrounded with parenthesis, but I still get an error.
    What is the correct syntax to provide 2 dates for the P6 parameter. This is my weblink url:
    https://secure-ausomxbha.crmondemand.com/OnDemand/user/ReportIFrameView?SAWDetailViewURL=saw.dll?Go%26Path%3D%252fshared%252fCompany_31193_Shared_Folder%252fUnused%252fTemp&Action=Navigate&P0=2&P1=eq&P2=Lead.PICK_1&P3=Fans&P4=bet&P5=Lead.Created&P6=(08-30-09,09-30-09)

    According to Michael L's book the operator is 'bet'.
    I have already tried using what you have suggested. That is add an extra param and check for date less-than(lt) SELECTED_DATE and date greater-than(gt) SELECTED_DATE. That doesnt work either. CRMOD ignores the 2nd param and takes into account only the first one.
    *(I did not forget to change P0=3)
    Any other suggestions?
    Edited by: nmbtcAdmin on Nov 16, 2009 3:26 PM

  • InputListOfValue with ViewCriteria using between operator giving error.

    So i am using inputlistofvalues with ViewCriteria.In ViewCriteria i am using between operator for a date(CreDttm) field.
    when i click on search icon,it takes me to search popup and i give range of date and click search it give me result correctly and when i select a row and click ok,it take me to parent page but give error that "Credttm is required"...its Readonly Vo. If i use equal operator on same it works fine.
    Am i doing something wrong?
    Any help will be appreciated!
    Thanks

    its better to say which jdev version you are using..
    what is 'Credttm' atttribute is associated with.. is it the inputComboboxlitof values.. is this happening when you set the autsubmit=false for the inputcombolov? whe exactly are you seeing this error..

  • Using between operator

    Hello,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0
    I am using between operator in date field,read that the between opertaor takes the inclusive of the second value.
    But i am not getting that way,its taking exclusive of the last value.
    For e.g
    ud is timestamp.
    ud between to_date('01-Sep-2010','DD-Mon-YYYY') and to_date('31-Aug-2011','DD-Mon-YYYY')
    is excluding the dat 31-Aug.Its just showing the data only till 30Aug.
    May be the reason is because its a timestamp,in such case how to include 31Aug data also without doing to_date('01-Sep-2011','DD-Mon-YYYY')
    Thanks

    user123 wrote:
    Hello,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0
    I am using between operator in date field,read that the between opertaor takes the inclusive of the second value.
    But i am not getting that way,its taking exclusive of the last value.
    For e.g
    ud is timestamp.
    ud between to_date('01-Sep-2010','DD-Mon-YYYY') and to_date('31-Aug-2011','DD-Mon-YYYY')
    is excluding the dat 31-Aug.Its just showing the data only till 30Aug.
    May be the reason is because its a timestamp,in such case how to include 31Aug data also without doing to_date('01-Sep-2011','DD-Mon-YYYY')
    ThanksYou will have to truncate the timestamp variable
    trunc(ud) between to_date().. etc

  • Error while using between operator with sql stmts in obiee 11g analytics

    Hi All,
    when I try to use between operator with two select queries in OBIEE 11g analytics, I'm getting the below error:
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Location: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool.socketrpcserver, saw.threads
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
    can anyone help me out in resolving this issue.

    Hi All,
    Thank u all for ur replies, but I dint the exact solution for what I'm searching for.
    If I use the condition as
    "WHERE "Workforce Budget"."Used Budget Amount" BETWEEN MAX("Workforce Budget"."Total Eligible Salaries") AND MAX("Workforce Budget"."Published Worksheet Budget Amount"",
    all the data will be grouped with the two columns which I'm considering in the condition.
    my actual requirement with this query is to get the required date from a table to generate the report either as daily or weekly or monthly report. If I use repository variables, variables are not getting refreshed until I regenerate the server(which I should not do in my project). Hence I have created a table to hold weekly start and end dates and monthly start and end dates to pass the value to the actual report using between operator.
    please could anyone help me on this, my release date is fast approaching.

  • Changing operations work center during creation of  PM order

    Hi all,
    I am looking for BADI or EXIT in order to change operationS work center which created from maintenance calls.
    Does anyone know such possibility?
    Assaf

    Assaf,
    Have a look at BADI IWO1_TL_INTEGRATION2.
    Also see [OSS Note 925072|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=925072]
    Which system are you running?
    PeteA

  • PM Order - Change operations Work Center to Main Work Center

    Hi Experts,
    We have prepared a tool for client, which create Maintenance Plan and order in the background.
    The order created is having "Main Work Center" defined at header and "Work Center" at the operations level. In the current scenario the "Main Work Center" and "Work Center" are different say 'ABC' & u2018XYZu2019.
    Client has the requirement that work center maintained at operations should be same as the main work center.
    We need to implement the solution to take care of work center to be same as main work center while creation of the order in the background.
    Has anyone worked on the similar requirement before?
    I checked for existing USER EXITS for IW31/32/33 and found only one IWO10012. This doesnu2019t seem to be much useful.
    Please suggest any possible solution.
    Thanks,
    Ankur Sharma

    Hi,
         The work Center entered by default comes in operation work center, u can do validations while saving the Order :-using user exit : IWO10009 PM Order: Customer Check for 'Save' Event.
    regards
    pushpa

  • User exit/Badi for changing operation work center based on service product

    Hi,
    I have an requirement to change the operation work center based on the service product in IW31/IW32 transaction. I am using the BAdi 'IM_SM_BADI_READT399A' for changing the main work center. It changes all the operation work centers except the first one. But I need to change it all the operations.
    Thanks in Advance.

    I am using the enhancement spot 'IWO1_TL_INTEGRATION2' for changing the first operation work center

  • How to use BETWEEN Operator in physical layer in OBIEE 11g

    Hi Experts,
    How do I do the BETWEEN Operator functionality in Physical layer if my requirements is like this?
    TABLE_1.COLUMN_1 = TABLE_2 is between COLUMN_2 and COLUMN_3
    Below is the syntax for BETWEEN Operator function when I am trying to insert them.
    <<expression>> BETWEEN <<Upper Bound>> AND <<Lower Bound>>
    Thanks,
    Edited by: OBIEE/BIP Forumer on Nov 3, 2012 11:37 PM

    Below is an example diagram, as you can see, FACT TABLE have a join (an arrow one) towards TABLE_1 and TABLE_3. AS for the TABLE_3, this table is the one which I implement with the BETWEEN Operators function in Physical Layer. Also, the arrow in FACT TABLE and TABLE_3 is a red one with no arrow head line.
    TABLE_2
    ^
    l
    l
    l
    FACT TABLE ---------> TABLE_1
    l
    l
    l
    TABLE_3
    Edited by: OBIEE/BIP Forumer on Nov 4, 2012 2:33 AM

  • XML Document Format for JDBC Receiver(Between operation)

    Hello everybody,
    is there a way to use a BETWEEN operation for the key in a SELECT XML document format????????, I need to filter in the Where for different Statements in teh strcuture as BETWEEN, thanks in advance.
    Regards,
    Julio

    http://help.sap.com/saphelp_nw70/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Not sure but Check the option of
    <key1>
         <col2 compareOperation=u201DLTu201D>val2old</col2>
         <col2 compareOperation=u201DGTu201D>val2old</col2>
    </key1>
    Thanks,
    Beena.

Maybe you are looking for

  • 7.1 Update process for Acrobat 7.x standalone users

    OK, tried this one on a PC with Acrobat 7.x Pro (updated to 7.05) and the bundled Designer 7.0. The Designer 7.1 installer does not remove Designer 7.0, so confusingly you end up with both on the same machine. Can't think of any reason why this would

  • SID Name in oracle 10g

    Dear Experts, how I can find SID name in Oracle 10g databse, which i forget. thanks in advance

  • Error in j2i6 with rg23c part1

    hii all,      i am doing j2i6 for rg23C part1.and got  that material document is different in MB51 than  j2i6 (rg23c part1).      i am looking RG23C Part1 with  j2i6 , against my XXX material, on 20th may its showing 50 qty recieved for a plant and 5

  • Web page depth

    Hi all, I'm new to iWeb, but am very much enjoying putting a website together myself. When using the available templates, it seems that I cannot have a page that continues further down than where the template finishes. Is there a way around this? I w

  • Manual photo transfer Windows 7

    I manage photos manually on Windows 7 PC (64 bit Home Premium) and would like to do the same as far as is possible with my iPad (32GB wifi+3G). I'm experiencing two problems: When I try to drag and drop photos into iTunes I get the following error me