Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Red face Unanswered: Title counts in a field using oracle decode.

    Hi All,

    I want to write a query to generate a report using decode function in Oracle 8i from the Single field in a table. The requirement is, there are 2 fields Calldate and Menucode in a table, in the Menucode field values will be like '0103020504' sequentially the same has to be replaced with corresponding titles, like for 01 - A; 02 - B; 03 - C; 04 - D; 05 - E;
    also should bring individual title counts(with multiple occurences of data across records) from the particular field based on the date.

    Table fields: Calldate, MenuCode
    field values: Calldate= 04-Dec-03; MenuCode='0103020504' (similar data in multiple rows)

    Result structure is: callDate,Titles, OccurencesCount

    03 Dec 03 A 25
    B 11
    C 15

    04 Dec 03 A 10
    C 21
    D 17

    and so on...

    can you please help me on this.

    Thanks in advance.


  2. #2
    Join Date
    Apr 2003
    Minneapolis, MN
    it is not possible with the single SQL statement.

    You have to user PL/SQL block to solve this. I guess you also need to create one temporary table for this.

    MS Computer Science
    OCP DBA 9i/8i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts