Invalid number error when trying to convert a varchar2 to a number.

I need to extract the middle four numbers from a varchar2(12) and then convert it to a number. The middle four are numbers but the first four can have letters. I've tried
TO_NUMBER(substr(wptk.ext_wo_num,5,4))
TO_NUMBER(LPAD(wptk.ext_wo_num,5,4))
substr(TO_NUMBER(wptk.ext_wo_num) ,5,4)
cast as number
I need to get rid of any 0 that are at the beginning of the four numbers. Some of the data has no 0 and some can have up to three 0 at the beginning. Is there a way to do that?
thanks.

user10426897 wrote:
I came back with 56 rows that look like this 1127-0651-E1. I am trying to translate an ingres view into Oracle that has this in the select statement: INT4(LEFT(TRIM(RIGHT(wptk.ext_wo_num,8)),4))You could use regular expressions...
SQL> with t as (select '065101412354' as num from dual union all
  2             select '065106523237' from dual union all
  3             select '065206523238' from dual union all
  4             select '065606542356' from dual union all
  5             select '080101410218' from dual union all
  6             select '080102520218' from dual union all
  7             select '080106020218' from dual union all
  8             select '080201120219' from dual union all
  9             select '080601111214' from dual union all
10             select '080801351216' from dual union all
11             select '080802511216' from dual union all
12             select '10000133013' from dual union all
13             select '10000133SC3' from dual union all
14             select '10000133SP4' from dual union all
15             select '10000211011' from dual union all
16             select '10000241011' from dual union all
17             select '10000601S29' from dual union all
18             select '10000601SC1' from dual union all
19             select '10000601SH2' from dual union all
20             select '10000601SP2' from dual union all
21             select '10000602A11' from dual union all
22             select '10000602A50' from dual union all
23             select '10000602A54' from dual union all
24             select '10000602A59' from dual union all
25             select '10000602C06' from dual union all
26             select '10000602E67' from dual union all
27             select '10000602M00' from dual union all
28             select '10000602M01' from dual union all
29             select '10000602M07' from dual union all
30             select '1127-0651-E1' from dual)
31  --
32  select num, to_number(regexp_replace(num,'^.{4}-?([0-9]{4}).*$','\1')) as num_num
33  from t
34  /
NUM            NUM_NUM
065101412354       141
065106523237       652
065206523238       652
065606542356       654
080101410218       141
080102520218       252
080106020218       602
080201120219       112
080601111214       111
080801351216       135
080802511216       251
10000133013        133
10000133SC3        133
10000133SP4        133
10000211011        211
10000241011        241
10000601S29        601
10000601SC1        601
10000601SH2        601
10000601SP2        601
10000602A11        602
10000602A50        602
10000602A54        602
10000602A59        602
10000602C06        602
10000602E67        602
10000602M00        602
10000602M01        602
10000602M07        602
1127-0651-E1       651
30 rows selected.
SQL>

Similar Messages

  • Error when trying to convert excel files to pdf

    I'm getting the following error when trying to convert .xls and .xlsx files to pdf, using the "Create PDF" option:
    Error message from the primary converter:
    ALC-PDG-010-012-PDFMaker reported an error while printing the document.
    Word, Powerpoint and Text files convert without any issues. Also I'm able to opent the excel files and convert them to pdf using the acrobat option in excel.
    Livecycle Version: 10.0.2, GM
    MS Office Version: 2007
    Any help would be appreciated. Thanks in advance.
    Regards,
    Suhail N.

    It is always difficult when you need to convert multiple xls files to pdf or multiple sheets to pdf. If you have a single file to convert then the best method would be to copy your data to doc file and then convert it into PDF . If you have multiple files to convert then it is really difficult to convert all the files manually. Then the better method would be to use converter tool to convert excel to pdf . By doing this you can convert many files in just few seconds.

  • I'm getting a 9041 error when trying to convert files to AAC -- any ideas on how to fix it?  the files files in iTunes show up as Apple Lossless but i can't put them on my iPod

    i'm getting a 9041 error when trying to convert files to AAC -- any ideas on how to fix it?  the files files in iTunes show up as Apple Lossless but i can't put them on my iPod

    "I have been able to convert to AAC by first converting to AIFF  and then to AAC. This is a pan though."
    this worked for me.
    thanks.

  • I receive an error when trying to convert PDF to word.  Pls help, I have a paid acct.

    I receive an error when trying to convert PDF to word.  Can someone advise on how to resolve?

    "an error" really doesn't tell us much.
    Assuming that you use the ExportPDF online service, I suggest that you Contact Customer Care - click on the Still need help? button to chat or talk with an agent.
    [topic moved to ExportPDF forum]

  • Please help.  Keep getting a conversion error when trying to convert a PDF to a .docx. Advice?

    Please help.  Keep getting a conversion error when trying to convert a PDF to a .docx. Advice?

    Sara,
    Please see my answers in bold below.
    What browser are you using? Try clearing the cache, or using a different browser. N/A
    Are you converting from within Reader, or directly via the ExportPDF website. Within Reader.I disabled the OCR and this did not work either. Try converting from within Reader, and disable OCR as detailed in this document: How to disable Optical Character Recognition (OCR) when converting PDF to Word or Excel.
    Are you on a networked computer? Make sure that there aren't any firewall/proxy settings that are preventing you from uploading files to the Internet. Not having problems uploading the file--that works fine.
    Make sure the file is within the file-size limit of 100 MB. It is <40.
    I get the error message, "File failed to be converted using Adobe ExportPDF online."
    Thanks for your help in advance.

  • ORA-01722: invalid number error when trying to pass a list of values

    Gurus
    We are using a function like so
    The usage for the function below is
    Select fn_st_bb_nm_uc (‘1232131312, 123213312’) from dual;
    SQL> /
    Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual
    ERROR at line 1:
    ORA-01722: invalid number
    It’s giving an invalid number error. When we pass one value it is working fine but when we pass a string of values it gives this error. I have opened an SR around this but would greatly appreciate your help
    Acc_blackbar is the table and acc_blkbr_id is of type number.
    FUNCTION fn_st_bb_nm_uc (pBB_ID_LIST VARCHAR2)
    RETURN VARCHAR2 IS
    vspcm_typ_nm_uc VARCHAR2 (2000);
    CURSOR stname
    IS
    SELECT distinct st.spcm_typ_nm_uc
    FROM
    acc_blackbar abb,
    acc_specimen_type ast, acc_procedure apr,
    acc_specimen_part asp,
    specimen_type st, procedure pr,
    proc_proc_family ppf
    WHERE abb.ACC_BLKBR_ID = apr.ACC_BLKBR_ID
    AND apr.ACC_SPCM_PART_ID = asp.ACC_SPCM_PART_ID
    AND asp.ACC_SPCM_TYP_ID = ast.ACC_SPCM_TYP_ID
    AND ast.ACC_SPCM_TYP_SPCM_TYP_ID = st.SPCM_TYP_ID
    AND apr.procdr_id = pr.PROCDR_ID
    AND pr.PROCDR_ID = ppf.PROCDR_ID
    AND abb.acc_blkbr_id in (pBB_ID_LIST) ;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(' BB LIST : ' || pBB_ID_LIST);
    FOR st IN stname
    LOOP
    vspcm_typ_nm_uc := vspcm_typ_nm_uc || ',' || st.spcm_typ_nm_uc;
    END LOOP;
    vspcm_typ_nm_uc := SUBSTR (vspcm_typ_nm_uc, 2);
    RETURN vspcm_typ_nm_uc;
    END;

    This ask tom thread covers multiple solutions:
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425]

  • Using SSRS local mode, receive invalid token error when trying to export the report when running in worker thread

    We're using ASP.net with .Net 4, developing with Visual Studio 2012.  We use SSRS 2012sp1 with local reports, so exporting the report ourselves instead of using a reportviewer control (and not using the SQL Reporting service).  The reports are
    executing fine when we export the report in the main thread, but if we spawn a worker thread and run a report there we receive the following error when calling Render():
    Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Failed to load expression host assembly. Details: Invalid token for impersonation - it cannot be duplicated.
    We only receive this when running a report that uses expressions on a separate thread.  I've tried running the application pool under all the default built-in accounts (NetworkService, etc), and under admin user accounts to no avail.
    This didn't occur with the previous version of our application which used .net 3.5.

    As mentioned, we are not using the Reportviewer control, we are rendering locally.  Not certain if that would make a difference.
    Also, I had tried using all the built-in accounts.  Just for kicks I changed it to LocalSystem again, then reset IIS (see image below).  I then tried to export the report in a worker thread and received the same error.
    Here is the text from the exception:
    Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Failed to load expression host assembly. Details: Invalid token for impersonation - it cannot be duplicated.
    at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.ProcessLoadingExprHostException(ObjectType assemblyHolderObjectType, Exception e, ProcessingErrorCode errorCode)
    at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.LoadCompiledCode(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, Boolean includeParameters, Boolean parametersOnly, ObjectModelImpl reportObjectModel, ReportRuntimeSetup runtimeSetup)
    at Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(Boolean includeParameters, Boolean parametersOnly)
    at Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(ParameterInfoCollection parameters)
    at Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.CreateReportInstance(OnDemandProcessingContext odpContext, OnDemandMetadata odpMetadata, ReportSnapshot reportSnapshot, Merge& odpMerge)
    at Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.Execute(OnDemandProcessingContext& odpContext)
    at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdpInitial.ProcessReport(ProcessingErrorContext errorContext, ExecutionLogContext executionLogContext, UserProfileState& userProfileState)
    at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer)
    at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition)
    at Microsoft.Reporting.LocalService.CreateSnapshotAndRender(ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
    at Microsoft.Reporting.LocalService.Render(String format, String deviceInfo, String paginationMode, Boolean allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
    at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
    --- End of inner exception stack trace ---
    at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
    at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
    at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
    at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
    at IxSS.Infolinx.Report.MicrosoftInfolinxReport.ExportReport(String strFileFullyQualifiedPath, String strExportType, String strFilterDesc, Dictionary`2 extraParams, String area)
    at IxSS.Infolinx.Report.MicrosoftInfolinxReport.ExportReport(String strFileFullyQualifiedPath, String strExportType, String strFilterDesc, Dictionary`2 extraParams)

  • Logon Failed - Invalid element error when trying to connect to SalesForce

    I had a working crystal reports database connection to salesforce until I installed a Crystal Reports update on my machine.  It is currently running v12.2.0.290 (CR Developer).
    Since the update when trying to connect, I enter my password and salesforce security token to get access to the database but now I receive an error that says:
    Logon Failed
    Details: Unexpected error
    ; nested exception is
      org.xml.sax.SAXException: Invalid element in com.sforce.soap.partner.LoginResult - metadataServerUrl
    Help is resolving this error would be appreciated.

    Hi Ron -- you have installed SP2 of Crystal Reports 2008. You will need to install the FP 2.2 as per this thread -- Crystal Reports 2008 SP2 update to the Salesforce.com connectivity
    Let us know if this solved your problem.
    Thanks,
    Pete

  • Invalid session error when trying to transfer line items to shopping basket

    Hi All,
    I have a requirement in E-Commerce application.
    when a user searches for a product in B2B webshop in 'products' tab in left frame, search results table get displayed which will have a shopping basket icon for each line item.
    There we can transfer only a single item to shopping basket.
    if we want to transfer more than one item, again shopping basket icon has to be clicked..
    Now my requirement is that I have to add check boxes before each line item and a button below the results table ,so that when it is cliked, all the checked items should move to shopping basket in a shot.
    I added a button and called '/catalog/updateitems.do' (onclick of buttton) which is the action called when  'transferselection' button in 'productISA.jsp' is clicked.
    Now I am getting  an error saying 'Invalid session' when that button is clicked. I am not able to guess the reason.
    And also I want to ask experts, is this the correct way of proceeding for the requirement ?
    I am new to E-Commerce and any pointers in this regard will be of great help.
    Thanks,
    Anasuya.

    Hello Anasuya,
    Any reason why Catalog is not used but "Product" search list is used in the process? Catalog gives a more organized way of displaying and searching capabilities and makes the buying experience simple. Product search is a convenience tool for power users when you know the product.
    Without major UI changes - like de-framing, the use of Product search for "Add to Cart" of all "selected" products from search list will not excite the end users. Catalog is a powerful tool that is available to you. Unless you have a strong business reason, it is better to use the features the way they are intended. You need to go back to the drawing board with your customer.
    Anyway, I am assuming that you are doing a POC. I will give the same help I provided for your previous message on a similar topic. Re: Null poiner exception when trying to store extension data in existing BO.  We need to understand the basics of Servlet / JSP. Just adding any action (calling servlet) from any page (JSP) may not help. We must understand that the action (servlet) may be expecting many values in the request context which is available in the page (JSP) it was placed in. If that action is blindly placed in another page, it is highly unlikely that it will work, unless, you also took the pain to provide the servlet behind that action with the data it is expecting. So, adding the action from _'productsISA.jsp' _ in organizer-content-product-search1.jsp will have bad results. If you have done the required changes to the JSP, then let us know the changes you have done to really understand the issue.
    If you have not done so, here is what you can do for the POC. If you look at the JSP organizer-content-product-search1.jsp, it doesn't have any useful <INPUT tags that would pass on the Product data to the servlet. So
    Surround the product (tech key) with <Input tag. (Hint: see productISA.jsp)
    I am sure you already have this for the quantity1 and the new checkbox.
    Add a button to a custom action.
    inside the custom action read all the items and create a simple Java List of  BasketTransferItem. Use BasketTransferItemImpl to actually use the instance.
    Use methods setProductKey(String techKey), setQuantity(String quantity) and if you know the UoM use setUnit(String unit) to set the BasketTransferItemImpl object.
    Add each instance of BasketTransferItem to the java List.
    Now, place this list object in the request context under the attribute name baskettransferitemlist.
    On success forward to "addtodocument"
    Make proper changes to config.xml
    I hope this will work without much changes.
    (Note: This is not a cake served in a plate, but just a tested recipe for the cake. Please cook it nicely. If you need the cake immediately, then hire a Chef! - )
    Easwar Ram
    http://www.parxlns.com

  • Error when trying to convert pdf to word

    an error occurs when I try to convert pdf to word, it says, "an error occured when trying to access the service."

    how do you fix it?

  • Getting Entry 10: Invalid Ip error when trying to open up a port.

    Hey everyone, I'm using linksys wrt54gc wireless router. I'm trying to open up a few ports for several applications but when i try to add a port i'm getting invalid ip error. For example i'm trying to open up port 6112 for warcraft 3 and setting it to 192.168.1.10 but it says invalid ip. whatever i wrote down there it refused. any ideas ? By the way i updated to latest firmware. Thanks.

    Disable all the firewall on the computer .... also make sure that the router is working on latest firmware .... check the firmware from linksys website & see if it works ,,,,

  • 'unexpected error' when trying to convert PDF to word

    THis keeps coming up in the forum and hasnt been answered. trying to convert PDF to word but it says there is an unexpected error. help please.

    Hi!
    Please send us a copy of the file here with a brief description so we can take a look at it. Thanks! Sorry for the problems.
    Dave, Adobe

  • FCP ERROR when trying to convert variable frame rate Panasonic P2

    Ok, yesterday I was able to convert variable frame rate footage so it rendered out nice slo mo's via DVCPRO HD Frame rate converter in FCP 6.0.4, it worked perfect. I tried it multiple times - So I know it can be done... Today however I created the same "easy setup" in FCP I used yesterday, and it wont work?
    it comes up with the error:
    "An error occurred during processing, unable to conform source media FCP" is there some setting that by default switches"
    has anyone heard of this happening? it seems like a program error... but I could be wrong... I haven't been able to figure it out on my own.
    does anyone have any suggestions?
    Thanks!
    A

    Lance,
    Sounds like you have done a very thorough job of tracking down your problem and a temporary solution. Just one question. Is the footage from the HDX-900 that you say...
    Lance Moody wrote:
    Since some footage from the HDX-900 was shot at 60FPS for conversion to 24FPS as slo-mo, I then attempted to use the DVCPRO HD Frame Rate converter to accomplish this.
    flagged in camera as being 24fps or are you just trying to convert it after the fact?
    o| TonyTony |o

  • Reg error when trying to convert planned order to production order

    Dear all,
    While trying to convert planned order to production order we are getting error  CO684,( you cannot make an assignment to make to order stock---create an order with respect to sale order where account assignment  to sales order or project is not allowed in settlement profile to chosen order type.
    What is to be done to correct it.
    Thanks in advance
    Regards
    madhav

    Hi
    Check which settlement profile maintained in your order type using OPJH.
    Then go to the t.code OKO7 and select the same settlement profile which is there in your order type.
    In receivers
    Change the sales orders settings to
    Sales orders 1 Settlement Optional
    If in your scenrio not using sales order the change to Settlement not allowed
    try this
    Thanks
    S.Murali

  • Getting a 9041 error when trying to convert to AAC

    I'm trying to convert some Apple Lossless songs to AAC and every time I try (different songs) I get "Unknown error occurred (9041).
    I was able to drag the song to the desktop, open it in QuickTime and export it as an AAC so the files aren't corrupted.
    I'm running Lion and the latest version of iTunes

    "I have been able to convert to AAC by first converting to AIFF  and then to AAC. This is a pan though."
    this worked for me.
    thanks.

Maybe you are looking for