HELP HELP HELP SQL CALCULATION

Im really struggling with something and I desperately need help and advice on how to do this.
I have a SQL link table called student_monitor containing the follwing attributes and e.g. data
student_id, Class_id, Predicted_Grade, Actual_Grade
1 1 A C
2 1 B B
3 1 C B
I need to be able to flag which students are under achieving on their target grades and dont know how to do this or the best way to do this as i cannot calculate the diff between a char?
thanks for any help this is quite urgent so a quick response will be appreciated

Yes we can do that.
select * from student_monitor where predicted_grade > actual_grade;It should be predicted_grade < actual_grade as you see in the data, only the first student with student_id 1 is under acheived, as he is predicted to get A, but got C. So he under acheived
? (In fact in your statement it should also be > not <, since we want those who are under-achieving.)The answer is same as above.
see below:
SQL> with student_monitor as
  2  (select 1 student_id, 1 Class_id, 'A' Predicted_Grade, 'C' Actual_Grade  from dual union all
  3  select 2, 1, 'B', 'B' from dual union all
  4  select 3, 1, 'C', 'B' from dual )
  5  --
  6  select * from student_monitor
  7  where predicted_grade > actual_grade;
STUDENT_ID   CLASS_ID P A
         3          1 C BStudent_Id 3 was predicted to get C, but instead he got B, so he over acheived. Change > to <
SQL> with student_monitor as
  2  (select 1 student_id, 1 Class_id, 'A' Predicted_Grade, 'C' Actual_Grade  from dual union all
  3  select 2, 1, 'B', 'B' from dual union all
  4  select 3, 1, 'C', 'B' from dual )
  5  --
  6  select * from student_monitor
  7  where predicted_grade < actual_grade;
STUDENT_ID   CLASS_ID P A
         1          1 A C

Similar Messages

  • 很全的help.sql 安装Oracle的sqlplus帮助系统

    在linux系统下的时候,我们可以通过man命令,获得系统里对某个命令的usage的解释。
    在sqlplus里我们也可以通过help和?命令。
    sqlplus的帮助主题对应的是数据库里的一张表(system.help)。
    在$ORACLE_HOME/sqlplus/admin/help/目录下的helpus.sql包含了这个表的帮助主题
    不过oracle自带的help和?的解释太少了
    在网上找了很久终于找到一个很全的help.sql叻
    下载文中附件,用system登录,因为这个是建立在system的schema里的help表里的。
    直接执行脚本就可以了。比如我把这个sql保存到$ORACLE_HOME\sqlplus\admin\help里,
    大家在这里可以看到有
    helpbld.sql
    helpdrop.sql
    helpus.sql
    hlpbld.sql
    这四个文件,这就是oracle自带的help脚本。可以执行
    helpbld.sql来安装oracle默认的help, 这里会提示你输入两个参数,看了这个源文件。
    两个参数一个是当前路径,一个是helpus.sql, 还是用system来执行,执行完就安装了help,
    就可以使用我上面的那些方式。这个是默认会安装的。
    要安装我这个最新的help文件,只需要执行就可以了
    SQL>conn system/systempwd;
    SQL>@?/sqlplus/admin/help/helpbld.sql
    输入 1 的值: F:\developer\oracle\product\10.2.0\db_1\sqlplus\admin\help
    输入 2 的值: F:\developer\oracle\product\10.2.0\db_1\sqlplus\admin\help\help.sql
    这里就会执行了,执行是有一些和默认的有冲突,可以忽略这些错误。
    成功以后,我们执行一下
    SQL> select count(*) from system.help ;
    COUNT(*)
    5085
    呵呵呵一下多了好多条了哟
    SQL> help create database;
    引用:
    CREATE DATABASE
    Use this command to create a database, making it available for
    general use, with the following options:
    * to establish a maximum number of instances, data files, redo
    log files groups, or redo log file members
    * to specify names and sizes of data files and redo log files
    * to choose a mode of use for the redo log
    * to specify the national and database character sets
    Warning: This command prepares a database for initial use and erases
    any data currently in the specified files. Only use this command
    when you understand its ramifications.
    .......这里还要好多有关create table的帮助信息,我就不写了。
    有了这个帮助系统,要查一个命令的详解,正是太方便叻。
    help.sql文件【 下载 】

  • Help in Calculation Script

    I need your help in calculation script: Using 9.3.1 version
    In below script , I have to write same code for total 10 account members used in the same place A and all 10 accounts members are level 0 children of 1 parent.
    A = A + B / C*D
    I need to write a code where 10 Account members can be used during calculation in place of A.
    Please can you help me on this query .. How to achieve this requirement ...
    Regards
    Vishal

    Using my Very Favorite Essbase Database In The Whole Wide World, aka Sample.Basic, I wrote the following nonsense code snippet:
    FIX(@RELATIVE("Profit", 0), @LEVMBRS("Product", 0), @LEVMBRS("Market", 0), @LEVMBRS("Year", 0))
         "Actual" = "Actual" + "Actual"->"Opening Inventory" / "Actual"->"Additions" * "Actual"->"Ending Inventory" ;
    ENDFIXDon't focus on why you would never ever want to do the above with inventory, just look at the code.
    The code does work.
    Before:
              100-10     New York     Actual
    Jan               Sales     679          
                   COGS     271          
              Margin     408          
                   Marketing     94          
                   Payroll     51          
                   Misc     0          
              Total Expenses     145          
         Profit     263          
              Opening Inventory     2101          
              Additions     644          
              Ending Inventory     2066          After
              100-10     New York     Actual
    Jan               Sales     7419.164596          
                   COGS     7011.164596          
              Margin     408          
                   Marketing     6834.164596          
                   Payroll     6791.164596          
                   Misc     6740.164596          
              Total Expenses     20365.49379          
         Profit     -19957.49379          
              Opening Inventory     2101          
              Additions     644          
              Ending Inventory     2066          I can't remember if your to be affected members are under a common parent or not. If the latter, use a UDA to go after the members.
    Oh yes, this code violates one of my personal design considerations -- it modifies the source data so it can only be run once. That is really dangerous but the choice is yours.
    Regards,
    Cameron Lackpour

  • How to change sql expression of SQL-Calculated Attribute of view object ?

    Hi
    jdev 11.1.1.5
    I have a view object with a SQL-Calculated Attribute (sumAnalytic) how can I change sql expression of this attribute in runtime?
    for example in application module method??

    Hi Mr Timo
    Thanks for your reply but I do not need dynamic vo because I can not change all of my vo
    I only need to change expression of SQL-Calculated Attribute of view object in run time.
    For this I set expression in view object something like this 'select 2 from dual' and in run time in my AM method I get the vo query and replace 'select 2 from dual' with something like 'selet sum(amnt) over (partition by 1)' and set new query.
    But I think the better solution must exist
    Thanks

  • Help in calculating correct ofset for SQL

    Hello Everyone
    Please help me in formulating sql query
    Basically what I want is that I need to get desired result in such a way that, whenever Transaction type is Sales Order Issue, I want last TRANSACTION_COSTED_DATE of 'Intransit Shipment'
    INVENTORY_ITEM_ID     TRANSACTION_COSTED_DATE     TRANSACTION_TYPE     R
    123     28-06-2012 21:36     Intransit Shipment     
    123     23-07-2012 01:25     Sales order issue     28-06-2012 21:36
    123     30-07-2012 05:20     Sales order issue     28-06-2012 21:36
    123     08-08-2012 20:03     Intransit Shipment     
    123     23-08-2012 11:15     Intransit Shipment     
    123     27-08-2012 16:19     Intransit Shipment     
    123     27-08-2012 16:19     Intransit Shipment     
    123     05-09-2012 04:22     Sales order issue     27-08-2012 16:19
    123     05-09-2012 04:22     Sales order issue     27-08-2012 16:19
    123     17-09-2012 01:42     Sales order issue     27-08-2012 16:19
    123     17-10-2012 22:25     Sales order issue     27-08-2012 16:19
    123     13-11-2012 21:12     Intransit Shipment     
    Lag with offset 1 doesn’t work as it will only go to previous row,
    What I want is that it should go to row above where transaction type is Intransit Shipment
    Sample data and query I tried
    with sampl_rownum_reset as
    (select '123' inventory_item_id,
    to_date ('28-Jun-2012 9:36:23 PM ', 'DD-MON-RRRR HH:MI:SS AM')
    transaction_costed_date,
    to_date ('28-Jun-2012 9:35:23 PM ', 'DD-MON-RRRR HH:MI:SS AM')
    transaction_date,
    'Intransit Shipment' transaction_type
    from dual
    union all
    select '123',
    to_date ('23-Jul-2012 1:25:44 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('23-Jul-2012 9:40:08 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('30-Jul-2012 5:20:38 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('01-Aug-2012 9:37:17 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('08-Aug-2012 8:03:04 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('08-Aug-2012 7:59:33 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Intransit Shipment'
    from dual
    union all
    select '123',
    to_date ('23-Aug-2012 11:15:40 AM', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('23-Aug-2012 11:12:24 AM', 'DD-MON-RRRR HH:MI:SS AM'),
    'Intransit Shipment'
    from dual
    union all
    select '123',
    to_date ('27-Aug-2012 4:19:46 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('27-Aug-2012 4:11:55 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Intransit Shipment'
    from dual
    union all
    select '123',
    to_date ('27-Aug-2012 4:19:46 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('27-Aug-2012 4:11:55 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Intransit Shipment'
    from dual
    union all
    select '123',
    to_date ('05-Sep-2012 4:22:16 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('18-Sep-2012 9:44:14 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('05-Sep-2012 4:22:16 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('18-Sep-2012 9:44:15 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('17-Sep-2012 1:42:43 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('17-Sep-2012 9:35:35 AM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('17-Oct-2012 10:25:12 PM', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('17-Oct-2012 10:22:28 PM', 'DD-MON-RRRR HH:MI:SS AM'),
    'Sales order issue '
    from dual
    union all
    select '123',
    to_date ('13-Nov-2012 9:12:43 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    to_date ('13-Nov-2012 9:07:48 PM ', 'DD-MON-RRRR HH:MI:SS AM'),
    'Intransit Shipment'
    from dual)
    select inventory_item_id,
    transaction_costed_date,
    transaction_date,
    transaction_type,
    case
    when transaction_type = 'Intransit Shipment' then null
    else lag (transaction_costed_date, 1) over (order by inventory_item_id,
    transaction_costed_date, transaction_date)
    end r
    from sampl_rownum_reset
    order by inventory_item_id, transaction_costed_date, transaction_date
    Thanks
    Sachin

    Hi,
    when you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Is this fitting your needs?SELECT inventory_item_id
    , transaction_costed_date
    , transaction_date
    , transaction_type
    , CASE transaction_type
    WHEN 'Sales order issue ' THEN
    LAST_VALUE (CASE transaction_type
    WHEN 'Intransit Shipment' THEN
    transaction_costed_date
    END IGNORE NULLS)
    OVER (ORDER BY inventory_item_id, transaction_costed_date, transaction_date)
    END r
    FROM sampl_rownum_reset
    ORDER BY inventory_item_id, transaction_costed_date, transaction_date;
    INVENTORY_ITEM_ID TRANSACTION_COSTED_DATE TRANSACTION_DATE TRANSACTION_TYPE R
    123 28-06-2012 21:36:23 28-06-2012 21:35:23 Intransit Shipment
    123 23-07-2012 01:25:44 23-07-2012 09:40:08 Sales order issue 28-06-2012 21:36:23
    123 30-07-2012 05:20:38 01-08-2012 09:37:17 Sales order issue 28-06-2012 21:36:23
    123 08-08-2012 20:03:04 08-08-2012 19:59:33 Intransit Shipment
    123 23-08-2012 11:15:40 23-08-2012 11:12:24 Intransit Shipment
    123 27-08-2012 16:19:46 27-08-2012 16:11:55 Intransit Shipment
    123 27-08-2012 16:19:46 27-08-2012 16:11:55 Intransit Shipment
    123 05-09-2012 04:22:16 18-09-2012 09:44:14 Sales order issue 27-08-2012 16:19:46
    123 05-09-2012 04:22:16 18-09-2012 09:44:15 Sales order issue 27-08-2012 16:19:46
    123 17-09-2012 01:42:43 17-09-2012 09:35:35 Sales order issue 27-08-2012 16:19:46
    123 17-10-2012 22:25:12 17-10-2012 22:22:28 Sales order issue 27-08-2012 16:19:46
    123 13-11-2012 21:12:43 13-11-2012 21:07:48 Intransit Shipment
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL help with calculation uptime from event logs

    Hi guys,
    I'm able to retrieve uptime/downtime info from the eventlogs using the 6005, 6006 events. I just realized that there are cases (dirty shutdowns) where there may not be a shutdown (6006) logged. There will be a 6008 message logged though. I am kinda stumped as to how to match up the 6006 and 6005 messages now to calculate uptime as there might be a few more 6005 messages than 6006. Any ideas. Here's what I have so far: I'm querying the MOM reporting database.
    select t1.computername ServerName,
    t1.computerdomain ComputerDomain,
    t1.timegenerated ShutdownTime,
    (select min(t2.TimeGenerated) from SDKEventView t2
    where t1.ComputerName = t2.computername
    and NTEventID = 6005
    and t2.timegenerated >= t1.TimeGenerated) StartupTime,
    datediff(minute,t1.TimeGenerated, (select min(t2.TimeGenerated) from SDKEventView t2
    where t1.ComputerName = t2.computername
    and NTEventID = 6005
    and t2.timegenerated >= t1.TimeGenerated)) Downtime
    from SDKEventView t1
    where t1.NTEventID = 6006
    and t1.timeGenerated between '5/1/2005 12:00:00.000 AM' and '5/2/2006 12:00:00.000 AM'
    and t1.computername in (select name from sdkcomputerview where name like '%FLK%')
    order by Downtime

    What I would do is create a class with the stored procedure call as one of the methods:
    Class Accessor()
      public UsrObject getUser(String loginId)
         //put stored procedure here>
         //after getting data from database, put into an
         // object you define (ie: UsrObject)
         return UsrObject
    }You have a couple of other issues you need to address (and they may already be taken care of)
    You need to decided if this is a 2-tier or 3-tier architecture. Are you accessing the database directly without going through a middle tier?

  • Sql calculation help needed.

    Hi all gurus.
    I'm having problem where I need to calculate AR days.
    formula  is (sales of prior 3 months/90)/Ar $ amount.= Days
    Data is stored in two different table.
    1.Monthly data table .
    CURR_MO                 REVENUE_PRIOR_MO (in Sept they will enter what was made/achieved in AUG)
    JANUARY                                 0
    FEBRUARY                          1717631
    MARCH                             1591972
    APRIL                             1649450
    MAY                               1662600
    JUNE                              1667823
    JULY                              1669651
    AUGUST                         1709323
    SEPTEMBER                   2006983
    2) Ar $ value enter each week  in Balance sheet table
    AR$            week#   period
    2589570
    10
    07-MAR-13
    2376294
    11
    14-MAR-13
    2454919
    12
    22-MAR-13
    2767058
    13
    31-MAR-13
    2603831
    14
    05-APR-13
    2759590
    15
    11-APR-13
    2376294
    16
    18-APR-13
    2308476
    17
    26-APR-13
    2455142
    18
    02-MAY-13
    2498546
    19
    10-MAY-13
    2457499
    21
    23-MAY-13
    2461661.79
    22
    30-MAY-13
    2310346
    23
    06-JUN-13
    2512139
    24
    13-JUN-13
    2267758
    25
    20-JUN-13
    2497566
    26
    27-JUN-13
    2583208
    27
    04-JUL-13
    2195667
    28
    11-JUL-13
    2288098
    29
    18-JUL-13
    2322778
    30
    25-JUL-13
    2306878
    31
    01-AUG-13
    2513741
    32
    08-AUG-13
    2350728
    33
    15-AUG-13
    2554842
    34
    22-AUG-13
    2664116
    35
    29-AUG-13
    2743931
    36
    05-SEP-13
    2501886
    37
    12-SEP-13
    2315477
    38
    19-SEP-13
    I want to take sum of 3 months corresponding
    Daily Rev.
    June
    July
    Aug
    3-mo Total
         59,844
          1,669,651
          1,709,323
          2,006,983
          5,385,957
    Daily Rev.
    May
    June
    July
    3-mo Total
          56,076
          1,667,823
          1,669,651
          1,709,323
          5,046,797
    Daily Rev.
    April
    May
    June
    3-mo Total
          55,556
          1,662,600
          1,667,823
          1,669,651
          5,000,074
    Daily Rev.
    March
    April
    May
    3-mo Total
          55,332
          1,649,450
          1,662,600
          1,667,823
          4,979,873
    Daily Rev.
    Feb.
    March
    April
    3-mo Total
          54,489
          1,591,972
          1,649,450
          1,662,600
          4,904,022
    Daily Rev.
    Jan
    Feb.
    March
    3-mo Total
          55,101
          1,717,631
          1,591,972
          1,649,450
          4,959,053
    Highlighted daily values with be divided by Ar $ amount  depending on monthly daily rev.
    Output should be like (roughly this not actually output)
    ARDAYS
    WEEK_NUMBER
              47
    10
              43
    11
              45
    12
              50
    13
              48
    14
              51
    15
              44
    16
              42
    17
              44
    18
              45
    19
              44
    21
              44
    22
              42
    23
              45
    24
              41
    25
              45
    26
              46
    27
              39
    28
              41
    29
              41
    30
              39
    31
              42
    32
              39
    33
              43
    34
              45
    35
              46
    36
              42
    37
              39
    38

    I got the answer
    "use the latest 3 completed months for each week"
    as soon sliding window hit JUNE use june (apr-may-june)value to divide
    output (coulm 1 and 2 only)
    ARDAYS
    WEEK#
    period
    AR $
              47
    10
    3/7/2013
    2589570
              43
    11
    3/14/2013
    2376294
    Daily Rev.
    June
    July
    Aug
    3-mo Total
              45
    12
    3/22/2013
    2454919
          59,844
          1,669,651
          1,709,323
          2,006,983
          5,385,957
              50
    13
    3/31/2013
    2767058
              48
    14
    4/5/2013
    2603831
    Daily Rev.
    May
    June
    July
    3-mo Total
              51
    15
    4/11/2013
    2759590
          56,076
          1,667,823
          1,669,651
          1,709,323
          5,046,797
              44
    16
    4/18/2013
    2376294
              42
    17
    4/26/2013
    2308476
    Daily Rev.
    April
    May
    June
    3-mo Total
              44
    18
    5/2/2013
    2455142
          55,556
          1,662,600
          1,667,823
          1,669,651
          5,000,074
              45
    19
    5/10/2013
    2498546
              44
    21
    5/23/2013
    2457499
    Daily Rev.
    March
    April
    May
    3-mo Total
              44
    22
    5/30/2013
    2461662
          55,332
          1,649,450
          1,662,600
          1,667,823
          4,979,873
              42
    23
    6/6/2013
    2310346
              45
    24
    6/13/2013
    2512139
    Daily Rev.
    Feb.
    March
    April
    3-mo Total
              41
    25
    6/20/2013

  • Help with calculations in XMLP Template

    Hi,
    I would like to get some guidance on how the below could be done in XMLP. I am getting the 'Amount' column from FSG and would like to calculate the percentage in the template. Is it possible to calculate rows and store results in column like in the example below in XMLP? Many thanks for your help.
    Type-------Amount-----%
    Gross-----------10-----166.7 (Gross/Net*100)
    Discount---------4-------66.7 (Discount/Net*100)
    ======================
    Net (G-D)--------6-----100.0 (Net/Net*100) or (Gross% - Discount%)

    Hi Hazan,
    I have done a similar Gross Margin Report using XMLP 5.5.
    I have used the concept of variables to store temporary values in my report and carry out complex calculations.
    Please let me know what version of XMLP are you using?
    Some of my form fields containing variables look like this:
    <?xdoxslt:set_variable($_XDOCTX, ’Sum1’, CS_TCOST + CS_TCOST1)?>
    <?xdoxslt:get_variable($_XDOCTX, ’Sno’ )?> <?xdoxslt:set_variable($_XDOCTX, ’Sno’, xdoxslt:get_variable($_XDOCTX, ’Sno’) + 1)?>
    <?xdofx:if(CS_TSELL + CS_TSELL1) <= 0 then
    xdoxslt:set_variable($_XDOCTX, ’Sum1’, 1)
    end if?>
    I am not sure if you are looking at this or not. Do let me know if this solves the purpose and need be required some help :-o)
    HTH,
    Nitin

  • Need help-SQL with result format suppressing duplicate values

    I am trying to write a SQL which would select data from the below tables(in reality i have many other tables also) but I wanted to know how do i get the data in the format given below.
    The scenario is :-A training_plan can N no. of OBJECTIVES and EACH objective has N no.of activities
    Insert into TEST_TRAINING_PLAN
       (TPLAN_ID, TPLAN_NAME, TPLAN_DESC, T_PERSON_ID
    Values
       ('111', 'test_name', 'test_name_desc', '****')
    Objectives table:-
    Insert into TEST_TRAINING_OBJECTIVE
       (T_OBJECTIVE_ID,  T_OBJECTIVE_NAME,T_owner)
    Values
       ('10', 'objective1', '1862188559')
    Objective and Training Plan relationship table where TPLAN_ID is the foreign key.
    Insert into TEST_TP_OBJECTIVE
       (TPLAN_TOBJ_ID, TPLAN_ID, T_OBJECTIVE_ID, 
        REQUIRED_CREDITS)
    Values
       ('1', '111', '10',5)
    Objective and Activity relationship table where T_OBJECTIVE_ID is the foreign key from the TEST_TRAINING_OBJECTIVE table.
    Insert into TEST_TRAIN_OBJ_ACTIVITY
       (TOBJ_TRAIN_ACTIVITY, T_OBJECTIVE_ID, ACTIVITY_ID, IS_REQUIRED, STATUS,
        ACTIVITY_TYPE, ITEM_ORDER, IS_PREFERRED)
    Values
       ('1000', '10', 'selfstudy event', SS1, NULL,
        'Event', 0, 0);
    Insert into TEST_TRAIN_OBJ_ACTIVITY
       (TOBJ_TRAIN_ACTIVITY, T_OBJECTIVE_ID, ACTIVITY_ID, IS_REQUIRED, STATUS,
        ACTIVITY_TYPE, ITEM_ORDER, IS_PREFERRED)
    Values
       ('1001', '10', 'SQLcourse', 1, NULL,
        'Course', 1, 0);
    Insert into TEST_TRAIN_OBJ_ACTIVITY
       (TOBJ_TRAIN_ACTIVITY, T_OBJECTIVE_ID, ACTIVITY_ID, IS_REQUIRED, STATUS,
        ACTIVITY_TYPE, ITEM_ORDER, IS_PREFERRED)
    Values
       ('1002', '10', 'testSQL', 1, NULL,
        'test', 2, 0);
    COMMIT;
    firstname     emplid     Tplan name     Number of activities/credits completed(for TP)     Objective Name     Number of required activities/Credits (for objective)     Number of activities/credits completed(for objective)     activity  name     activity completion status
    U1     U1     TP1     5                         
                        OBJ1     4     3     C1     PASSED
                                       C2     PASSED
                                       C3     WAIVED
                                       T1     ENROLLED
                                       T2     ENROLLED
                        OBJ2     3     2          
                                       S1     ENROLLED
                                       S2     PASSED
                                       T3     WAIVED
    U1     U1     TP2                         C4     INPROGRESS
                   50     OBJ11     50     30     C11     PASSED
    **The second row where we have another training_plan record and accordingly all objectivesand their objective.**similarly ,i need to display many Training_plan records in such tabular format.Please help with the SQL query to select and display data in the above format
    If you want to suppress duplicate values in some of your results columns
    I am using toad 9.1 using Oracle 10g version 2

    Hi,
    You can use the BREAK command to suppress duplicate values.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12009.htm#SQPUG030
    (scroll down for an example)
    It's a 'SQL*Plus-ism', not sure if TOAD's capable to handle it.
    Simple example:
    HR%xe> break on department_name
    HR%xe> select l.department_name
      2  ,        e.last_name
      3  ,        e.first_name
      4  from     departments l
      5  ,        employees e
      6  where    e.department_id = l.department_id;
    DEPARTMENT_NAME                LAST_NAME                 FIRST_NAME
    Executive                      King                      Steven
                                   Kochhar                   Neena
                                   De Haan                   Lex
    IT                             Hunold                    Alexander
                                   Ernst                     Bruce
                                   Austin                    David
                                   Pataballa                 Valli
                                   Lorentz                   Diana
    Finance                        Greenberg                 Nancy
                                   Faviet                    Daniel
                                   Chen                      John
                                   Sciarra                   Ismael
                                   Urman                     Jose Manuel
                                   Popp                      Luis
    Purchasing                     Raphaely                  Den
                                   Khoo                      Alexander
                                   Baida                     Shelli
                                   Tobias                    Sigal
                                   Himuro                    Guy
                                   Colmenares                Karen
    Shipping                       Weiss                     Matthew
                                   Fripp                     Adam
                                   Kaufling                  Payam
                                   Vollman                   Shanta
                                   Mourgos                   Kevin
                                   Nayer                     Julia
                                   Mikkilineni               Irene
                                   Landry                    James
    Public Relations               Baer                      Hermann
    Accounting                     Higgins                   Shelley
                                   Gietz                     William
    106 rijen zijn geselecteerd.

  • Need help with calculating interest

    Hey im trying to find out where my calculations are screwing up on the interest is coming up wrong but i am unable to find out where. After every month its suppose to be deposit - withdrawl * monthly interest rate and then add that total to the new month etc... any help will be appreciated. Heres my class and test
    public class SavingsAccount
        private double bal;
        private double intRate;
    The constructor initializes an object with a
    balance and an annual interest rate.
    @param bal The account balance.
    @param intRate The annual interest rate.
        public SavingsAccount(double bal, double intRate)
        bal= 0.0;
        intRate = 0.0;
        The withdraw method withdraws an amount from
        the account.
        @param amount The amount to withdraw.
        public void withdraw(double amount)
            bal -= amount;
        The deposit method deposits an amount into
        the account.
        @param amount The amount to deposit.
        public void deposit(double amount)
            bal += amount;
        The addInterest method calculates the monthly
        interest and adds it to the account balance.
        public void addInterest()
        // Get the monthly interest rate.
        // Calculate the last amount of interest earned.
        // Add the interest to the balance.
         intRate = bal * (intRate/12);
         bal += intRate;
        The getBalance method returns the account balance.
        @return The account balance.
        public double getBalance()
        return bal;
        The getInterestRate method returns the annual
        interest rate.
        @return The annual interest rate.
        public double getInterestRate()
        return intRate;
        The getLastInterest method returns the last amount
        of interest earned.
        @return The last amount of interest earned.
        public double getLastInterest()
        return bal;
    import java.util.Scanner;
    import java.text.DecimalFormat;
    public class SavingsAccountTest
        public static void main(String args[])
        // Annual interest rate
           double intRate;
        // Starting balance
           double startBal;
        // Amount of deposits for a month
           double deposit;
           double totalDeposit;
        // Amount withdrawn in a month
           double withdrawn;
           double totalWithdrawn;
        // Interest earned
           double intEarned = 0;
        // Deposit accumulator
           deposit = 0.0;
           totalDeposit = 0.0;
        // Withdrawal accumulator
           withdrawn =0.0;
           totalWithdrawn = 0.0;
        // Months that have passed
           double months;
        // Create a Scanner object for keyboard input.
           Scanner keyboard = new Scanner(System.in);
        // Get the starting balance.
           System.out.println("What is your account's starting balance");
           startBal = keyboard.nextDouble();
           while (startBal < 0)
               startBal=0;
        // Get the annual interest rate.
           System.out.println("What is the annual interest rate?");
           intRate = keyboard.nextDouble();
           while (intRate <= 0 )
               intRate = 0;
        // Create a SavingsAccount object.
           SavingsAccount account = new SavingsAccount(0.0, 0.0);
        // Get the number of months that have passed.
           System.out.println("How many months have passed since the " +
                              "account has opened? ");
           months = keyboard.nextDouble();
           while (months <= 0)
               months = 1;
        // Get the deposits and withdrawals for each month.
        for (int i = 1; i <= months; i++)
        // Get the deposits.
           System.out.println("Enter the amount deposited during month " + i);
           deposit= keyboard.nextDouble();
           totalDeposit += deposit;
           while (deposit <=0)
               deposit = 0;
        // Get the withdrawals.
           System.out.println("Enter the amount withdrawn during month " + i);
           withdrawn = keyboard.nextDouble();
           totalWithdrawn += withdrawn;
           while (withdrawn <= 0)
               withdrawn = 0;
        // Add the deposits to the account.
           startBal += deposit;
        // Subtract the withdrawals.
           startBal -= withdrawn;
        // Add the monthly interest.
           intRate = startBal * intRate/12;
           startBal += intRate;
        // Accumulate the amount of interest earned.
           intRate += intEarned;
        // Create a DecimalFormat object for formatting output.
        DecimalFormat dollar = new DecimalFormat("#,##0.00");
        // Display the totals and the balance.
        System.out.println("Total deposited: " + dollar.format(totalDeposit));
        System.out.println("Total withdrawn: " + dollar.format(totalWithdrawn));
        System.out.println("Total interest earned: " + dollar.format(intEarned));
        System.out.println("Account balance: " + dollar.format(startBal));
    }

    Ok this is what i have fixed up so far but im still having trouble calculating the interest. Problem1) We were given the skeleton to the class and demo. I cannot figure out what to enter in getLastInterest.(completely lost all i need is hint) 2)When i try to get the Total money deposited and i call the account.deposit(balance) it keeps on giving an error void not allowed. Any help is appreciated
    public class SavingsAccount
        private double balance;
        private double interest;
        private double intEarned;
        The constructor initializes an object with a
        balance and an annual interest rate.
        @param bal The account balance.
        @param intRate The annual interest rate.
        public SavingsAccount(double bal, double intRate)
        balance = bal;
        interest = intRate;
        The withdraw method withdraws an amount from
        the account.
        @param amount The amount to withdraw.
        public void withdraw(double amount)
            balance -= amount;
        The deposit method deposits an amount into
        the account.
        @param amount The amount to deposit.
        public void deposit(double amount)
            balance += amount;
        The addInterest method calculates the monthly
        interest and adds it to the account balance.
        public void addInterest()
        // Get the monthly interest rate.
        // Calculate the last amount of interest earned.
        // Add the interest to the balance.
         interest = balance * (interest/12);
         interest = intEarned;
         balance += interest;
        The getBalance method returns the account balance.
        @return The account balance.
        public double getBalance()
        return balance;
        The getInterestRate method returns the annual
        interest rate.
        @return The annual interest rate.
        public double getInterestRate()
        return interest;
        The getLastInterest method returns the last amount
        of interest earned.
        @return The last amount of interest earned.
        public double getLastInterest()
        return intEarned;
    import java.util.Scanner;
    import java.text.DecimalFormat;
    public class SavingsAccountTest
        public static void main(String args[])
        // Annual interest rate
           double intRate;
        // Starting balance
           double balance;
        // Amount of deposits for a month
           double deposit;    
        // Amount withdrawn in a month
           double withdraw;
        // Interest earned
           double intEarned = 0;
        // Deposit accumulator
           deposit = 0.0;  
        // Withdrawal accumulator
           withdraw =0.0;    
        // Months that have passed
           double months;
        // Create a Scanner object for keyboard input.
           Scanner keyboard = new Scanner(System.in);
        // Get the starting balance.
           System.out.println("What is your account's starting balance");
           balance = keyboard.nextDouble();
           if (balance < 0)
               balance=0;
        // Get the annual interest rate.
           System.out.println("What is the annual interest rate?");
           intRate = keyboard.nextDouble();
           if (intRate <= 0 )
               intRate = 0;
        // Create a SavingsAccount object. Cannot find Symbol!!
           SavingsAccount account = new SavingsAccount(balance,intRate);
        // Get the number of months that have passed.
           System.out.println("How many months have passed since the " +
                              "account has opened? ");
           months = keyboard.nextDouble();
           if (months <= 0)
               months = 1;
        // Get the deposits and withdrawals for each month.
        for (int i = 1; i <= months; i++)
        // Get the deposits.
           System.out.println("Enter the amount deposited during month " + i);
           deposit= keyboard.nextDouble();
           account.deposit(deposit);
           if (deposit <=0)
               deposit = 0;
        // Get the withdrawals.
           System.out.println("Enter the amount withdrawn during month " + i);
           withdraw = keyboard.nextDouble();
           account.withdraw(withdraw);
           if (withdraw <= 0 || withdraw >= balance)
               withdraw = 0;
        // Add the deposits to the account.
           account.deposit(balance);
        // Subtract the withdrawals.
           account.withdraw(balance);
        // Add the monthly interest.
           account.addInterest();
        // Accumulate the amount of interest earned. ????? Wrong
           intRate += intEarned;
        // Create a DecimalFormat object for formatting output.
        DecimalFormat dollar = new DecimalFormat("#,##0.00");
        // Display the totals and the balance.
        System.out.println("Total deposited: " + dollar.format(account.deposit(balance)));
        System.out.println("Total withdrawn: " + dollar.format(account.withdraw(balance)));
        System.out.println("Total interest earned: " + dollar.format(account.addInterest()));
        System.out.println("Account balance: " + dollar.format(account.getBalance()));
    }

  • Need help in calculating a total from flowable table

    I've tried everything to include using the example from the tutorial on creating a flowable purchase order form.  My problem is that I can't get the total field to reflect a total.  I'd be willing to send the form to anyone willing to shed some light and provide a solution.
    Thanks

    Paul, I don't believe that I'm grasping exactly what you are saying.  I have several forms at work that I've designed (none with flowable content however) with calculations, it's just I can't seem to get this one to do what I need.  So.... let me plead ignorance on this one for the moment.
    Actually, I have the one row that accepts data, then if the user wants to, they can click on the add item button to add another instance.  Even after entering the one rows data, that amount does not reflect in the total field.  You would likely need to see the form possibly, and if so, let me know.  I'd be glad to have your help in any way you could provide it.
    Mike

  • Need help with calculator project for an assignment...

    Hi all, I please need help with my calculator project that I have to do for an assignment.
    Here is the project's specifications that I need to do"
    """Create a console calculator applicaion that:
    * Takes one command line argument: your name and surname. When the
    program starts, display the date and time with a welcome message for the
    user.
    * Display all the available options to the user. Your calculator must include
    the arithmetic operations as well as at least five scientific operations of the
    Math class.
    -Your program must also have the ability to round a number and
    truncate it.
    -When you multiply by 2, you should not use the '*' operator to perform the
    operation.
    -Your program must also be able to reverse the sign of a number.
    * Include sufficient error checking in your program to ensure that the user
    only enters valid input. Make use of the String; Character, and other
    wrapper classes to help you.
    * Your program must be able to do conversions between decimal, octal and
    hex numbers.
    * Make use of a menu. You should give the user the option to end the
    program when entering a certain option.
    * When the program exits, display a message for the user, stating the
    current time, and calculate and display how long the user used your
    program.
    * Make use of helper classes where possible.
    * Use the SDK to run your program."""
    When the program starts, it asks the user for his/her name and surname. I got the program to ask the user again and again for his/her name and surname
    when he/she doesn't insert anything or just press 'enter', but if the user enters a number for the name and surname part, the program continues.
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??
    Here is the programs code that I've written so far:
    {code}
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class Project {
         private static String nameSurname = "";     
         private static String num1 = null;
         private static String num2 = null;
         private static String choice1 = null;
         private static double answer = 0;
         private static String more;
         public double Add() {
              answer = (Double.parseDouble(num1) + Double.parseDouble(num2));
              return answer;
         public double Subtract() {
              answer = (Double.parseDouble(num1) - Double.parseDouble(num2));
              return answer;
         public double Multiply() {
              answer = (Double.parseDouble(num1) * Double.parseDouble(num2));
              return answer;
         public double Divide() {
              answer = (Double.parseDouble(num1) / Double.parseDouble(num2));
              return answer;
         public double Modulus() {
              answer = (Double.parseDouble(num1) % Double.parseDouble(num2));
              return answer;
         public double maximumValue() {
              answer = (Math.max(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double minimumValue() {
              answer = (Math.min(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double absoluteNumber1() {
              answer = (Math.abs(Double.parseDouble(num1)));
              return answer;
         public double absoluteNumber2() {
              answer = (Math.abs(Double.parseDouble(num2)));
              return answer;
         public double Squareroot1() {
              answer = (Math.sqrt(Double.parseDouble(num1)));
              return answer;
         public double Squareroot2() {
              answer = (Math.sqrt(Double.parseDouble(num2)));
              return answer;
         public static String octalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
    String octal1 = Integer.toOctalString(iNum1);
    return octal1;
         public static String octalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String octal2 = Integer.toOctalString(iNum2);
              return octal2;
         public static String hexadecimalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
              String hex1 = Integer.toHexString(iNum1);
              return hex1;
         public static String hexadecimalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String hex2 = Integer.toHexString(iNum2);
              return hex2;
         public double Round1() {
              answer = Math.round(Double.parseDouble(num1));
              return answer;
         public double Round2() {
              answer = Math.round(Double.parseDouble(num2));
              return answer;
              SimpleDateFormat format1 = new SimpleDateFormat("EEEE, dd MMMM yyyy");
         Date now = new Date();
         SimpleDateFormat format2 = new SimpleDateFormat("hh:mm a");
         static Date timeIn = new Date();
         public static long programRuntime() {
              Date timeInD = timeIn;
              long timeOutD = System.currentTimeMillis();
              long msec = timeOutD - timeInD.getTime();
              float timeHours = msec / 1000;
                   return (long) timeHours;
         DecimalFormat decimals = new DecimalFormat("#0.00");
         public String insertNameAndSurname() throws IOException{
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        while (nameSurname == null || nameSurname.length() == 0) {
                             for (int i = 0; i < nameSurname.length(); i++) {
                             if ((nameSurname.charAt(i) > 'a') && (nameSurname.charAt(i) < 'Z')){
                                       inputCorrect = true;
                        else{
                        inputCorrect = false;
                        break;
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your name and surname: ");
                             nameSurname = inStream.readLine();
                             inputCorrect = true;
                        }catch (IOException ex) {
                             System.out.println("You did not enter your name and surname, " + nameSurname + " is not a name, please enter your name and surname :");
                             inputCorrect = false;
                        System.out.println("\nA warm welcome " + nameSurname + " ,todays date is: " + format1.format(now));
                        System.out.println("and the time is now exactly " + format2.format(timeIn) + ".");
                        return nameSurname;
              public String inputNumber1() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter a number you want to do a calculation with and hit <ENTER>: ");
                             num1 = br.readLine();
                             double number1 = Double.parseDouble(num1);
                             System.out.println("\nThe number you have entered is: " + number1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("\nYou did not enter a valid number: " + "\""+ num1 + "\" is not a number!!");
                             inputCorrect = false;
                        return num1;
         public String calculatorChoice() throws IOException {
              System.out.println("Please select an option of what you would like to do with this number from the menu below and hit <ENTER>: ");
              System.out.println("\n*********************************************");
              System.out.println("---------------------------------------------");
              System.out.println("Please select an option from the list below: ");
              System.out.println("---------------------------------------------");
              System.out.println("1 - Add");
              System.out.println("2 - Subtract");
              System.out.println("3 - Multiply");
              System.out.println("4 - Divide (remainder included)");
              System.out.println("5 - Maximum and minimum value of two numbers");
              System.out.println("6 - Squareroot");
              System.out.println("7 - Absolute value of numbers");
              System.out.println("8 - Octal and Hexadecimal equivalent of numbers");
              System.out.println("9 - Round numbers");
              System.out.println("0 - Exit program");
              System.out.println("**********************************************");
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your option and hit <ENTER>: ");
                             choice1 = inStream.readLine();
                             int c1 = Integer.parseInt(choice1);
                             System.out.println("\nYou have entered choice number: " + c1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid choice number: " + "\""+ choice1 + "\" is not in the list!!");
                             inputCorrect = false;
                        return choice1;
         public String inputNumber2() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br2 = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter another number you want to do the calculation with and hit <ENTER>: ");
                             num2 = br2.readLine();
                             double n2 = Double.parseDouble(num2);
                             System.out.println("\nThe second number you have entered is: " + n2);
                             System.out.println("\nYour numbers are: " + num1 + " and " + num2);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid number: " + "\""+ num2 + "\" is not a number!!");
                             inputCorrect = false;
                        return num2;
         public int Calculator() {
              int choice2 = (int) Double.parseDouble(choice1);
              switch (choice2) {
                        case 1 :
                             Add();
                             System.out.print("The answer of " + num1 + " + " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 2 :
                             Subtract();
                             System.out.print("The answer of " + num1 + " - " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 3 :
                             Multiply();
                             System.out.print("The answer of " + num1 + " * " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 4 :
                             Divide();
                             System.out.print("The answer of " + num1 + " / " + num2 + " is: " + decimals.format(answer));
                             Modulus();
                             System.out.print(" and the remainder is " + decimals.format(answer));
                             break;
                        case 5 :
                             maximumValue();
                             System.out.println("The maximum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             minimumValue();
                             System.out.println("The minimum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 6 :
                             Squareroot1();
                             System.out.println("The squareroot of value " + num1 + " is: " + decimals.format(answer));
                             Squareroot2();
                             System.out.println("The squareroot of value " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 7 :
                             absoluteNumber1();
                             System.out.println("The absolute number of " + num1 + " is: " + decimals.format(answer));
                             absoluteNumber2();
                             System.out.println("The absolute number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 8 :
                             octalEquivalent1();
                             System.out.println("The octal equivalent of " + num1 + " is: " + octalEquivalent1());
                             octalEquivalent2();
                             System.out.println("The octal equivalent of " + num2 + " is: " + octalEquivalent2());
                             hexadecimalEquivalent1();
                             System.out.println("\nThe hexadecimal equivalent of " + num1 + " is: " + hexadecimalEquivalent1());
                             hexadecimalEquivalent2();
                             System.out.println("The hexadecimal equivalent of " + num2 + " is: " + hexadecimalEquivalent2());
                             break;
                        case 9 :
                             Round1();
                             System.out.println("The rounded number of " + num1 + " is: " + decimals.format(answer));
                             Round2();
                             System.out.println("The rounded number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 0 :
                             if (choice2 == 0) {
                                  System.exit(1);
                             break;
                   return choice2;
              public String anotherCalculation() throws IOException {
                   boolean inputCorrect = false;
                   while (inputCorrect == false) {
                             try {                              
                                  BufferedReader br3 = new BufferedReader (new InputStreamReader(System.in));
                                  System.out.print("\nWould you like to do another calculation? Y/N ");
                                  more = br3.readLine();
                                  String s1 = "y";
                                  String s2 = "Y";
                                  if (more.equals(s1) || more.equals(s2)) {
                                       inputCorrect = true;
                                       while (inputCorrect = true){
                                            inputNumber1();
                                            System.out.println("");
                                            calculatorChoice();
                                            System.out.println("");
                                            inputNumber2();
                                            System.out.println("");
                                            Calculator();
                                            System.out.println("");
                                            anotherCalculation();
                                            System.out.println("");
                                            inputCorrect = true;
                                  } else {
                                       System.out.println("\n" + nameSurname + " thank you for using this program, you have used this program for: " + decimals.format(programRuntime()) + " seconds");
                                       System.out.println("the program will now exit, Goodbye.");
                                       System.exit(0);
                             } catch (IOException ex){
                                  System.out.println("You did not enter a valid answer: " + "\""+ more + "\" is not in the list!!");
                                  inputCorrect = false;
              return more;
         public static void main(String[] args) throws IOException {
              Project p1 = new Project();
              p1.insertNameAndSurname();
              System.out.println("");
              p1.inputNumber1();
              System.out.println("");
              p1.calculatorChoice();
              System.out.println("");
              p1.inputNumber2();
              System.out.println("");
              p1.Calculator();
                   System.out.println("");
                   p1.anotherCalculation();
                   System.out.println("");
    {code}
    *Can you please run my code for yourself and have a look at how this program is constructed*
    *and give me ANY feedback on how I can better this code(program) or if I've done anything wrong from your point of view.*
    Your help will be much appreciated.
    Thanks in advance

    Smirre wrote:
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??You cannot restrict the user. It is a sad fact in programming that the worst bug always sits in front of the Computer.
    What you could do is checking the input string for numbers. If it contains numbers, just reprompt for the Name.
    AND you might want to ask yourself why the heck a calculator needs to know the users Name.

  • Need Help in Calculation of Paid and Unpaid Break in Daily Work Schedule

    hai,
    I am a student of SAP-HCM. I am having problem with the calculation
    in Paid and Unpaid Break in Daily work schedule (Time Management).
    Please help.
    thank you
    Dev.

    Hi,
    The above screen shot is table where we maintain unpaid and paid breaks, we mention about when a break has to start under START tab and when it has to end under END button.
    Under UNPAID and PAID tabs we mention duration of break,  if its 15 mins break or half an hour or one hour depending on start and end timings.
    Suppose a shift is for 9 hours in total and client wants there should be a paid break of one hour, then out of this 9 hours shift itself  break would be considered.... and in case client wants unpaid break then shift would be for 10 hours out of which 9 hours will be working hours and one hour break.
    When this concept has to be calculated in schema processing type would be assigned to this time pair showing break accordingly either paid or unpaid.

  • Need help with calculated fields in Adobe Interactive Forms

    Hi Gurus,
    I have an Adobe Interactive form in which i have radio buttons. Upon selecting any of the radio buttons, value in text box should be changed( Calculqated filedS). How i can achieve this?
    Regards,
    Srini
    Moderator message: wrong forum, please post again in Adobe Interactive Forms, but always try yourself before asking.
    Edited by: Thomas Zloch on Jul 13, 2010 11:58 AM

    Hi Tapan
    No, it's working ,with  one remark.
    I've done a mistake, in the final formula. The logic remain the same! ;)
     The calculation values for second column ( COL2 ) are 1,2,3 and not 0,1,2 as I wrote  before and as for COL1 are so the formula is
    =3*if(COL1="ABC",0,IF(COL1="DEF",1,2)+if(COL2="RST",1,IF(COL2="YYZ",2,3)
    and not
    =3*if(COL1="ABC",0,IF(COL1="DEF",1,2)+if(COL2="RST",0,IF(COL2="YYZ",1,2)
    I created also a real example  for you, with 2 dif calculation ways . First I created 2 calc_columns for COL1 and COL2 ( CALC_COL1+CALC_COL and after I added both these 2 column , and second way is to calculate directly) .
    Check this image
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • Help sql

    Hi,
    I have two functions.But some codes are the same so I want to merge in one function.
    My code is:
    function get_column_name (p_table_name in varchar2) return varchar2 is
          l_var varchar2(100) := null;
          l_str varchar2(2000) := null;
          i int := 1;
       begin
          for l_rec in (select COLUMN_NAME item_name,COLUMN_NAME display_name from all_tab_cols
                           where table_name = p_table_name
                             and column_name not in (select a.item_name
                                                       from item_t a
                                                      where a.table_name = p_table_name)                                             
                         union all                            
                        (select item_name,display_name
                           from item_t
                          where table_name = p_table_name)
          loop        
             if (instr(upper(l_rec.item_name), 'DATE') > 0) or (instr(upper(l_rec.item_name), 'TIME') > 0) then
                l_var := 'to_char(' || l_rec.item_name || ', ''yyyymmdd hh24mmss'') '||l_rec.display_name;
             elsif (l_rec.item_name != l_rec.display_name) then
                l_var := l_rec.item_name||' '||l_rec.display_name;
             else
                l_var := l_rec.item_name;  
             end if;
             if ( i = 1 ) then
               l_str := l_var;
             else
               l_str := l_str || ',' || l_var;
             end if;
               i := i + 1;
          end loop;
          if (l_str is null) then l_str := '*';
          end if;
          return l_str;
       end;
       function get_column_name (p_table_name in varchar2,p_column_name_list in item_list) return varchar2 is
          l_var varchar2(100) := null;
          l_str varchar2(2000) := null;
          i int := 1;
       begin
          for l_rec in (select COLUMN_NAME item_name,COLUMN_NAME display_name from all_tab_cols
                           where table_name = p_table_name
                             and column_name not in (select a.item_name
                                                       from cmn_lookup_item_t a
                                                      where a.table_name = p_table_name)                                               
                         union all                            
                        (select item_name,display_name
                           from cmn_lookup_item_t
                          where table_name = p_table_name
                           and display_name in (select value from table(cast(p_column_name_list as item_list ))))
          loop        
             if (instr(upper(l_rec.item_name), 'DATE') > 0) or (instr(upper(l_rec.item_name), 'TIME') > 0) then
                l_var := 'to_char(' || l_rec.item_name || ', ''yyyymmdd hh24mmss'') '||l_rec.display_name;
             if (l_rec.item_name != l_rec.display_name) then
                l_var := l_rec.item_name||' '||l_rec.display_name;
             else
                l_var := l_rec.item_name;  
             end if;
             if ( i = 1 ) then
               l_str := l_var;
             else
               l_str := l_str || ',' || l_var;
             end if;
               i := i + 1;
          end loop;
          if (l_str is null) then l_str := '*';
          end if;
          return l_str;
       end;   The code start 'loop' is the same just different at 'l_rec' part.How can i merge it?
    Thanks for your help!
    Jing

    Simple example:
    SQL> create or replace type my_type is table of varchar2(20)
      2  /
    Type created.
    SQL> create or replace package my_pkg
      2  is
      3    coll my_type := my_type('SALESMAN');
      4  end;
      5  /
    Package created.
    SQL> create or replace procedure my_prc
      2  (
      3    deptno number,
      4    job_list my_type default null
      5  )
      6  is
      7  begin
      8   for v in (select ename from emp where deptno = my_prc.deptno
      9   and (job in (select column_value from table(cast(job_list as my_type)))
    10   or job_list is null)) loop
    11     dbms_output.put_line(v.ename);
    12   end loop;
    13  end;
    14  /
    Procedure created.
    SQL> exec my_prc(30);
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    PL/SQL procedure successfully completed.
    SQL> exec my_prc(30,my_pkg.coll);
    ALLEN
    WARD
    MARTIN
    TURNER
    PL/SQL procedure successfully completed.
    SQL> select ename, job from emp where deptno = 30;
    ENAME      JOB
    ALLEN      SALESMAN
    WARD       SALESMAN
    MARTIN     SALESMAN
    BLAKE      MANAGER
    TURNER     SALESMAN
    JAMES      CLERK
    6 rows selected.Rgds.

Maybe you are looking for

  • Multi room DVR freezes when paused

    Multi room DVR freezes when paused and won't play the show unless you change the channel.  Unless you are recording that show, you can't go back to the point at which it was initially paused.

  • Report Generation to PDF File Fails

    Has anyone else encountered anything like this. I have a report (Oracle Reports 10g) that's fairly straight-forward; the query basically joins a couple of tables and utilizes maybe a dozen Function Columns. For smaller units within my organization it

  • Can i put a background picture (from my photo album) in imessage

    Can someone tell me if i can put up a backgrnd picture in imessage... Can i only do it if my phone is jailbroken??!! I have searched for apps but couldn find any... Help!!!!

  • Incorrect sequence of shop floor paper after upgrade

    Hi All, We had an upgrade from 4.7 to ECC6 and we have a problem with shop paper printing for Production orders. The sequence of shop papers doesn't follow the sequence defined in configuration. e.g. Pick List gets printed before Operation list even

  • Application downloads open in Textedit. How do I fix this?

    Have a refurbished Macbook, unsure of version year, OS X, 10.6.8  I'm currently involved in college courses where I need to use notepad++ for mac.  But everytime I download it or other applications they keep opening up with Text edit, of course text