Need a solution for the special case...

My version of Oracle is 11.2.0

My table name is nit_khush have a single column named as a

Values in the table

A

Vincent
Murali
Bharath
Nitesh
Perron
Married

Case, it is I want to count number of present to each name of a column and I am trying my best here to get an output that is mentioned below


Vincent 1
Murali 1
Bika 2
Nitesh 0
Perron 1
Married 3

In above example output for a single VIP is available in name is 1 the same he shoul count in each line and I have an assumption that surely by using the function nesting count with some string as SUBSTR functions can help but still substr find specific place and not dynamically so someone can suggest better idea to get a result as although I am also here but need your assisatance so and for any information required medium, let know

Kind regards
Nitesh...

use regexp_count

http://docs.Oracle.com/CD/B28359_01/server.111/b28286/functions135.htm

SELECT REGEXP_COUNT ('Vincent', 'a', 1, 'i') REGEXP_COUNT
FROM DUAL;

First parameter - your channel
second parameter - string you want to search
third parameter - position where you want to start the search
fourth parameter - ignore case
Published by: Rahul India on January 24, 2013 15:19

Tags: Database

Similar Questions

  • Need the best solution for the special case

    My version of oracle is 11.2.0

    My name of the table is nitkhush and have a column named long_string of long data type

    The values of the tables are

    LONG_STRING

    Vincent
    Murali
    Bharath
    Nitesh
    Perron
    Married


    I know its not appropriate to use the long type, but again I want to understand the concept, so I've used and should
    output is


    Vincent Kumar
    Murali Kumar
    Bharath Kumar
    Nitesh Kumar
    Perron Kumar
    Married Kumar


    I tried this query
    Select 'Kumar ' | long_string nitkhush but error is ORA-00932: inconsistent data types: expected NUMBER got LONG so I tried to convert in varchar2 pl/SQL

    DECLARE
    LONG temp_long;
    temp_var VARCHAR2 (4000);
    BEGIN
    SELECT 'Kumar ' | long_string
    IN temp_long
    OF nitkhush;

    temp_var: = SUBSTR (temp_long, 1, 4000);
    Dbms_output.put_line (temp_var);
    END;

    but still unable to do as I thought store at length and then using SUBSTR function it will convert and store it in a variable of type varchar2 data but it does not, and according to my knowledge CAST do not long support for the conversion of varchar2 so someone can give me best solution but I need complex queries wholesale as it should be as short as simple to understand so that all the world can understand it easily... And also through the procedure, I tried so that execution of the procedure but still unable to... I tried throgh procedure also all as written above...
    Thank you
    Nitesh Perron.

    If you have to / want to change the default value of a column, you should not update the system tables but use an alter table command
    And by the way, it works

    begin
      for r_col in ( select *
                     from user_tab_columns
                     where table_name = 'MY_TABLE'
                     and data_default is not null
                   )
      loop
        dbms_output.put_line( r_col.data_default || 'Anton' );
      end loop;
    end;
    
  • OfficeJet 6500 wireless needs of solution for the damage to the print head as possible.

    I have recently change ink in my all in one printer officejet 6500 wireless and now it has an error message indicating that the print head is damaged. Please help me I have a paper due soon

    Hi tlawsonfrancis,

    Officejet 6500 what model do you have (E709 or E710)?

    If you get an error on a bad printhead you can try to remove the printer and then turn the printer without it in the cycle. Wait for the printer to you asking to reinstall. If you continue to receive the error you can contact our technical support at the 800-474-6836, and they can helo you buy a new print head for your printer. If you do not live in the United States / Canada region please click the link below to get help from your region number.

    http://www.HP.com/cgi-bin/hpsupport/index.pl

  • I need a solution for the issue mentioned with my Audio below

    Product
    Windows Audio
    Problem
    Stopped working
    Date
    13/04/2013 11:29
    Status
    Report sent
    Signature of the problem
    Problem event name: APPCRASH
    Application name: svchost.exe_Audiosrv
    Application version: 6.0.6001.18000
    Application timestamp: 47918b 89
    Fault Module name: stapo.dll
    Fault Module Version: 1.0.6124.0
    Timestamp of Module error: 49237ad0
    Exception code: c0000005
    Exception offset: 0008810a
    OS version: 6.0.6001.2.1.0.768.2
    Locale ID: 1033
    Additional information 1: fd00
    More information 2: ea6f5fe8924aaa756324d57f87834160
    Additional information 3: fd00
    Additional information 4: ea6f5fe8924aaa756324d57f87834160
    Additional information about the problem
    Bucket ID: 1036323151

    IDT just make chips. They provide drivers.

    It comes in a general way. Each approach has pros and cons try each.

    You can;

    • Choose update driver (and rollback) in the property sheet of the hardware in the Device Manager
    • Use Windows Update, you choose the option to check the updates of pilot also
    • If it came with a PC, go to the web site of PC manufacturers more for those who made the web site of the component
    • Often the material is based on a specific chip and the web site of the manufacturer of the chip can have reference drivers. For example, NVidia has the reference drivers for their chips to http://www.nvidia.com/Download/index.aspx?lang=en-us material
  • I found the solution for the problem of sound-acpi with Satellite P100-219

    Hello

    I found the solution for the problem of sound-acpi with Toshiba P100 (it works with P100-219 at least). I can provide the source modified and compiled table DSDT, but I would like to know if it is possible to get these changes in the next update of the BIOS?

    See you soon,.
    MIK

    Hi Mik

    As you know that it is not possible to find info on the next BIOS, especially if you want to have some information about the Linux operating system. Just wait and see if some forum users pointed out something on the subject.

  • Satellite M30X-165 - need a driver for the PCI Flash memory

    Hey,.

    I need a driver for the PCI Flash memory, I have already searched the web and posted in other Forums, but I can't find anything. I heard he is hidden somewhere in another file... ? !
    I have a toshiba sm30X-165

    I would be very happy if someone can help me!

    Kind regards

    Freddy

    Drivers for Satellite M30X are placed in the archive on the European driver Toshiba page.
    Product type choose Archive.
    Then the Satellite-> Satellite M-> Satellite M30X

    There, you must download and install the Cardbus and Chip Set Utility driver

  • Satellite 1000-Z2: I need a driver for the display and the LAN

    Hello

    I reformatted my laptop S1000-Z2, and I have a real problem trying to find all the information about this model!

    Basically, I need a driver for the display and the LAN?

    Best regards

    Austin.

    What operating system do you use?
    If you use XP, you will not find the network on the site recommended driver driver!
    I can't give you advice where to find such driver because I don t know what the LAN card is installed in your oldie.

    But why you n t check yourself? Try to know what the LAN card you use and googel a bit for compatible applications ;)

  • Need a driver for the gforce 6400 ultra 128 MB graphics card

    Original title: find a driver

    Hello

    I need a driver for the gforce 6400 ultra 128 MB graphics card.

    know of anyone who has this?

    TNX for help

    Hello

    Take a look in the manufacturer's website:

    http://www.nvidia.in/page/GeForce6.html

  • Need help now for the live installation

    Need help now for the live installation

    Hello

    As described in the question, I understand that you need help. I will definitely help you however, I would be grateful if you could help me with more information to better understand the problem and resolving it.

    1. What is the problem you are experiencing during installation?

    2. That you install? Any software or operating system?

    3. How you try to install the software/Os/application?

    If you need live support from Microsoft then you can click on the link given below and check if it helps.

    https://support.Microsoft.com/en-us/contactus/

    Hope that this help, please write us back for any further assistance on this point, we will be happy to help you further.

  • Does anyone have a solution for the use of Bible Illustrator 3.0 MS8 and MS7

    Original title: program programs Application Applications compatibility.

    Does anyone have a solution for the use of Bible Illustrator 3.0 MS8 and MS7

    What are the requirements of system for this program?

    What version of Windows it says on the package, it was designed for?

    If its designed for an earlier version of Windows such as Windows 95 or Windows 98 or XP, then it is probably incompatible with Windows 8.

    If the product packaging indicates anything in the 1990s OR early 2000s, I am afraid that this is not something that is guaranteed to work with Windows 8.

    You can try the following average time.

    Point to the installation files where they are.

    Right-click on the configuration file, and then click "troubleshoot compatibility".

    Wait, it detects the problem.

    Click on the option "worked in an earlier version of Windows.

    Select Windows 7 RTM or better Windows Vista SP2

    Click next

    Click Start the program, wait, it installs

    When the installation is complete, click Finish and save the settings.

  • Hey everyone if I use photoshop mixture do I need to pay for the cloud

    Hey everyone if I use photoshop mixture do I need to pay for the cloud

    Laughing out loud

  • Solution for the mutation of table of error when using triggers

    Hello

    Could you please give the solution for the error table mutation during the use of triggers. I'll give you the simple scenario here,

    I created a trigger on the employees table, whenever all DML operations takes place in the employees table, it must run the trigger body. I intentionally used also of the employees in the body of the trigger table. Please give me the solution.

    Triggering factor:

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    end;

    DML statement:

    Update employees set salary = 20000 where job_id = "AD_PRES" (I run this query)

    Error message:

    ORA-04091: table HR. Is the transfer of EMPLOYEES, the function of triggering/can not see

    ORA-06512: at "HR. TEST_TRIGGER', line 4

    ORA-04088: error during execution of trigger ' HR. TEST_TRIGGER'

    Can anyone tell, in what other scenarios, we get this error or recursive table mutation?

    Thanks in advance

    Hello

    When you create a trigger on a table, you cannot edit/query this table the trigger is not completed.

    You can use

    (1) transaction of Pragma autonomous

    (2) instead of row-level trigger, you have statement-level trigger

    (3) to 11 g, try with COMPOSITE trigger

    Try below to avoid it (a solution):

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    PRAGMA AUTONOMOUS_TRANSACTION;

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    COMMIT;

    end;

  • I searched for a solution for the problem I was on Win 7 Pro Service Pack 1 in the links on an open Adobe Acrobat file will not open in my browser Firefox 33.0.2. The error I get is "Acrobat could not run the web browser.  Unknown error. (123).

    I want a solution for the problem I was on Win 7 Pro Service Pack 1 in the links on an open Adobe Acrobat Pro 10.1.12 file will not open in my browser Firefox 33.0.2. The error I get is "Acrobat could not run the web browser.  Unknown error. (123).

    You can try a repair of your Acrobat installation. Maybe, at least it's a start toward a solution.

  • Need to alert for the margin of safety

    Hi all

    Could someone please provide solution for the alert of safety margin.

    If the elements of any page by page width or height of the alert page will display or report to produce.

    [range of margin of safety = 24 points]

    myDoc var = app.activeDocument;

    var myPgItems = app.activeDocument.allPageItems

    doc.viewPreferences.horizontalMeasurementUnits = doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

    doc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

    var myPageWidth = app.activeDocument.documentPreferences.pageWidth;

    var myPageHeight = app.activeDocument.documentPreferences.pageHeight;

    Could someone help...

    Thank you

    Beginner

    Hi beginner,

    You can get the result by comparing with your myPageWidth and myPageHeight geometricBounds

    myGMB = myPgItems [0] .geometricBounds;

    If (myGMB [0]<=0 ||=""><=0 ||="" mygmb[2]="">= myPageHeight | gmb [3] > = myPageWidth) {}

    Alert(myPgItems[0].) ParentPage.Name);

    }

    Suresh

  • Need help for the particular case of selection

    Oracle DB 12 c, I think than 12.1.2

    drop table person_tests;

    create table person_tests)

    person_id number,

    test_type_id varchar2 (1).

    date of test_date

    );

    insert into person_tests (person_id, test_type_id, test_date) values (1, 'A', to_date('01012000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (1, 'A', to_date('01022000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (1, 'B', to_date('01032000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (1, 'B', to_date('01042000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (1,', to_date('01052000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (2,', to_date('01062000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (3, 'A', to_date('01072001','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (3, 'A', to_date('01082000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (3, 'B', to_date('01092000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (3, 'B', to_date('01102000','MMDDYYYY'));

    insert into person_tests (person_id, test_type_id, test_date) values (3,', to_date('01102000','MMDDYYYY'));

    People as a participant in some of the tests: A, B and C where each event is tagged with a date when finished.

    I need to get out of the only people who have done 2 tests of type A, 2 type tests B and 1 type C. I test have show the type of test and the date of the most recent of these tests. In the above example would output desired

    1 JANUARY 5 C 00

    3. A 7 JANUARY 01

    Hope that this definition of the logical problem

    Hello

    Sorry, I missed the obligation to show the most recent test_type_id.

    Assuming that the date to display is the date, that the minimum conditions were met (if not gratutitous trials came afterwrds), you can do something like this:

    WITH got_r_num AS

    (

    SELECT person_id, test_type_id, test_date

    , ROW_NUMBER () OVER (PARTITION BY person_id, test_type_id)

    ORDER BY test_date

    ) AS r_num

    OF person_tests

    WHERE test_type_id IN ('A', 'B', 'C')

    )

    SELECT person_id

    MIN (test_type_id) DUNGEON (DENSE_RANK LAST ORDER BY test_date) AS last_test_type

    MAX (test_date) AS last_test_date

    OF got_r_num

    WHERE r_num<= case ="">

    WHEN 'A' THEN 2

    WHEN 'B' THEN 2

    WHEN 'C' THEN 1

    END

    GROUP BY person_id

    HAVING COUNT (*) = 5-2 ' A + 2 ' B + 1 'C '.

    ;

    What test_type_id would you like to display tie for the final round?

    I just saw your post by saying that a person with 3 or more 'A' type tests should be excluded.  In this case, my original solution (with = in the WHERE clause) is what you want; only FINALLY used to get past test_type_id.  The solution in this post is for the situation where you don't care if there are 3 or more ' has, but you want to ignore all but the first 2.

Maybe you are looking for