How to Achieve this in SQL Query?

How to Achieve this ?
I have a table with numeric value populated like this
create table random_numeral (numerals Number(10));
insert into random_numeral values (1);
insert into random_numeral values (2);
insert into random_numeral values (3);
insert into random_numeral values (4);
insert into random_numeral values (5);
insert into random_numeral values (6);
insert into random_numeral values (56);
insert into random_numeral values (85);
insert into random_numeral values (24);
insert into random_numeral values (11);
insert into random_numeral values (120);
insert into random_numeral values (114);
Numerals
1
2
3
4
5
6
56
85
24
11
120
114
I want to display the data as follows
col1 / col2 / col3
1 / 2 / 3
4 / 5 / 6
11 / 24 / 56
85 / 114 / 120
Can anyone Help me?

I hope there might be some simple way to do this and waiting for experts to reply.
Try the below query.
SQL> select * from random_numeral;
  NUMERALS
         1
         2
         3
         4
         5
         6
        56
        85
        24
        11
       120
  NUMERALS
       114
       100
       140
14 rows selected.
SQL> select a.numerals ||' / '||b.numerals||' / '||c.numerals from
  2          (select numerals,rownum rn1 from
  3          (
  4              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
  5              from random_numeral
  6          )
  7          where rn=1) a,
  8          (select numerals,rownum rn1 from
  9          (
10              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
11              from random_numeral
12          )
13          where rn=2) b,
14          (select numerals,rownum rn1 from
15          (
16              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
17              from random_numeral
18          )
19          where rn=0) c
20  where   a.rn1=b.rn1(+)
21  and b.rn1=c.rn1(+)
22  /
A.NUMERALS||'/'||B.NUMERALS||'/'||C.NUMERALS
1 / 2 / 3
4 / 5 / 6
11 / 24 / 56
85 / 100 / 114
120 / 140 /
SQL>Cheers,
Mohana

Similar Messages

  • How to achieve this Calculaction in Query Designer

    Hi Experts
    Could you please update me on How can i acieve this calculaction...
    I had 2 KFs & 1 Formula (% Calculaction) in my Report
    Col A--Col B---Col C (%)-----
    R1----32 50%--
    R2----23(-33%)--
    R3----141217%--
    R4----161060%--
    Over
    all
    Result352729%--
    Col C = Col A % Col B
    In my Query  i had a condition on Col C
    Show Col C >0
    Then output of query is
    Col A--Col B---Col C (%)-----
    R1----32 50%--
    R3----141217%--
    R4----161060%--
    Over
    all
    Result352729%--
    THE OVERRESULT IS NOT CHANGING
    MY requirment is to achieve overresult for above query output
    Over
    all
    Result332437%--
    I can managed to get the Overall result for Col A & Col B in the Properties>Calculactions>Calculate result As-->Total
    What setting i have to make to change Col C Overall result
    Thanks

    Hi,
    I think that deactivating the condition and using a formula instead will work.
    Try e.g. this formula for Col C:
    ( 'Col A' % 'Col B' > 0 ) * ( 'Col A' % 'Col B' )
    You might also want to activate zero suppression in the report.
    Hope it helps.
    BR
    Stefan

  • HOw to achieve this at report/query level

    Hi Experts
    Please update me how can i achieve this at query level
    Lets Consider Data in my Cube
    Dept_id--Date--
    Qty
    -101.01.20093-----
    -101.01.20095-----
    -101.01.20098-----
    -101.01.20091-----
    -101.01.20099-----
    That is how data is avaliable in my cube
    When i run the report the output is displayed as
    Dept_id--Date--
    Qty
    -101.01.200926-----
    That is what it actually do...it will sumirises into one record.....
    BUT
    My requirment is the query result should be ....with out summarisation
    Dept_id--Date--
    Qty
    -101.01.20093-----
    -101.01.20095-----
    -101.01.20098-----
    -101.01.20091-----
    -101.01.20099-----
    Please update me is there any setting i can make at query level

    Hi,
    By default data will be aggregated in Query.
    How come data available in Cube at different aggregation level...? due to request no or some other characteristic which is unique for each record...??
    If some other characteristic available, make it available that characteristic in rows to get desired result.
    Srini

  • How to achieve this in SQL?

    Hi Guys,
    I'm stuck in one place. Here is my problem explained below -
    Table definition is -
    Column name          Data Type          Nullable
    FLT_NBR           CHAR(5 BYTE)     No
    CARR_IATA_CD     CHAR(4 BYTE)     No
    FLT_LCL_ORIG_DT     DATE                 No
    ORIG_ARPT_CD     CHAR(3 BYTE)     No
    DEST_ARPT_CD     CHAR(3 BYTE)     No
    ORIG_OCCUR_NBR     NUMBER(3,0)          No
    DEST_OCCUR_NBR     NUMBER(3,0)          No
    SCHED_LEG_NBR     NUMBER(3,0)          No
    NOSE_NBR          CHAR(4 BYTE)     Yes
    GMT_EST_DEP_DTM     DATE               Yes
    GMT_EST_ARR_DTM     DATE               Yes
    TAIL_NBR          CHAR(6 BYTE)     Yes
    ACTIVE_IND          NUMBER(1,0)          YesEach record of the table is segment. This will applicable on all the data of that given table.
    Consider the following case -
    SQL Is -
    select o.CARR_IATA_CD,
           o.FLT_NBR,
           o.FLT_LCL_ORIG_DT,
           o.ORIG_ARPT_CD,
           o.SCHED_LEG_NBR,
           o.DEST_ARPT_CD,
           o.ORIG_OCCUR_NBR,
           o.DEST_OCCUR_NBR,
           o.NOSE_NBR,
           o.TAIL_NBR,
           to_char(o.GMT_EST_ARR_DTM,'DD-MON-YYYY hh24:mi:ss') GMT_EST_ARR_DTM,
           to_char(o.GMT_EST_DEP_DTM,'DD-MON-YYYY hh24:mi:ss') GMT_EST_DEP_DTM
    from ops_flt_leg o
    where o.flt_nbr = '109'  
    and   o.orig_arpt_cd = 'ORD'
    and   o.dest_arpt_cd = 'ORD'
    and   o.flt_lcl_orig_dt = to_date('30-APR-2008','DD-MON-YYYY')
    Output -
    CARR FLT_N FLT_LCL_O ORI SCHED_LEG_NBR DES ORIG_OCCUR_NBR DEST_OCCUR_NBR NOSE TAIL_N GMT_EST_ARR_DTM                                                             GMT_EST_DEP_DTM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
    UA   109   30-APR-08 ORD             1 ORD              0              1 5688        30-APR-2008 15:34:00                                                        30-APR-2008 14:59:00               Determination of 2nd condition is -
    SQL is -
    select o.CARR_IATA_CD,
           o.FLT_NBR,
           o.FLT_LCL_ORIG_DT,
           o.ORIG_ARPT_CD,
           o.SCHED_LEG_NBR,
           o.DEST_ARPT_CD,
           o.ORIG_OCCUR_NBR,
           o.DEST_OCCUR_NBR,
           o.NOSE_NBR,
           o.TAIL_NBR,
           to_char(o.GMT_EST_ARR_DTM,'DD-MON-YYYY hh24:mi:ss') GMT_EST_ARR_DTM
    from ops_flt_leg o
    where o.active_ind=1 
    and   o.nose_nbr  =5688
    and   o.dest_arpt_Cd = 'ORD'
    order by o.gmt_est_arr_dtm   N.B.: Check that the 2nd query is receiving values from 1st query in the following columns -
    NOSE_NBR - which will be nose_nbr from the first query.
    dest_arpt_Cd - Which will be orig_arpt_cd from the first query.
    Output -
    CARR FLT_N FLT_LCL_O ORI SCHED_LEG_NBR DES ORIG_OCCUR_NBR DEST_OCCUR_NBR NOSE TAIL_N GMT_EST_ARR_DTM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    UA   106   28-APR-08 LAX             1 ORD              0              0 5688        28-APR-2008 20:38:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   906   29-APR-08 SFO             1 ORD              0              0 5688        29-APR-2008 21:38:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   819   30-APR-08 EWR             1 ORD              0              0 5688        30-APR-2008 13:36:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   109   30-APR-08 ORD             1 ORD              0              1 5688        30-APR-2008 15:34:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   122   02-MAY-08 LAX             1 ORD              0              0 5688        03-MAY-2008 03:31:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   940   04-MAY-08 DEN             1 ORD              0              0 5688        04-MAY-2008 21:52:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   1130  06-MAY-08 YVR             1 ORD              0              0 5688        06-MAY-2008 21:16:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   566   07-MAY-08 SMF             1 ORD              0              0 5688        07-MAY-2008 21:15:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   110   08-MAY-08 LAX             1 ORD              0              0 5688        08-MAY-2008 21:07:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   566   10-MAY-08 SMF             1 ORD              0              0 5688        10-MAY-2008 21:28:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   110   11-MAY-08 LAX             1 ORD              0              0 5688        11-MAY-2008 21:07:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    UA   122   12-MAY-08 LAX             1 ORD              0              0 5688        13-MAY-2008 02:52:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    This should do it. Note that the only thing that is hard coded with this query is the where clause for query 1 (aliased as q1 and joined to q1 as an inline view) Just replace the hard coded values with appropriate binds and you should be good to go.
    --<"Begin Sample Data">
    with ops_flt_leg as (
      select 'UA' CARR_IATA_CD
           , '106' FLT_NBR
           , to_date('28-APR-08','dd-mon-yy') FLT_LCL_ORIG_DT
           , 'LAX' ORIG_ARPT_CD
           , 1 SCHED_LEG_NBR
           , 'ORD' DEST_ARPT_CD
           , 0 ORIG_OCCUR_NBR
           , 0 DEST_OCCUR_NBR
           , '5688' NOSE_NBR
           , cast(null as char(6)) TAIL_NBR
           , to_date('28-APR-2008 20:38:00','dd-mon-yyyy hh24:mi:ss') GMT_EST_ARR_DTM
           , to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss') GMT_EST_DEP_DTM
           , 1 ACTIVE_IND
        from dual
      union all select 'UA', '906', to_date('29-APR-08','dd-mon-yy'), 'SFO', 1, 'ORD', 0, 0, '5688', null, to_date('29-APR-2008 21:38:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '819', to_date('30-APR-08','dd-mon-yy'), 'EWR', 1, 'ORD', 0, 0, '5688', null, to_date('30-APR-2008 13:36:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '109', to_date('30-APR-08','dd-mon-yy'), 'ORD', 1, 'ORD', 0, 1, '5688', null, to_date('30-APR-2008 15:34:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '122', to_date('02-MAY-08','dd-mon-yy'), 'LAX', 1, 'ORD', 0, 0, '5688', null, to_date('03-MAY-2008 03:31:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '940', to_date('04-MAY-08','dd-mon-yy'), 'DEN', 1, 'ORD', 0, 0, '5688', null, to_date('04-MAY-2008 21:52:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '1130',to_date('06-MAY-08','dd-mon-yy'), 'YVR', 1, 'ORD', 0, 0, '5688', null, to_date('06-MAY-2008 21:16:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '566', to_date('07-MAY-08','dd-mon-yy'), 'SMF', 1, 'ORD', 0, 0, '5688', null, to_date('07-MAY-2008 21:15:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '110', to_date('08-MAY-08','dd-mon-yy'), 'LAX', 1, 'ORD', 0, 0, '5688', null, to_date('08-MAY-2008 21:07:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '566', to_date('10-MAY-08','dd-mon-yy'), 'SMF', 1, 'ORD', 0, 0, '5688', null, to_date('10-MAY-2008 21:28:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '110', to_date('11-MAY-08','dd-mon-yy'), 'LAX', 1, 'ORD', 0, 0, '5688', null, to_date('11-MAY-2008 21:07:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
      union all select 'UA', '122', to_date('12-MAY-08','dd-mon-yy'), 'LAX', 1, 'ORD', 0, 0, '5688', null, to_date('13-MAY-2008 02:52:00','dd-mon-yyyy hh24:mi:ss'), to_date('30-APR-2008 14:59:00','dd-mon-yyyy hh24:mi:ss'), 1 from dual
    --<"Cut Here">
    select CARR_IATA_CD,
           FLT_NBR,
           FLT_LCL_ORIG_DT,
           ORIG_ARPT_CD,
           SCHED_LEG_NBR,
           DEST_ARPT_CD,
           ORIG_OCCUR_NBR,
           DEST_OCCUR_NBR,
           NOSE_NBR,
           TAIL_NBR,
           to_char(GMT_EST_ARR_DTM,'DD-MON-YYYY hh24:mi:ss') GMT_EST_ARR_DTM
      from (select o.*,
                   row_number() over (order by o.gmt_est_arr_dtm desc) rn
              from ops_flt_leg o
              join (select *
                      from ops_flt_leg o
                     where o.flt_nbr = '109'  
                       and o.orig_arpt_cd = 'ORD'
                       and o.dest_arpt_cd = 'ORD'
                       and o.flt_lcl_orig_dt = to_date('30-APR-2008','DD-MON-YYYY')) q1
                on o.nose_nbr  = q1.nose_nbr
               and o.dest_arpt_Cd = q1.orig_arpt_cd
               and o.GMT_EST_ARR_DTM < q1.GMT_EST_DEP_DTM
             where o.active_ind=1)
    where rn = 1
    CARR_IATA_CD FLT_NBR FLT_LCL_ORIG_DT           ORIG_ARPT_CD SCHED_LEG_NBR          DEST_ARPT_CD ORIG_OCCUR_NBR         DEST_OCCUR_NBR         NOSE_NBR TAIL_NBR GMT_EST_ARR_DTM              
    UA           819     30-APR-2008 00:00         EWR          1                      ORD          0                      0                      5688              30-APR-2008 13:36:00         
    1 rows selected

  • Filtering on 0activity - how to achieve this in a query?

    Hi all,
    I have a requirement in my report which is: Give me, of all network numbers, only they keyfigures concering activity 0001.
    In the BEx querydesigner I have 0WBS_ELEMT, 0NETWORK and 0ACTIVITY as characteristics.
    The next step is that I want to filter on a certain activity code, say 0001.
    The only problem is that the key of 0ACTIVITY consists of both 0NETWORK and 0ACTIVITY and I can never select just 0001 as a filter.
    Is there a way to achieve filtering on query level? Or do I have to adapt my model in BW?
    Thanks,
    JW

    Thank you Alexander!
    Well, I found several sub optimal solutions in the query designer.
    One is creating a variable with an offset value to select only the activity code, and using this to create a keyfig z_activity to display just the activity code. Then, you can set a condition on this keyfig to show only certain activity codes.
    Advantage: datamodeling unchanged.
    Disadvantage: high maintenance solution
    The optimal solution seems to be on the BW-side: an option is to define an attribute only z-infoobject and add it to InfoObject 0ACTIVITY, filling via the routine of the InfoObject in the maintenance screen.
    The downside to Alexanders solution is that, by adding it to the InfoProvider, you make it transaction data while it is actually master data...
    Edited by: J. W. ter Avest on Jan 13, 2011 1:11 PM

  • How to achieve this result using sql query?

    hello gurus,
    i have a table like this
    id    name
    1       a
    2       b
    3       c
    4       d
    5       e
    6       f
    7       g
    8       h
    9       i
    10     j
    11     k
    12     l
    13     m now my result should be like this
    id    name  id   name   id   name
    1       a     6       f      11     k
    2       b     7       g     12     l
    3       c     8       h     13     m
    4       d     9       i
    5       e     10      jhow to achieve it by sql query ?
    thanks and regards,
    friend
    Edited by: most wanted!!!! on Feb 22, 2012 5:55 AM

    hi,
    Did you mean this:
    with a as
    (select 1 id ,'a' name from dual
    union all select 2 id ,'b' name from dual
    union all select 3 id ,'c' name from dual
    union all select 4 id ,'d' name from dual
    union all select 5 id ,'e' name from dual
    union all select 6 id ,'f' name from dual
    union all select 7 id ,'g' name from dual
    union all select 8 id ,'h' name from dual
    union all select 9 id ,'i' name from dual
    union all select 10 id ,'j' name from dual
    union all select 11 id ,'k' name from dual
    union all select 12 id ,'l' name from dual
    union all select 13 id ,'m' name from dual
    select
      id_1
      ,name_1
      ,id_2
      ,name_2
      ,id_3
      ,name_3
    from
      select
        id id_1
        ,name name_1
        ,lead(id,5) over (order by id) id_2
        ,lead(name,5) over (order by id) name_2
        ,lead(id,10) over (order by id)  id_3
        ,lead(name,10) over (order by id) name_3
        ,rownum r
      from
        a
    where
      r <=5
    D_1                   NAME_1 ID_2                   NAME_2 ID_3                   NAME_3
    1                      a      6                      f      11                     k     
    2                      b      7                      g      12                     l     
    3                      c      8                      h      13                     m     
    4                      d      9                      i                                   
    5                      e      10                     j Regards,
    Peter

  • How to achieve this photographic slide display/navigation

    Hi,
    I would like to know how to achieve the following:
    1. Go to
    http://www.corneliaadams.com/
    & then click on 'michael mundy' link. this opens up a page with
    a slideshow of photographs that i really love. I have very basic
    knowledge of scripting ,a nd i usually achieve my goals by
    modifying flas that i have seen or by following tutorials (as
    opposed to writing it myself). the great thng about the above
    version is taht the images slide to an exact position when you
    click on the forward or back arrows, and they slow down ever so
    slightly just before stopping. Can anyone point me in the right
    directoin with how to achieve this, or offer a tutorial. I am
    really starting from scratch, and would lik eto end up with the
    same clean and professional outcome.
    2. regarding the same above link, when you are at the main
    site, and then you click the michael mundy' link, what is it that
    happens, is it a new html popup page that opens of specified
    dimensions and the embedded swf is set to stretch to maximum
    width/height? or is it a lone swf that pops up (with no html page)?
    or is that impossible?
    Many Many Many thanks in advance,
    Cheska

    I hope there might be some simple way to do this and waiting for experts to reply.
    Try the below query.
    SQL> select * from random_numeral;
      NUMERALS
             1
             2
             3
             4
             5
             6
            56
            85
            24
            11
           120
      NUMERALS
           114
           100
           140
    14 rows selected.
    SQL> select a.numerals ||' / '||b.numerals||' / '||c.numerals from
      2          (select numerals,rownum rn1 from
      3          (
      4              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
      5              from random_numeral
      6          )
      7          where rn=1) a,
      8          (select numerals,rownum rn1 from
      9          (
    10              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    11              from random_numeral
    12          )
    13          where rn=2) b,
    14          (select numerals,rownum rn1 from
    15          (
    16              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    17              from random_numeral
    18          )
    19          where rn=0) c
    20  where   a.rn1=b.rn1(+)
    21  and b.rn1=c.rn1(+)
    22  /
    A.NUMERALS||'/'||B.NUMERALS||'/'||C.NUMERALS
    1 / 2 / 3
    4 / 5 / 6
    11 / 24 / 56
    85 / 100 / 114
    120 / 140 /
    SQL>Cheers,
    Mohana

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How to Perform this calculaction in Query

    Hi Experts
    How can i achieve this Calculaction at query Level.
    Data:
    Emp_ID--Wage_IDPayroll_Date--Amount
    1--03925.01.2008-5000
    1--03925.02.2008-5000
    1--03925.03.2008-5000
    1--03925.04.2008-6000
    1--03925.07.2008-6000
    The employee will have No of different Wage types in his pay run.
    But as per my requirment i want to calculacte Employee Salarly.
    Lets Consider Wage Type 039 which is Salarly
    The Cal i need to perform is
    Select the Wage Type 039 and then Select the Latest (25.07.2008) Payroll date and then select the amount assiociated with it for and the 12* amount give salarly
    In the above case aslarly should be 72,000

    Hi,
    Soluition can be the following:
    Put Pay_Roll_date also as a key-figure in your cube and add to columns.
    Add condition (top 1) on keyfigure,
    In Character Assignment tick ïndividual char. and Char combinations.
    Tick also Emp_id and Wage ID. do not tick Pay_Roll_date (the characteristics, not the keyfigure)
    Hide key-figure Pay_roll_date & Amount
    Make calculated keyfigure Salary = 12 * Amount.
    That should do it.
    Udo

  • How to put this condition in Query

    Dear experts,
    I have a scenario where in the calculation should be dynamic between key figures in query
    For example i have a
    Target Cost and Actualcost1, Actualcost2, Actualcost3
    i need to findout the variance between the Target and Actual
    but the catch is that i need to findout the variance with the latest actual cost
    1. )  Target cost = 100
    Actual cost1=10, Acutal cost2=0, actual cost3=0
    then the formula should be Actual cost1-target cost
    2. )But if
    Target cost  =100
    Actual cost1=10, Actual cost2=5, Actual cost3=0
    then the formula should be Actual cost2- Target cost
    3. Target cost =100
    Actual cost1=10, Actual cost2 = 5, Actual cost3= 15
    then the formula should be Actual Cost3-Target cost
    How to achieve this
    Thanks and regards
    Neel

    Hi Neel,
    Do you have indicator saying that a particular actual cost is the latest? If you have any indicator thsi would make the job easy. Else you need to create new formulas to derive the logic.
    Else you can proceed with the belwo logic.
    1.target cost
    2. Actual Costs 1 - Hide
    3. Actual Costs 2 - Hide
    4. Actual Costs 3 - Hide
    5. New formula whcih evaluates the latest.
    Write the condition
    If Actual costs3 = 0 and actual cost2 = 0 then actual cost1.
    else if actual cost2= 0 then actual cost1
    else if actual cost1 NE 0 and actual cost2 NE 0 then Actual cost3.
    Then hide the above new formula.
    And in a new formula you can find the diff between the Target cost and the latest cost derived in teh above new formula.
    If the conditions is too big in the above new formula, you can split across two three new formulas and derive the logic.
    Just make some changes to the above logic if it is not 100%.
    I believe this logic will work.

  • Re: How to converting from PL/SQL query to T-SQL query

    How to converting from PL/SQL query to T-SQL query... Its Urgent

    Download the
    SQL Server Migration Assistant for Oracle.  It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
    With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
    But you can try
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to achieve this?

    Hi Friends,
    I'm facing one strange problem. Not able to figure it out how to get it. Basically, not able to identify a particular window to let oracle understand how to behave.
    Let's find the problem ->
    Oracle Version ->
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> And, input data ->
    with tt
    as
          select 'SAP_ALL' sap_type,'' sap_det_type,1 s_no from dual union all
          select '','Dialog',2 from dual union all
          select '','Service',3 from dual union all
          select '','System',4 from dual union all
          select '','Communication',5 from dual union all
          select '','Reference',6 from dual union all
          select 'SAP_NEW','',7 from dual union all
          select '','Dialog',8 from dual union all
          select '','Service',9 from dual union all
          select '','System',10 from dual union all
          select '','Communication',11 from dual union all
          select '','Reference',12 from dual union all
          select 'SAP_FIR_EMER','',13 from dual union all
          select 'SAP_ALL','',14 from dual union all
          select '','Dialog',15 from dual union all
          select '','Service',16 from dual union all
          select '','System',17 from dual union all
          select '','Communication',18 from dual union all
          select '','Reference',19 from dual union all
          select 'SAP_NEW','',20 from dual union all
          select '','Dialog',21 from dual union all
          select '','Service',22 from dual union all
          select '','System',23 from dual union all
          select '','Communication',24 from dual union all
          select '','Reference',25 from dual union all
          select 'SAP_FIR_EMER','',26 from dual
    select *
    from tt;And, the input data look like ->
    SAP_TYPE     SAP_DET_TYPE        S_NO
    SAP_ALL                             1
                 Dialog                 2
                 Service                3
                 System                 4
                 Communication          5
                 Reference              6
    SAP_NEW                             7
                 Dialog                 8
                 Service                9
                 System                10
                 Communication         11
                 Reference             12
    SAP_FIR_EMER                       13
    SAP_ALL                            14
                 Dialog                15
                 Service               16
                 System                17
                 Communication         18
                 Reference             19
    SAP_NEW                            20
                 Dialog                21
                 Service               22
                 System                23
                 Communication         24
                 Reference             25
    SAP_FIR_EMER                       26And, expected output ->
    SAP_TYPE     SAP_DET_TYPE        S_NO
    SAP_ALL                             1
    SAP_ALL      Dialog                 2
    SAP_ALL      Service                3
    SAP_ALL      System                 4
    SAP_ALL      Communication          5
    SAP_ALL      Reference              6
    SAP_NEW                             7
    SAP_NEW      Dialog                 8
    SAP_NEW      Service                9
    SAP_NEW      System                10
    SAP_NEW      Communication         11
    SAP_NEW      Reference             12
    SAP_FIR_EMER                       13
    SAP_ALL                            14
    SAP_ALL      Dialog                15
    SAP_ALL      Service               16
    SAP_ALL      System                17
    SAP_ALL      Communication         18
    SAP_ALL      Reference             19
    SAP_NEW                            20
    SAP_NEW      Dialog                21
    SAP_NEW      Service               22
    SAP_NEW      System                23
    SAP_NEW      Communication         24
    SAP_NEW      Reference             25
    SAP_FIR_EMER                       26How to achieve this in SQL?
    Thanks in advance for your time.

    Try
    select nvl(sap_type, last_value(sap_type) ignore nulls over (order by s_no)) sap_type
    ,      sap_det_type
    ,      s_no
    from tt
    order by s_no
    ;It should work without the nvl function as well...
    select last_value(sap_type) ignore nulls over (order by s_no) sap_type
    ,      sap_det_type
    ,      s_no
    from tt
    order by s_no
    ;Edited by: BobLilly on Jun 20, 2012 3:11 PM

  • How to achieve this OIC Calculation?

    Scenario likes this:
    Two dimensions:
    Dimension#1 Year Target Fulfillment Percentage
    Dimension#2 Discount (Selling Price/ List Price) for each transaction
    Ratetable is based on the two dimensions.
    So the formula is like this:
    Individually, no accumulative
    Input1: Year Target Fulfillment Percentage ( How to achieve this?)
    Input2: Discount (Easy to do)
    Is there anyone has any thought about it? The headache is when calculating the rate for each transactions (different discount), you need to know the whole year Target Fulfillment Percentage.
    帖子经 967311编辑过

    Hi,
    Sorry, I think I understand you now. You cannot do what you want because you cannot use Discoverer percentages to create a percentage based on a grand total from a different column. You can only create the percentages for Category A column based on the grand total for category A.
    To create the percentages that you want you can put the category A and Category B figures on a different row so that you only have one total column and use subtotals to calculate the totals for the categories. You can then create a Discoverer percentage for the total column to give you your category A and B percentages. You may need a row generator to create extra rows for the categories.
    The alternative is to use an analytic function in a calculation to calculate the grand total in the main query. For example:
    gtotal = SUM(Total) OVER ()
    Once you have the grand total you can then create percentage calculations, using:
    Cat A perc = Category A * 100/ gtotal
    Rod West

  • How to Achieve this Data Load into Cube

    Hi Experts,
    Could you please update me on how to achieve this
    I got a History data (25-35 Million Records) for about 8 years to be loaded to BW.
    What is the best approach to be followed
    1) Load everything into one cube and create aggregates or
    2) Create 4 different cubes (with same data model) and load load 2 years of data into each cune (2Years * 4 Cubes = 8 Years Data) and develop a multicube on top of 4 cubes
    If so how can i load data into respective cubes
    Ex: Lets assure i got data from 31.12.2007 to 01.01.2000 which is 8 years of data
    Now i created 4 Cubes--C1,C2,C3,C4 & C5
    How can i specifically
    load data from 01.01.2000 to 31.12.2001 (2 Years) to C1
    load data from 01.01.2002 to 31.12.2003 (2 Years) to C2
    load data from 01.01.2004 to 31.12.2005 (2 Years) to C3
    load data from 01.01.2006 to 31.12.2007 (2 Years) to C4
    load data from 01.01.2008 to 31.12.2010 (2 Years) to C5 (Currently Loading)
    Please advise the best approach to be followed and why
    Thanks

    If you already have the cube C5 being loaded and the reports are based on this cube, then if you donot want to create additional reports, you can go ahead and load the history data into this cube C5.
    What is your sourcesystem and datasource?. Are there selection conditions (in your infopackage) available to specify the selections? If so, you can go ahead and do full loads to the current cube.
    For query performance, you can create aggregates on this cube based on the fiscal period / month / year ( whichever infoobject is used in the reports)
    If your reports are not based on timeperiod, then multicube query will work as parrallelized sub queries and so there will be 4 dialog processes occupied on your BW system everytime the query is hit.
    Also any changes that you want to make in cube will have to be copied to all cubes, so maintenance may be a question.
    If there are enough justification, then approach 2 can be taken up

  • How to achieve this tree table (displaying/modifying non leaf level details) ?? Image inside

    Region
    location
    Dept
    Budget Available
    Allot Budget
    Unused Budget
    Decision for unused budget
    US
    200$
    User Input
    NY
    100$
    User Input
    CA
    100$
    User Input
    HR
    50$
    User Input
    IT
    50$
    User Input
    ---------30$--------
    20$
    LOV
    Add to Location
    Use for Future Project
    Add to Region
    Spend as Bonus
    How to achieve this tree table ?
    My client wants that they should also be able to manage budge at Location or region level not only at the leaf(Dept) level.
    I did a lot of research and finally found out that the details can only printed at the leaf(Dept) level.......
    We can not hard code Region, locations and departments in table rows. When table tree is displayed we will only show all the regions... (US, UK, SA, IND, AUS, CAN,RUS, JPN.... etc..)
    For Example:
    Locations for US (NY, CA, OKH, WC...... etc.)
    Locaitons for UK (SC, ENG, WL..... etc)  and so on......
    Departments for CA (HR, IT, ADMIN, FIN, TRVL, OPRN........ etc. ..)
    Thanks in advance... It will be really great help if I get some breakthrough...
    -Rahul

    Hi,
    what if you add a transient attribute to those view objects? This way you don't need to change the table structure.
    Frank

Maybe you are looking for