Identify the Position of the Alphabet or number in given string

Hi all
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE     9.2.0.6.0     Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production
I have string value approximately 15000 records, I need to retrieve these archives with the length of 12 n identify the position of the character and the number.
Ex:  Record Set 
=================

A12345T11111
A12345F12222
A12345F13333
A12345F14444
In this case, the first character is an alphabet followed 5 digits and 7 th position is an alphabet and followed by 5 digits...

I pick up these format record only...


There are some files like these

-In the example below the 2nd charater is an alphabet its invalid
AA2345512345
-In this area, the 7th character is not an alphabet
BA2345512345

These documents must be eliminated...

Valid format: 99999 99999 X X
==============

Invalid format: XX9999999999, XX999999999X, X 99999999999


I have one query, which gives me a result if string has an alphabet or not, if I tried present alphabets how are present.

This helped me to identify the number of characters, but I need to get the positions...
select LENGTH('A12345T11111') LEN#, LENGTH(TRANSLATE('A12345T11111','A1234567890','A')) from dual where LENGTH(TRANSLATE('A12345T11111','A1234567890','A'))=2
Any ideas or thoughts on the same...

Thank you
Ananda
with data as
(
select 'A12345T11111' as val from dual union all
select 'AA2345512345' from dual
)
select val from data where regexp_like(val, '[[:upper:]][[:digit:]]{5}[[:upper:]][[:digit:]]{5}')
/

VAL
------------
A12345T11111 

1 rows selected

EDIT: Just read your version of Oracle. I do not think that REGEXP_LIKE is supported in 9.2

Perhaps instead you can use the translation:

with data as
(
select 'A12345T11111' as val from dual union all
select 'AA2345512345' from dual
)
select val
from   data
where  length(val) = 12
and    translate(substr(val, 1, 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '..........................') = '.'
and    translate(substr(val, 2, 5), '1234567890', '..........') = '.....'
and    translate(substr(val, 7, 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '..........................') = '.'
and    translate(substr(val, 8, 5), '1234567890', '..........') = '.....'
/

VAL
------------
A12345T11111 

1 rows selected

Published by: Cyn on December 17, 2009 10:28

Tags: Database

Similar Questions

  • G62-340US: identify the revision number of the laptop (1.0, 1.1, 1.2)

    Hi all!

    Like many people here, I plan on upgrading my CPU to AMD bicoeur to an AMD quad-core processor. The problem is when I turn to my manual, it says that some processors are only for 1.0 and 1.1, 1.1, and 1.2, models etc.. What I found, we can identify their model by looking for their warranty date or their computers 'date of birth '; However, I have a computer that is restored to nine, so I don't know if this has changed the warranty, so HP updated the orignial parties when he left the 2nd factory, etc. My warranty (as shown in my BIOS) started on 07/07/11 and ends on 04/10/11. Can someone help me identify the revision of my model number?

    Hi @Apolinar4840,

    Thanks for the info requested and I am happy to help you!

    According to the manual, part number 616343-001, Chapter 4, page 85. the processor P340 is only for models 1.1.

    Compaq Presario CQ62 Notebook PC laptop HP G62 Notebook PC Maintenance and Service guide.

    Your must be version 1.1.

    Good luck!

  • How to identify the number of current row in a tabular form?

    Hi all

    I have a tabular presentation on the emp table. I want to recalculate the commission only column for the row where I changed the number of salaries. I gave my javascript below. I'm trying to triggerItem.slice (4) to identify the line number, but it doesn't seem to work. Anyone can point out the issue with it please?
    <script language="JavaScript" type="text/javascript">
    
    function getTheCurrentRow(triggerItem){   
          var theRow = triggerItem.slice(4);
          return theRow;         
    }
    
    function getComm(){
       var theRow = getTheCurrentRow(pThis.id);
       document.wwv_flow.f05[theRow].value = (document.wwv_flow.f04[theRow].value)*0.1;
    }
    </script>
    I use Oracle 10 g and Apex 4.0.

    Thank you

    Hello

    You forgot pThis in your second code I think.

    function getComm(pThis){
       var theRow = getTheCurrentRow(pThis.id);
       document.wwv_flow.f05[theRow].value = (document.wwv_flow.f04[theRow].value)*0.1;
    }
    

    You must call getComm thereby

       getComm(this);
    

    Thank you

  • How to identify the serial number for the instalation?

    How to identify the serial number for adobe photoshop cs5?

    http://helpx.Adobe.com/x-productkb/global/find-serial-number.html

  • Convert number to letter of the alphabet?

    Hello

    Is there a LabWindows function to convert a number to an equivalent alphabet?

    I tried something like that...

    char getLetterOfAlphabetByNum (int number) {}
    test if alpha
    If (isalpha (Number) == 0)
    DebugPrintf ("letter number conversion error. Not alphabetic. ») ;
    else {}
    take decimal and convert it to ascii
    Fmt = statusReturned (& letter, "%s < %d »,="" numéro) ;=""> < br=""> if(statusReturned<0)> < br=""> DebugPrintf ("erreur de conversion de nombre en lettre!)) ") \n ») ; < br=""> DebugPrintf ("tempString = %s\n", letter); { < br=""> } < br=""> DebugPrintf ("%d--> %s\n",number,letter);
    return letter; < br="">}

    Thank you!

    Thanks, that was my solution. Passing a 4 gives an a ', for example.

    alphabet letter number < br=""> char getLetterOfAlphabetByNum (int number) {< br=""> number = number + 64;} < br=""> //test if alpha and printable < br=""> if (isgraph (number) == 0) {< br=""> DebugPrintf ("Non-printable character.} \n ») ; < br=""> return; { < br=""> } < br=""> if (isalpha (number) == 0) {< br=""> ("not alphabetic. DebugPrintf} \n ») ; < br=""> return; { < br=""> } < br=""> sprintf (& tempString [0], "%c", number); < br=""> letter tempString = [0]; < br=""> DebugPrintf ("%d--> %c\n",number, letter ');< br="" >="" retour="" lettre ;="">< br="">

  • identify the most recent candidate

    First I'm sorry for the creation of a long term position, just trying to understand.
    Please help me make my efficient query.

    Example followed with a logic behind the scenes.

    create table finalcand (ptsequence number,version number,candidate varchar2(10),date_submitted date,
    file_valid varchar(2))
    insert into finalcand values(101,1,'VJ',TRUNC(SYSDATE),'Y');
    insert into finalcand values(102,1,'RD',TRUNC(SYSDATE),'Y');
    insert into finalcand values(103,1,'GD,TRUNC(SYSDATE),'Y');
    insert into finalcand values(104,1,'GD',TRUNC(SYSDATE),'N');
    insert into finalcand values(105,2,'GD,TRUNC(SYSDATE),'Y');
    insert into finalcand values(107,2,'GVR',TRUNC(SYSDATE),'N');
    insert into finalcand values(106,1,'GD',TRUNC(SYSDATE+1),'Y');
    insert into finalcand values(108,1,'GD',TRUNC(SYSDATE),'Y');
    insert into finalcand values(109,2,'GVR',TRUNC(SYSDATE+1),'Y');
    o/p required
       PTSEQUENCE    VERSION    PATIENT DATE_SUBMITTED FILE_VALID   RNK
         105     2     GD     7/23/2009           Y             2
         108     1     GD     7/23/2009           Y             3
         103     1     GD     7/23/2009           Y             4
         104     1     GD     7/23/2009           N             4
         107     2     GVR     7/23/2009           N             2
    IM using this query that works perfectly, but I'm still trying to see if I can do it effectively.
    SELECT z.*
      FROM (SELECT r.*,
                   RANK() OVER(
                   PARTITION BY r.candidate 
                   ORDER BY R.DATE_SUBMITTED DESC,
                            R.VERSION DESC, 
                            R.PTSEQUENCE desc) rnk
              FROM finalcand r
              where file_valid='Y') z
     WHERE RNK >1
    union all
    SELECT z.*
      FROM (SELECT r.*,
                   RANK() OVER(
                   PARTITION BY r.candidate  
                   ORDER BY R.DATE_SUBMITTED DESC,
                            R.VERSION DESC, 
                            R.PTSEQUENCE desc) rnk
              FROM finalcand r
              ) z
     WHERE RNK >1
     and z.file_valid='N'
    Logic behind it all

    This is to identify all records that are no more final candidate

    -> candidate is identified by the name of the candidate.
    -> version and date_submitted is used to identify the most recent entry of this candidate.
    -> if same candidate has several entries with the same version and also date_submitted even then use max (ptsequence) to identify the most recent.

    Problem here is
    -> if we see a candidate with File_valid input = ' don't this means that the earlier version of this candidate should be the most recent.
    An other problem is
    -> if we see a candidate with File_valid input = ' don't and no not all old records, then the current should be the last.


    Thanks for reading this post.

    Published by: user5495111 on July 23, 2009 13:37

    OK then, this query matches your output (with the exception of the rank column)

    select * from (
    select r.*
         , row_number() over (partition by r.candidate
                                  order by r.file_valid desc
                                      , r.date_submitted desc
                                      , r.version desc
                                      , r.ptsequence desc) rn
      from finalcand r)
      where rn!=1
      order by candidate, rn
    
    PTSEQUENCE  VERSION  CANDIDATE  DATE_SUBMITTED    FILE_VALID RN
    ----------- -------- ---------- ----------------- ---------- ----
    105         2        GD         23-JUL-2009       Y          2
    108         1        GD         23-JUL-2009       Y          3
    103         1        GD         23-JUL-2009       Y          4
    104         1        GD         23-JUL-2009       N          5
    107         2        GVR        23-JUL-2009       N          2   
    
    5 rows selected
    
  • Satellite Pro A120 - how to identify the sound card

    Hello

    don't know if you can help me on this one, I have more or less the same problem.
    Bit long-winded, but we broken rececently, very clever thieves, stole a number of point with my computer with disks of Toshiba bag. (LOL) the lap top was next to the bag on the desk, they left.

    Since then contracted a virus which means I had to completely format the hard drive and installed XP.

    No problem, but now I can not find the audio drivers right. Q. How can I identify the sound card on the top of the Tower?

    You n t know what sound chip has your laptop?
    On the Europe of Toshiba page you can find the drivers for this model of laptop.
    I can see that the Realtek sound card driver has been released and so I'm 100% sure that the sound chip was made by Realtek.

  • Qosmio G20: How can I identify the DVD Recovery CD?

    I work in a society where more is Toshiba Laptops. Unfortunately, all DVD-recovery are in the same place, and I don't know how can I identify the one for my laptop.

    I have a Qosmio G20.
    Any ideas?
    Thanks in advance!

    Hello

    > I don't know how can I identify the one for my laptop
    Each original Toshiba Recovery CD is labeled.
    There is a number and the model of laptop that is supported.

    You can compare the number on the CD with the number at the bottom of the laptop.

    All that s

  • Need to identify the model A100 to select the good BIOS update

    Good morning to all and thanks in advance for any whole made :-> assitance

    My question is this:
    How to identify the exact model of a Satellite A100 PSAAxx series laptop?

    Reason:
    I need to update the BIOS and I'm uninclined to simply apply the updates, I could get for fear of turning it into a brick.

    What I know:
    There is some time, my wife and I bought a used Satellite A100 - in good working condition, but warned that he has 'problems' with USB ports driver. The time has come to address the issue of the USB, and the upgrade of the BIOS seems to be a good starting point.

    At the time of purchase, the label with the model number and the number of harem on the bottom of the system was quite readable - unfortunately, this label has subsequently lost all 'tailor-made' (we know what the fields are called by all useful information has disappeared).

    It is a Toshiba Satellite A100 (I have discs recovery and thus marked user manual).
    The user manual specifies the model number PSAAxx.
    CPU: Celeron M 1.4 GHz
    RAM: 704 MB
    HD: 40 GBbyte
    Graphics card: ATI RADEON XPRESS 200 M Series
    BIOS: v1.20 2008-12-12

    Any suggestions gratefully received

    Peter Townson :->

    Hello!

    To identify what A100 you exactly, you can use Toshiba PC Diagnostic. If you have installed the laptop with the recovery disk, this tool is installed too.

    If you n t have PC diagnosis, you can also download:
    http://EU.computers.Toshiba-Europe.com-online decision-making supported Downloads & => Download drivers

    In the diagnostic tool you can see on the part number (basic information of category).

    Good bye

  • identify the generation for my iPod nano?

    I'm trying to refer to this table: identify your model of iPod - Apple Support

    to identify the generation of my iPod nano from Apple (online) was purchased in June 2014. However, on my Bill, all I get under "Product number" (instead of "model imbue") is PD477C/A ... which is probably a number valid in Canada only. (why are we still screwed to the Canada...)

    Does anyone have an idea of what it is (generation) or if there is another way to see maybe in iTunes when connected?

    Thank you

    Rob

    7th generation (latest version).

  • HP Pavilion G7 1070US: need help to identify the version of my laptop's HDMI port

    Hello!

    I'm trying to identify the version of my laptop's HDMI port. The reason for this is - a product that I'm shoping requires the version of HDMI 1.3 port and it does not support version 1.4. My laptop is HP Pavilion G7 1070US and product number is

    LF156UA #ABA

    Thank you for your help.

    Thanks for a quick and helpful response. That helped a lot.

  • identify the cartridge

    How to identify the cartridge HP *?  Shattered timе sticker. Just the serial number printed on plastc left.

    Initially it was HP131 or HP132. It works very well. It's the pair needs to be replaced.

    Hello

    Thus, if the cartridge has been reported in 92, then the one you need for the Russia is 132.

    Ciara

  • Need to identify the designation of port COM through BACK...

    I'm editting a program that sends and receives information to a device via a USB - serial adapter. Previously, the program has been run only on one pc which always use the same COM port when the device is connected. Scripts used with this program have been written to always specify this port. After having taken the device and connected to another pc, the pc allocates another COM port - this is a relatively easy task for me to go through the device management and identify the appropriate COM port, modify the script and get the device communicates with the pc. HOWEVER, in the future, communication must be maintained between the device and a laptop with any user.

    The program you are using may open a windows command prompt and run DOS commands. If possible, I would like to help you find a way to use BACK to identify the COM port used by the USB adapter so I can assign this port number for a variable to be used in scripts, creating their infallible to any user.

    Thanks for your time,

    Chris

    Hello

    To improve assistance to this subject, you can ask your question in the MSDN forums.

    http://social.msdn.Microsoft.com/forums/en-us/categories

  • Help identify the part CLX-3180

    Hi, I have a printer CLX-3180. He had a few small metal object stuck in it and my repair shop says that the part marked in red must be replaced because now he needs assistance to run (it does not correctly turn by itself). I really want to throw this printer just as it's a recent purchase and I have the new ink there. Could someone help me identify the part, possibly with the part number? Thank you!

    Hello

    This forum deals with HP products.

    I would say check with TeamViewer, they know probably their best product

    http://www.Samsung.com/us/support/contact

  • Identify the main hard drive on an HDX X 18 1103EA

    I seek to replace the main drive in my notebook, but how to identify the main drive, there are two here, with no brand identification who's who? Service guide deosn seem to make light, either...

    Hello

    Secondary and primary hard drives are located under the lid of the accessories. The main hard disk drive is located to the left disk hard bay, identified by the number "1" embossed on the base unit. The secondary hard drive is located in the right disc hard bay, identified by the number '2' embossed on the base unit.

Maybe you are looking for

  • When I will be able to import from Eudora to Thunderbird

    I downloaded Thunderbird. He gave me an option to import from Eudora, but it is grayed out. When this feature will be fixed?

  • How to increase the number of lines 'forward '.

    The number of lines to allow me to "pass" the address elements recently reduced to only 4. Previously, I had an endless places in which to place the forwarding addresses.

  • Start on Satellite BIOS password click on L9W Mini-B

    Hello everyone,I am now digging some time arround to find a solution to my problem. I have a 'locked' Toshiba Satellite click Mini (L9W - B) convertible. Is it now somehow a "starting password" on this subject.Im not sure if this is a BIOS/UEFI but I

  • Vista crashes when playing the lonely spider

    Hello Well Vista crashed again everything playing spider solitaire.  I checked the problems & Solutions in Control Panel and it is said that the problem was caused by the ATI graphics driver, and there is not at this time. I hope someone can find a s

  • Problems with updates on 3 and 23/3/24?

    My computer has not been run as smooth and having internet problems after that I installed two updates: update for windows vist for systems x 64 (KB2524375) [installed on 3/24] and update for windows vist for x 64 systems (KB2505189) [installed on 3/