Compare the int table with Z-table

Hi
i want to compare one Internal table with one Z-Db table
help me with coding..
thank you

Hi Sunny,
Check this code.
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA: ITAB LIKE TABLE OF LINE,
JTAB LIKE TABLE OF LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
  APPEND LINE TO ITAB.
ENDDO.
MOVE ITAB TO JTAB.
LINE-COL1 = 10. LINE-COL2 = 20.
APPEND LINE TO ITAB.
IF ITAB GT JTAB.
WRITE / 'ITAB GT JTAB'.
ENDIF.
APPEND LINE TO JTAB.
IF ITAB EQ JTAB.
WRITE / 'ITAB EQ JTAB'.
ENDIF.
LINE-COL1 = 30. LINE-COL2 = 80.
APPEND LINE TO ITAB.
IF JTAB LE ITAB.
WRITE / 'JTAB LE ITAB'.
ENDIF.
LINE-COL1 = 50. LINE-COL2 = 60.
APPEND LINE TO JTAB.
IF ITAB NE JTAB.
WRITE / 'ITAB NE JTAB'.
ENDIF.
IF ITAB LT JTAB.
WRITE / 'ITAB LT JTAB'.
ENDIF.
And my suggestion is better you go to the website where the above code is present and helpful for basics.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3841358411d1829f0000e829fbfe/content.htm
Cheers!!
Venkat

Similar Messages

  • Is it possible to change the order of the fields in the int table?

    Hello
    Is it possible to change the order of the fields in the int table?
    Lets say itab has the following fields :
    F1, F2, F3
    I would like to see it as F2 F3 F1
    Thanks

    >
    Comandante Che Guevara wrote:
    > Lets say itab has the following fields : F1, F2, F3
    >
    > I would like to see it as F2 F3 F1
    What do you mean by "like to see" ? You can WRITE the fields in any order you want. If you want to display the internal table in an ALV you can manipulate the fieldcatalog.
    If you want something else other than display the field, you have to explain your req. in detail.
    BR,
    Suhas

  • Comparing the BOM usage with the actual usage for materials.

    Hi All
    My client want to compare the BOM usage with the actual usage and have a report for this within a period? More specified they want to calculate the BOM usage, based on the requirement quantity from confirmation - but with out the scrap %. mulitplied with the confimed quantity of the header material.
    The actual usage should be based on  goods issuing from stock, either as goods issue to order (backflushing) or as goods issue to cost center. 
    I havent been able to indentiy a standard report for doing this - does some of you know a standard report?
    -  I was thinking of the following method:
    Look at  tabel RESB and compare it  with MSEG, but I have some diferent problems with this.
      - In resb there is no qty before scrap. 
      - The data amount from MSEG, is so huge so it is not possible to make a data search for a whole period (eg. month)
    Br. M

    There is one std report MCRX which gives a comparison of quanity in order and actual consumption,
    if it doesnt meet your need, you may have to create a custom report.
    logic can be find the quantites as per BOM for the produced quantities
    issued quantities to the order
    tables you may need are AUFK AUFM
    AFKO, STAS STPO
    MSEG, MKPO
    JEST ( if you want to filter using order status)

  • Comparing the current value with the previous one in Powershell

    Hi,
    New to scripting and i was wondering how can I compare the current value with the previous value?
    I am having trouble with the loop structure, and I am not sure I am on the right track...
    I am trying to compare the record to next record in the same csv file after import-csv... My code runs fine, but is not giving the right result.
    $FilePath = Get-FileName -initialDirectory "C:\"
    #Testing for null
    If($FilePath)
    $Data = Import-csv -Path $FilePath | Sort-Object BUYER, {[int] $_.PO_NBR}, {[int] $_.LINE_NBR}
    Foreach($fData in $Data)
    $i = $fData
    Foreach($i in $fData)
    if($fData.Buyer -eq $i.Buyer)
    #save all the same buyer name to a new variable
    Write-Host "Same as previous"
    Else
    Write-Host "Variable is null"
    Remove-Item function:\Get-FileName

    Thank you. The Foreach loop is now working properly.
    Can I ask what is the purpose of "-ea 0" in the import-csv? I can't seem to find "-ea" as a parameter for import-csv in help.
    -ea is short for -ErrorAction.
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • Compare the current value with the previous value in the same column

    Hi all,
    I have to include a statement in a query which allows to compare the current value of column A with the previous value of column A (same column). from there, I need to add a condition in order to have the expected result.
    Let's take an example to illustrate what I want to achieve:
    I have the following columns in table called 'Charges':
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 50
    SID1111 9999 MD5553 50
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 80
    SID2222 8887 MD6662 80
    SID3333 6666 MD7771 90
    I want to check if the ship_id of row 2,3 (and more if available) is equal to the ship_id of row 1.
    If it is the case, then value 'together with the first batch_nr' in row 2 and 3 under Price column. If not, then keep the original value of Price column
    PLease see below the expected result:
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 together with 9997
    SID1111 9999 MD5553 together with 9997
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 together with 8887
    SID2222 8887 MD6663 together with 8887
    SID3333 6666 MD7771 90
    Thanks in advance for your help, it is really urgent.
    Imco20030

    Hi,
    user11961002 wrote:
    Hi,
    Here is the query that I use:
    [ select
    sl.ship_id,
    o.ordnum,
    o.reffld_5 "BatchNR",
    sum(tc1.chrg_amt) "FreightPRC",
    sum(tc2.chrg_amt) "FuelPRC",
    sum (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt) "Total Price"
    from ord_line ol
    join ord o on (ol.ordnum = o.ordnum and ol.client_id = o.client_id)
    join shipment_line sl on (ol.ordnum = sl.ordnum and ol.client_id = sl.client_id and ol.ordlin = sl.ordlin)
    join adrmst a2 on (o.rt_adr_id = a2.adr_id)
    left join tm_chrg tc1 on (tc1.chargetype = 'FREIGHT' and tc1.chrg_role = 'PRICE' and tc1.ship_id = sl.ship_id)
    left join tm_chrg tc2 on (tc2.chargetype = 'FUELSURCHARGE'and tc2.chrg_role = 'PRICE' and tc2.ship_id = sl.ship_id)
    where sl.ship_id = 'SID0132408'
    group by o.client_id, o.ordnum, o.reffld_2, sl.ship_id, a2.adrnam, a2.adrln1, a2.adrpsz, a2.adrcty, a2.ctry_name,
    o.reffld_5, ol.early_shpdte
    order by ship_id
    ]That looks like the query you were using before you started this thread.
    Modify it, using the analytic fucntions FIRST_VALUE and LAG, like I showed you.
    I see that you did simplify the problem quite a bit, and it's good that you did that.
    It doesn't matter that your real problem involves joins or GROUP BY. Analytic functions are calculated on the results after all joins and GROUPS BYs are done. Just substitute your real expressions for the simplified ones.
    For example, in your simplified problem, there was a column called order_nr, but I see now that's it's really called o.ordnum. Where the solution I posted earlier says "ORDER BY order_nr", you should say "ORDER BY o.ordnum".
    Here's a less obvious example: in your simplifed problem, there was a column called price, but I see now that it's really SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt). Where the solution I posted earlier says "TO_CHAR (price)", you should say "TO_CHAR (SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt))". (You can't use an alias, like "Total Price", in the same SELECT clasue where it is defined.)
    I removed some columns from the select as they are not relevant for the wanted action like 'adress details or other references'.
    Now here is the result:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 120
    SID0132408     MDK-000014-05602652     04641363     110     10 120
    as you can see, the 3 orders have the same shipment ID.
    The expected result should be shown under column 'Total Price' as follows:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 tog with 04641401
    SID0132408     MDK-000014-05602652     04641363     110     10 tog with 04641401Okay, so those are the correct results that I asked for, plus the incorrect results you're getting now. Thanks; extra information doesn't hurt.
    But where is the raw data that you're starting with?
    It looks like you tried to format the code (but not the results) by typing this 1 character:
    before the formatted section and this different character
    after the formatted section. To post formatted text on this site, type these 6 characters
    before the formatted section, and the exact same 6 characters again after the formatted section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to compare the texted password with the encrypted password of dba_users

    Hi,
    I have Oracle 10g in my system. I know dba_users table has information of all the created users of the oracle, along with their encrypted passwords.If I want to make a login page based on this table ,how could I compare the password in that case?
    In above situation, I am getting the username with the regular texted password for authentication check. How can we checked this texted password with the encrypted password of dba_users, for the respective username?
    Your input would be appreciated.

    Try use the username/password from login page to create an connection to database.

  • Comparing the iPhone 3G with my current Japanese iPhone (trying to decide)

    I'm trying to decide whether or not to switch to an iPhone 3G now that it has been released here in Japan. I currently use an AU cell phone by Casio. I would have to switch to Softbank, but you can keep your old phone number now, so that's no problem.
    The iPhone certainly has it's attractions. It also has it's drawbacks compared to phones here. I think it adds up differently for different people depending on which features they think are important. Here is how I have been currently thinking about it. Please tell me if I got any of the iPhone features wrong!
    iPhone = how I rank the iPhone feature on a 0-10 scale
    current = how I rank my current Japanese cell phone on a 0-10 scale
    weight = how important I think the feature is on a 0-10 scale
    (1) Web Surfing - iPhone 10 / current 3 / weight 10
    The iPhone's browser is clearly the best cell phone web browser anywhere.
    (2) Camera Still - iPhone 3 / current 5 / weight 8
    My current cell phone's quality has never been pleasing, and is the same 2 megapixel resolution of the iPhone. But it does have a flash and an image stabilizer, neither of which the iPhone has.
    (3) Camera Video - iPhone 0 / current 6 / weight 8
    It really is convenient to be able to shoot videos with your cell phone these days. The iPhone may be the ONLY cell phone in the world these days without that feature, which is very inexplicable. This might be the show-stopper for me. True, I usually shoot videos with my regular camera. In fact, I usually shoot still photos with my regular camera. Still, it is a very useful feature to have.
    (4) Electronic Wallet - iPhone 0 / current 10 / weight 5
    It really is convenient to just wave your cell phone at the train wicket, or at the convenience store, or vending machine and not fuss with cash. But the fact of the matter is there is also a card version of the e-money which I also have, so I can do the same thing by waving my unopened wallet at the same devices. So I could live without this feature. Recharging the e-money by cell phone is convenient though.
    (5) Cut and Paste - iPhone 0 / current phone 5 / weight 3
    I don't often use the feature, but it is relatively easy on my current phone to mark the begin and end of a section of text and then use copy/cut/paste. I can't believe the iPhone still doesn't have something as basic as that. It probably isn't a show stopper, but it does give me pause.
    (6) Digital TV receiver - iPhone 0 / current phone 9 / weight 1
    My Japanese friend really wants a new phone with a digital TV receiver so he can watch it on the trains to and from work. On the other hand, this isn't a show-stopper for me because I very rarely use the TV feature.
    (7) Replaceable battery pack - iPhone 0 / current phone 10 / weight 2
    Most Japanese seem to be very taken aback that you can't remove and change the battery pack yourself and switch to a spare when out for a long day. That sort of bothers me too, but the fact of the matter is I've never done that with any of my previous phones, so don't think I would worry about it. I am guessing there are portable rechargers available that run on batteries, right? I've used those before.
    (8) Applications - iPhone 10 / current phone 2 / weight 10
    The iPhone clearly has all the other cell phones beat in terms of applications. I've always been very disappointed with the lack of interesting apps available for my Japanese cell phones. I am assuming there is a PDF viewer available?
    (9) Email - iPhone 7 / current phone 7 / weight 10
    I haven't used the iPhone email app so I am just guessing. I assume you can have file attachments, right? Like send photos via email? Can you have multiple attachments in one email? iPhone email isn't "push" yet, right? You have to poll for new messages. My current phone uses push technology, like a Blackberry does, so it receives email automatically as soon as it is sent.
    (10) Keyboard - iPhone ? / current phone ? / weight 10
    I still can't figure out which is easier to use. My current cell phone is easy to input in Japanese, but hard to input in English! I suspect that the iPhone is the opposite - probably easier to input in English because of the full kb, but more difficult in Japanese. Also the lack of there being buttons or tactile feedback might make it harder to user.
    (11) Display - iPhone 8 / current phone 6 / weight 10
    The iPhone's display is larger and brighter. On the other hand, my current phone's display has a higher resolution.
    (12) Music features - iPhone 10 / current phone 2 / weight 7
    Having a built-in iPod is very nice. My current phone has the AU music system built in but it doesn't work well with Macs. A Windows person might find it more useful.
    I also read about a "yellow-ish tint" problem with the new iPhones. That's something I wouldn't want to get into. Another headache with Apple over some quality problem, like I had with my iPod nano 3G that I ended up getting a refund for. I don't think I could take that right now. Has that issue been resolved?
    Thanks!
    doug

    (3) Apple didn`t include video support because of the quality of the 2 MP camera, they are known as being the best in video and photography, so enabling video would result in a poor quality, Apple`s approach on this was all or nothing.
    (9) It supports loads of attachments such as PDF, DOC, images, that can be saved to the phone, or attached right after making them from the Camera Roll, and actually it supports push email, via the "Mobile Me" service from Apple (.Mac). This requires a anual payment, but it`s not that expensive, considering that you can use it with PC`s, Macs, and your phone.
    (10) The iPhones keyboard is the best I`ve ever used, i takes about a week to write fast, and about 2 to be a pro, and I mean really fast :))
    PS: What`s your current phone ?

  • How to compare the date value with the date datatype column?

    Hi,
    I am executed a query to get output for the particular date in two different database.
    I got output in one db environment, but in the another environment i didnt get the output.
    APP_DECISION_DATE column contains date datatype
    ex:
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE = TO_DATE('23-JAN-07',
    'DD-MON-YY'); 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060106 SYSTEM
    DATABASE - II
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE=
    TO_DATE('31-JAN-2007','DD-MON-RRRR') and application_id=2007010028552;
    no rows selected
    in the same db i got the output while i used the TO_DATE(APP_DECISION_DATE)
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where TO_DATE(APP_DECISION_DATE)=
    TO_DATE('31-JAN-2007','DD-MON-YYYY') and application_id=2007010028552; 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    is it necessary to use TO_DATE function while i am using the data datatype column in the WHERE CLAUSE?
    Thanks in advance.
    siva

    Sorry & thanks sathish,
    Now i got the result.
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE BETWEEN TO_DATE ('31.01.2007 00:00:00', 'DD.MM.YYYY HH24:MI:SS') AND TO_DATE ('31.01.2007 23:59:59', 'DD.MM.YYYY HH24:MI:SS')
    2 and application_id=2007010028552;
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    ================================
    But one doubt,
    When i created the column with the date datatype how it gets the time value,
    And in one environment db i got the result but in another environment i dont get,
    Shall i want to change any session status of date?

  • Tests comparing the Radeon 2600 with the 3870?

    I have a new Mac Pro. before I bought it, I did some research and decided that the ATI Radeon HD 3870 would probably be faster for Aperture use so I ordered that too. unfortunately, the retailer didn't have it in stock at the time so for the time being, my Mac has an ATI Radeon HD 2600 card in it.
    here's the question. the ATI 3870 has arrived and I can pick it up anytime I want. would anyone like to see a comparison between the 2600 and the 3870? I would need specific test details. my camera for the last year has been a Mark III so my images are 10 mpixel images.
    cheers,
    Gregory

    I had an iMac (that I have since returned) that had it's 2600 ATI problem. They took a few months, and eventually they pushed a similar firmware update to this one.
    My computer had been crashing multiple times a day. After the firmware update, it was fine - although other problems led to its return.
    Hope that helps!

  • Do you know of a standard tool to compare the fields of 2 database tables?

    do you know of a standard tool to compare the fields of 2 database tables? please note i dont want to compare data just the fields.
    ~Suresh

    Hi,
    I am not aware any standard tool but you can write custom report to use FM DDIF_FIELDINFO_GET to get fields information of SAP database table.
    Call the above FM twice in order to get field names for two different database tables. Then compare the results (table parameter DFIES_TAB) to find out the differences of field names.
    Hope this will help ...
    Regards,
    Ferry Lianto

  • Compare of 2 tables with multiple output rows???

    I have two table which hold port and process information from a network scan.  One table is a baseline and the other is a recent scan.  The tables contain the ports and services from all the systems scanned for each system.  
    I need to compare the two tables and show what the difference is.  One report showing just the unique ports not in the baseline and another to show a complete list of all the ports not in the baseline and the associated computer name.  I need both
    the reports to be able to show if the difference is a port that was in the baseline that is not in the new scan or is a new port not in the baseline.
    Here are the table formats I have:
    Baseline
    Date
    Plant
    ComputerName
    Protocol
    LocalAddress
    LocalPort
    RemoteAddress
    RemotePort
    State
    ProcessName
    Scan
    Date
    Plant
    ComputerName
    Protocol
    LocalAddress
    LocalPort
    RemoteAddress
    RemotePort
    State
    ProcessName

    tablediff:- Just find the tablediff.exe and change the sourceserver,source database  -sourcetable and same thing you need to do it for destination.
    Interchange it for the second run
    C:\Program Files\Microsoft SQL Server\100\COM>tablediff.exe -SourceServer hqvd0026\kat -SourceDatabase dssp -sourcetable Baseline -DestinationServer hqvd0026\kat -DestinationDatabase dssp -destinationtable Scan -c -f c:\tablediff.sql
    OR 
    A=A-B
    The following query returns any distinct values from the query to the left of the EXCEPT operand
    that are not also found on the right query.
    select * from dbo.baseline
    except
    select * from dbo.scan
    The following query returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand.
    select * from dbo.baseline
    INTERSECT
    select * from dbo.scan
    -Prashanth

  • How to insert the data if the data in the two tables doesn't match.

    Hi,
    I have requirement like,I have to insert the data by comparing the two tables based on the date field.If they both are equal then the data shouldn't be inserted if not the data has to be inserted.
    Can some one help me on this ASAP.
    Regards,
    Sudha
    sudha

    Hi,
    Thanks for the reply,i would like to know the way that we can design the packages
    sudha
    You have multiple ways of implementing this
    1. Using Lookup Task
    http://www.sqlis.com/sqlis/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx
    2. using SCD wizard
    http://www.bimonkey.com/2009/07/the-slowly-changing-dimension-transformation-part-1/
    3. using hashing
    http://visakhm.blogspot.in/2014/06/ssis-tips-implementing-scd.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • UDF to compare the dates with the input date

    Hi,
    Help me in writing an UDF to compare the input date with start date and end date.
    I had written following UDF, but it is not working. we are on XI 3.0
    try {
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                Date sd = df.parse(StartDate);
                Date id = df.parse(InputDate);
                Date ed = df.parse(EndDate);
                if ((sd.before(id) || (sd.equals(id))) && (ed.after(id)) || (ed.equals(id))) {
              return true;               
    else{
                    return false;
            }     catch (Exception e){
           e.printStackTrace();
    Thanks
    Srinivas

    Hello Srinivas,
    did you import this two classes in your UDF ?  java.text.* and java.util.*
    In case you did but the program is still not working I just wrote a code without imports. See if this might help. I have tested this with all type of data please test again from your end. I have assumed that if three dates are equal the function return true. I am not sure whether you wanted to exclude the boundary dates. In case you want to exclude those dates just replace '<=' with '<' symbol. The code could have been smarter but in short time I thought this might help.
    public class DateRange {
      static boolean compareDate(String startDate,String inputDate,String endDate)
              int j,k,l;
              String s[],i[],e[];          
              s=startDate.split("-", 3);
              i=inputDate.split("-", 3);
              e=endDate.split("-", 3);
              j=s[0].compareTo(i[0]);
              k=i[0].compareTo(e[0]);
              l=s[0].compareTo(e[0]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<0)
                   return true;
              j=s[1].compareTo(i[1]);
              k=i[1].compareTo(e[1]);
              l=s[1].compareTo(e[1]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<0)
                   return true;
              j=s[2].compareTo(i[2]);
              k=i[2].compareTo(e[2]);
              l=s[2].compareTo(e[2]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<=0) 
                   return true;
                return false;
         public static void main(String[] args) {
              String startDate="1992-04-03";
              String inputDate="1992-02-03";
              String endDate="1992-02-03";
              System.out.println(compareDate(startDate,inputDate,endDate));
    Plese let me know if this works.
    regards
    Anupam

  • Compare the result of a query with a number and return a message

    Hello,
    I have the following query in oracle 9i:
    SELECT COUNT(*)
    FROM hourly_files
    WHERE date_received = TO_DATE((SELECT TO_CHAR(SYSDATE - INTERVAL '1' DAY,'DDMMYYYY')
    FROM DUAL), 'DDMMYYYY');
    This will produce a count of the required rows
    I need to compare the output number with another hardcoded number (threshold) and print an appropriate message e.g.
    if the output of the above query is 18000 and the threshold number is set to 20000, then output a meesage:
    Number of files received less than 2000
    Any help will be much appreciated !
    Thank you.

    SQL> ed
    Wrote file afiedt.buf
      1  SELECT CASE WHEN COUNT(*) >5 THEN 'Number is > than 5'
      2              WHEN COUNT(*) <1 THEN 'Its less than 1'
      3  ELSE 'Its in between'
      4  END
      5  FROM emp
      6* WHERE deptno=20
    SQL> /
    CASEWHENCOUNT(*)>5
    Its in between
    SQL> SELECT COUNT(*) FROM emp
      2  WHERE deptno=10;
      COUNT(*)
             3

  • How to check the current time with a Stored  time in string format

    Hi All
    I would like to compare the system time with an existing time values which is allready there in String format..
    i mean i would like to check if the SysTime is inbetween 6:30 and 14:00
    I accomplished this in Oracle ..
    Select 'Y' from dual where to_date(to_char(sysdate,'HH24:MI '),'HH24:MI') between to_date('06:30','HH24:MI') and to_date('14:00','HH24:MI')
    But instead of checking the DB each and every time , the perfomance would be better if we can do this in our java code..
    Could some one provide me with a code to accomplish the above scenario..
    Thanks in advance..,.,

    import java.util.Calendar;
    Calendar rightNow = Calendar.getInstance();  // gets the current date and time to millisec
    Calendar earlyTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 6).set(Calendar.MINUTE, 30);
    Calendar lateTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 8).set(Calendar.MINUTE, 0);
    if (rightNow.compareTo(earlyTime)> 0 && rightNow.compareTo(lateTime) < 0){
    // do something
    }Try this.

Maybe you are looking for