Group By one column

I have one table as below
CREATE TABLE [dbo].[emp](
    [EmpId] INT,
    [EmpName] VARCHAR(20),
    [SAL] INT,
    [DeptId] INT
) ON [PRIMARY]
I want to select all column with group by one column
SELECT EmpId, EmpName, SAL, DeptId FROM Emp GROUP BY DeptId
Is it possible ?
Is there any other way to achieve this?
Deepak Talele Ph: 91-9158413830 Email: [email protected], [email protected]

Hi,
If you want to select all the columns then what is the need of group by?
Group By normally used when you have math function in your query like, SUM() , COUNT(), MIN(), MAX() etc
Could you please provide us with sample output that you are trying to achieve.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page

Similar Messages

  • How to group by one column and concatinate records from another col

    hi,
    i want to fill a list-item in forms 6i with one cursor. i need a cursor / sql-function that fetch the data from the following table structur. it looks like this:
    col1 col2
    group1 01
    group1 02
    group2 03
    group3 04
    group2 05
    group1 06
    the resultset should look like this:
    label value
    group1 01.02.06
    group2 03.05
    group3 04
    any ideas ?
    thanks in advance.
    greets Kevin

    Try this
    table X2
    columns a and b
    SELECT a
    , LTRIM(MAX(SYS_CONNECT_BY_PATH(b,'.'))
    KEEP (DENSE_RANK LAST ORDER BY curr),'.') AS concatenated
    FROM ( SELECT a
    , b
    , ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) AS curr
    , ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) -1 AS prev
    FROM x2 )
    GROUP BY a
    CONNECT BY prev = PRIOR curr AND PRIOR a = a
    START WITH curr = 1
    Pls. Confirm if it works..

  • Select multi column group by one column

    Dear SQL Experts,
    I have one question related to pl/sql.
    I need to do below query. Please advice proper way.
    select code, firstname, lastname
    from customer
    group by code
    But group by expecting firstname and lastname.
    Please advice
    Thank you,
    Erdenebayar

    Erdenebayar wrote:
    I have one question related to pl/sql.You have posted SQL code. Not PL/SQL code.
    I need to do below query. Please advice proper way.
    select code, firstname, lastname
    from customer
    group by code
    But group by expecting firstname and lastname.Of course you will also need to group by firstname and lastname for that SQL statement.
    With a group by SQL you have basically 2 types of values that can be returned:
    - the value to group by
    - the aggregated/calculated value for that group
    So you could look at the first firstname and the last lastname per code:
    select
      code, MIN(firstname), MAX(lastname)
    from customer
    group by codeYou can look at the number of unique first and last names per code:
    select
      code, COUNT(DISTINCT firstname), COUNT(DISTINCT lastname)
    from customer
    group by codeThink of the group by clause in terms of having dimensions (e.g. code in the above SQL) and measures (the calculations per code in the above SQL).

  • GROUB BY with more than one column

    I (who is not very good at SQL) was explaining GROUP BY clause in SQL to my beginner colleague . I showed him an example where results are grouped for one column . Something like
    select customer, count(*) as ItemCount
    from Orders
    group by customerCould you guys give us a meanigful, simple and easy to remember example where two columns are being grouped

    Hi Zebra,
    Got this example from Google
    DROP TABLE myenterprise;
    CREATE TABLE myenterprise(
    city VARCHAR2(10),
    storeid VARCHAR2(10),
    month_name VARCHAR2(10),
    total_sales NUMBER);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'January', 1000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'March', 7000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'April', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id2', 'November', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id3', 'January', 5000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'Janaury', 3000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'August', 6000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'September', 500);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'November', 1000);
    -- GROUPing of one column (which you already have)
    SELECT city, SUM(total_sales) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    -- Two columns making up a group
    select city, month_name, sum(total_sales) as total_sales_per_city
    from myenterprise
    group by city, month_name
    order by total_sales_per_city desc;

  • Table with column group (one column) - next row is showing on new page instead of below previous row

    I am creating new table. My goal is to display some text in few lines like this:
    "AAAAAAAA"           "BBBBBBBB"           "CCCCCCCCC"     
    "DDDDDDD"           "EEEEEEEE"
    Actually the next row (with "DD" and "EE" values) is not displayed below first row, but on the next page.
    I've tried to put table into rectangle, disabled all page breaks and still the same effect. Any help?

    Hi Heidi,
    Actually, it's not solution, I only gave more details about my problem :)
    Another description:
    In my report I'm creating Tablix with Column grouping. There is only one column with image (every image has same width). If there is only three pictures, then they are displayed next to each other in one row.
    In case, there is more than three pics, another row is showing on next page. I'd like to display all rows one after another on one page.
    I've tried to create three vertical lists, and filter each column group to display only records:
    1) =(RowNumber("Tablix1")) mod 3 = 1
    2) =(RowNumber("Tablix1")) mod 3 = 2
    3) =(RowNumber("Tablix1")) mod 3 = 0
    Unfortunately, I got an error:
    "A FilterExpression for the tablix ‘Tablix1’ uses the function RowNumber.  RowNumber cannot be used in filters."
    Do You have any other propositions?
    --------EDIT--------
    ok, I manged to solve it. As I said, I've created three vertival lists and placed them next to each other.
    Then, instead of using filter, I've used Visibility trigger:
    1)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix1") mod 3 = 1, false, true)
    2)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix2") mod 3 = 2, false, true)
    3)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix3") mod 3 = 0, false, true)
    I had to use function RunningValue to count all occurrences, as my report is quite complex and "RowNumber" [ssrs function] and "ROW_NUMBER() OVER (ORDER BY [rowgroupfield])" [sql query] were not working properly.

  • Merge two resultsets into one column

    Hi Guys,
    I have two SQL statements. The first returns 12 columns and the second returns 2 columns but both return the same number of rows. I can't seem to merge both the queries into a common query as the WHERE clauses in both are different. I have to dump the output into a table i created. The table has 14 columns. One column in both queries act as primary key and they help form the relationship between the resultsets. The column name is SUBSCR_CODE. Below you will find my SQL queries and the CREATE TABLE statement. Please could someone tell me how to achieve this.
    SELECT o.subscr_code,
    SUM(NVL(m.remain_capital,0)),
    SUM(NVL(m.remain_interest,0)),
    SUM(NVL(m.remain_debtor_fee,0)),
    SUM(NVL(s.remain_debtor_fee,0)),
    SUM(NVL(m.remain_costs_to_client,0)),
    SUM(NVL(m.remain_debtor_outlay,0)),
    SUM(NVL(s.remain_debtor_outlay,0)),
    SUM(NVL(m.debtor_exp_outlay,0)),
    SUM(NVL(s.debtor_exp_outlay,0)),
    SUM(NVL(m.vatbase_debtor_fee,0)),
    SUM(NVL(s.vatbase_debtor_fee,0)),
    NULL
    FROM kkrpt1 o,
    maincase m,
    subcase s
    WHERE o.maincase_id = m.maincase_id
    AND m.maincase_id = s.mc_maincase_id
    AND s.claim_type IN (6,7,8,9,10,11,13)
    AND s.subcase_no = 0
    AND m.closing_date IS NULL
    AND s.closing_date IS NULL
    GROUP BY subscr_code;
    SELECT o.subscr_code,
    SUM(NVL(a.remain_interest,0))
    FROM kkrpt1 o,
    amount a,
    maincase m,
    subcase s
    WHERE o.maincase_id = a.mc_maincase_id
    AND o.maincase_id = m.maincase_id
    AND m.maincase_id = s.mc_maincase_id
    AND s.claim_type IN (6,7,8,9,
    10,11,13)
    AND s.subcase_no = 0
    AND m.closing_date IS NULL
    AND s.closing_date IS NULL
    AND a.amount_type = 41
    GROUP BY subscr_code;
    CREATE TABLE kk_ajot_14 (
    subscr_code VARCHAR2(5),
    remain_capital_sum NUMBER,
    remain_inerest_sum_1 NUMBER,
    remain_debtor_fee_sum_1 NUMBER,
    remain_debtor_fee_sum_2 NUMBER,
    remain_costs_to_client NUMBER,
    remain_debtor_outlay_1 NUMBER,
    remain_debtor_outlay_2 NUMBER,
    remain_debtor_exp_outlay_1 NUMBER,
    remain_debtor_exp_outlay_2 NUMBER,
    vatbase_debtor_fee_1 NUMBER,
    vatbase_debtor_fee_2 NUMBER,
    remain_inerest_sum_2 NUMBER);

    No need to create table
    with
    sql_1 as
    (<first sql here>
    sql_2
    (<second sql here>
    select a.*,b.*
      from sql_1 a,sql_2 b
    where a.subscr_code = b.subscr_codeRegards
    Etbin

  • Creating a radio button group in a column of a table in Web Dynpro

    Hi,
    I want to put a radio button group in a column of a table in Webdynpro. I added a column to a web dynpro view and then inserted a tableCellEditor for that column.. But I cannot define it as Radio Button group. I want the user to be able to select 3 statuses using this group.
    Does anyone have a solution for this??
    Thanks in advance...
    Nakul

    Hi,
    You wont be able create three RB in one cell.
    Create as many column as the no of options is.Here it is 3.
    Create 4 attributes inside the node , option 1,option 2,option 3 and selectedoption.
    Map each RB s keytoSelect to option 1,2,3. Map all the RBs selectedKey atribute to selectedoption.
    Now selection for each row will be stored in the selected option.
    Regards
    Bharathwaj

  • Collecting data from multiple rows into one column

    I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
         CREATE TABLE "SKIP"."INGREDIENTS"
       (     "INGRED_ID" NUMBER,
         "INGRED_NAME" VARCHAR2(20 BYTE),
         "STORES" VARCHAR2(20 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGREDIENTS
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
      CREATE TABLE "SKIP"."PRETZELS"
       (     "PRETZEL_ID" NUMBER,
         "PRETZEL_NAME" VARCHAR2(20 BYTE),
         "PRETZEL_DESC" VARCHAR2(100 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.PRETZELS
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
      CREATE TABLE "SKIP"."INGRED_XREF"
       (     "PRETZEL_ID" NUMBER,
         "INGRED_ID" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGRED_XREF
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
    --  Constraints for Table INGRED_XREF
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
    {code}
    Desired output (note how the ingredients are all listed in one column, separated by commas):
    {code}
    PRETZEL_ID PRETZEL_NAME     PRETZEL_DESC                        INGREDIENTS
    1          CLASSIC          Classic knot pretzel                SEA SALT, TABLE SALT, YEAST
    2          THICK STICK      Straight pretzel, abt 1/2" in dia   TABLE_SALT, FLOUR, BEER

    See the FAQ : {message:id=9360005}
    Especially links concerning string aggregation.

  • How to place one column under another column in obiee report?

    Hi all,
    I am new to obiee, so need some help from obiee experts. Can anyone tell me how to place one column data under another column in obiee report?
    i need the report to be as below
    category total_students Course_enrollment Test_attended pass_test
    total N % N % N %
    all students ##### ## ## ## ## ## ##
    Ethnicity
    Asian ###### ## ## ## ## ## ##
    African American ###### ## ## ## ## ## ##
    white ######
    Filipino ######
    Gender
    Male ##### ## ## ## ## ## ##
    Female ##### ## ## ## ## ## ##
    and similarly for other columns
    where ethnicity, gender are columns in the table and Course_enrollment, Test_attended, pass_test are calculated columns.
    Please help me to create a report as above if anyone knows how to do it.
    Edited by: Shailaja on Jul 19, 2010 12:23 AM

    Two ideas I can think of:
    1) Create multiple pivot tables and then display them one under the other
    2) Create multiple measure columns such as "male_amt", "female_amt", "white_amt", "asian_amt", "black_amt", etc. for all the columns you need. Then you could simple stack them in a single pivot table.
    Option #2 might give you the prettiest results - but also requires a lot more maintenance (for instance, if you reclassify ethnic groups, you'd have to go through the reports to add additional metric columns).
    Hope this helps,
    Scott

  • Simple request... More than one column to organize tracks?!

    Is it possible to organize tracks with more than one column, such as 'name' followed by 'comment', for example.. The way I have it now, each time you click on a new header, the last header cannot be used in combination, i.e. only the currently selected header can be used. Thanks!

    strangelittleman,
    I don't know of any way to do this, but I agree it would highly useful. (Like the sorting algorithms in word processors that let you sort by column 2 followed by column 6, etc., or whatever.)
    Here is a work-around. If the column you use to arrange your songs, say song name, produces a fairly sizable listing for the same song (Louie Louie, for instance) and you want to organize that by artist name (to group the multiple versions done by Motorhead or IGGY POP, for instance), then just select the songs of a given name and copy them to a new playlist. Then select the artist name column to organize by that.
    This is clumsy, and only useful if you have a large number of songs in the first sorting category (song name in the example above) and duplicates that you wish to detect in the second sorting category (artist name in the example above). But in some cases it may be helpful.
    Drake

  • 11g: automatic group by unused column

    Hi,
    I've got this problem:
    I have report with just one measure. This measure should be aggregated over a selectable dimension.
    Therefor I build a dashboard prompt, which saves the selected dimension in a presentation variable.
    (btw: a column selector would be the easier way, but there are more than one report which should react on this dashboard prompt)
    Then I used a "case when" in the report to differ between the selection:
    case when [presentation-variable] = 'Dim1' then Dim1.col1
    when [presentation-variable] = 'Dim2' then Dim2.col1
    end
    Now I would expect such a physical SQL:
    select
    case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end,
    sum(...)
    from
    group by
    case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end;
    But OBIEE creates such one:
    select
    case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end,
    sum(...)
    from
    group by
    Dim1.col1,
    Dim2.col1,
    case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end;
    So of course the wrong the measure is aggregated wrong, because it is grouped by a column, which i do not want to use.
    Could it be the Problem, that this 2 columns are logical level key of a dimension hierarchy?
    Anybody got a idea, how I could suppress this group by?

    Hi,
    Just 4 hours ago, someone else had a very similar question:
    Group by fails on ORA-00979
    Personally, I consider that a bug in Oracle 10. When you do a GROUP BY on a view, you can't expect the SQL engine to look at the view definition, and determine if one of the columns can be derived from another.
    In practice, it's easy enough to add c1u to the GROUP BY clause, or to use MAX (c1u) instead of c1u, to make your query work.

  • One column one row w/ separator to be hierarchical columns

    Dear Gurus,
    I want to present the "+one column/one row data+"
    F:\JDeveloper\Tut\TIJ4-code\generics\watercolors\Watercolors.javaas this follow:
    id               parent_id
    Watercolors.java     watercolors
    watercolors          generics
    generics          TIJ4-code
    TIJ4-code          Tut
    Tut               JDeveloper
    JDeveloper          F:Id better using an sql rather than pl/sql.
    regards,

    I think you'd struggle to do this in SQL alone, unless you use some fancy MODEL clause or Michaels can come up with some nifty XML solution. I would probably go with some PL/SQL as a pipelined function...
    SQL> create table treedata as
      2  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Adding Window Event Listener. Working with MDI.swf' as cp from dual union all
      3  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Finger Icon.swf' from dual union all
      4  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Key Icon.swf' from dual union all
      5  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Containing Information on Fingers.swf' from dual union all
      6  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Handling Shift Press.swf' from dual union all
      7  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 1).swf' from dual union all
      8  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 2).swf' from dual union all
      9  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyCode.swf' from dual union all
    10  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 1).swf' from dual union all
    11  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 2).swf' from dual union all
    12  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Key Systemization .swf' from dual union all
    13  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Saving Information on Keys.swf' from dual union all
    14  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating the Main Window (the Class MainWindow).swf' from dual union all
    15  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Class Constructor.swf' from dual union all
    16  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Fill.swf' from dual union all
    17  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 1).swf' from dual union all
    18  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 2).swf' from dual union all
    19  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 1).swf' from dual union all
    20  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 2).swf' from dual union all
    21  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Highlighting Icons.swf' from dual union all
    22  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method run.swf' from dual union all
    23  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method setVisible.swf' from dual union all
    24  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Registering Keyboard in the Main Window of Application .swf' from dual union all
    25  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\The Methods new_icon and new_fingericon.swf' from dual union all
    26  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Adding Keyboard Listener to the Application.swf' from dual union all
    27  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating Methods to Test the Efficiency of the User''s work.swf' from dual union all
    28  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class ExerciseGUI.swf' from dual union all
    29  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class Lessons and Working with It in the Class ExerciseGUI.swf' from dual union all
    30  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Handling Pressed Keys.swf' from dual union all
    31  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Improving Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    32  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Setting Position and the Sizes of the Main Window.swf' from dual union all
    33  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Statistics.swf' from dual union all
    34  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    35  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Keyboard Events.swf' from dual union all
    36  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Working with Main Window Menu. Positioning the Main Window.swf' from dual
    37  /
    Table created.
    SQL>
    SQL>
    SQL>
    SQL> CREATE OR REPLACE TYPE pth IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION tree RETURN pth PIPELINED IS
      2    l_maxlen      NUMBER;
      3    l_parent_path VARCHAR2(255);
      4    type t_output is table of varchar2(32767) index by pls_integer;
      5    l_output      t_output;
      6    l_cnt         NUMBER := 0;
      7    PROCEDURE show_children(p_path IN VARCHAR2, p_lvl IN NUMBER, p_tree IN VARCHAR2) IS
      8      l_ch_path_cnt number;
      9      CURSOR cur_children_elements IS -- non path children
    10        select replace(cp,p_path) as ch
    11        from   treedata
    12        where  instr(replace(cp,p_path),'\') = 0
    13        order by 1;
    14      CURSOR cur_children_paths IS -- path children
    15        select pth
    16              ,row_number() over (order by pth) as rn
    17              ,count(*) over () as cnt
    18        from (
    19              select distinct substr(replace(cp,p_path),1,instr(replace(cp,p_path),'\')) as pth
    20              from   treedata
    21              where  instr(cp,p_path) > 0
    22              and    instr(replace(cp,p_path),'\') > 0
    23              order by 1
    24             );
    25    BEGIN
    26      select count(*)
    27      into   l_ch_path_cnt
    28      from   treedata
    29      where  instr(cp,p_path) > 0
    30      and    instr(replace(cp,p_path),'\') > 0;
    31      for c in cur_children_elements
    32      loop
    33        l_cnt := l_cnt + 1;
    34        if l_ch_path_cnt = 0 then
    35          l_output(l_cnt) := replace(replace(substr(p_tree,1,length(p_tree)-2)||'  ','+',' '),'-',' ')||'  '||c.ch;
    36        else
    37          l_output(l_cnt) := replace(replace(p_tree,'+',' '),'-',' ')||'  '||c.ch;
    38        end if;
    39      end loop;
    40      if l_ch_path_cnt = 0 then
    41        l_cnt := l_cnt + 1;
    42        l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2);
    43      else
    44        l_cnt := l_cnt + 1;
    45        l_output(l_cnt) := p_tree;
    46      end if;
    47      for p in cur_children_paths
    48      loop
    49        if p.rn != p.cnt then
    50          l_cnt := l_cnt + 1;
    51          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'+-'||substr(p.pth,1,length(p.pth)-1);
    52          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'| | ');
    53        else
    54          l_cnt := l_cnt + 1;
    55          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'\-'||substr(p.pth,1,length(p.pth)-1);
    56          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'    ');
    57        end if;
    58      end loop;
    59    END;
    60  BEGIN
    61    -- first display the common parent path
    62    select max(length(txt)) as max_ln
    63    into   l_maxlen
    64    from (
    65          select substr(cp,1,rn) as txt
    66          from   treedata, (select rownum rn from dual connect by rownum <= 255)
    67          group by substr(cp,1,rn)
    68          having count(*) = (select count(*) from treedata)
    69         );
    70    select substr(cp,1,l_maxlen)
    71    into   l_parent_path
    72    from   treedata
    73    where  rownum = 1;
    74    PIPE ROW(l_parent_path);
    75    -- now recurse the data
    76    show_children(l_parent_path, 1, '| ');
    77    for i IN 1..l_cnt
    78    loop
    79      PIPE ROW(l_output(i));
    80    end loop;
    81    RETURN;
    82  END tree;
    83  /
    Function created.
    SQL>
    SQL> select * from table(tree);
    COLUMN_VALUE
    F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\
    |   Adding Window Event Listener. Working with MDI.swf
    |   Creating the Main Window (the Class MainWindow).swf
    |   Working with Main Window Menu. Positioning the Main Window.swf
    |
    +-Creating Supplementary Classes
    | |   Creating Finger Icon.swf
    | |   Creating Key Icon.swf
    | |   Creating the Class Containing Information on Fingers.swf
    | |   Creating the Class Handling Shift Press.swf
    | |   Creating the Class KeyCode.swf
    | |   Creating the Class for Key Systemization .swf
    | |   Creating the Class for Saving Information on Keys.swf
    | |
    | +-Creating the Class KBLayout
    | |     Creating the Class KBLayout (Part 1).swf
    | |     Creating the Class KBLayout (Part 2).swf
    | |
    | \-Creating the Class KeyIcon
    |       Creating the Class KeyIcon (Part 1).swf
    |       Creating the Class KeyIcon (Part 2).swf
    |
    +-KeyboardGUI
    | |   Class Constructor.swf
    | |   Creating Methods Responsible for Icon Fill.swf
    | |   Highlighting Icons.swf
    | |   Overriding the Method run.swf
    | |   Overriding the Method setVisible.swf
    | |   Registering Keyboard in the Main Window of Application .swf
    | |   The Methods new_icon and new_fingericon.swf
    | |
    | +-Creating Methods Responsible for Icon Highlight
    | |     Creating Methods Responsible for Icon Highlight (Part 1).swf
    | |     Creating Methods Responsible for Icon Highlight (Part 2).swf
    | |
    | \-Defining Some Static Variables
    |       Defining Some Static Variables (Part 1).swf
    |       Defining Some Static Variables (Part 2).swf
    |
    \-The Class ExerciseGUI
          Adding Keyboard Listener to the Application.swf
          Creating Methods to Test the Efficiency of the User's work.swf
          Creating the class ExerciseGUI.swf
          Creating the class Lessons and Working with It in the Class ExerciseGUI.swf
          Handling Pressed Keys.swf
          Improving Graphical Interface of the Class ExerciseGUI.swf
          Setting Position and the Sizes of the Main Window.swf
          Statistics.swf
          Working with Graphical Interface of the Class ExerciseGUI.swf
          Working with Keyboard Events.swf
    51 rows selected.
    SQL>

  • Trying to find ALL objects that point to one column...

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I have multiple schemas, all which have tons of objects that point to one column of one table.
    I tried to look at v$sqltext, and v$sqlarea, but it doesn't seem to show as expected.
    Is there a view that I can look at that will show me all the objects that relate to one column?
    my situation. Had to change the data structure of this one column. Changed the default value from a Y to an L. I have packages, functions, triggers...etc... that deal with this one column. I need to ensure that I go through EACH one and edit them to reflect the change to the table column. And again, this spans multiple schemas that point back to it.
    I can't overlook any objects. Is there any one place to find this?
    Thanks.

    Use view - DBA_DEPENDENCIES
    select * from dba_dependencies
    where type= 'TABLE'
    and name = '<TABLE_NAME>';Another crude way...
    select * from all_source
    where lower(text) like lower('%<TABLE_COLUMN_NAME>%')
    group by owner,name,type;But, this 'll not search in Views & MView queries.
    HTH
    Ranit B.
    Edited by: ranit B on Oct 15, 2012 11:09 PM
    -- added                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

  • One column concat...urgent

    Hello All,
    I have a table with one column, which has the values are follows as 12 records.
    Out of that I want to create only three records
    discard all 'value' records and
    concatenate all the remaining records as one with respective of each 'value' record: Assume the 'value' will be default value and it'll never get changed at all
    column
    value
    val1
    val2
    val3
    value
    val11
    val22
    val33
    val44
    value
    val10
    val30
    So in the output will be
    column
    val1,val2,val3
    val11,val22,val33,val44
    val10,val30
    Any help would be appreciated

    Ok see this:
    SELECT rank, MAX(TRIM(LEADING ',' FROM SYS_CONNECT_BY_PATH(col1,','))) AS result
    FROM (
         SELECT col1, rank, ROW_NUMBER() OVER (PARTITION BY RANK ORDER BY RANK) AS rn
         FROM (
              SELECT col1, len, DECODE(SUBSTR(col1,-1,1),0,0,len) as rank
              FROM (
                   SELECT col1, LENGTH(TRIM(BOTH '*' FROM TRANSLATE(col1,'abcdefghijklmnoprstuvwxyz','*************************'))) AS len
                   FROM test_table
                   WHERE col1 <> 'value'
    START WITH rn = 1
    CONNECT BY PRIOR rn = rn - 1 AND PRIOR rank = rank
    GROUP BY rank;Hope this help you ;)
    Peter D.
    Forgot about result. Here it is:
          RANK RESULT
             0 val10,val30
             1 val1,val2,val3
             2 val11,val22,val33,val44Message was edited by:
    Peter D.

  • Grouping by 2 columns. Please see

    Hi,
    I am using Reports 9I.
    I need to use two group by's :
    Table:
    TRANS_ID   ACC_ID DEL        CCY        AMT TRADE_DAT LENDER
    LEL0002045 SLEND  RECEIVE    GBP       1200 02-AUG-05 LENDERA
    LEL0002053 SLEND  DELIVER    GBP       1000 02-AUG-05 LENDERA
    LEL0002100 SLEND  DELIVER    USD        500 02-AUG-05 LENDERB
    LEL0002000 SLEND  DELIVER    KRN       1000 03-AUG-05 LENDERC
    LEL0002002 SLEND  DELIVER    KRN       1000 03-AUG-05 LENDERA
    LEL0002001 SLEND  DELIVER    GBP       1000 03-AUG-05 LENDERA
    REPORT
    LEL0002045 SLEND  RECEIVE    GBP       1200 02-AUG-05 LENDERA
    LEL0002053 SLEND  DELIVER    GBP       1000 02-AUG-05 LENDERA
    LEL0002001 SLEND  DELIVER    GBP       1000 03-AUG-05 LENDERA
    LEL0002002 SLEND  DELIVER    KRN       1000 03-AUG-05 LENDERA
                      RECEIVE    GBP       1200
                      DELIVER    GBP       2000
                      DELIVER    KRN       1000The break is on DEL and then on the CCY (ie currency).
    I am using the flwg SQL Query in my report:
    SELECT trans_id,
            acc_id,
            decode(DEL,'RECEIVE', AMT,0) as REC_AMT,
            decode(DEL,'DELIVER', AMT,0) as DEL_AMT,
            ccy,
            amt,
            trade_date,
            lender
    FROM    TableAand using SUMMARY cols to sum the AMT for column DEL
    But now,i need to sum also on column CCY.How do I sum AMT first on col DEL
    and then on col CCY?
    Is my SQL query proper? Any suggestions to modify this ?

    You provided following format:
    ccy    transid    accId  rec      Amt
    lenderA
    GBP    LEL001     SLEND  RECEIVE  1000
    GBP    LEL002     SLEND  RECEIVE  1200
    GBP    LEL003     SLEND  DELIVER  1000
    USD    LEL004     SLEND  RECEIVE  1000
                      RECEIVE GBP     3000
                      DELIVER USD     1000
    BUT, I THINK YOU WANTED IN THIS FORMAT
    GBP    LEL001     SLEND  RECEIVE  1000
    GBP    LEL002     SLEND  RECEIVE  1200
    GBP    LEL003     SLEND  DELIVER  1000
    USD    LEL004     SLEND  RECEIVE  1000
    RECEIVE GBP 2200
    DELIVER GPB 1000
    RECEIVE USD 1000
    If i am right, then you need two groups, one on LENDER and other rest of the column, lets say it 'DETAIL'.
    Create 4 formula columns in detail group
    First Formula Column:
    if :del = 'RECEIVE' and ccy = 'GPB'  then
       return(:amt);
    else
       return(0);
    end if;
    Second Formula Column:
    if :del = 'RECEIVE' and ccy = 'USD'  then
       return(:amt);
    else
       return(0);
    end if;
    Third Formula Column:
    if :del = 'DELIVER' and ccy = 'GPB'  then
       return(:amt);
    else
       return(0);
    end if;
    Fourth Formula Column:
    if :del = 'DELIVER' and ccy = 'USD'  then
       return(:amt);
    else
       return(0);
    end if;
    Create four summary column in LENDER group based on these formula columns and reset at LENDER.
    Put these summary column in repeating frame of LENDER.
    This will work if you are only dealing with 'USD' and GBP'

Maybe you are looking for

  • Error while opening an workbook

    Hi   I have done some changes to a query and transported Query as well as Work book to production. When i open the work book I get the below error and gets disconnected form BW <internal Error > Receiving from theBW server failed BW server raised exc

  • Sql is too long for DBMS_SQL.EXECUTE()

    The code as the following works. However if I run it with my original SQL statement(in quotes), this procedure does not have results shown. How to solve the problem? create or replace procedure dynamic_sql(p_fail IN tab.DisFai1_1%type) IS v_counter N

  • Show times in month view?

    Hey all! Just made the switch from Outlook to iCal and am wondering when you're in the month view if you can have the individual entries show the time. Thanks so much!

  • Editing .html files in iWeb!

    Hello, mutual iWeb users! I work as a freelance webmaster, and after converting to mac a year ago I have been using iWeb as my favorite editing program. I recently made a web page for a company, and it was published using a one.com domain. I reinstal

  • Upgraded (6.0.6) iPhoto will not recognise music purchased from ITune

    I downloaded the iPhoto 6.0.6 update and the iTunes 7.1.1 update, and now when I try to add any of the songs from my iTunes library which I have purchased from the iTunes store to one of my Iphoto slideshows, it says that my computer is not authorise