How to Validate the Domain for a given email id. Is a valid or invalid

Hello Frndz,
I am trying to validate the domain of a given email as a valid or invalid using the below SQL Block. But the values are hard coded into it.
Please suggest me some way to validate the email id Domain dynamically, so that it can be identify that the domain exsists or not.
Please help me. Thanks in advance.
DECLARE
l_domain_pos VARCHAR2(50);
l_at_pos VARCHAR2(50);
BEGIN
FOR DOMAIN_CHCK IN (SELECT * FROM s_cnct_test WHERE PROCESSED ='N')
LOOP
BEGIN
l_at_pos :=substr(DOMAIN_CHCK.email_addr,instr(DOMAIN_CHCK.email_addr,'@'));
l_domain_pos := SUBSTR(l_at_pos,INSTR(substr(DOMAIN_CHCK.EMAIL_ADDR,instr(DOMAIN_CHCK.EMAIL_ADDR,'@')),'.'));
IF ((l_domain_pos ='.com') OR(l_domain_pos ='.net')OR (l_domain_pos ='.nic.in') OR(l_domain_pos ='.co.in')) THEN
UPDATE S_CNCT_TEST SET
DOMAIN_STATUS ='Y',
PROCESSED = 'Y',
NEW_COMMENT = 'VALID DOMAIN'
WHERE ROW_ID = DOMAIN_CHCK.ROW_ID;
ELSE
UPDATE S_CNCT_TEST SET
DOMAIN_STATUS ='X',
PROCESSED = 'N',
NEW_COMMENT = 'NOT A VALID DOMAIN'
WHERE ROW_ID = DOMAIN_CHCK.ROW_ID;
END IF;
COMMIT;
END;
END LOOP;
END;

Hi,
Try something like this
SQL> create table s_cnct_test(id not null primary key
                        ,email_addr, domain_status,processed, new_comment)
as
    select 1, '[email protected]', 'Z1', 'N', 'D1**************************' from dual union all
    select 2, '[email protected]', 'Z2', 'N', 'D2***************************' from dual union all
    select 3, '[email protected]', 'Z3', 'N', 'D3*************************' from dual
Table created.
SQL> create table valid_domain(domain varchar2(64) not null
                         ,constraint valid_domain_pk primary key (domain))
Table created.
SQL> insert into valid_domain(domain)
    values ('.com')
1 row created.
SQL> insert into valid_domain(domain)
    values ('.net')
1 row created.
SQL> insert into valid_domain(domain)
    values ('.nic.in')
1 row created.
SQL> insert into valid_domain(domain)
    values ('.co.in')
1 row created.
SQL> commit
Commit complete.
SQL> create function domain(pi_email_addr in s_cnct_test.email_addr%type)
   return varchar2
   deterministic
as
begin
   return substr(substr(pi_email_addr, instr(pi_email_addr, '@'))
                ,instr(substr(pi_email_addr, instr(pi_email_addr, '@')), '.'));
end domain;
Function created.
SQL> update s_cnct_test s
   set domain_status =
          nvl((select 'Y'
                 from valid_domain
                where domain = domain(s.email_addr)), 'X')
      , processed = nvl((select 'Y'
                 from valid_domain
                where domain = domain(s.email_addr)), 'N')
      , new_comment =  nvl((select 'VALID DOMAIN'
                 from valid_domain
                where domain = domain(s.email_addr)), 'NOT A VALID DOMAIN')
where processed = 'N'
3 rows updated.
SQL> commit
Commit complete.
SQL> select *from s_cnct_test
        ID EMAIL_ADDR     DO P NEW_COMMENT                 
         1 [email protected]  X  N NOT A VALID DOMAIN          
         2 [email protected]   Y  Y VALID DOMAIN                
         3 [email protected] Y  Y VALID DOMAIN                
3 rows selected.Regards
Peter

Similar Messages

  • How to get the Domain Name of recipient Email ID when the recipient in the Address Book

    Hi All,
    I am new in Outlook Development and I have stuck in a situation, please find below the situation:
    I want to get the recipient domain address when someone is sending the email. Now, the thing is that I am facing the issues when the Email Id is in the address book. For an example "John Smith @live.com" is the email ID but when this email is in
    the address book it shows "John Smith ".  I’m trying to read out the email address from an Exchange connected Outlook in time of sending the email.
    So, my question is how I can get the domain in this situation?
    Thanks in Advance..

    Hi,
    Based on my research, there is no way to change the behavior on Outlook side. Email addresses are resolved to user names by Exchange server which is expected by design.
    I'd recommend you post a new question in the Exchange forum to see if we can achieve the goal on Exchange side. For your convenience:
    https://social.technet.microsoft.com/Forums/office/en-US/home?category=exchangeserver
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to track the queries for a given info object

    Hello All,
    I have info object 0COORDER, I wan to know what are list of queries built on this particular info object
    Full points just for solution or suggestion
    varsha

    Hi
    This can be easily found in Meta Data Repositry. RSA1 --> Meta Data Repositry --> Choose the category Infoobject and search for your required infoobject, here you get following Info:
    1. Display Attributes of the Info Object
    2. Navigationla Attributes of the Info Object
    3. Queries in which they are used.
    4. Used by which MP,Cubes,DSO, Info Set , Transfer Rules etc.
    Regards
    Raj Rai

  • How to get start date of the period for a given date from cube

    I have a situation where i need to find the start day of the period for a given date. is there a way to know that. i want to use that in my report. i enter the date from my report(i have date parameter), depends on the date, i want to display the start day
    of the period. how can i write expression for that in my report?
    ram

    Hi ramprasad74,
    According to your description, you are using Analysis Services as a data source for the report, the cube has hierarchy: Fyear, FQuarter, FPeriod, fweek, Fdate. You want to add a date parameter to the report, after you changed value of the parameter, the
    report will return the first day of FPeriod.
    To achieve your goal, we need to add a parameter to the report, then use the parameter in mdx query. For detail information, please refer to the following steps:
    In the Report Data pane, right-click on a dataset created from a SQL Server Analysis Services data source type, and then click Query. The MDX query designer opens in Design mode.
    On the toolbar, click Design to toggle to Query mode.
    On the MDX query designer toolbar, click Query Parameters symbol. The Query Parameters dialog box opens.
    In the Parameter column, click <Enter Parameter>, and then type the name of a parameter.
    In the Dimension column, choose a value from the drop-down list.
    In the Hierarchy column, choose a value from the drop-down list.
    In the Default column, from the drop-down list, select a single value.
    Click OK. 
    In query designer dialog box, type the mdx query like below:
    with member [Measures].[FirstChild]
    as
    [Date].[Fiscal].currentmember.parent.firstchild.name
    select {[Measures].[FirstChild]} on 0,
    [Date].[Fiscal].[Date].members on 1
    from
    ( SELECT ( STRTOSET(@ParameterName, CONSTRAINED) ) on 0
    from
    [Cube]
    Here are relevant threads you can reference:
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/c7146ac3-40ea-4d53-b321-c707aebbd405/how-to-pass-date-parameter-to-mdx-query
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/fd12a865-bc90-4a65-af42-ce38a8cfa29b/pass-date-time-parameter-to-mdx-query-ssrs
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.

  • How to identify all the information for a given company code?

    Hi,
    Our company provides data migration services for SAP and other ERP applications. Our customers provide us the specifications for extractions and conversions. We use one or more 3rd party tools to extract data from legacy systems into text/Excel files. Customers use LSMW to load generated files.
    We just got an unusual request. This customer wants to get ALL the data from SAP for a given company code and dump into Excel. They would do some manual editing on the data and load it into a new SAP client.
    In the past, customers would be more specific in their requirements. For example, they will mention Materials, Customers, Inventory, etc. In this case, the customer simply wants ALL the data for a given company code.
    Q1. Is everything in SAP related to company code, either directly or indirectly? For example, can materials be filtered by company code?
    Q2. The tools that we use let us extract data from SAP using SQL-like queries. How do I identify ALL the tables that I would need for a given company code?
    My feeling is the customer themselves are not clear on what they really want. Perhaps they are expecting us to guide them.
    I would appreciate any thoughts that you may have.
    If there is a more appropriate forum for this question, please let me know.
    Thank you in advance for your help.
    Regards,
    Peter

    hi
    t001w is the master table for plants, u can see all plants in this table.
    regads:
    rajesh.k

  • How to find out the infoProvider for a given dimension table?

    Experts:
    In RSA1, I want to find out the infoProvider for a given dimension table.
    But I am not sure how to display the tables linked to a given infoProvider.
    Could you provide a way to display all tables linked to a given infoProvider?
    Thanks a lot!

    See, The dimension table starts with Dcubename1 and incremental Dcubename2 .... so on
    Ex.ZSD_C01 is your cube name
    Dim tables starts for this is /BIC/DZSD_C011 /BIC/DZSD_C012 ...
    Goto - LISTSCHEMA  - derive cube name from given dim table and enter cube name  - execute - will show you all the tables

  • How do I change which application is the (default) for a given file type?

    For .pdf files, I have set the application behaviour to "Always Ask", because sometimes I want to open the pdf, sometimes I want to save it. So far so good.
    Now, when I want to open the .pdf, I have added an application to the dropdown list, so now I have "Adobe Reader 9 (default)" and "okular".
    The problem is this: I *never* open using Adobe Reader. I always want to use okular, but Adobe Reader always appears first on the list, as it is the 'default'. This means I always have to click on the dropdown and select "okular", i.e. an extra step every time I want to open a pdf.
    How do I change which application is the default?

    Yes, I know that. That was the first sentence of my question, but it is not the problem I have.
    I want to change which application is the (default) for a given file type, and this cannot be done from the settings.

  • How to validate the fields  and how to display the error messagein presenta

    Hi,
    I am new to OBPM 10g, pls tell me how to validate the fields in a presentation.
    for example if we take login presentation if user enters his user name and password wrongle and submit the form. Then we need to display error message right side of the each field i.e user name and passowrd is wrong and try again.
    Regards
    jaya
    Edited by: 12345 on Aug 12, 2010 10:38 PM

    Hi Jaya,
    You can initially set the validation for empty values.. that is when the user dint enters any value and clicks on submit.
    for these vadliations you need to write a method and call it on submit button click!!
    secondly, you can validate for the format if required.
    thirdly, you can validate against a database for the credentials. For this you need to fetch list of usernames from database and search for user entered value in that list.
    Optimal query would be : if user name not null, query for pwd of the entered user name from database or file storage. if you dont get any value for pwd of given username, its incorrect user name. if you get some pwd value for username, then check against the one user entered in pwd field..
    Write all this logic in a method and call on submit button click event of the login form!!
    HTH
    Sharma

  • Get the Stock for a given Material no

    Hi,
         I'm an ABAP consultant, new to MM.
         I have a requirement - For a given Production Order I have to find the Material and respective BOM Explosion. Once that is done I have to get the Stock for those Materials [Child Materials].
    I have used AUFK and AFPO to get the material from the Production Order and Used MAST table to get the other details and passed it to FM - 'CS_BOM_EXPL_MAT_V2' - This gives me the Child materials.
    Now I want to know how can I find the Stock for a given Material. I want to get the Overall Unrestricted stock. Which Table do I have to use. Is there any standard Function Module [FM] or BAPI to get it.
    Please help.
    Thanks & Regards,
    Ashish

    I have gone through  the MARD table. I want to confirm - for a Material no there are more than 1 plant and for each plant there are more than storage location. So I have to add the Unrestricted Stock of all those to get the Full Unrestricted Stock.
    Please refer Transaction MMBE - I have to use that output.

  • How to calculate the number of sent/received emails of a certain domain

    Thank you for what you have helped me with!
    How to calculate the number of sent/received emails of a certain domain in a certain period? It is Messaging Server 5.2, Directory Server 4.2. Is there a log option for this?
    Thank you.

    Not sure where you find, "LOG_MESSSAGE_ADD". I don't actually find this option in the documentation.
    The domains that mails are coming from and being sent to are certainly logged in the normal mail.log, so why mess with additional logging options? If you're talking about "LOG_CONNECTION", I actually see no additional data that is useful to you.
    If you decide to change the option.dat, you do indeed need to
    imsimta cnbuild (note, it's not cnrebuild)
    imsimta restart
    If I were facing the same issue, I'd be looking at the log parsing perl script, and simply modifying it to do what I wanted.

  • How to change the color for HTML words in JEditorPane?

    Hi Sir,
    In the JTextPane , we could change the word's color by using:
    Style style = doc.addStyle("test",null);
    StyleConstants.setForeground(style, Color.red);
    doc.setCharacterAttributes(10,20,syle,true);
    we can change the text into red color,which range is from 10 to 30.
    But how to change the color for HTML words in JEditorPane?

    Hi,
    you can use an AttributeSet to apply the foreground color. Let's say, doc is a HTMLDocument, then SimpleAttributeSet set = new SimpleAttributeSet();
    doc.getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D"); would apply a color to a given AttributeSet. The AttributeSet with your color then can be applied to a selected range of text in a JEditorPane by   /**
       * set the attributes for a given editor. If a range of
       * text is selected, the attributes are applied to the selection.
       * If nothing is selected, the input attributes of the given
       * editor are set thus applying the given attributes to future
       * inputs.
       * @param editor  the editor pane to apply the attributes to
       * @param a  the set of attributes to apply
      public void applyAttributes(JEditorPane editor, AttributeSet a) {
        ((HTMLDocument) editor.getDocument()).getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D");
        editor.requestFocus();
        int start = editor.getSelectionStart();
        int end = editor.getSelectionEnd();
        if(end != start) {
          doc.setCharacterAttributes(start, end - start, a, false);
        else {
          MutableAttributeSet inputAttributes =
            ((SHTMLEditorKit) editor.getEditorKit()).getInputAttributes();
          inputAttributes.addAttributes(a);
      } Ulrich

  • How to validate the field when i am populating the data cursor to block

    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.

    902434 wrote:
    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
    If :quentity <0 then
    message('do not enter negative value');
    message('do not enter negative value');
    raise form_trigger_failure;
    end if;Why u open same thread again ? not closing one.. check this one
    </a>
    How to validate the field when i am populating the data cursor to block
    Hopes this helps
    If someone's response is helpful or correct, please mark it accordingly.

  • How to validate table entries for that table

    i hav created one ztable se11.how to validate table entries for that table

    hi,
    create foreign key relation ships
    do the following way
    create a check table with key fields  the fields which you want to check
    create a foreign key relations with that table
    the procedure is as follows
    To create your check table:
    Begin at the Dictionary: Initial Screen.
    Type the table name in the Object Name field.
    Choose the Tables radio button.
    Press the Create button. The Dictionary: Table/Structure: Change Fields screen is displayed.
    Type a short text, choose delivery class A, and tickmark Tab. Maint. Allowed.
    Type the field and data element names at the bottom of the screen.
    Tickmark both fields to indicate that they both form the primary key
    Press the Save button on the Standard toolbar. The Create Object Catalog Entry screen appears.
    Press the Local Object button. You are returned to the Dictionary: Table/Structure: Change Fields screen
    Press the Technical Settings button on the Application toolbar. The ABAP/4 Dictionary: Maintain Technical Settings screen is displayed.
    In the Data Class field, enter APPL0 (APPL0 with a zero, not APPLO with an alphabetic O).
    Enter 0 (zero) in the Size Category field.
    Press the Save button.
    Press the Back button. You are returned to the Dictionary: Table/Structure: Change Fields screen.
    Press the Activate button on the Application toolbar. The message "was activated" appears in the status
    bar and the Status field contains the value Act..
    Choose the menu path Utilities->Create Entries to enter data into your newly created check table. Enter six rows with land1 values of US, CA, DE, IT, JP, and AU.
    Foreign Key Creation Procedure
    To create a foreign key:
    Begin at the Dictionary: Initial Screen.
    In the Object Name field, type the name of the table that is to contain the foreign key .
    Choose the Tables radio button.
    Press the Change button. The Dictionary: Table/Structure: Change Fields screen is displayed.
    Position your cursor on the field that is to become the foreign key
    Press the Foreign Keys button on the Application toolbar. The Create Foreign Key screen will be displayed
    Type a description of the foreign key in the Short Text field, for example, Country Code validation.
    Type the name of the check table (-t005) in the Check Table field, or click on the down-arrow and choose it from the list.
    The Change Foreign Key pop-up appears. It states Check table name was created or changed. Generate a proposal for field assignment? Press the Yes button.
    You are returned to the Create Foreign Key screen. The check table field names and the foreign key field names are displayed. (The check table field names are -t005-mandt and -t005-land1. The foreign key field names are -lfa1-mandt and -lfa1-land1).
    Press the Copy button. You are returned to the Dictionary: Table/Structure: Change Fields screen and the message "Foreign key was transferred" appears in the status bar. The Status fields contain the values Revised and Not saved.
    Press the Activate button on the Application toolbar. The message "was activated" appears in the status bar. The values in the Status fields are now Act. and Saved.
    reward if helpful
    prasanth

  • How to validate the warranty of my iphone 5 where I live, in Caracas, Venezuela

    How to validate the warranty of my Iphone 5 in Caracas, Venezuela. I have problems with the start button and the phone is unlocked one. I found only service for all Apple products except Iphone5, What can I do?

    I'm not sure what you're asking.
    You can find out if your phone is under warranty by entering the serial number here: https://selfsolve.apple.com/agreementWarrantyDynamic.do
    If you want to know if you can get it serviced in Venezuela... that depends on where you purchased it.  The warranty is NOT international. It can only be serviced in the country where it was originally sold.
    What is the model number in Settings>General>About?

  • How  to validate the mandatory fields in the view in WDA?

    Dear experts,
                            Iam new to WDA. i just want to know how  to validate the mandatory fields in the view in WDA?please refer any documents for validating the mandatory fields.
    Regards,
    murthy.
    Edited by: Murthy Ganti on Jul 13, 2009 2:31 PM

    Hi,
    Firstly goto view->select the element that you want to make mandatory and set the State property to required.
    Secondly place the below code in the WDDOBEFOREACTION
    DATA: l_view_controller TYPE REF TO if_wd_view_controller.
    * Get view controller
      l_view_controller = wd_this->wd_get_api( ).
    * Check for mandatory attribute
      cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
      EXPORTING view_controller  = l_view_controller
                display_messages = abap_true
    Regards,
    Radhika.

Maybe you are looking for

  • Problem running putty.exe in a seperate thread

    Hi All - I have an issue when using a new thread to run an external .exe file (Putty in this case) When I don't use a new thread Putty will start and stay open and let me do what I need to as normal, however it then hangs the rest of the application

  • Delivery Notification Details Copy to billing Document in 3rd Party Process

    Hi Expert we has been configured third Party process , but we not doing delivery process. our vendor directly delivered to customer, then we need to some of shipping details for the customer invoice , please give us to proper solution for this scenar

  • Is my DVD/CD drive dead?

    I just burned a DVD-R and usually I can see the disc show up on my desktop and in Finder after it's done burning. This time I don't see it anywhere. I can pop the disc into my MacBookPro and it reads fine. Is there a way to test the drive in my MacPr

  • Can't establish VPN on windows client to OSX server

    Hi everyone, I'm stuck for a while now with a very annoying problem. I can't establish a VPN connection on a windows client to a OSX Server. It worked fine while we had OSX server 10.6. We recently updated to 10.8 and got this problem. I know some of

  • BSP link to Workflow task after transport - trans BDLSS

    I was able to call a BSP from SAPGUI inbox (trans SBWP) by doing the necessary config in transactions WF_HANDCUST and WF_EXTSRV - generate my task from WF_EXTSRV, etc.  The task was generated as a local object but I converted this to a transportable