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;
/

Similar Messages

  • ORA-01858 error in RMAN during backup backupset format '/test/rman/%U'

    Hello!
    I am trying to perform bacup using command
    RMAN> backup backupset completed after 'sysdate-1' format '/tmp/test/%U';
    as described in:
    asmcmd scripts
    All backupsets are copied to /tmp/test/.
    Everything is going fine except the last message from RMAN:
    input backupset count=5342 stamp=660348635 creation_time=17-JUL-08
    channel ORA_DISK_1: starting piece 1 at 18-JUL-08
    piece handle=/tmp/test/6ujlo7mr_1_2 comment=NONE
    channel ORA_DISK_1: finished piece 1 at 18-JUL-08
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
    input backupset count=5343 stamp=660348722 creation_time=17-JUL-08
    channel ORA_DISK_1: starting piece 1 at 18-JUL-08
    piece handle=/tmp/test/6vjlo7pi_1_2 comment=NONE
    channel ORA_DISK_1: finished piece 1 at 18-JUL-08
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
    input backupset count=5344 stamp=660348810 creation_time=17-JUL-08
    channel ORA_DISK_1: starting piece 1 at 18-JUL-08
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/18/2008 10:59:48
    ORA-01858: a non-numeric character was found where a numeric was expected
    I suspect that rman is performing, at the end of backup, some internal work (store something in control file based catalog or so) and catches ORA-01858.
    The destination catalog is local catalog (not nfs mounted remote dir).
    RMAN is spawned from the same node the Oracle Database is running on.
    I tested it on two servers.
    Error occurs on both of them:
    version 10g (ia-32) - flash recovery area on filesystem
    and version 11g (Aix) - flash on ASM
    RMAN-oracle10> show all ;
    using target database controlfile instead of recovery catalog
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
    CONFIGURE BACKUP OPTIMIZATION OFF;
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
    CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/10gSE/dbs/snap_dbname.dbf'; # default
    RMAN-oracle11> show all ;
    using target database control file instead of recovery catalog
    RMAN configuration parameters for database with db_unique_name O2DB are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
    CONFIGURE BACKUP OPTIMIZATION OFF; # default
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
    CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
    CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.1.0/dbname_1/dbs/snapcf_dbname.f';
    How to diagnose the problem?
    How check what RMAN is exactly doing when error occurs?
    Or maybe there is better way to achieve this:
    I want to move backupset from asm realm to remote server without storing them on local, non asm disk.
    Any suggestions kindly welcome!
    Thanx!

    Solution:
    NLS_DATE_FORMAT mus be set mannualy;
    export NLS_DATE_FORMAT='YYYY_MM_DD'
    solved the problem..
    https://metalink.oracle.com/metalink/plsql/f?p=130:15:12788270042070262572::::p15_database_id,p15_docid,p15_show_header,p15_show_help,p15_black_frame,p15_font:BUG,6198368,1,1,1,helvetica
    Metalinking before posting is the rule of thumb : )

  • 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

  • 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

  • How can I handle ora 04031 error ?

    Hi there,
    I got ora 04031 error message.
    so I increased shared memory size.
    After that I got again ora 04031.
    How can I fix this error? Pls give me a talk.
    Thanks.

    Hi,
    This error isn't just caused by a lack of memory, it can also be caused by fragmentation of the shared pool. It quite often shows up in applications where developers don't use bind variables and issue a large number of very similar but distinct queries, especially in long running processes. In this case you can try regularly flushing the shared pool or beating the developers about the head every time you see them not using bind variables.
    Andre

  • How to handle ORA-28001 error with JDBC thin driver ?

    Dear reader,
    As you all know, ORACLE returns error ORA-28001 upon a connection attempt when the user's password has expired.
    Handling the error in OCI is quite simple, thanks to the function OCIPasswordChange(). However, I have not been able to find a JAVA equivalent in the Oracle JDBC library.
    I have found a field called oracle.jdbc.driver.OracleDriver.set_new_password_string, and a field oracle.jdbc.OracleConnection.CONNECTION_PROPERTY_SET_NEW_PASSWORD, but I have really no idea on how to use them (if appropriate) so as to allow the user to change his/her password on the fly.
    I greatly appreciate having any advice from anyone who happened to be faced with that problem.
    Best regards.
    Georges BREFORT

    Hi,
    according to Note [124970.1 Example: How to Change an Expired Password in JDBC?|https://metalink2.oracle.com/metalink/plsql/f?p=130:14:2181952130729466734::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,124970.1,1,1,1,helvetica] it's possible with JDBC Thick (OCI) driver only.

  • 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

  • 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

  • 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

  • Oracle error - ociexecute(): OCIStmtExecute: ORA-01858

    Using PHP 4.3.11 on Linux and ADODB data abstraction library.
    Oracle client version is 10.1.
    Can sucessfully connect to remote database (version 9.2.0.6 NLS_LANG AL32UTF8).
    When doing a simple select from a view:
    select RTS_LOAD from VW_R_PROJECTED_LOAD_OUTPUT
    I get the error message:
    ociexecute(): OCIStmtExecute: ORA-01858: a non-numeric character was found where a numeric was expected in /opt/devftp/var/www/php/adodb/461/drivers/adodb-oci8.inc.php on line 942
    1858: ORA-01858: a non-numeric character was found where a numeric was expected
    If in my PHP script I directly query the underlying table that this Oracle view is based on, I have no problem.
    Using SQLPlus on the web server I don't have any problems at all selecting from the view, it is definitely a valid view.
    Any clues? If so please email as well as posting response here.
    Geoff
    [email protected]

    Hi !
    I think Your view has to_date function in its definition, and this to_date is called without second parameter: date format. Probably NLS_DATE_FORMAT is set to different values in SQL*Plus and PHP environment. You can check it out by running
    select * from v$nls_parameters;
    in SQL*Plus and in PHP.
    If there are two different values You should modify view to use to_date in form: to_date(some_date_string, ‘poroper_date_format’)
    Regards,
    Pawel

  • 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

  • Re: How to Handle ORA Errors in adf

    HI all.
    I am using Jdev 11.1.2.3 , Database oracle 11g,
    Some scenarios i am getting ORA:022XXX error popup.
    How can i make this popups as user defined messages.
    Withregards,
    satishkumar N

    Hi Satish,
    To my mind the easiest solution would be one from developer's guide (last option Lars suggested). But it is quite limited, because there You can't override ORA messages like ORA:022XXX in general, there You must list specific DB constraints in two-dimensional array. In this solution I also missed just simple "error code -message" mapping in regular bundle file. It is not described in developer's guide, but easily implemented by just creating bundle file in the same package as extending class resides (more details in blog post Custom bundle to override default error mesasges in ADF application).
    But.. If You still need to override DB messages like ORA:022XXX, not particular constraints, You should go with rth suggested solution.
    Here is a code sample of "DCErrorHandlerImpl" extending class to set You on the road:
    public class DataControlExceptionHandler extends DCErrorHandlerImpl {
        public DataControlExceptionHandler() {
            super(true);
        @Override
        public String getDisplayMessage(BindingContext bindingContext, Exception exception) {
         if (exception instanceof SQLIntegrityConstraintViolationException) {
                SQLIntegrityConstraintViolationException sqlExc = (SQLIntegrityConstraintViolationException) exception;
               return "DB exception occured: "+ sqlExc.getMesage();
            return exception.getLocalizedMessage();
    Regards,
    Danas

Maybe you are looking for

  • Alter table tablename drop column col

    I tried to drop a column from a table created by sys user. Being a sys user I am unable to drop the column. Please explain. SQL> alter table test move tablespace users; Table altered. SQL> alter table test drop column two; alter table test drop colum

  • Missing music files on iTunes

    Some iTunes music files on my PC have become corrupt or disappeared and I would like to know how to force a sync from my iPad to overwrite replace these files. iTunes recognises that an album exists and what the tracks are but fails to find them when

  • Not using the in-built mic.

    Hey, I need some help configuring my mac so that i can use my external headset rather than the in-built mic. I need to do this so i can use Skype, TS and Vent but without getting annoying background noise from my house that interrupts the chat. Thank

  • CC Serial Number Licensing Carryover to CC 2014 Versions

    I install CC apps in a college computer lab.  When I create a package with Creative Cloud Packager I specify the license type as "Serial Number License" & submit the required serial number. Installing the package presents no problems and the apps com

  • Qs About SQL Server and RoboSource Control

    Hi. I have two questions: (1) Will the SQL Server Compact edition work as the db used for RoboSource Control? I know that it has a limit of 4 GB. (2) Do I have to install a copy of RoboHelp (and, thus, of the RoboSource Server Configuration Utility)