Query doubt again

Hello Friends,
SET SERVEROUTPUT ON;
DECLARE
vMemName VARCHAR2(100) DEFAULT '';
vName VARCHAR2(100) DEFAULT '';
BEGIN
FOR I IN (SELECT EMAIL FROM MYTABLE WHERE ID <10)LOOP
IF vMemName IS NULL THEN
vMemName := I.MEM_EMAIL;
ELSE
vName := CONCAT(CONCAT(vName,','),vMemName);
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('The Name :'||vName);
END;
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 9
y?..What's the wrong here ?

Hmm, I think it would be better to limit it:
SELECT SUM(length(EMAIL )) + count(EMAIL ) - 100 FROM MYTABLE where id < 10
(this is trying to find the amount you'll need to extend your variable by)

Similar Messages

  • ABAP Query Doubt

    Hi All,
           I am using the ABAP query using the infoset Logical database PNPCE.
    When i select the fields for the output i am getting it. But i need to make some of the fields as mandatory in the selection screen.
    How can i make it.
    Regards,
    Yogesh

    Hello,
    Go to the info set of the query.
    SQ02 -> Enter the infoset name  -> click on 'Change'
    Go to the 'Selections' tab.
    There you will find all the selction screen parameters. Double click on the selection parameter which you want to make it a mandatory field.
    It will pop-up a dialog screen. On  this dialog screen on the input field 'Extras'
    enter the key word OBLIGATORY. Than don't forget to regenarate the infosets again.
    This will solve your problem.
    Regards,
    A.Singh

  • Query problem again

    Will I ever get this!
    I have a form template which runs fine (it registers a user
    of my discussino board):
    <h2>Register here to post comments to any forum on this
    site </h2>
    <form action="Education - Bulletin Board - Register -
    code.cfm" method="post">
    <p>
    <strong>Username: </strong>
    <input type="text" name="user" />
    </p>
    <p><br />
    <strong>Password: </strong>
    <input type="password" name="pass" />
    </p>
    <p><br />
    <strong>Your mother's maiden name (a security
    precaution if you forget your username/password and need to
    retrieve them): </strong>
    <input type="text" name="MaidenName" />
    </p>
    <p><br />
    <strong>Email address (optional - in case I need to
    contact you about your posts): </strong>
    <input type="text" name="email" />
    </p>
    <p><br />
    <p>
    <input type="submit" value="Register!" />
    <input type="button" value="Back"
    onClick="self.location='index.cfm';" />
    </p>
    </form>
    </body>
    Now I want to check if the username and password have been
    taken by a previous user so I use this code:
    <cfif NOT structIsEmpty(form)>
    <cfquery name="CheckUserName" datasource= "Education
    Forum">
    SELECT UserName, Count(UserName) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.UserName=#form.user#
    GROUPBY ForumUsers.UserName
    </cfquery>
    <cfquery name="CheckPassword" datasource= "Education
    Forum">
    SELECT PassWord, Count(PassWord) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Password=#form.PassWord#
    GROUPBY Password
    </cfquery>
    I just count how many times the password has been used. If it
    has been used more than once I'll later ask the new user to enter a
    different password. Unfortunately, Coldfusion has a problem with
    this query. Specifically, it gives me the error:
    Access Driver] Syntax error (missing operator) in query
    expression 'ForumUsers.UserName=jimmy GROUPBY ForumUsers.UserName'.
    The Error Occurred in C:\CFusionMX\wwwroot\Education\Bulletin
    Board\Education - Bulletin Board - Register - code.cfm: line 7
    5 : WHERE ForumUsers.UserName=#form.user#
    6 : GROUPBY ForumUsers.UserName
    7 : </cfquery>
    8 : <cfquery name="CheckPassword" datasource= "Education
    Forum">
    9 : SELECT PassWord, Count(PassWord) as Duplicates
    SQL SELECT UserName, Count(UserName) as Duplicates FROM
    ForumUsers WHERE ForumUsers.UserName=jimmy GROUPBY
    ForumUsers.UserName
    DATASOURCE Education Forum
    VENDORERRORCODE -3100
    SQLSTATE 42000
    I've run into this before, but I don't seem to be able to
    grasp the general principle involved.
    I'd be very grateful if someone could explain the error in
    this particular case and how I can avoid the problem in the futre.
    Thanks, once again, very much in advance.

    Thanks for the suggestions. I've changed the code to
    incorporate the advice as far as I can. It now reads:
    <cfif NOT structIsEmpty(form)>
    <cfparam name = "form.user" default = 0>
    <cfparam name = "form.password" default = 0>
    <cfparam name = "form.Email" default = 0>
    <cfparam name = "form.MaidenName" default = 0>
    <cfquery name="CheckUserName" datasource= "Education
    Forum">
    SELECT Uname, Count(Uname) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Uname='#form.user#'
    GROUPBY ForumUsers.Uname
    </cfquery>
    <cfquery name="CheckPassword" datasource= "Education
    Forum">
    SELECT Pword, Count(Pword) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Pword="AK"
    GROUPBY Pword
    </cfquery>
    Unfortunately, it still fails giving me the same error:
    Access Driver] Syntax error (missing operator) in query
    expression 'ForumUsers.Uname='adk' GROUPBY ForumUsers.Uname'.
    The Error Occurred in C:\CFusionMX\wwwroot\Education\Bulletin
    Board\Education - Bulletin Board - Register - code.cfm: line 11
    9 : WHERE ForumUsers.Uname='#form.user#'
    10 : GROUPBY ForumUsers.Uname
    11 : </cfquery>
    12 : <cfquery name="CheckPassword" datasource= "Education
    Forum">
    13 : SELECT Pword, Count(Pword) as Duplicates
    SQL SELECT Uname, Count(Uname) as Duplicates FROM ForumUsers
    WHERE ForumUsers.Uname='adk' GROUPBY ForumUsers.Uname
    DATASOURCE Education Forum
    VENDORERRORCODE -3100
    SQLSTATE 42000
    I think its just a SQL error as I get the same failure
    message if I replace '#form.user#' with say 'GAK'.
    Any further suggestions would be greatly appreciated.
    P.S. I'm still a novice, so how would I use
    <cfqueryparam> tags here?

  • Reports Query Doubt??

    hi all,
    Thanks to ALL the replies to my query.
    I have a doubt in Oracle reports.
    This is the query in the format trigger.
    ctr,cnt - are summary columns in the group above which counts the detail group
    I have to retrieve the records for status codes equal to active and cancelled.
    and suppress the records with no records for either of these status codes
    if :ctr <> 0 and :cnt <> 0 and :status_code in ('act,'can') then
    return(true);
    else
    return(false);
    end if;
    Now the records with status code 'can'
    are not been retrieved.
    Could you please suggest as to how I could
    rectify where Iam going wrong.
    TIA
    sg
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ():
    Why don't you use a decode in your query?<HR></BLOCKQUOTE>
    if :ctr <> 0 and :cnt <> 0 and
    (:status_code = 'act' or
    :status_code = 'can') then
    return(true);
    else
    return(false);
    end if;
    null

  • Simple abap query doubt

    Hello all,
       i have one simple doubt plz help.
    data:begin of itab1 occurs 0,
         psnfh like plfh-psnfh,
         end of itab1.
    select  psnfh  into table itab1
    from plfh
                     where plnty = 'N'
                     AND plnNR = group_number
                     AND plnfl  = W_PRT_ASSIGN-SEQUENCE_NO
                     and loekz ne 'X'
                    and plnkn = t_plnkn.
    this query is working fine.
            now i have 3 psnfh entires(0010 0020 0030) ..my requirement is that i have choose maximum of these that is 0030 and wanna add 0010 to it everytime.....and may be it will be better if i can save it in a variable.......
         plz help in this syntax......i know we can use MAX function but it will be better if u can give that exact 2-3 lines of code.

    Hi Abhijeet,
    Do you always want to add "0010" to the maximum value from that internal table?
    If yes, then you can follow the steps mentioned below.
    1. Declare temporary internal table and transfer al values from your main internal table to the temporary.
    ITAB_TEMP[] = ITAB[].
    2. Now Sort the temp table as follows.
    SORT ITAB_TEMP BY fieldname DESCENDING.
    3. Now if you READ this temp table with INDEX 1, you wil get the maximum value to which you can add the value.
    READ TABLE ITAB_TEMP INTO W_ITAB INDEX 1.
    IF SY-SUBRC EQ 0.
      V_MAX = W_ITAB-field + 0010.
    ENDIF.
    Best Regards,
    Ram.

  • Select query doubt

    hello all,
    i am writting this code .....first select is working fine for me as i am getting 5 entires in  table itab which i am expecting...
    but for second when i loop itab itab then at that time i should get one record  in table itab2 out of second select query........
    but as i can see while debugging  i am getting that entry at third time when i am in loop.....but it again i think it overwrites with next enter and making itab2 entry as 0 at the end.....
    what might be problem.
    even i write append itab2.
                        clear itab2.
    same error i am getting...(here CDPOS is cluster table..is this because of this??)..pease help
    selection-screen:begin of block test with frame title new.
    select-options: s_ddate for vbak-vdatu.
    selection-screen:end of block test.
    select avbeln avdatu bnetpr bnetwr b~matnr into corresponding fields of table itab
        from vbak as a inner join vbap as b on avbeln = bvbeln where
           b~matnr = 'AUP-501'
        and a~vdatu in s_ddate.
    LOOP AT ITAB.
    select *  from CDPOS into table itab2 where
      OBJECTID = ITAB-VBELN AND
      TABNAME = 'VBAP' AND
      FNAME = 'NETPR'.
    ENDLOOP.

    Hi,
    You are completely into wrong performance..
    as per your query
    selection-screen:begin of block test with frame title new.
    select-options: s_ddate for vbak-vdatu.
    selection-screen:end of block test.
    select avbeln avdatu bnetpr bnetwr b~matnr into corresponding fields of table itab
    from vbak as a inner join vbap as b on avbeln = bvbeln where
    b~matnr = 'AUP-501'
    and a~vdatu in s_ddate.
    LOOP AT ITAB.
    select * from CDPOS into table itab2 where
    OBJECTID = ITAB-VBELN AND
    TABNAME = 'VBAP' AND
    FNAME = 'NETPR'.
    ENDLOOP.
    The second query is inside loop and its moving data into itab2 for every record in internnale table ITAB and
    finally itab2 contains the last records of ITAB data if CDPOs has the data for itab-vbeln(last records).
    To over come you need to write the select as beloew
    select * from CDPOS APPENDING table itab2 where
    OBJECTID = ITAB-VBELN AND
    TABNAME = 'VBAP' AND
    FNAME = 'NETPR'.
    But I suggest you to write for all entries
    select <the filed you need> from CDPOS
    into table itab2
    for all entries in itab
    where OBJECTID = ITAB-VBELN AND
    TABNAME = 'VBAP' AND FNAME = 'NETPR'.
    Then
    loop at ITAB.
    Read table itab2 with key vbeln = itab-vbeln binary search.
    If sy-subrc = 0.
    <Write your code, functions etc>.
    endif.
    endloop.
    regards,
    Nazeer

  • Formula in Query: New--Again

    Hello,
    Please refer to link:
    Formula in query
    please guide me as to how to handle the input date & the date difference?
    thanks,
    (posting it again as i am not able to assign points from the old post!!)

    Hi,
    Define a variable with ready for input option so that it during the runtime variable will ask for the inputs.
    hope this will be helpful.
    Vijay

  • Dynamic Query Doubt

    Hi,
    I need to write a Dynamic Query to get the data from the table by using the Input date parameters.
    LIke,
    SELECT* from table where date_start between to_date('12-14-2004','mm-dd-yyyy') AND
    to_date('12-15-2005','mm-dd-yyyy');
    How can i write the above query in dynamic sql as i will get the two dates as input in my procedure
    Help me in this

    Or more preferably use bind variables with the
    EXECUTE IMMEDIATE as, if the query will be called
    many times, the bind variables will prevent hard
    parsing of the statement each time (i.e. it will be
    quicker to execute).blushadow,
    Yes, the execute immediate using bind variables is better/faster than not using bind variables, but your first example outperforms your second one. This is due to the fact that execute immediate really closes all cursors, and in your first example the cursors are kept open (yes, even though you issue a CLOSE cur_test) in the PL/SQL cursor cache.
    SQL> create table i_links
      2  as
      3  select sysdate - l linkdate from (select level l from dual connect by level <= 10000)
      4  /
    Tabel is aangemaakt.
    SQL> exec dbms_stats.gather_table_stats(user,'I_LINKS')
    PL/SQL-procedure is geslaagd.
    SQL> create or replace procedure test1 (start_date in date, end_date in date) as
      2    CURSOR cur_test IS
      3      SELECT count(*)
      4      FROM   i_links
      5      WHERE  linkdate BETWEEN start_date AND end_date;
      6    v_count NUMBER;
      7  begin
      8    OPEN cur_test;
      9    FETCH cur_test INTO v_count;
    10    CLOSE cur_test;
    11    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> create or replace procedure test2 (start_date in date, end_date in date) as
      2    v_count NUMBER;
      3  begin
      4    EXECUTE IMMEDIATE 'SELECT count(*) FROM i_links WHERE linkdate BETWEEN :x1 AND :x2' INTO v_count USING start_date, end_date;
      5    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
      6  end;
      7  /
    Procedure is aangemaakt.
    SQL> begin
      2    -- warm up
      3    test1(sysdate-365,sysdate);
      4    test2(sysdate-365,sysdate);
      5    -- begin test
      6    runstats_pkg.rs_start;
      7    for i in 1..1000
      8    loop
      9      test1(sysdate-365,sysdate);
    10    end loop;
    11    runstats_pkg.rs_middle;
    12    for i in 1..1000
    13    loop
    14      test2(sysdate-365,sysdate);
    15    end loop;
    16    runstats_pkg.rs_stop(100);
    17  end;
    18  /
    Run1 draaide in 341 hsecs
    Run2 draaide in 348 hsecs
    Run1 draaide in 97,99% van de tijd
    Naam                                                    Run1      Run2  Verschil
    STAT.session cursor cache hits                             0       998       998
    STAT.opened cursors cumulative                             0     1,000     1,000
    STAT.parse count (total)                                   0     1,000     1,000
    LATCH.shared pool                                      1,047     3,043     1,996
    STAT.recursive calls                                   3,001     1,001    -2,000
    LATCH.library cache pin allocation                         8     2,011     2,003
    LATCH.library cache pin 2,048 6,044 3,996
    LATCH.library cache 2,056 6,060 4,004
    Run1 latches totaal versus run2 -- verschil en percentage
          Run1      Run2  Verschil     Pct
        48,522    60,548    12,026  80.14%
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • SQL Query doubt

    Hi,
    I have a Customer info table Table1
    it has the following fields apart from many other fields like cust account info.
    Account_number
    Tax_id
    Tax_ID_format (this field has values S, T and the column is NUllable.
    I need to find all the tax ids that have both format codes S and T. This is not common as every tax_id is either S or T. But there can be an instance when both of them can be same that is the SSN and TIN number being same as both do not originate from the same system.
    The query i used is:
    SELECT A.ACCT_NUM, A.TAX_ID, A.TX_FMT_CD
    FROM
    ACCOUNT A
    WHERE A.TAX_ID IN
    SELECT B.TAX_ID FROM
    ACCOUNT B
    WHERE B.TAX_FMT_CD = 'S'
    AND A.TX_FMT_CD = 'T'
    ORDER BY A.TAX_ID
    The results are all messed up. Any help can be appreciated. Thank you.

    Hi,
    Jut another way.
    Assuming you dont have Y,X and Z as your tax_is_format.
    WITH DATA AS(
    SELECT 1 acct_no,'A' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 2 acct_no,'B' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 3 acct_no,'C' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 4 acct_no,'D' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 5 acct_no,'E' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'A' tax_id,'T'  tax_id_format FROM dual UNION ALL
    SELECT 2 acct_no,'B' tax_id,'T'  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'A' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'C' tax_id,'S'  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'C' tax_id,'T'  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'C' tax_id,NULL  tax_id_format FROM dual UNION ALL
    SELECT 1 acct_no,'C' tax_id,NULL  tax_id_format FROM dual
    SELECT DISTINCT tax_id FROM(
    SELECT acct_no,tax_id,tax_id_format,
    COUNT(DISTINCT nvl(decode(tax_id_format,'S','Y','T','X','Z'),'Z')) over (PARTITION BY tax_id) cnt
    FROM DATA
    WHERE tax_id_format IS NOT NULL
    WHERE cnt=2
    Cheers!!!
    Bhushan

  • Hi sap query doubt

    where shud we add two additional fields in SAP query ? actually i am not able to locate the query but i have the program whch is generated along it . so in whch section of the query i shud write the logic to get two additional fields ?

    Hi,
    Already there are some Infosets (tables) defined in that query.
    Go to that infosets and add extra fields which are there in those tables
    or add extra infoset(table) and link it to the existing table with the key, then add that table field.
    No need to write the code.
    Only thing is to select that field on to the Selection screen or on to the output is required.
    See the help:
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b413afab52b9e10000009b38f974/content.htm
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Step-by-step guide for creating ABAP query
    http://www.sappoint.com/abap/ab4query.pdf
    ABAP query is mostly used by functional consultants.
    SAP Query
    Purpose
    The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
    All the data required by users for their lists can be selected from any SAP table created by the customer.
    To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
    ABAP Query, as far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
    To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
    use either SQ02 ans SQ01
    or SQVI tr code
    for more information please go thru this url:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
    http://goldenink.com/abap/sap_query.html
    Please check this PDF document (starting page 352) perhaps it will help u.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    check the below link will be helpful for u
    Tutorial on SQVI
    once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
    reward if useful
    regards,
    Anji

  • SAP Query Doubt

    Hi, Guys!
        I'm trying to create a SAP Query, which should display the old and the new position of employee.
        The problem is that the SAP Query generates 2 lines for each position, the employee had.
       We need a report that display in two or tree a column for each position the employee had. And we have one line for each employee.
        Can we do this in SAP Query? Or will we need a development for this report?
    Regards,

    If it is just an addition of previous/old position, I would recommend creating a new field and field group within the infoset of SAP query framework. You may also have to write a small piece of code within the infoset to populate the field value.
    If your business scenario is getting complex it is better to have a simple ABAP report rather than enhancing the SAP query.
    Thanks
    Ravikumar

  • Experts doubt again

    HI
    What are the steps to create a dynamic ALV ? can some one help me out.

    Its very simple if you understand .
    make these declarations
    DATA:     L_STRUCTURE   TYPE REF TO DATA,
              L_TABLE    TYPE REF TO DATA,
              STRUC_DESC   TYPE REF TO CL_ABAP_STRUCTDESCR,
              LS_LVC_FIELDCATALOGUE  TYPE LVC_S_FCAT,
              LT_LVC_FIELDCATALOGUE  TYPE LVC_T_FCAT.
    FIELD-SYMBOLS :
      <IT_TABLE>    TYPE STANDARD TABLE,
      <DYN_STR>         TYPE ANY,
      <STR_COMP> TYPE ABAP_COMPDESCR.
    Then we create the structure dynamically,
    Syntax:
    Dynamic creation of a structure
      CREATE DATA L_STRUCTURE TYPE (P_TABLE).
      ASSIGN L_STRUCTURE->* TO <DYN_STR>.* Fields Structure
      STRUC_DESC ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <DYN_STR> ).
    We build the fieldcatalog by looping the structure :
    LOOP AT STRUC_DESC->COMPONENTS ASSIGNING <STR_COMP>.
      Build Fieldcatalog
        LS_LVC_FIELDCATALOGUE-FIELDNAME = <STR_COMP>-NAME.
        LS_LVC_FIELDCATALOGUE-REF_TABLE = P_TABLE.
        APPEND LS_LVC_FIELDCATALOGUE TO LT_LVC_FIELDCATALOGUE.
      Build Fieldcatalog
        LS_FIELDCATALOGUE-FIELDNAME = <STR_COMP>-NAME.
        LS_FIELDCATALOGUE-REF_TABNAME = P_TABLE.
        APPEND LS_FIELDCATALOGUE TO LT_FIELDCATALOGUE.
      ENDLOOP.
    Then we create the dynamic internal table:
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_FIELDCATALOGUE
        IMPORTING
          EP_TABLE        = L_TABLE.  ASSIGN L_TABLE->* TO <IT_TABLE>.
    Then its a dynamic select if required we can Use. rest is the same process.
    i will give you a link again
    http://www.****************/Tutorials/ALV/DynamicALV/Demo.htm

  • Update query doubt

    I have table with two columns as given below ....
    Name sex
    ab m
    ac m
    ad m
    ae m
    ba f
    bb f
    bc f
    bd f
    I have to change all 'm' to 'f' and all 'f' to 'm'..... I have tried this using rowid and collection and I was able to do this. Is there other way to do this with simple SQL query????? Please somebody help....
    thanks in advance
    Prabu.....

    update your_table
    set    s_e_x = (case s_e_x
                         when 'm' then 'f'
                         when 'f' then 'm'
                    end
    where s_e_x in ('m','f');

  • Query help again

    Hi all,
    I have a table as given below:
    NO NAME SAL
    1 x 200
    1 a 100
    2 y 400
    2 b 300
    I want to query in such a way that the result should be as follows:
    NO NAME SAL
    1
    x 200
    a 100
    2
    y 400
    b 300
    How to write this...thanks iin advance...

    Hi,
    880186 wrote:
    no name sal1
    x 200
    a 100
    2   y 400 b 300
    Does this looks good now?
    No. Does it look good to you?
    Use one \ tag before the first line of each formatted section, and another at the end of the section.  You don't need separate tags on every line.
    This query, using the scott.emp table, shows one way to do what you want:SELECT     CASE
              WHEN GROUPING (ename) = 1
              THEN job
         END     AS job
    ,     ename
    ,     sal
    FROM     scott.emp
    GROUP BY GROUPING SETS ( (job, ename, sal)
                   , (job)
    ORDER BY emp.job
    ,      ename          NULLS FIRST
    ,     sal
    This assumes that the combination (job, ename, sal) is unique.
    Output:JOB ENAME SAL
    ANALYST
    FORD 3000
    SCOTT 3000
    CLERK
    ADAMS 1100
    JAMES 950
    MILLER 1300
    SMITH 800
    MANAGER
    BLAKE 2850
    CLARK 2450
    JONES 2975
    PRESIDENT
    KING 5000
    SALESMAN
    ALLEN 1600
    MARTIN 1250
    TURNER 1500
    WARD 1250

  • A query doubt.

    Hello All,
    I have a query to be defined.  I have an existing variable for year/month. Query that should be defined is..
    User should enter two period intervals ( eg: jan till march & may till july) For these two periods i should produce a comparison of price for these period(key figure comparison). Can anybody gimme an idea to create the query.
    Thanks
    Krishna

    Hi Krishna,
    Without these variables you can only restrict your KFs in the query designer by fixed values (months) and change these restriction every time the user needs another report.
    So, either get authorization or try to find variables already created that suit your needs or ask authorized persons to cretae variables.
    During query desing you'll do the following:
    - create a structure in rows.
    - create a new selection and put there your KF and 0calmonth. Restrict the latter by a user entry 1st month range.
    - Do the same for the 2nd month range.
    - Create a new variable. There insert any logic for comparing the previous selections.
    Best regards,
    Eugene

Maybe you are looking for

  • Help: can not regist application in HP-UX 11.0

    My application work fine in iAS SP3 for Win2000, but when I deployed it to HP-UX 11.0, It can not regist the application in HP-UX. can any onr help me, thanks Lu yanqiang the error message is: HotSpot VM warning: Setting of property "java.compiler" i

  • Play chess with others over iPhone?

    On websites like RedHotPawn.com, I can play chess with others in a "correspondence" fashion. I.e. I login to the website and see that my opponent has made a move. I then make a move. My opponent will then make a move when convenient (i.e. this is not

  • Import EXIF tag to new App Yosemite Photos

    Hi I have custom metadata EXIF tag in my photos, how can i import to keywords in the new App Photos ? it's works for dataTime et GPS position (in EXIF metadata). Thanks Francois

  • How to use wwv_flow.g_inline_validation_error_cnt?

    well, I stucked... Somebody could post some sample code illustrating how to use g_inline_validation_error_cnt (number of validations errors). thx, cyryl

  • I need to get help... edited by host

    I need to get help... My Case ID: <edited by host> My English is not good, please forgive me. But I need to get help I purchased in China in March of 2t time capsule, can not open yesterday, which has important data. China, Hong Kong Plaza Apple stor