How to find a column by sampling data?

Can any one help me to identify the columns
which are ssn by sampling the data in the database or to run a query/script against each table so that the result
will tell you that the data in a a particular column seems to be a ssn ?[I have identified the columns in tables
which has ssn  as there column names]. Please help...

You can use regexp to check the rows.
select  ssn from some_table
where regexp_like(ssn,'^[0-9]{3}-[0-9]{3}-[0-9]{4}$')
OR
with ssns as
        ( select '123-254-5455' ssn from dual
union all select '.23-254-5455' ssn from dual
union all select '1232545455' ssn from dual
union all select '12a2545455' ssn from dual
union all select '1x3-s54-5455' ssn from dual
union all select '123-254-54552' ssn from dual
union all select '0123-254-5552' ssn from dual
select ssn ,regexp_replace(ssn,'^[0-9]{3}[-][0-9]{3}[-][0-9]{4}$','VALID') xc
from ssns
SSN           XC
123-254-5455  VALID
.23-254-5455  .23-254-5455
1232545455    1232545455
12a2545455    12a2545455
1x3-s54-5455  1x3-s54-5455
123-254-54552 123-254-54552
0123-254-5552 0123-254-5552You can check how many valid ssn's are in a column
SS
Edited by: Sänjay on Jun 25, 2009 9:34 AM
Added my example cases

Similar Messages

  • How to find the table in which data from a structure sits

    Hi,
    I want to know how to find the exact table where data sitting in various structures during runtime are stored.
    For instance,in ME23N we have various tabs and data in those are held in various structures. This we can see by checking the technical setting of each field.
    I want to know in which table the data is actually stored for each field and how to find them.
    Any other means other than using "WHERE USED" option?
    Thanks
    CM

    After checking for technical field from the screen, when you reach out to structure, you can dbl click on the particular field's data element. From this data-element you can get to know in which tables it is used. Also if the data element refers to some master data field then you can check out its domain and in the domain you can refer the<b> value table</b> for that domain. This is what i will do if i am not sure about anything.
    Hope it will help a little.
    Jignesh.

  • How to find out each Cell having Data or Not in Excel File by Using WDJ

    Hi Friends,
    I have one doubt on WDJ.
    I have to Upload Excel File. Click on Upload Button in Excel file Data will move to One Bapi. This is I was done. But my Requirement is if any empty Cell in Excel That File not uploaded it display one error message Please upload Correct Excel File
    How to find out each Cell having Data or Not in Excel File by Using WDJ. Please tell me.
    By Using this Code I have Upload Excel File
    InputStream text = null;
         int temp = 0;
         //wdComponentAPI.getMessageManager().reportSuccess("filePath Vijay:::");
         try
                   File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());     
    FileOutputStream op = new FileOutputStream(file);
                   if (wdContext.currentContextElement().getResource()!= null)
                          text = wdContext.currentContextElement().getResource().read(false);
                             while((temp=text.read())!= -1)
                                  op.write(temp);
                                  op.flush();
                                  op.close();
                                  path = file.getAbsolutePath();
                                  //wdComponentAPI.getMessageManager().reportSuccess("Path Name :::::"+path);
         catch(Exception ex)               
                   ex.printStackTrace();
    But my Requirement is If excel having any Empty Cell that excel file not uploaded.How to do this...
    Regards
    Vijay Kalluri

    Hi my friend
    I would like to share you some APACHE APi´s that i use when i have to read excel files in Web Dynpro.
    JAR = poi-3.2-FINAL-20081019.jar
    Some Example:
    POIFSFileSystem fs;
    HSSFWorkbook wb;
    HSSFSheet sheet;
    String myMexican_ValueFromExcelis = "";
    try {
             fs = new POIFSFileSystem(new FileInputStream();
             // and select the cell "y"
            cell = row.getCell( 0 );
            myMexican_ValueFromExcelis = cell.getCellValue();  
    }cach(Exception e){
    REgargds

  • How to find the column name and table name with a value

    Hi All
    How to find the column name and table name with "Value".
    For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
    Any help is highly appricatable
    Thanks & Regards
    Srikkanth.M

    2 solutions by Michaels (the latter is 11g upwards only)...
    michaels>  var val varchar2(5)
    michaels>  exec :val := 'as'
    PL/SQL procedure successfully completed.
    michaels>  select distinct substr (:val, 1, 11) "Searchword",
                    substr (table_name, 1, 14) "Table",
                    substr (t.column_value.getstringval (), 1, 50) "Column/Value"
               from cols,
                    table
                       (xmlsequence
                           (dbms_xmlgen.getxmltype ('select ' || column_name
                                                    || ' from ' || table_name
                                                    || ' where upper('
                                                    || column_name
                                                    || ') like upper(''%' || :val
                                                    || '%'')'
                                                   ).extract ('ROWSET/ROW/*')
                       ) t
    --        where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
           order by "Table"or
    SQL> select table_name,
           column_name,
           :search_string search_string,
           result
      from cols,
           xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
           columns result varchar2(10) path '.'
    where table_name in ('EMP', 'DEPT')
    TABLE_NAME           COLUMN_NAME          SEARCH_STRING        RESULT   
    DEPT                 DNAME                ES                   RESEARCH 
    DEPT                 DNAME                ES                   SALES    
    EMP                  ENAME                ES                   JONES    
    EMP                  ENAME                ES                   JAMES    
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   PRESIDENT
    EMP                  JOB                  ES                   SALESMAN 
    9 rows selected.

  • How to find encrypted columns in oracle 10g database

    Hi,
    How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
    my question is apart from this is there anyother views or tables?
    Thanks..

    user602872 wrote:
    Hi,
    How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
    my question is apart from this is there anyother views or tables?Hmm not which I could find,
    SQL> select * from dict where lower(table_name) like '%encrypted%';
    TABLE_NAME
    COMMENTS
    DBA_ENCRYPTED_COLUMNS
    Encryption information on columns in the database
    ALL_ENCRYPTED_COLUMNS
    Encryption information on all accessible columns
    USER_ENCRYPTED_COLUMNS
    Encryption information on columns of tables owned by the user
    SQL>HTH
    Aman....

  • How to find the columns and tables used in a stored procedure?

    Hi,
    Can someone suggest how to find the columns and tables used within a stored procedure?
    Thanks
    VBK

    For example:
    SQL> create or replace
      2    procedure p1
      3      is
      4          cnt number;
      5      begin
      6          select count(*) into cnt from emp;
      7  end;
      8  /
    Procedure created.
    SQL> select  referenced_owner,
      2          referenced_name
      3    from  dba_dependencies
      4    where owner = 'SCOTT'
      5      and name = 'P1'
      6      and referenced_type = 'TABLE'
      7  /
    REFERENCED_OWNER               REFERENCED_NAME
    SCOTT                          EMP
    SQL> SY.

  • How to find if COLUMN DEFAULT VALUE is stored as metadata?

    Hello,
    I'm using Oracle 11g enhanced ADD COLUMN Functionality. Adding new columns with DEFAULT values and NOT NULL constraint no longer requires the default value to be stored in all existing records.
    Sometimes we change DB columns from NOT NULL with DEFAULT to NULL with DEFAULT. This operation "materialize" column default.
    Is there an easy way (Dictionary view) how to find, that COLUMN default value is stored as metadata or is "materialized" ?
    Thanks. Filip
    Oracle RDBMS version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Thanks for your suggestion, but it is not what i'm looking for :-(
    I don't need to find the default value, i need to know how is default value stored. It could be stored in 2 ways.
    1. "materialized" - prior to 11G (value is physicaly stored for every column)
    2. "as a metadata" - new 11G functionality (default is not physicaly stored and if you query the column DB transalte NULL value to defaut value)
    Now I would like to now if my column is type 1) or 2). How can I do it?
    Thank you.Filip

  • How to find unsued Transfer Rules and Data Sources for a Master Table...??

    How to find unsued Transfer Rules and Data Sources for a Master Table...?? My requirement is i need to delete those Transfer rules and Data Sources which are not in use

    Hi
    Go to manage of the Text or attirbute of the master data object, see what are being loaded daily from there and delete the remaining.
    Cheer
    Ans as expected, Please reward

  • OBIEE:How to display row/columns where no data is present in pivot results?

    I have a request from some team members to provide an OBIEE report of 7 teams and the number of open incidents for each team by week.
    I was able to create the pivot listing the teams vertically and the age (by week#: 1 week, 2 weeks, 3 weeks, 4 weeks & > 4weeks) horizontally.
    The dilemma I have is that of the 7 teams that have incidents tickets only 4 of them have data, thus only those 4 teams that have ticket data show up in my pivot. I would like to be able to reflect ALL 7 teams even if representing a dash or null value across the pivot for those teams that don't have data.
    Does anyone know if this is possible and if so, how would I do this? I've tried searching the internet and found out how to replace a null value with a dash in columns/rows when a cell is null. But not how to display an entire row (or column) where no data is present.
    Edited by: coutya on May 22, 2012 11:01 AM
    Edited by: coutya on May 22, 2012 11:02 AM

    You are correct; if there are no data at all, those teams won't show in a pivot table. NULLs or dashes only work if a particular column is null. There are two ways to accomplish what you wish. The first example I thought when I wasn't aware of being able to do a LEFT OUTER JOIN in Answers using the Advanced tab. The first method works nicely, though and is simpler to execute.
    Read my solution here:
    Re: Section Values showing NULL in Pivot
    To do the LEFT OUTER JOIN read this:
    http://gerardnico.com/wiki/dat/obiee/multiple_subject_area
    Both will get you what you want...

  • How to find that from which table data is coming in datasource?

    Hi friends
    I want to find that from which tables data is coming into datasource 2LIS_04_P_COMP,2LIS_04_P_MATNR..
    I have searched in forums.. I also have checked in sap.help.. but I didnt get any tablename in field "Table of origin"..
    Please tell me how can I find that data is coming from which table into these datasources..
    I dont want name of the setup tables.. I want name of the original tables (in R/3)which has data..
    Regards
    Swati

    Hi......
    For  data source 2LIS_04_P_COMP............MCAFKO, MCAFPO, MCCOMP are the R3 communication structures...........
    Check these commonication Structure in SE11............I think u will get the required information........
    2LIS_04_P_MATNR is Material View from PP/PP-PI ..........check this..........
    http://help.sap.com/saphelp_nw70/helpdata/EN/88/7fc73c0c52085be10000000a114084/frameset.htm
    Check this each field in SE11....from there try to find out these fields belongs to which table..........as I hav explained u in another thread..........
    May be the extractor is using these fields from different tables.....
    Regards,
    Debjani........

  • How to find a column name in tables

    Hello Guys,
    I need to find a column name "company_id"
    in all the tables in my schema. How can i dont this?
    Is there any view that search for coulmns in a table. Please help.
    Regards, Imran

    Questions about the dictionary are best answered by querying DICT.
    In this case
    select * from dict where table_name like '%COL%'
    Alternatively you can look in the Oracle reference manual for your version.
    The information is online, there is little need to ask around here.
    Sybrand Bakker
    Senior Oracle DBA

  • How to find function and SP from data dictionary?

    For example:
    create or replace package SPK_A is
    lv_empno number;
    lv_deptno number;
    function FUN_A(in_empno number) return varchar2;
    function SP_A(in_deptno number) return varchar2;
    end;
    Then, how can i to find FUN_A and SP_A from data dictionary.
    and mark the former is a function, the latter is a stored procedure.
    I have tried to use the following 2 views, but i cannot give me the answer.
    (1)dba_procedures: it can only find the sole function or sole stored procedure, which is not define in a package.
    and it can not distinguish between function and SP.
    For example, it can only find the function or SP as below:
    create or replace function FUN_OUT return number is
    begin
    null;
    end;
    (2)all_arguments: it can list all function or SP which has varibles, but can not distinguish between function and SP.
    Can anyone help me?
    Any ideas appreciated.
    Merry Chirstmas!

    Is this what you mean?
    SQL> connect test/test
    Connected.
    SQL> create or replace package SPK_A is
      2  lv_empno number;
      3  lv_deptno number;
      4  function FUN_A(in_empno number) return varchar2;
      5  function SP_A(in_deptno number) return varchar2;
      6  end;
      7  /
    Package created.
    SQL> create or replace function FUN_OUT return number is
      2  begin
      3  null;
      4  end;
      5  /
    Function created.
    SQL> select object_type, object_name from user_objects;
    OBJECT_TYPE
    OBJECT_NAME
    TABLE
    ABC
    PACKAGE
    SPK_A
    FUNCTION
    FUN_OUT

  • How to get this column (SYSDATE-CREATEDON DATE)

    I have a reporting requirement to get a column subtracting two date fields and result gets displayed in days.
        I have a notification number with CreatedON date field in my DSO. Now for notification age, I have to subtract SYSDATE(which is current day)-CREATEDON date(for Notification Number)
      AGE(in days) = SYSDATE - CREATEDON DATE
    Can anyone give me some suggestion on how to fulfill this requirement?
    Thanks in Advance
    N

    Hi,
    The steps in Query designer 7 are :
    1) Open your Query
    2) Go to Columns area and create a structure and under this strcuture create a formula by context menu.
    3) In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    4) Now select edit option from the context menu of the new varible :
    in general tab page take processing by <i>Customer Exit</i> and change the desription to FV1.
    in details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    5) Again ,In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    6) Now select edit option from the context menu of the new varible :
    In general tab page take processing by <i>Replace ment path</i> and change the desription to FV2.And Take 0NOTIFICATION as <i>reference Characterstic</i>.
    In the REplace ment path tab page , Attribute value for<i> Varibale represents</i> and tehn take CREATEDON as the <i>Attribute</i>.
    In details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    7) Now in te formula created in teh step 2  , take FV1-Fv2 as <i>Detail View</i>
    8) Write the code for FV1 in Cmod as below:
    DATA: L_S_RANGE TYPE RSR_S_RANGESID.
    DATA: L_S_RANGE2 TYPE RSR_S_RANGESID.
    DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
    DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.
    CASE I_VNAM.
    WHEN 'ZFV1'.
        IF I_STEP = 2.
             L_S_RANGE-LOW = sy-datum.
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT  = 'EQ'.
            APPEND L_S_RANGE TO E_T_RANGE.
          ENDLOOP.
        ENDIF.
    endcase.
    With rgds,
    Anil Kumar Sharma .P
    With rgds,
    Anil Kuamr Sharma .P

  • How to find the Last report run date

    Hello All,
    I have one ALV report.
    In that report i have to display the date on which the report was run last time.
    The user can run report both in backgroud as well as in forground.
    Cay anybody plz tell me how to find the date on which report was run last time.
    Thanks and Regards
    Sachin Yadav

    Hello Sachin,
    I agree with Thomas on this. That would be the simplest & fool-proof solutn. Alternatively, you can try to use the stmts: EXPORT/IMPORT TO DATABASE.
    Search in SDN you will find [similar posts|Get IP Address and Report Running Date and time;.
    BR,
    Suhas
    Edited by: Suhas Saha on May 18, 2009 3:44 PM

  • How to find table that store real data for field 'BETRG' ?

    1) datasource  0HR_PY_1 include field 'BETRG' in R/3 source system; extract structure HRMS_BIW_PY1 for datasource 0HR_PY_1, however structure is not used for stroing data. Question: how can we find table which store real data for the field  'BETRG'?
    2) If I want to add one type call department leader type which already defined in one enhanced HR table, to calculate the total amount using field 'BETRG'  according to department leader type. Should I enhance datasource  0HR_PY_1 by adding department leader type or create new view based on enhanced HR table and another table that include 'BETRG' data, also create new datasource based on this view later on?
    Thanks!

    Hi,
    Check this for Payroll Data (Transaction Data) 0HR_PY_1
    http://help.sap.com/saphelp_nw70/helpdata/EN/a5/94e8288eec11d4b2fb00010220c65f/frameset.htm
    The extractor for payroll results reads data from payroll cluster PCL2, not from standard tables.
    thanks,
    JituK

Maybe you are looking for

  • IMac won't switch to new user on logout

    I have an number of iMacs that are doing the same thing. When a user goes to logout, the iMacs will get to the default background and that is as far as they will go. They will not get to the login screen so that another user can login. Some of the co

  • My Acrobat 9 pro stopped working.  I do not have a hard copy of the download and need to be able to repair it.  How do I fix it?

    I purchased my Acrobat 9 pro as a digital download.  It just recently stopped working and I don't know how to repair it.  I need it up and running ASAP!!! Please help!

  • Reassign human task using tasklist application...

    Tasklist app have built in reassignment capability. We tried to move javascritpt functions from TaskRouting.jsp to our auto generated human task from. But when we want to reassign or delegate a task to other user fallowing error occurs. An error occu

  • Error Running patch 4440000

    I am upgrading my Ebiz from 11i to 12. I have done it serveral times but I am getting an error in my worker log I have never encountered Time when worker started job: Sun Sep 14 2008 02:03:28 Start time for file is: Sun Sep 14 2008 02:03:28 sqlplus -

  • IPhone 3GS not recognized as camera on Windows XP

    I connect my iPhone 3GS to my laptop to sync and it is not recognized as a digital camera and cannot download my photos to back up.  Rebuilt my laptop in the mean time and it recognized the camera on the phone, but when downloading the photos, it cra