How to check the value of a string is numeric, alphanumeric or characters?

Hi all
I have a task to validate an employee ID, assume that the employee Id is E121212. Now according to the validation rule, I need to check "the first letter of the employee Id is a character and rest are numbers." How can I do this? Please answer.



Thanks and greetings
Marie Laurence

Hello

You can opt for regexp_like in this case. See the code below

with data as (
  select 'E121212' s from dual union all
  select '121212' from dual union all
  select 'EE121212' from dual union all
  select 'EE1212EE' from dual union all
  select 'É121212' s from dual
)

select
*
from data
where
regexp_like (s, '^[A-Z]\d+$')

S
E121212 

^ [A-Z] means that, at the beginnign (^), should be only between A - Z characters, uppercase. If you want to add lowercase letters, you can easily replace it [A-Za-z]. \d is a symbol for the numbers and + means it must complete at least one or more of her. $ means the end, so he stayed there until the end but nothig figures.

If yoou want characters as allowed, you can change the character class to [: alpha:]

select
*
from data
where
regexp_like (s, '^[[:alpha:]]\d+$')

S
E121212
É121212 

concerning

Published by: chris227 on 26.07.2012 00:53
fix

Tags: Database

Similar Questions

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • How to check the value of Disqualification working correctly?

    Hello

    I have problems using the processor to check the value in Disqualification. I want to check the customer name field for how many names contain 'TEST' in them. Here are the steps I follow, I hope that someone can identify where I'm wrong:

    1. Add checking the value

    2. in the ATTRIBUTES tab, add "Customer Name" as the field of Validation

    3. in the OPTIONS tab, add 'TEST' as against value to compare files, choose "is equal to", as the comparison operator, select 'Yes' to Ignore Case.

    In reviewing the data, I see many instances where TEST is in the name of customer - but the value record tells me that there is no example of this.

    Have I missed something obvious/fast?

    Thank you!

    Checking the value does not have a check Contains. Use the list check with the Contains option for this.

    You can press F1 on each processor for its help page if you are not sure about what he does.

    Mike

  • How to check the value of the space of the tablespaces and tables when errors occur?

    Hi Experts,

    For example, lets say we get ORA-01653: unable to extend table of error. How to check the size of the table and a tablespace? And how understanding is full?

    Thanks for your help

    Hello

    Select df.tablespace_name "Tablespace"

    totalusedspace 'Used MB',

    (df.totalspace - tu.totalusedspace) "MB free.

    DF. TotalSpace 'Total MB. "

    round (100 * ((df.totalspace-tu.totalusedspace) / df.totalspace))

    "PCT free."

    Of

    (select nom_tablespace,

    Round (Sum (bytes) / 1048576) TotalSpace

    from dba_data_files

    Group by tablespace_name) df,.

    (select round (sum (bytes) /(1024*1024)) totalusedspace, nom_tablespace)

    from dba_segments

    you group by tablespace_name)

    where df.tablespace_name = tu.tablespace_name

    and df.tablespace_name = "";

    For example, lets say we get ORA-01653: unable to extend table of error. How to check the size of the table and a tablespace? And how understanding is full?

    Is to say clearly to the question (you can let us know what you have understood so we can fix)

    [oracle@machine1 ~] $01653 oerr ora

    01653, 00000, "impossible to extend %s.%s table by %s in %s tablespace»

    * Cause: Failed to allocate a certain measure the required number of blocks for

    a segment of the table in the specified tablespace.

    * Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more

    storage of files indicate.

    -Thank you

    Pavan Kumar N

  • How to check the values in multi-record block. ?

    Hello

    I'm new to forms. I have the field titled "Comments" in the block of multi-record. I have a button called "reject". Reject button is in the control block. If I press the button reject, field comments must be entered in one of the record. Otherwise, he should tell message. How to check the multi-record block. ?

    Pl.Help.

    Thanks in advance.
    Mano

    Mano,

    Add NEXT_RECORD just before the END of the LOOP.

         GO_BLOCK('');
         FIRST_RECORD;
         LOOP
              IF NVL(:., ' ' ) = ' ' THEN
                   MESSAGE('');
                   RAISE FORMS_TRIGGER_FAILURE;
              END IF;
              EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
              NEXT_RECORD;
         END LOOP;
    

    Kind regards

    Manu.

    If my response or response from another person was helpful, please mark accordingly

  • How to check the value of the main forces?

    Run the following command:

    sure emctl console - self_signed-key_strength 1024

    But, how to check if this value has been updated correctly?

    Thank you

    Hello

    You can see the key_strength of the following navigation:

    From the browser to work, enter the URL for the console.
    There should be a lock next to the url of a red cross next to him.
    Click on the padlock (see site information)
    Click on "certificate information".
    Click on "Details".
    Scroll down to the public key
    they must be RSA(1024 bits) if the command changed successfully or he'll tell RSA (512 bits).

    Thank you
    Vincent

  • How to get the value of a string

    I have a problem where I am suppose to determine the value of a

    variable.

    However at the time of the design, I don't know the name of the variable.

    During execution, the name of the variable will be given and based on the

    given the name of the variable, I need to find the value of the specified

    the name of the variable.

    DECLARE

    NOM_DE_VARIABLE VARCHAR2 (1000);

    VARIABLE1 VARCHAR2 (1000): = 1;

    VARIABLE2 VARIABLE2 (1000): = 2;

    BEGIN

    NOM_DE_VARIABLE: = 'VARIABLE1 ';

    END;

    In the example above of the VARIABLE_NAME value is 'VARIABLE1 '.

    That's why I need to return a value of '1'.

    And if the VARIABLE_NAME is 'VARIABLE2', then the return value

    would be '2'.

    I know that this can be done using simple if else, however if the number of

    Variables is unknown or very large.

    So if on the other would not.

    Please advise, thank you

    The instinctive reactions are WTF!

    This is NOT how a codes in ALL languages - address variables directly and dynamically.

    But in PL/SQL, horribly enough, can be done using associative arrays.

    SQL > declare
    2 type TVariableContainer is table of indexes varchar2 (4000) by varchar2 (30);
    3
    var 4 TVariableContainer;
    5 varName varchar2 (30);
    6 start
    7 put variables into the container
    8 ('variable1') var: = 1;
    9 ('variable2') var: = 2;
    10
    11 set the name of a variable
    12 - a variable in the container
    13 varName: = 'variable1 ';
    14 dbms_output.put_line ('varName "variable1" variable value");
    15
    16. now solve this problem by assigning the
    17 - value of container that him
    18 varName: = var (varName);
    19 dbms_output.put_line (' varName is value ['| varName |']) ' );
    20
    21 - repeat
    22 varName: = 'variable2;
    23 dbms_output.put_line ('varName variable 'variable2' value');


    24 varName: = var (varName);
    25 dbms_output.put_line (' varName is value ['| varName |']) ' );
    26 end;
    27.
    varName variable value "variable1".
    varName is value [1]
    varName variable value "variable2.
    varName is value [2]

    PL/SQL procedure successfully completed.

    SQL >

  • How to check the values of the view object?

    Hi all

    I created a new object view by right-clicking my module of the application. Now when I try to retrieve values

    the attributes of the view object, I get null pointer exception. How can I check if the view has

    some values inside or not manually by using the select statement? I'm trying to find the view in my database to the database browser

    but he was not there. Kindly help me out in the present.

    Thank you
    Flavian.

    Published by: 887737 on October 19, 2011 12:53 AM

    Hello
    Make a right click on the application module (yourAM in the model project) and press Run, then you can check if your ViewObject works or not.
    Note:
    Typically create viewObject using based EO or query based how did you create viewObject
    See:

    http://download.Oracle.com/otn_hosted_doc/JDeveloper/1012/BC4J/intro/bc_avo.html
    http://www.adftips.com/2010/09/ADF-Model-creating-view-object-vo.html

  • How to check the value (if it is null or not) in the application process

    Hello

    I click on a particular record to access the home page of my search after go touch, but I need to check a validation of NULL at this point, if a particular column is null, then I need to make it false.
    My column type is BLOB.

    Can someone suggest me how to find whether or NOT this column is NULL.


    Thank you
    Mahesh

    Published by: user8996062 on August 25, 2010 10:35

    Mahesh

    If you receive the null pointer exception to

    XxafpEepStageRebateHdrVOImpl vo = (XxafpEepStageRebateHdrVOImpl) am.findViewObject ("XxafpEepStageRebateHdrVO1");

    This means that you not give the good instance of vo. Do something please post your VO.xml and AM.xml files.

    Thank you
    AJ

  • How to check the value of field in the controller

    Hi all

    I have an obligation to check if the field entered in invAmount is null or zero. Vo.getinvAmount () returns a number.
    How can I check to see if he has a 0.00? My code is in the controller.
    I tried some conversions using number inv = (Number) vo.getInvAmount (); and methods doubleValue()
    but no luck.

    If (inv = 0)
    {

    }

    but it gives errors.
    Thank you
    Shankar

    For this pseudocode

    (IF (CurrencyCode "EUR") AND (invAmt = Null or invAmt = 0))

    Simply write

    If ("EUR".equals (CurrencyCode) & invAmit! = null & invAmt.intValue () == 0)

  • How to check the length of a string?

    I want to basically create a < cfif > statement that said:

    cfIf #variable # is = to 8 length

    result

    cfelse

    result

    I've tried a few things, but none seems not to work. can someone help me with what it might look like?


    result Yes

    result no

  • How to connect the value of the input string to numeric values

    Hello

    I'm trying to figure out how to connect the value of unique user input string to numeric values. Basically I want the user to enter the name of a gas that I have a list for (I think I put the list of gases in a table >). Then I want to match numeric values 2 'a' and 'b', according to which gas, name of the user has set. These 'a' and 'b' values will be automatically matched with the name of the gas in a list that I put. For example, hydrogen gas has the value 3 for "a" and 4 for "b. when the user puts the ' hydrogen' name in a string constant, automatically 'a' and 'b' must be issued.» I have connect a and b to a formula

    Thanks for any help

    Hello

    It is perhaps not exactly what you are looking for, but perhaps you could use the enumerated data type and the array of clusters of points (a, b).

    Look at the VI I enclose.

  • How to get the value of a variant as a string

    I have an existing codebase, which transmits the values of the user interface to business logic as variants. I was prompted to connect all values passed in this way in a text file. I'm trying to figure out how to get the data as a string to a Variant value without having to deal on the type for the data descriptor. The flag variant the fact, so I think I can, too.

    Anyone know how?

    Thank you, all! I decided to use the XML approach:

  • How to change the value of string clustered, to implement using the node value of property instead of writing directly on the flow of data or using the variable

    new to labview :-) and I have a problem when I want to change the value of a string in bunches, and I want to implement this using the node value of property instead of writing directly to the stream or by using the variable, enclosed is the picture.   No matter, I have change in cluster (control) or value of Popery out (indicator) cluster, the value (sensor 7) dataflow keeps unchanged even I gave the new value by value of property node. Thank you to give me some advice about this.

    Hi GerdW

    Thanks a lot for your answer. The reason I'm stubbornly tring to break the flow of DATA is: we have a test system that have about 100 screws, they have a few connected flow, some of them will be unbundling a cluster dataflow chain to check the value in order to make the different cases.  Now I want to insert user event by changing the control and influential cases during run time.

    As I initially uses a global variable (to control cases) instead of unbundle string data flow, it works well.  But then, I found there are a lot of screws that are using the string unbundle.  One of the 'lazy' means, I tried is to change the value via the property node (because that way, I did not need to find all the places where using the unbundle string and replace them with the global variable), then I noticed a problem with "dataflow", the value in the stream of cluster in fact will not be changed by changing the value of the property node.

    I did a test with VI simple (like the picture in last post), and after reading your advice, I tell myself that I need to understand the concept of "DATAFLOW" in labview, it seems that my "lazy" way can not work in this scenario.

    I have attached the criterion VI here, have you furthur suggestions on what I can do in this case?

    Mant thanks!

    Minyi

  • How to check the page dirty with default values existing in viewObject?

    Hi all

    I use JDeveloper 11.1.1.4.

    I have two pages in my application. I am browsing for page2 page1.

    Before opening page 2 I created new line page 2 notice of object using method 'Create Insert()' with some default values by using the ViewRowImpl class.

    My problem is that I have a button to return to Page 2. If I click the back button, then check the Application module is dirty or not.

    But it always shows AM is dirty due to I'm setting some default values in ViewRowImpl. If I avoid the default values in ViewRowImpl then AM dirty check works fine.

    My Question is how to check the AM (or) dirty Page with default values in the object view?

    My bean Codes:

    Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DataControl dc = bindings.findDataControl("AppModuleDataControl");

    ApplicationModuleImpl am = ((ApplicationModuleImpl) dc.getDataProvider ());

    If (am.getDBTransaction (.isDirty (()))

    {

    return "Page is dirty."

    }

    My Jspx Codes:

    < af:commandLink id = "cl6" text = '2 '.
    shortDesc = "Add Row in Page2"
    actionListener = "#{bindings." Action CreateInsert.execute}' = 'Edit' >

    Thank you

    David...

    see this

    http://www.techartifact.com/blogs/2013/11/how-to-check-ifdirty-is-modified-for-view-object.html

    http://www.jobinesh.com/2011/05/checking-for-dirty-data.html

Maybe you are looking for

  • Help with authentication error [R0107005]

    OS X 10.10.1 and Thunderbird 31.4.0. I have two accounts with my ISP (Time Warner). Both use the same password. Suddenly, I am unable to send one of these accounts (works well for months). There has been no change before this problem. After that the

  • Keyboard not repeat when key held down.

    How can I get my wireless keyboard to repeat the letters when the hold key for example 1000000000000000000000. Seems to be a common fault from what I've read. Best regards, John

  • Is HP ENVY 15 Notebook PC t-j100 - available in AUS?

    I've been Googling for ages re a Christmas gift for my son (nothing like leaving toward the end) and I love the HP ENVY 15 t-j100 Quad Edition Notebook PC as shown http://shopping.HP.com/en_US/Home-Office/-/products/laptops/HP-envy/E2E34AV?HP-envy-15

  • Adobe Lightroom CC crashes with el Capitan, who else?

    While filming for customer happens about 15 times a day. Usually occurs with the tethered shooting, probably more often when using a grid overlay on the picture. Also happens when you move a folder from one place to the other. ATTENTION: also, you lo

  • Windows 8.1 kills HP Apps

    Hello I'm new here I just wanted to know if anyone has had the same problem. I have a HP Envy 15 "Touchsmart I don't got it for a few months now, but after do the upgrade of Windows 8 - 8.1 all HP apps are now empty and When I click on them I get a m