Procedure Erroring: ORA-01858

Hello: Here is the call stack from SQL Plus (9i):
ORA-06512: at "SYS.CALLHIST_CSV", line 147
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at line 1
I have another procedure similar that runs well. I tried isolating the issue by running the sql solo and the query returns fine but when run in this procedure it errors. Originally I didn't have all the NVL and CAST. I did that to try to compensate for the error plus I need the output file to be in unicode.Thanks!
These are the field types that I thought to look out for (the others are varchars):
NUMBER DATE
CUSTOMER_ID SHIP_DATE
SEQNO STAUS_DATE_TIME
INSTALLER_ID CREATION_DATE
ESCALATION_ID COMPLETION_DATE
PROBLEM_ID
SUBJECT_ID
STATUS_ID
REASON_ID
RESOLUTION_ID
CLASS_ID
CREATE OR REPLACE PROCEDURE CALLHIST_CSV
IS
CURSOR c_data IS
SELECT /*+ USE_HASH ( a b) */
CAST(to_char(NVL(b.start_date_time,'08-MAR-68'),'DD-MON-YY') AS nvarchar2(20)) As actualstart,
CAST(NVL(a.model_desc,' ') As nvarchar2(150)) As ModelDesc, CAST(c.customer_id As nvarchar2(25)) As CustomerID,
CAST(NVL(b.call_id,' ')As nvarchar2(25)) As CallID, CAST(NVL(c.model_number,' ') AS nvarchar2(100)) As ModelNumber,
CAST(NVL(c.date_code,' ')As nvarchar2(20)) As DateCode,
CAST(NVL(c.date_of_purchase,' ') As nvarchar2(20)) As DatePurchased,
CAST(to_char(NVL(o.completion_date,'08-MAR-68'),'DD-MON-YY')As nvarchar2(20)) As actualend,
CAST(NVL(o.order_status,' ') As nvarchar2(1)) As OrderStatus,
CAST(NVL(f.subject_desc,' ') As nvarchar2(150)) As subject, CAST(NVL(g.problem_desc,' ') As nvarchar2(150)) As kategory,
CAST(NVL(h.resolution_desc,' ') As nvarchar2(150)) As Resolution,
CAST(NVL(i.reason_desc,' ') As nvarchar2(150)) As Reason,
decode(e.notes, null, '', 'AGENT NOTES: ' || e.notes) || ' ' || decode(q.notes, null, '', 'QP NOTES: ' || q.notes) As Notes,
CAST(NVL(j.escalation_id, 0) As nvarchar2(2)) as EscalationID,
CAST(NVL(j.escalation_desc, ' ') As nvarchar2(150))as EscalationDesc,
CAST(NVL(k.agent_id,' ') As nvarchar2(25)) As ownerid, CAST(NVL(k.first_name,' ') As nvarchar2(30)) As AgentFirstName,
CAST(NVL(k.last_name,' ') As nvarchar2(50)) As AgentLastName
FROM GENIECS.model a, GENIECS.contact_record b,
GENIECS.product_record c, GENIECS.warranty d,
GENIECS.call_detail e, GENIECS.subject f,
GENIECS.problem g, GENIECS.resolution h, GENIECS.reason i,
GENIECS.escalation j, GENIECS.agent k,
GENIECS.order_record o, GENIECS.qa q
WHERE b.customer_id < 1000
AND b.customer_id = c.customer_id
AND b.model_id = c.model_number
AND b.seqno = c.seqno
AND c.model_number = a.model_number
AND d.model_number = a.model_number
AND e.call_id = b.call_id
AND e.subject_id = f.subject_id
AND e.problem_id = g.problem_id
AND e.resolution_id = h.resolution_id
AND i.reason_id(+) = e.reason_id
AND j.escalation_id(+) = b.escalation_id
AND b.agent_id = k.agent_id
AND b.call_id=o.call_id(+)
AND o.order_id=q.order_id(+)
ORDER BY c.customer_id;
v_file UTL_FILE.FILE_TYPE;
BEGIN
-- | WRITE CONTENTS OF THE LOB TO A FILE |
-- The maximum line length that can be written is 32K in 9i.
v_file := UTL_FILE.FOPEN(location => 'EXTRACT_DIR',
filename => 'callhist_csv.csv',
open_mode => 'w',
max_linesize => 32767);
FOR cur_rec IN c_data LOOP
UTL_FILE.PUT_LINE(v_file,
cur_rec.actualstart           || '|' ||
cur_rec.ModelDesc           || '|' ||
cur_rec.CustomerID           || '|' ||
cur_rec.CallID      || '|' ||
cur_rec.ModelNumber      || '|' ||
cur_rec.DateCode      || '|' ||
     cur_rec.DatePurchased      || '|' ||
     cur_rec.actualend           || '|' ||
     cur_rec.OrderStatus           || '|' ||
     cur_rec.subject     || '|' ||
     cur_rec.kategory      || '|' ||
     cur_rec.Resolution      || '|' ||
     cur_rec.Reason          || '|' ||
     cur_rec.Notes      || '|' ||
cur_rec.EscalationID      || '|' ||
cur_rec.EscalationDesc      || '|' ||
     cur_rec.ownerid      || '|' ||
     cur_rec.AgentFirstName           || '|' ||
     cur_rec.AgentLastName);
END LOOP;
UTL_FILE.FCLOSE(v_file);
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20000, 'File location is invalid.',True);
WHEN UTL_FILE.INVALID_MODE THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20001, 'The open_mode parameter in FOPEN is invalid.',True);
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20002, 'File handle is invalid.',True);
WHEN UTL_FILE.INVALID_OPERATION THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20003, 'File could not be opened or operated on as requested.',True);
WHEN UTL_FILE.READ_ERROR THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20004, 'Operating system error occurred during the read operation.',True);
WHEN UTL_FILE.WRITE_ERROR THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20005, 'Operating system error occurred during the write operation.',True);
WHEN UTL_FILE.INTERNAL_ERROR THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20006, 'Unspecified PL/SQL error.',True);
WHEN UTL_FILE.CHARSETMISMATCH THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20007, 'A file is opened using FOPEN_NCHAR, but later I/O ' ||
'operations use nonchar functions such as PUTF or GET_LINE.',True);
WHEN UTL_FILE.FILE_OPEN THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20008, 'The requested operation failed because the file is open.',True);
WHEN UTL_FILE.INVALID_MAXLINESIZE THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20009, 'The MAX_LINESIZE value for FOPEN() is invalid; it should ' ||
'be within the range 1 to 32767.',True);
WHEN UTL_FILE.INVALID_FILENAME THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20010, 'The filename parameter is invalid.',True);
WHEN UTL_FILE.ACCESS_DENIED THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20011, 'Permission to access to the file location is denied.',True);
WHEN UTL_FILE.INVALID_OFFSET THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20012, 'The ABSOLUTE_OFFSET parameter for FSEEK() is invalid; ' ||
'it should be greater than 0 and less than the total ' ||
'number of bytes in the file.',True);
WHEN UTL_FILE.DELETE_FAILED THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20013, 'The requested file delete operation failed.',True);
WHEN UTL_FILE.RENAME_FAILED THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20014, 'The requested file rename operation failed.',True);
WHEN OTHERS THEN
UTL_FILE.FCLOSE(v_file);
RAISE_APPLICATION_ERROR(-20015, 'Error.',True);
-- reraise the current exception
--RAISE;
END;

sorry wrong forum

Similar Messages

  • National Language Support and Error ORA-01858

    Hi,
    I have a problem using NLS.
    When I use NLS for Italian,I become the error ORA-01858 -->
    "a non-numeric character was found where a numeric was
    expected".
    But with the same query I use for NLS_Italian,it works with
    NLS_German and NLS_English.
    I use this date-formats "DD.Month YYYY" , "DD.MM.YYYY", "DD.MM"
    For example:
    Select to_char(sd.Datum,'DD.Month YYYY') Datum ,
    sd.FONDSVERMOEGEN, sd.AKTIEN, sd.KASSE, sd.RENTEN,sd.FUTURES,
    sd.WERTPAPIERE, sd.IMMOBILIEN,
    sd.KUPON, sd.DURCHSCHNITT_RENDITE, sd.DURCHSCHNITT_RL from
    Strukturdaten sd,fondsdaten_allgemein fd
    where sd.match=fd.match and sd.match=amfcomm .
    Can somebody help me??

    Can you tell us what the value of sd.Datum is in the queries?

  • Nationnal Language Support and Error ORA-01858

    Hi,
    I have a problem using NLS.
    When I use NLS for Italian,I become the error ORA-01858 -->
    "a non-numeric character was found where a numeric was expected".
    But with the same query I use for NLS_Italian,it works with
    NLS_German and NLS_English.
    I use this date-formats "DD.Month YYYY" , "DD.MM.YYYY", "DD.MM"
    For example:
    Select to_char(sd.Datum,'DD.Month YYYY') Datum ,
    sd.FONDSVERMOEGEN, sd.AKTIEN, sd.KASSE, sd.RENTEN,sd.FUTURES,
    sd.WERTPAPIERE, sd.IMMOBILIEN,
    sd.KUPON, sd.DURCHSCHNITT_RENDITE, sd.DURCHSCHNITT_RL from
    Strukturdaten sd,fondsdaten_allgemein fd
    where sd.match=fd.match and sd.match=amfcomm .
    Can somebody help me??

    Can you tell us what the value of sd.Datum is in the queries?

  • PL/SQL Function Returning Query Error / ORA-01858: a non-numeric char.....

    I'm trying to write a PL/SQL function to dynamically return a query with varying # of columns. I've done this type of thing before wiith much success, however this is the first time I'm using a cursor for loop within a function to accomplish my task.
    here is the error I get:
    ORA-01858: a non-numeric character was found where a numeric was expected
    Error ERR-1101 Unable to process function body returning query.
    Mind you I have tested the PL/SQL from a SQL editor and it works fine. I'm confused.
    Code is below.
    Thanks in advance!
    DECLARE
    my_query varchar2(4000);
    string1 varchar2(50) := 'select city, ';
    string2 varchar2(4000) := '' ;
    string3 varchar2(4000):= 'from
    ( select a.title, a.city, a.start_date, sum(a.total_stu) cnt
    from sj_class_summary3 a
    group by a.title, a.city, a.start_date
    having a.title = :P4_COURSE )
    group by title, city';
    TYPE date_tab_type IS TABLE OF date INDEX BY PLS_INTEGER;
    date_tbl date_tab_type;
    i number;
    BEGIN
    i:=1;
    for myrec in (select distinct start_date from sj_class_summary3
    where start_date between :P4_START_DATE and :P4_END_DATE order by 1) loop
    date_tbl(i) := myrec.start_date;
    string2 := string2 || ' max( decode( start_date, ''' || date_tbl(i) || ''', cnt,0) ) "' || date_tbl(i) || '", ';
    i := i+ 1;
    end loop;
    string2 := SUBSTR(string2,1,LENGTH(string2)-2);
    string2 := string2 || ' ';
    my_query := string1 || string2 || string3;
    return my_query;
    END;

    Hi Bob,
    you also have another date to character to date conversion in:
    decode( start_date, ''' || date_tbl(i) || ''', cnt,0)
    does this need to be:
    decode( start_date, to_date(''' || to_char(date_tbl(i), 'dd/mm/yyyy') || ''', ''dd/mm/yyyy''), cnt,0)
    Regards
    Michael

  • External Procedure Error: Ora-28575

    We are trying to set up external procedures in an HP/UX environment. However, we can not seem to get past the following error:
    ORA-28575: unable to open RPC connection to external procedure agent
    The following is our TNSNAMES.ORA set up:
    EXTPROC =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = extproc_key))
    (CONNECT_DATA =
    (SID = extproc_agent)
    The following is the listener.ora setup:
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ssi2)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = TTC)
    (SESSION = NS)
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = extproc_key))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = SDST.world)
    (ORACLE_HOME = /u001/app/oracle/product/SDST)
    (SID_NAME = SDST)
    (SID_DESC =
    (SID_NAME = extproc_agent)
    (ORACLE_HOME = /u001/app/oracle/product/SDST)
    (PROGRAM = extproc)
    The following is the SQLNET.ORA setup:
    SQLNET.EXPIRE_TIME = 0
    NAMES.DIRECTORY_PATH= (TNSNAMES)
    Does anyone have any ideas/help??? We're stuck. Thanks!

    Hi,
    I guess, it is happening in connection point only. Other wise It will give another error "RPC lost connection".
    I will give some tips.
    1.".so" path should match with oracle library path. For this one, u can query ur system tables and verify.
    2. When u create external procedure, be careful. Especially, when u give name of procedure and library. Pls. check this particular part.
    Pls. let me know the progress. U can directly contact me through the mails.
    With regards,
    Boby Jose Thekkanath,
    Dharma computers(P) Ltd.,
    Bangalore-India.
    www.dharma.com
    null

  • ORA-01858 error in Application but not in sqlpluss

    Hi.
    I have this query that runs nicely in sqlpluss and the SQL Commands that came with Expressedition 10g, but when I put it in a report region it produce:
    report error:
    ORA-01858: a non-numeric character was found where a numeric was expected
    query:
    SELECT temae.temae, NVL(antall,0) Antall
    FROM temae LEFT OUTER JOIN (SELECT temae, count(temae) as antall
    FROM okeiko
    WHERE person = :P3_PERSON and dag >= to_date(DECODE(SIGN(to_char(current_date,'mm')-5),
    -1, to_date('01-NOV-'||to_char(current_date,'yy'))-365,
    0, to_date('01-MAY-'||to_char(current_date,'yy')),
    1, DECODE(SIGN(to_char(current_date,'mm')-10),
    -1,to_date('01-MAY-'||to_char(current_date,'yy')),
    0,to_date('01-MAY-'||to_char(current_date,'yy')),
    1,to_date('01-NOV-'||to_char(current_date,'yy')))),'dd-mon-yy')
    GROUP BY temae) p
    ON temae.id = p.temae
    where antall > 0
    ORDER BY NVL(antall,0) DESC, temae.type, temae.temae
    Before I added the decode part for the date it looked like this, and worked nice in the application:
    SELECT temae.temae, NVL(antall,0) Antall
    FROM temae LEFT OUTER JOIN (SELECT temae, count(temae) as antall
    FROM okeiko
    WHERE person = :P3_PERSON and dag > to_date('30-apr-06','dd-mon-yy')
    GROUP BY temae) p
    ON temae.id = p.temae
    where antall > 0
    ORDER BY NVL(antall,0) DESC, temae.type, temae.temae
    This is the data structure
    SQL> describe temae
    Name Null? Type
    ID NOT NULL NUMBER
    TEMAE VARCHAR2(20)
    TYPE NUMBER
    Then it worked nicely in the application to.
    SQL> describe okeiko;
    Name Null? Type
    ID NOT NULL NUMBER
    PERSON NOT NULL NUMBER
    TEMAE NOT NULL NUMBER
    SENSEI NUMBER
    REMARK VARCHAR2(4000)
    DAG NOT NULL DATE
    Can anyone se why application is complaining?
    BTW report region also complains to_date('01-may-06','dd-mon-yy') does not have a valid month.

    Marius,
    I am not sure but try this:
    SELECT   temae.temae, NVL (antall, 0) antall
        FROM temae LEFT OUTER JOIN (SELECT   temae, COUNT (temae) AS antall
                                        FROM okeiko
                                       WHERE person = :p3_person
                                         AND dag >=
                                                TO_DATE
                                                   (DECODE
                                                       (SIGN
                                                           (  TO_CHAR
                                                                    (CURRENT_DATE,
                                                                     'mm'
                                                            - 5
                                                        -1, TO_DATE
                                                              (   '01-NOV-'
                                                               || TO_CHAR
                                                                     (CURRENT_DATE,
                                                                      'yy'
                                                         - 365,
                                                        0, TO_DATE
                                                           (   '01-MAY-'
                                                            || TO_CHAR
                                                                    (CURRENT_DATE,
                                                                     'yy'
                                                        1, DECODE
                                                           (SIGN
                                                               (  TO_CHAR
                                                                     (CURRENT_DATE,
                                                                      'mm'
                                                                - 10
                                                            -1, TO_DATE
                                                               (   '01-MAY-'
                                                                || TO_CHAR
                                                                      (CURRENT_DATE,
                                                                       'yy'
                                                            0, TO_DATE
                                                               (   '01-MAY-'
                                                                || TO_CHAR
                                                                      (CURRENT_DATE,
                                                                       'yy'
                                                            1, TO_DATE
                                                               (   '01-NOV-'
                                                                || TO_CHAR
                                                                      (CURRENT_DATE,
                                                                       'yy'
                                    GROUP BY temae) p ON temae.ID = p.temae
       WHERE antall > 0
    ORDER BY NVL (antall, 0) DESC, temae.TYPE, temae.temaeI took out the formating of your to_date function.
    Denes Kubicek

  • HELP!!!!  ORA-01858 By creating user or reset password get this error

    By creating user or reset password get this error:
    Data Error: ORA-01858: found a non-digital world where expecting one numerical ORA-06512: at "DERWEB.ORA_ASPNET_MEM_RESETPASSWORD", line 80 ORA-06512: at line 1

    Hi
    You get this error when profile class amounts are not set for all the currency.  Go back to your profile and ensure that the profile amounts are set for all the currencies found, whether you are using it or not.
    Regards

  • Lession 3 oca sql fundamental doubts on ora -01858 error

    SELECT last_name, hire_date
       FROM   employees
       WHERE  hire_date = TO_DATE('May 24, 1999', 'fxMonth DD, YYYY');
       books mention it will leave a error (ora-01858 which is an non-numeric error )but the statement running perfectly while
    by deleting that "fx"-prefix gives an error called ora-01861.
    i am confused here??can anyone show me the right way?

    Hi,
    The outcome depends on your NLS settings. Probably yours are set to something different than AMERICAN. In you language the month of May may then have a different number of characters(?)
    That's why you hit the ORA-01861 with the FX Format Model, and something else without. (Can't see why you should get ORA-01858, though)
    Regards
    Peter

  • ORA-01858 error from Apex Report on working/valid underlying query

    After two days of searching these forums and AskTom, I think I need to post the following problem.
    I have what seems to be a valid view of some data created as follows (with an apology for the formatting - doesn't seem to be a way of using a fixed font here):
    CREATE OR REPLACE FORCE VIEW "PRICING_CAPABILITY"."POW_EXEC_SUMM010" ("Item",
    "Jul-09", "Aug-09", "Sep-09", "Oct-09", "Nov-09", "Dec-09", "Jan-10",
    "Feb-10", "Mar-10", "Apr-10", "May-10", "Jun-10", "YTD")
    AS
    SELECT
    "Item",
    SUM(DECODE("ItemMonth",'Jul-09',"ItemValue",0)) "Jul-09",
    SUM(DECODE("ItemMonth",'Aug-09',"ItemValue",0)) "Aug-09",
    SUM(DECODE("ItemMonth",'Sep-09',"ItemValue",0)) "Sep-09",
    SUM(DECODE("ItemMonth",'Oct-09',"ItemValue",0)) "Oct-09",
    SUM(DECODE("ItemMonth",'Nov-09',"ItemValue",0)) "Nov-09",
    SUM(DECODE("ItemMonth",'Dec-09',"ItemValue",0)) "Dec-09",
    SUM(DECODE("ItemMonth",'Jan-10',"ItemValue",0)) "Jan-10",
    SUM(DECODE("ItemMonth",'Feb-10',"ItemValue",0)) "Feb-10",
    SUM(DECODE("ItemMonth",'Mar-10',"ItemValue",0)) "Mar-10",
    SUM(DECODE("ItemMonth",'Apr-10',"ItemValue",0)) "Apr-10",
    SUM(DECODE("ItemMonth",'May-10',"ItemValue",0)) "May-10",
    SUM(DECODE("ItemMonth",'Jun-10',"ItemValue",0)) "Jun-10",
    SUM("ItemValue") AS "YTD"
    FROM
    SELECT
    'New Proposals Received' AS "Item",
    TO_CHAR(t1.scope_received,'Mon-RR') AS "ItemMonth",
    COUNT(*) AS "ItemValue",
    10 AS "SortOrder"
    FROM
    PRICING_CAPABILITY.POW_DATA t1
    WHERE
    t1.scope_received IS NOT NULL
    AND extract(YEAR FROM t1.scope_received) IN (2009,2010)
    AND t1.scope_received >= '01-JUL-2009'
    GROUP BY
    'New Proposals Received',
    TO_CHAR(t1.scope_received,'Mon-RR'),
    10
    UNION
    SELECT
    'New Proposals Completed' AS "Item",
    TO_CHAR(t2.pricing_approval,'Mon-RR') AS "ItemMonth",
    COUNT(*) AS "ItemValue",
    20 AS "SortOrder"
    FROM
    PRICING_CAPABILITY.POW_DATA t1
    JOIN PRICING_CAPABILITY.POW_LAST_HISTORY t2
    ON
    t1.POW_DATA_ID = t2.POW_DATA_ID
    WHERE
    t2.pricing_approval IS NOT NULL
    AND extract(YEAR FROM t2.pricing_approval) IN (2009,2010)
    AND t2.pricing_approval >= '01-JUL-2009'
    GROUP BY
    'New Proposals Completed',
    TO_CHAR(t2.pricing_approval,'Mon-RR')
    GROUP BY
    "Item",
    "SortOrder"
    ORDER BY
    "SortOrder" ;
    This view works, ie produces the right results when run (ie select * from ...) in SQL Developer and in the SQL Workshop section of Apex.
    But when I attempt to produce an Apex report using it as the source of data, I get the following error:
    ORA-01858: a non-numeric character was found where a numeric was expected
    The error is displayed before any part of the report itself is displayed, ie the Region Header is displayed and then the error message.
    So far, anything I've been able to find on the forums or AskTom suggests that it is probably due to a date conversion problem. But the aim here is to summarise dated records by month, so I'm extracted the year and month elements of the date values, converting them to strings (using TO_CHAR), and then using the resulting 'Mon-YY' strings to group the results.
    If there is a better way, I'm interested.
    But I don't understand why Apex seems to be rejecting what appear to be valid results from a valid working query.
    Any ideas? Suggestions?
    Cheers,
    Peter

    Thanks again, Flavio. I'm learning and I appreciate your patience.
    The solution you provided is very similar to the one I came up with after your previous message, but I didn't have the NLS_DATE_LANGUAGE parameter. I'll go back and try it.
    I appreciate your explanation re Apex not needing to know and Oracle assuming that the client knows what it is doing, but it puzzles me more.
    The way that I originally had things, I think, was consistent with what you have explained, but it didn't work. To make it clear:
    1 I had an Oracle view that had no parameters and contained the date literal in the where clause and worked fine in both SQL Developer and in the Apex SQL Workshop.
    2 The view did not return any date values. Aside from the column headings and the first column (of character strings), the body of the table comprised integer values only.
    3 So, when Apex called the view, I would have expected the Oracle server to independently execute the view and return the (dateless) results to Apex, which would then present the unmodified results in a standard report. This is, I think, what SQL Developer and the Apex SQL Workshop appear to have successfully done.
    My expectation seems to be consistent with at least some of your explanation (ie [Oracle assumes] "+that the client knows what it is doing+" and "+apex doesn't need to know anything about the underlying query+"), but is not consistent with actual experience, where Apex seems to know that the underlying query contains a date literal and unsuccessfully (and unnecessarily) attempts to interpret it.
    I'm obviously missing something about how Apex and Oracle interact in this situation. While I don't need to know - as I have a working solution now - it is valuable to understand how things work. Makes life easier and more productive.
    Cheers,
    Peter

  • ORA-01858: a non-numeric character was found where a numeric was expected

    hi ,
    This was the code which shows the sales rep invoice amount and collected amount but while running report thru concurrent program its showing the following error:
    ORA-01858: a non-numeric character was found where a numeric was expected
    WHERE TO_CHAR ( TO_DATE ( PS.GL_DATE , 'DD/MON/YY' ) , 'MON-YYYY' ) BETWEEN TO_CHAR ( TO_DATE ( : ==> P_todate , 'YYYY/MM/DD' ) , 'MON-YYYY' ) AND TO_CHAR ( TO_DATE ( : P_todate , 'YYYY/MM/DD' ) , 'MON-YYYY' ) AND ps.customer_id = cust.custome
    The Actual Code was this
    SELECT SUBSTR(SALES.name,1,50) salesrep_name_inv,
    --ps.CLASS,
    SUM(ABS(ps.acctd_amount_due_remaining)) acctd_amt,
    SUM(ABS(ps.amount_due_remaining)) amt_due_remaining_inv,
    SUM(ABS(ps.amount_adjusted)) amount_adjusted_inv,
    SUM(ABS(ps.amount_applied)) amount_applied_inv,
    SUM(ABS(ps.amount_credited)) amount_credited_inv,
              SALES.salesrep_id,
    NULL "REMARKS"
    -- ps.gl_date gl_date_inv,
    FROM ra_cust_trx_types ctt,
    ra_customers cust,
    ar_payment_schedules ps,
    ra_salesreps SALES,
    ra_site_uses site,
    ra_addresses addr,
    ra_cust_trx_line_gl_dist gld,
    gl_code_combinations c,
    ra_customer_trx ct
    WHERE TO_CHAR(TO_DATE(PS.GL_DATE,'DD/MON/YY'),'MON-YYYY')
    BETWEEN TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY') AND TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY')
    AND ps.customer_id = cust.customer_id
    AND ps.customer_trx_id = ct.customer_trx_id
    AND ps.cust_trx_type_id = ctt.cust_trx_type_id
    AND NVL(ct.primary_salesrep_id, -3) = SALES.salesrep_id
    AND ps.customer_site_use_id+0 = site.site_use_id(+)
    AND site.address_id = addr.address_id(+)
    AND TO_CHAR(TO_DATE(PS.GL_DATE_CLOSED,'DD/MON/YY'),'MON-YYYY')
    BETWEEN TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY') AND TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY')
    --AND    ps.gl_date_closed > TO_DATE(:P_todate,'MON-YYYY')
    AND ct.customer_trx_id = gld.customer_trx_id
    AND gld.account_class = 'REC'
    AND gld.latest_rec_flag = 'Y'
    AND gld.code_combination_id = c.code_combination_id
    AND sales.salesrep_id is not null and sales.name is not null
    -- and ps.payment_schedule_id+0 < 9999
    -- AND SALES.salesrep_id ='1001'
    GROUP BY SALES.name,
    --ps.CLASS,
    SALES.salesrep_id

    So to_date function accepts a string as input and returns a date. When a date is input instead, it is implicity converted to the required type of the function paremeter, which is a string, so that to_date can convert it back to a date again.
    If you are lucky with the implicit conversion, you get the same date back, if you are not you might get a different date or an error.
    From your query it appears that this conversion from a date, to a string, to a date, and then back to a string using to_char this time, is being done to remove the time or day part of the date. The actual range comparison is being done on strings rather than dates, which is dangerous as strings sort differently than dates.
    In this example if I sort by date, Jan 01 comes between Dec 00 and Feb 01 as you would expect.
    SQL> select * from t order by d;
    D
    12-01-2000
    01-01-2001
    02-01-2001When converted to strings, Feb 01 comes between Dec 00 and Jan 01, which is probably not the desired result
    SQL> select * from t order by to_char(d,'DD-MON-YY');
    D
    12-01-2000
    02-01-2001
    01-01-2001If you want to remove time and day parts of dates you should use the trunc function
    trunc(d) removes the time, trunc(d,'mm') will remove the days to start of month.
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions201.htm#i79761

  • Ora-01858 a non numeric found where numeric was found

    Hello All,
    When I am trying to query a view i am getting the follwoing error.
    ora-01858 a non numeric found where numeric was found
    When checked in all_objects the view status is showing as VALLID.
    Please let me know how do we come over this error.
    Kind Regards.

    I can think of two options:
    1-Create the view with the same datatype as the underlying column, then in your application handle the logic of conversion
    2-Keep the view with the same datatypes, but use a function that takes the value in the column as IN paramter and returns the date. Add exception handling to ignore the exception when a non-date value is encoutered
    Regards
    AK

  • Handling ORA-01858 error

    hi every body,
    How can i handle exception ora-01858 without
    using when others then null;
    I want something
    like
    when user_definded =ora-01858 then null;
    when others then
    v_ErrorNumber := SQLCODE;
    v_ErrorText := SUBSTR(SQLERRM, 1, 2000);

    in fact ,
    I use a procadure that insert values into a table.
    I want that when it reaches an ORA-01858 , then the error is ignored and continue
    to insert others values,
    but now , when I reach error it stops, how to deal with it ?
    CREATE OR REPLACE PROCEDURE INSERT_SWAP_FIXINGS (l_num number)
    as
    v_date varchar2(20);
    v_swap varchar2(1000);
    conn utl_tcp.connection;
    p pls_integer;
    line varchar2(4000);
    v_ErrorNumber NUMBER; -- Variable to hold the error number
    v_ErrorText VARCHAR2(200); -- Variable to hold the error message text
    e_Non_Numeric EXCEPTION;
    PRAGMA EXCEPTION_INIT(e_Non_Numeric , -1858);
    begin
    select trunc(sysdate) -l_num into v_date from dual;
    select regexp_replace (stringAgg(ticker),',','|') ||';' into v_swap from SWAP_DESC ;
    conn := utl_tcp.open_connection(remote_host=>'MY_H0ST',remote_port=>123156);
    p := utl_tcp.write_line(conn, v_swap);
    p := utl_tcp.write_line(conn, 'PX_Last;');
    p := utl_tcp.write_line(conn, v_date );
    p := utl_tcp.write_line(conn,';');
    p := utl_tcp.write_line(conn, v_date);
    p := utl_tcp.write_line(conn, '>');
    begin
    loop
    line := utl_tcp.get_line(conn, TRUE);
    if get_token(line,2) like '%N/A%' then
    dbms_output.put_line(get_token(line,1)||','||get_token(line,2));
    dbms_output.put_line(line);
    insert into TMP_SWAP_FIXINGS
    values (get_token(line,1),to_date(get_token(line,2),'DD/MM/YYYY'));
    else
    insert into swap_fixings values (get_token(line,1),to_date(get_token(line,2),'DD/MM/YYYY'),get_token(line,3));
    end if;
    end loop;
    EXCEPTION
    WHEN utl_tcp.end_of_input THEN
    NULL;
    end;
    utl_tcp.close_connection(conn);
    commit;
    declare
    ligne varchar2(2000);
    corps varchar2(7000);
    begin
    ligne :=' DATA SWAP INSERTION : '
    || UTL_TCP.crlf || UTL_TCP.crlf
    || RPAD ('TICKER',30,' ')
    || RPAD ('INFO_DATE',40,' ')
    || RPAD ('LAST_PRICE',10,' ');
    corps := ligne || UTL_TCP.crlf;
    for x in (select ticker,to_char(info_date,'DD/MM/YYYY') "INFO_DATE",LAST_PRICE from SWAP_FIXINGS where trunc(info_date) = v_date)
    loop
    ligne :=
    RPAD (x.TICKER, 30, ' ')
    ||RPAD (x.info_date,40 ,' ')
    ||RPAD (x.LAST_PRICE,10,' ');
    corps := corps || ligne || UTL_TCP.crlf;
    end loop;
    corps := '<pre>' || corps || '</pre>';
    debug(corps);
    end;
    EXCEPTION
    WHEN e_Non_Numeric then
    null;
    when OTHERS THEN
    v_ErrorNumber := SQLCODE;
    v_ErrorText := SUBSTR(SQLERRM, 1, 200);
    declare
    ligne varchar2(2000);
    corps varchar2(7000);
    begin
    ligne := RPAD (v_ErrorText, 200, ' ');
    corps := corps || ligne || UTL_TCP.crlf;
    corps := '<pre>' || corps || '</pre>';
    debug(corps);
    end;
    end;
    /

  • Error ORA-04031 while executing a stored procedure from Pro C++ code

    I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
    Does anyone know why it is happening and any possible solutions?
    TIA
    Srithaj.

    One thing that can be done is to flush the shared pool before starting the application.
    alter system flush shared pool;
    Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
    null

  • Issue while running a custom package:ORA-20100: File o2670336.tmp creation for FND_FILE failed.You will find more information on the cause of the error in request log. in Package PA_OPPORTUNITY_MGT_PVT Procedure modify_project_attributes ORA-20100: File o

    Hi Guys,
    We have created a custom package where in we are trying to call the standard API's of Oracle projects i.e PA_PROJECT_PUB.When we are trying to call these APIs we are facing the below issue.
    We have tried testing in two instances ,Initially it worked in both instances.
    Using the same API's multiple times we tested the same data set in these instances.
    For the first few runs it works fine.But when we go on using the same API's again and again for our testing we face now and then the below issue.
    Standard API's
    =========
    add_task
    update_project
    change_structure_status
    create_draft_plan
    Error:
    ORA-20100: File o2670336.tmp creation for FND_FILE failed.You will find more information on the cause of the error in request log. in Package PA_OPPORTUNITY_MGT_PVT Procedure modify_project_attributes ORA-20100: File o2670336.tmp creation for FND_FILE failed.
    You will find more information on the cause of the error in request log. in Package PA_PROJECT_PUB Procedure update_project:ORA-0000: normal, successful completionError while publishing the task
    Please let us know if anyone of has come across the same situation.
    Regards,
    Vijay

    But have issue only with validating invoice batch. I followed metalink ID's 605542.1, 167990.1,261693.1,1088553.1,749491.1, 461271.1 and few more.Was this working before? If yes, any changes have been done recently?
    Please see if these docs help.
    APXAPRVL: Invoice Validation Errors With MSG-00001 and REP-1419 [ID 333305.1]
    Invoice Validation Errors When Others:101505:Non-Oracle Exception Rep-1419 [ID 464125.1]
    Invoice Validation Fails with REP-1419 Error in Ap_approval_matched_pkg.Execute_matched_checks [ID 293425.1]
    Invoice Validation Failing On Fnd_file Could Not Write To File L0202306.Tmp [ID 461520.1]
    Invoice Validation (APPRVL) Errors ORA-20001 APP-SQLAP-10000 PSA_FUNDS_CONTROL_PKG.glxfck [ID 463184.1]
    Validate Invoice Error With ORA-20001: APP-SQLAP-10000: AP_FUNDS_CONTROL_PKG.Calc_QV [ID 432702.1]
    Invoice Validation Program Is Erroring Out [ID 382844.1]
    Error On Validation Of Invoices From Previous Periods [ID 412814.1]
    Thanks,
    Hussein

  • Error while pulling data from an Oracle database. ORA-01858: a non-numeric character was found where a numeric was expected

    I'm trying to pull data from an Oracle database using SSIS. When I try to select a few fields from the source table, it returns the following error message:
        [OLE DB Source [47]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80040E14  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80004005  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
    The source columns are a combination of numeric and texts, and I've also tried selecting one of them, which didn't work. I'm using the Oracle client 11.2.0.1, and it works fine with any other data sources I have connected to so far. How can I resolve this
    error?

    Hi H.James,
    According to your description, the issue is a non-numeric character was found where a numeric was expected while pulling data from an Oracle database in SSIS.
    Based on the error message, the issue should be you are comparing a number column to a non-number column in a query. Such as the query below (ConfID is a number, Sdate is a date):
     where C.ConfID in (select C.Sdate
                       from Conference_C C
                       where C.Sdate < '1-July-12')
    Besides, a default behavior for the Oracle OleDb Provider that change the NLS Date Format of the session to 'YYYY-MM-DD HH24:MI:SS can also cause the issue. For more details about this issue, please refer to the following blog:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/01/20/every-bug-is-a-microsoft-bug-until-proven-otherwise.aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for