How do I include those empployee numbers that are not 8 digits?

Hello all again.
My script currently doesn't find those employee numbers that are NOT 8 digits (some emp nos are 6, 7, 9) when doing comparisons. I've tried LPAD but it still doesn't find. Can anybody suggest a reason for this? I can post my whole script if you want but basically it doesn't match record in my temp table (SU_TEMPLOYEE_DETAILS):
  SELECT std_hire_date, std_last_name, std_sex, std_date_of_birth,
             std_email_address, std_emp_status,
             LPAD (std_employee_number, 8, '0') std_employee_number,
           --  std_employee_number,
             std_first_name, std_marital_status, std_middle_names,
             std_nationality, std_title, std_national_identifier,
             std_address_line1, std_address_line2, std_address_line3,
             std_address_line4, std_post_code, std_telephone_1, std_country,
                     std_location_id,         LPAD (std_supervisor_number, 8, '0') std_supervisor_number
      FROM   SU_TEMPLOYEE_DETAILS
       WHERE  std_employee_number = :p_emp_number..with the existing record in Production instance:
             SELECT DISTINCT per.person_id, per.business_group_id, per.last_name,
                      per.start_date, per.date_of_birth, per.email_address,
                     --LPAD (per.employee_number, 8, '0') employee_number,
                    per.employee_number,
                      per.first_name,
                      per.marital_status, per.middle_names, per.nationality,
                      per.national_identifier, per.sex, per.title,
                      padd.address_id, padd.primary_flag, padd.address_line1,
                      padd.address_line2, padd.address_line3,
                      padd.town_or_city, padd.postal_code,
                      padd.telephone_number_1, paas.assignment_id,
                      paas.assignment_number, paas.object_version_number,
                      paas.effective_start_date, paas.effective_end_date,
                      paas.job_id, paas.position_id, paas.location_id,
                      paas.organization_id, paas.assignment_type,
                      paas.supervisor_id, paas.default_code_comb_id,
                      paas.set_of_books_id, paas.period_of_service_id
                 FROM per_all_people_f per,
                      per_all_assignments_f paas,
                      per_addresses padd
                WHERE padd.person_id(+) = per.person_id
                  AND paas.person_id(+) = per.person_id
                  AND per.employee_number LIKE 'C%'-- :p_emp_number 
                      AND per.national_identifier = :p_ni_number
                      AND  REGEXP_LIKE(per.employee_number, '[[:alpha:]]');The Employee Number is 7 digits long (0000016). But I need the script to match its record where it may be 000016 or 00000016 in Production. Is this possible?
Many thanks for looking..
Steven

JackyWhite wrote:
My script currently doesn't find those employee numbers that are NOT 8 digits (some emp nos are 6, 7, 9) when doing comparisons. I've tried LPAD but it still doesn't find. Can anybody suggest a reason for this? I can post my whole script if you want but basically it doesn't match record in my temp table (SU_TEMPLOYEE_DETAILS):
The Employee Number is 7 digits long (0000016). But I need the script to match its record where it may be 000016 or 00000016 in Production. Is this possible? I would like to use the TRIM Function here rather than a simple LPAD (with hard coded length) especially if the length of the column std_employee number varies based on the leading zeroes. Something like:
SQL> WITH test_tab AS
  2       (SELECT '000016' col
  3          FROM DUAL
  4        UNION ALL
  5        SELECT '10000016'
  6          FROM DUAL
  7        UNION ALL
  8        SELECT '00000016'
  9          FROM DUAL)
10  -- "end of test data "
11  SELECT col, TRIM (LEADING '0' FROM col) changed_col_2
12    FROM test_tab
13  /
COL      CHANGED_
000016   16
10000016 10000016
00000016 16
3 rows selected.
SQL> variable param VARCHAR2(30);
SQL> exec :param := '00016';
PL/SQL procedure successfully completed.
SQL>  WITH test_tab AS
  2        (SELECT '000016' col
  3           FROM DUAL
  4         UNION ALL
  5         SELECT '10000016'
  6           FROM DUAL
  7         UNION ALL
  8         SELECT '00000016'
  9           FROM DUAL)
10   -- "end of test data "
11   SELECT col, TRIM (LEADING '0' FROM col) changed_col_2
12     FROM test_tab
13    WHERE TRIM (LEADING '0' FROM col) = TRIM (LEADING '0' FROM :param)
14   /
COL      CHANGED_
000016   16
00000016 16
2 rows selected.
SQL> exec :param := '016';
PL/SQL procedure successfully completed.
SQL>  WITH test_tab AS
  2        (SELECT '000016' col
  3           FROM DUAL
  4         UNION ALL
  5         SELECT '10000016'
  6           FROM DUAL
  7         UNION ALL
  8         SELECT '00000016'
  9           FROM DUAL)
10   -- "end of test data "
11   SELECT col, TRIM (LEADING '0' FROM col) changed_col_2
12     FROM test_tab
13    WHERE TRIM (LEADING '0' FROM col) = TRIM (LEADING '0' FROM :param)
14   /
COL      CHANGED_
000016   16
00000016 16
2 rows selected.
SQL> So your where clause will become something like:
WHERE TRIM (LEADING '0' FROM std_employee_number) =
                                          TRIM (LEADING '0' FROM :p_emp_number)Hope this helps.
Regards,
Jo

Similar Messages

  • How can I get rid of numbers that are covering my entire desktop, caused by right-clicking "Clean Up Selection" on an icon?

    How can I get rid of numbers that are covering my entire desktop, caused by right-clicking "Clean Up Selection" on an icon?  The Apple OS X Mavericks blue & green desktop is totally gone.  HELP!

    Here's a screenshot of my desktop, as of a few minutes ago:  http://lewgoodman.com/desktop.tiff

  • How do you add/use typekit fonts that are not edge web fonts?

    I am just trying out the new Muse CC 2014.1 (August) release and was keen to try the new font facilities.  As far as I can see that while I can now add other fonts for which I have downloaded web font files via the Self Hosted Web Fonts function, Typekit fonts that are not "Adobe Edge Web Fonts" are effectively unavailable?  Have I missed something.
    As an example I want to use the Proxima Nova web font family.  I have selected it on the type kit site, set them up to Sync via my Creative Cloud account.  So for example if I select a font in Photoshop CC or Illustrator, the Proxima Nova fonts appear. Even ok in Word for Mac.  They do not appear in Muse.
    To add them as self hosted web fonts, I would need to physically download the relevant fonts files and install them on my desktop using the OS-X font tool.  However as they are being sync'd via Creative Cloud this shouldn't be necessary should it?  Also I don't see an option for doing so on the typekit site.
    Any help or guidance would be very welcome.
    PS:  I seem to have a separate issue with the Creative Cloud app, which is not listing fonts under the Assets tab.  But I don't think that is related as they are working fine for Photoshop, etc.

    Hi David,
    I'm sorry that you ran into trouble with this. To add fonts from Typekit to your Muse website, you will want to use the web fonts path instead of desktop fonts.  (You can use a desktop font synced from Typekit in your Muse design, but it will exported as an image the same as any other system font.)
    There are a couple options for using Typekit web fonts in Muse:
    o) The Muse Insider wrote a post on how to insert the Typekit embed code from the Muse interface:
    http://museinsider.com/how-to-add-typekit-fonts-to-your-muse-site.html
    o) Or you can add the embed code to the Page Properties dialog within Muse, which will include it in the <head> of the page when you export your website. The steps are the same as this tutorial, but you will add the Typekit embed code to Muse instead of into your page directly:
    TYPEKIT | Adding fonts to your site
    Note that in either case the Typekit fonts will not be displayed in the Muse preview window. You'll need to publish your site to a server in order for the Typekit fonts to be loaded into the page.
    If those look like more coding that you are comfortable with, you might try one of the fonts which you can select from the font menu instead. Here are some that are similar to :
    https://edgewebfonts.adobe.com/fonts#/?xHeight=high&contrast=low&class=sans-serif&width=re gular
    We are also working on a more complete integration of Typekit with Muse in the future, but I can't say yet when that will be available.
    >> PS:  I seem to have a separate issue with the Creative Cloud app, which is not listing fonts under the Assets tab.  But I don't think that is related as they are working fine for Photoshop, etc.
    Do you see a "loading" icon in the tab (e.g. a blue spinner wheel)?  It sounds similar to this thread; you might try these suggestions:
    Re: Adobe Creative Cloud / Desktop App / Home Screen: Constant Spinning Wheel
    I hope that this helps; let me know if you have any other questions.  Best,
    -- liz

  • How to add video files to iMovie that are not present in photos ?

    i purchased iMovie yesterday for iPad and i am enjoying it a lot , but how to add my personal videos to edit that are not present in photos ? i m not a mac user but i hope soon i will get the budget to buy mac

    Put your videos in a folder and sync iPhone with iTunes, "Photos" tabpreviously selected "Sync photos" and checked the box next to "videos include" I understand you do not have Mac, but with a PC can do the same, with this you will reel and your videos can be edited withiMovie on your iPhone.

  • How do you delete songs on iTune that are NOT on the library?

    I got a new computer few days ago, and I downloaded iTune on my new computer today.
    I want to delete all my songs that are in my iPod Touch now, and want to buy other songs.
    I don't have any songs in my library at the moment, since there's no song in my new computer now.
    So I want to delete songs, but since I don't have any of those songs in the library, I can't delete them. (I can't delete them since they are not on the library.)
    Are there any ways I can delete songs that are NOT on the library?

    You don't want to keep the songs that are on your iPod touch, in your library?
    You can keep them in your library and not put them on the touch.
    Then you can purchase other songs and put those on the touch.

  • How can I delete stored email addresses that are not in my contacts

    Does any one know how to delete email addresses that are not in the contacts folder, with out completly wiping out my entire phone?

    Yes, just open mail and click on the window menu and select previous recipients, when the window opens start edit your email addresses.

  • TS1292 There are two numbers that are not visible in the middle of the code What can I do?

    There are two digits that are not visible in the middle of the itune code. How can I still access this card?

    Click here and request assistance, supplying as much of the code as you can.
    (74408)

  • How can I download my past purchases that are not in my icloud?  Somehow I lost songs that I purchased they say that the orginal files are gone but I did not delete them

    How can I download past purchases that are not in my icloud?  Somehow I lost songs it says that the orginal files can not be located.  They are still available in the store but it doesn't give me the option to download them.  I did not delete any songs or files but I am missing a lot of files

    The "missing file" error happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    If another application like Windows Media Player has moved/renamed the files then the chances are that subtle differences in naming strategies will make it hard to restore the media to the precise path that iTunes is expecting. In such cases, as long as the missing files can be found somewhere, you should be able to use my FindTracks script to reconnect them to iTunes. See this post for an explanation of how it works.
    If you have to resort to trying to pull back the library from your iPod see Recover your iTunes library from your iPod or iOS device.
    Note also that if iTunes has an entry for a song, even if that entry is broken, then it won't offer that track for download since it "thinks" you already have it. If you can't find the original files or recover them from a device, then you may need to delete the broken entries, close iTunes and reopen before you can access the past purchases.
    tt2

  • How Can I delete all the tracks that are not in my Itunes Library?

    I am runnig out of disk space and i just want to have more space. My files are located everywhere on my mac and I saw that I have a lot of songs that are in my itunes music folder and the same are in an other folder. I want to keep everything that is in Itunes and delete the rest out of my mac!
    Thanks

    You can select some files in iTunes then right click consolidate.
    Then delete the original files not in the iTunes media folder.
    This way you don't have to do it all at once.
    Note that when you add files to iTunes, they are copied into the iTunes media folder so anything you added in the past is already in the iTunes media folder. Consolidating wont do anything to those. Likely all you need to do is delete the original.

  • How do you transfer videos on imovie that are not showing up?

    so im doing a english project and i need to add in  some video clips that a friend  sent me in an email to my project on imovie. but they are not showing up, and they will not drag in. Help please

    You don't want to keep the songs that are on your iPod touch, in your library?
    You can keep them in your library and not put them on the touch.
    Then you can purchase other songs and put those on the touch.

  • How can i remove videos and music that are not on my ipad mini but are still taking up space and are showing that they are there even after i've deleted them?

    how can i remove videos and music that have been deleted from the ipad but are still showing in settings as still being on the ipad?

    I believe that I have the same issue with iPad Mini with Retina Display, iOS 8.1. No matter which way I delete videos from my iPad, they will still show as "deleted", yet the space is not cleared up. I tried restore and then a full restore (clean setup as a new iPad) and it still does this to me. I can solve it by doing a restore each and every time I download a video and delete it. Rather frustrating. Has been a problem since day 1 of iOS 8. I'm yet to try the power+home button reset. It may very well work, but I am surprised that a "fresh setup" of an iPad didn't resolve it from ever occurring.

  • How do you delete songs from iphone5, that are not in your iTunes library on the computer?! I have the spot unchecked where it says show all music and I still have songs on my iPhone that I want gone, but they're not in my iTunes library...HELP

    I have a iPhone 5 with the most up to date software and I have songs appearing on my phone that I've deleted prior too from iTunes on the computer. How do I remove them from my phone, I've tried the left to right swipe and that just plays the songs! :/ Can anyone help me, I'd be forever grateful if I didn't have to go back to the store! I went I today abc he unchecked the show all music and there's still songs I don't want on my iPhone! :(

    The answer to the question in the title of the thread is yes, but it is not necessarily a good idea. At some point you are likely to find you need to restore your iPod for one reason or another, or it could be lost, stolen or damaged. If your songs aren't on your computer, and backed up too, then you will be less than happy.
    tt2

  • Why does Siri not able to find phone numbers that are not listed in contacts

    What could be dragging my battery life down to less than eight hours per day with minimal usage

    Hi darceyam,
    I'm sorry to hear you are having these issues with iCloud Drive. If you are having issues accesssing your previous files, you may find the following article helpful:
    What if I don't see all my files at iCloud.com?
    Any documents that you've already stored in iCloud are automatically moved to iCloud Drive when you upgrade. iCloud.com will display these files in the new iCloud Drive app in addition to the iWork apps (Pages, Numbers, and Keynote) that you're used to seeing.
    If you don’t see your files in the iWork apps or in iCloud Drive, then make sure that you set up iCloud Drive on all of your devices.
    Get help using iCloud Drive - Apple Support
    Regards,
    - Brenden

  • History somehow set to private, how or can i retrieve the days that are not showing due to private setting.

    somehow my history was set to private by another user and now I need to find out how to restore this info for the days that it was set to private . there was very important sites that I had went and now my hdd crashed and i no longer have them stored what do i do ?

    In PB mode data is only kept in memory by Firefox and not saved to disk, so an undelete utility like Recuva won't help. It is possible that your firewall keeps a log of visited websites, so you can take a look there.

  • My account states I'm authorized 5 computers however I only have 2 computers that are working, how do you account for the 3 that are not working

    I have owned 5 computers which had iTunes loaded, however only 2 of the computers actually work.  My account states I'm authorized 5 computers, how do I update my account to indicate that.  The only option I saw was unauthorize all computers

    Mash,
    If a computer is authorized but is discarded withour deauthorizing, it continues to count as an authorized computer. 
    But, it is simple enough to "Deauthorize All" and then re-authorize just the ones that you are still really using.

Maybe you are looking for