ORA-01722 when executing a procedure

I am executing a procedure in a package thru a nightly database job. This job has been working fine for the last several months. However recently it started abending with a ORA-01722 error. No changes have been made to the code. The procedure code follows:
PROCEDURE p_start_batch_merge_sites IS
p_batch_site_id tf_batch_merge_sites.master_site_id%TYPE;
p_batch_sub_site_id tf_batch_merge_sites.subordinate_site_id%TYPE;
p_batch_sub_site_name tf_batch_merge_sites.subordinate_site_name%TYPE;
v_error number;
CURSOR batch_merge_sites_cur is
Select master_site_id, subordinate_site_id, subordinate_site_name
from tf_batch_merge_sites
where merge_Date_time is null;
BEGIN
OPEN batch_merge_sites_cur;
LOOP
FETCH batch_merge_sites_cur into
p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name;
EXIT WHEN batch_merge_sites_cur%NOTFOUND;
pkg_tf_merge_sites.p_merge_sites(p_batch_site_id, p_batch_sub_site_id);
select sql_err_no into v_error
from tf_merge_log
where id = (select max(id) from tf_merge_log);
IF v_error <>0 then
close batch_merge_sites_cur;
update tf_batch_merge_sites
set error_message_text = 'Error in Batch Merge'
where master_site_id = p_batch_site_id
and subordinate_site_id = p_batch_sub_site_id;
ELSE
update tf_batch_merge_sites
set error_message_text = 'Batch Merge Sites Successfully Completed',
merge_date_time = sysdate
where master_site_id = p_batch_site_id
and subordinate_site_id = p_batch_sub_site_id;
pkg_tf_merge_sites.p_delete_subordinate (p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name);
END IF;
END LOOP;
CLOSE batch_merge_sites_cur;
END;
One call in this procedure passing 2 number fields works ok:
pkg_tf_merge_sites.p_merge_sites(p_batch_site_id, p_batch_sub_site_id);
The call that is abending is passing the same 2 number fields as the above call, plus a varchar2 name field.
pkg_tf_merge_sites.p_delete_subordinate (p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name);
The table structure for the tf_batch_merge_sites is as follows:
SQL> desc tf_batch_merge_sites
Name Null? Type
MASTER_SITE_ID NOT NULL NUMBER(12)
MASTER_SITE_NAME NOT NULL VARCHAR2(60)
SUBORDINATE_SITE_ID NOT NULL NUMBER(12)
SUBORDINATE_SITE_NAME NOT NULL VARCHAR2(60)
MERGE_DATE_TIME DATE
ERROR_MESSAGE_TEXT VARCHAR2(100)
REVISION_USER_NAME NOT NULL VARCHAR2(30)
REVISION_DATE_TIME NOT NULL DATE
p_delete_subordinate procedure:
PROCEDURE p_delete_subordinate(
p_site_id IN NUMBER,
p_subordinate_site_id IN NUMBER,
p_site_name IN VARCHAR2
IS
-- PROCEDURE: p_delete_subordinate
-- NOTES: Deletes the subordinate site after merging with the master site.
-- HISTORY:
-- 05-01-2003 BSS Created.
v_batchid NUMBER;
CURSOR subordinate_site_cur(
p_subordinate_site_id NUMBER
IS
SELECT rid
FROM se_i_entities
WHERE id = p_subordinate_site_id
AND entity_type = 'SITE';
BEGIN
BEGIN
INSERT INTO tf_merge_sites
(site_id,
merged_site_id,
merged_site_name
VALUES (p_site_id,
p_subordinate_site_id,
p_site_name
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
DELETE FROM tf_site_aliases
WHERE primary_site_id = p_subordinate_site_id;
-- OR secondary_site_id = p_subordinate_site_id;
DELETE FROM tf_former_site_names
WHERE site_id = p_subordinate_site_id;
FOR k IN subordinate_site_cur(p_subordinate_site_id)
LOOP
DELETE FROM se_i_entity_relationships
WHERE entity_rid_2 = k.rid
AND entity_type_2 = 'SITE';
END LOOP;
DELETE FROM se_i_entities
WHERE id = p_subordinate_site_id
AND entity_type = 'SITE';
DELETE FROM tf_sites
WHERE site_id = p_subordinate_site_id;
DELETE FROM e_masters
WHERE id = p_subordinate_site_id;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
I've looked at the data and it looks fine. Does anyone have any idea why I would get this message after it has been running fine for several months?
Thanks!!
Shellie Bricker

ORA-01722: invalid number
Cause: The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates.
Action: Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operation.
Maybe you have bad data?

Similar Messages

  • Help! ORA 01012 WHEN execute SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER

    I encounter ORA 01012 WHEN execute "SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;" in my ProC program, but under SQLPLUS it is ok. The whole scenarios are:
    1. My platform is Solaris 10, Oracle 10.2g / 64bit
    2. "alter system archive log current" failure, Oracle complaint about flash_recovery_area full, so I run
    delete obsolete;
    crosscheck backup;
    delete expired backup;
    3. Later I issued command "shutdown", oralce had no reponse after long time, so I issued command "shutdown abort" to shutdown the database, and then "startup" the database successfully to "READ WRITE", user application can also accessed the database.
    4. One of my ProC program get ORA-01012 when execute SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
    5. But I got no error if I execute "SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL; " using SQLPLUS.
    Any suggestion about this problem? blow is my ProC function call.
    u_int32_t
    proc_GetLastSCN()
    char buf[300];
    u_int32_t scn=0;
    if (proc_ConnectDB() == APP_ERROR)
    return APP_ERROR;
    memset(buf, 0, sizeof(buf));
    snprintf(buf, sizeof(buf),
    "select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from DUAL");
    oraca.orastxtf = ORASTFERR;
    EXEC SQL WHENEVER SQLERROR GOTO ora_sqlerror;
    EXEC SQL WHENEVER NOT FOUND DO break;
    EXEC SQL WHENEVER SQLWARNING CONTINUE;
    EXEC SQL PREPARE S5 FROM :buf;
    EXEC SQL DECLARE C5 CURSOR FOR S5;
    EXEC SQL OPEN C5;
    for (;;) {
    EXEC SQL FETCH C5 INTO :scn;
    EXEC SQL CLOSE C5;
    proc_DisconnectDB();
    return scn;
    ora_sqlerror:
    dyn_error("ORACLE error --proc_GetLastSCN\n");
    EXEC SQL CLOSE C5;
    proc_DisconnectDB();
    return 0;
    int32_t
    proc_ConnectDB()
    /* Declare variables. No declare section is needed if MODE=ORACLE. */
    VARCHAR username[DB_MAX_NAME_LEN];
    /* VARCHAR is an Oracle-supplied struct */
    VARCHAR password[DB_MAX_NAME_LEN];
    int32_t ret = APP_OK;
    strncpy((char *) username.arr, gateinfo.szSrvLogin, sizeof(gateinfo.szSrvLogin));
    username.len = (unsigned short) strlen((char *) username.arr);
    strncpy((char *) password.arr, gateinfo.szSrvPassword, strlen(gateinfo.szSrvPassword));
    password.len = (unsigned short) strlen((char *) password.arr);
    EX_SCREEN_INIT();
    EXEC SQL WHENEVER SQLERROR GOTO ora_sqlerror;
    EXEC SQL CONNECT :gateinfo.szSrvLogin IDENTIFIED BY :gateinfo.szSrvPassword;
    return ret;
    ora_sqlerror:
    errlog(ELOG_ERROR, "proc_ConnectDB@Failed to connect to %s!", gateinfo.szHistSrv);
    sql_error("ORACLE error proc_ConnectDB --\n");
    ret = APP_ERROR;
    return ret;
    }

    01012, 00000, "not logged on"
    // *Cause:
    // *Action:use COPY & PASTE so we can see what you do & how Oracle responds.

  • Error ORA-03113 when execute procedure via OEM

    Hi All,
    I got error messages
    ORA-03113: end-of-file on communication channel
    ERROR at line 1:
    ORA-03114: not connected to ORACLE
    when execute procedure via Oracle Enterprise Manager
    Who do you know what 's the problem and how can I resolves ?
    Thanks,
    Mcka

    Solution Description:
    =====================
    The ORA-3113 error is a general error reported by Oracle client tools,
    which signifies that they cannot communicate with the oracle shadow
    process. As it is such a general error more information must be collected
    to help determine what has happened.
    This short article describes what information to collect for an
    ORA-3113 error when the Oracle server is on a Unix platform.
    General Issues:
    ===============
    1) Is it only one tool that encounters the error or
    do you get an ORA-3113 from any tool doing a similar operation?
    If the problem reproduces in SQL*Plus, use this in all tests
    below.
    2) Check if the problem is just restricted to:
    [ ] One particular UNIX user,
    [ ] Any UNIX user
    or [ ] Any UNIX user EXCEPT as the Oracle user.
    3) Check if the problem is just restricted to:
    [ ] One particular ORACLE logon
    or [ ] Any ORACLE logon that has access to the
    relevant tables.
    4) If you have a client-server configuration does this occur from:
    [ ] Any client
    [ ] Just one particular client
    or [ ] Just one group of clients ?
    If so what do these clients have in common ?
    Eg: Software release .
    5) Do you have a second server or database version where the
    same operation works correctly?

  • ORA-01722 when opening a package in SQL Developer 1.2 with oracle 9iR1

    Hi,
    I use SQL Developer with Oracle Database 9i release 1.
    When I open a package in SQL Developer 1.2 (or 1.5) for editing, I receive the error ORA-01722. The package successfully opens but this message, which pops everytime, is really annoying.
    I monitored the requests sent by SQL Developer and it seems that the following request is responsible of the error :
    SELECT LINE,POSITION,TEXT,ATTRIBUTE FROM USER_ERRORS WHERE TYPE=:1AND NAME=:2
    Notice there are no spaces between ':1' and 'AND'. When executing 'by hand' the request with SQL Developer, it asks for the value of '1AND' bind variable and the value of '2'. Then, it fails to execute with... ORA-01722.
    Is it possible to avoid this bug ?
    Thank you for your help.

    We're doing rolling 2 week releases until production. Expect something new next week.

  • ORA-01031 while executing a procedure with the owner

    I'm Trying to execute a procedure shipment_sequence which is under the ps_user user but i keep getting ORA-01031.
    Please suggest what should be done to counter this.
    Regards,
    Ankit

    create or replace Procedure shipment_sequence
    l_seq_start_with IN NUMBER,
    maxvalue IN NUMBER, event_identifier out SYS_REFCURSOR)
    is
    begin
    begin
    execute immediate 'DROP SEQUENCE SHIPMENT_SEQ';
    exception
    when others then null;
    end;
    execute immediate
    'CREATE SEQUENCE SHIPMENT_SEQ START WITH '
    ||to_char(l_seq_start_with)
    ||' MAXVALUE '||to_char(maxvalue)||' MINVALUE 1 CACHE 20 INCREMENT BY 1';
    OPEN event_identifier FOR select * from dual;
    end;
    Oracle version: 11.1.0.7
    execution: VAR rc REFCURSOR
    EXEC shipment_sequence(961000000,961100000, :rc);
    print rc;
    Error Message:
    Error starting at line 2 in command:
    EXEC shipment_sequence(961000000,961100000, :rc);
    Error report:
    ORA-01031: insufficient privileges
    ORA-06512: at "PS_USER.SHIPMENT_SEQUENCE", line 12
    ORA-06512: at line 1
    01031. 00000 - "insufficient privileges"
    *Cause:    An attempt was made to change the current username or password
    without the appropriate privilege. This error also occurs if
    attempting to install a database without the necessary operating
    system privileges.
    When Trusted Oracle is configure in DBMS MAC, this error may occur
    if the user was granted the necessary privilege at a higher label
    than the current login.
    *Action:   Ask the database administrator to perform the operation or grant
    the required privileges.
    For Trusted Oracle users getting this error although granted the
    the appropriate privilege at a higher label, ask the database
    administrator to regrant the privilege at the appropriate label.
    rc
    Let me know if you need any more information.
    Regards,
    Ankit

  • ORA-01722 when upgrading

    Hi,
    on Win 2003 I'm updating a 10.2.0.1 to 11g using Database upgrade assistant (start/program/ora 11g /...) and it fails with ORA-01722. I looked at logs and found in C:\app\Administrateur\cfgtoollogs\dbua\orcl\upgrade2\Oracle_Server.log:
    The following statement will cause an "ORA-01722: invalid number"
    DOC>     error if the user running this script is not SYS.  Disconnect
    DOC>     and reconnect with AS SYSDBA.It is suggested then to connect as sysdba. How can I connect as sysdba when I'm running upgrade assistant in windows ? Has it any sens this solution ? Even if you start dbua in command line you can not be sys as sysdba since you are windows user (in my case Windows Administrator) ?
    Thanks for help.

    Hi...
    have you started the database with upgrade option???
    Refer to metalink doc id:-Doc ID: 435536.1
    HTH
    Anand

  • Error occurs when executing a procedure

    I have queried a package and procedure.But when executing it shows an error.
    Here is the query
    CREATE OR REPLACE PACKAGE refcursor_pkg AS
    TYPE SYS_REF_CURSOR IS REF CURSOR RETURN EMP%ROWTYPE;
    end refcursor_pkg;
    CREATE OR REPLACE PROCEDURE mem_select(pMem_name VARCHAR2,
    pAge NUMBER,
    pDivision VARCHAR2,
    pOut_cur out refcursor_pkg.SYS_REF_CURSOR)IS
    BEGIN
    IF pMem_name IS NOT NULL THEN
    IF pDivision IS NOT NULL THEN
    OPEN pOut_cur FOR SELECT
    m.mem_name,m.nic,m.mar_state,u.division
    FROM members m,upf_kgl u
    WHERE m.member_id=u.member_id;
    END IF ;
    ELSE
    OPEN pOut_cur FOR SELECT
    u.mem_name,m.nic,m.mar_state
    FROM members m,upf_kgl u
    WHERE U.MEMBER_ID = M.MEMBER_ID;
    END IF;
    END mem_select;
    Here is the error.
    Error(6,1): PLS-00103: Encountered the symbol "CREATE"
    Can someone help me to correct it please?

    You can use sys_refcursor type:
    CREATE OR REPLACE PROCEDURE mem_select(pMem_name VARCHAR2,
                                pAge NUMBER,
                                pDivision VARCHAR2,
                                pOut_cur out sys_refcursor)IS
    BEGIN
            IF pMem_name IS NOT NULL THEN
             IF pDivision IS NOT NULL THEN
             OPEN pOut_cur FOR SELECT
                          m.mem_name,m.nic,m.mar_state,u.division
                          FROM members m,upf_kgl u
                             WHERE m.member_id=u.member_id;
             END IF ;
            ELSE
             OPEN pOut_cur FOR SELECT
                          u.mem_name,m.nic,m.mar_state                                             
                          FROM members m,upf_kgl u
                             WHERE U.MEMBER_ID = M.MEMBER_ID;
            END IF;
    END mem_select;Regards,
    Malakshinov Sayan

  • ORA-22809 when executing sample source code for purchaseOrder.xsd

    Hello,
    i was trying to execute the sample code given in chapter 5 of Oracle XML DB User's Guide for version 10GR2 (on an Oracle XE db) and i got:
    Error starting at line 1 in command:
    CREATE TABLE purchaseorder_as_column (
    id NUMBER,
    xml_document XMLType,
    UNIQUE (xml_document."XMLDATA"."Reference"))
    XMLTYPE COLUMN xml_document
    XMLSCHEMA "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    ELEMENT "PurchaseOrder"
    VARRAY xml_document."XMLDATA"."Actions"."Action"
    STORE AS TABLE action_table2
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$))
    ORGANIZATION INDEX OVERFLOW)
    VARRAY xml_document."XMLDATA"."LineItems"."LineItem"
    STORE AS TABLE lineitem_table2
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$))
    ORGANIZATION INDEX OVERFLOW)
    LOB (xml_document."XMLDATA"."Notes")
    STORE AS (TABLESPACE USERS ENABLE STORAGE IN ROW
    STORAGE(INITIAL 4K NEXT 32K))
    Error at Command Line:12 Column:32
    Error report:
    SQL Error: ORA-22809: nonexistent attribute
    22809. 00000 - "nonexistent attribute"
    *Cause:    An attempt was made to access a non-existent attribute of an
    object type.
    *Action:   Check the attribute reference to see if it is valid. Then retry
    the operation.
    The purchaseOrder.xsd schema document has been built by cutting and pasting the various fragments contained in the documentation and can be found at:
    http://www.yocoya.com/temp/purchaseOrder.xsd
    The schema was registered using the following command:
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd',
    SCHEMADOC => bfilename('XMLDIR','purchaseOrder.xsd'),
    CSID => nls_charset_id('AL32UTF8'),
    LOCAL => TRUE,
    GENTYPES => TRUE,
    GENTABLES => TRUE);
    END;
    Can someone explain what i am doing wrong or tell if the sample code is flawed?
    Thank you,
    Flavio
    http://www.oraclequirks.com

    Just to close this thread, in the sample xml schema document i linked in my original post, there were some xdb:SQLName annotations against elements LineItems, LineItem, Actions and Action. When such annotations are present, column names and object attributes that would otherwise carry the same name as the xml elements/attributes are completely replaced by the specified strings. This is necessary if, for some reason, the element name contain reserved oracle words (i also hit this problem 15 minutes after resolving my original issue...) or simply because we don't like having case sensitive names.
    In my original CREATE TABLE statement i was attempting to refer to nested elements using the original case sensitive names, but these names had been replaced by LINEITEMS, LINEITEM, ACTIONS and ACTION (in uppercase), hence ORA-22809.
    This was not the only problem afflicting my custom purchaseOrder.xsd, but it was the reason of ORA-22809.
    Eventually I managed to get the custom purchaseOrder schema to work.
    May be i'll come up with some tongue-in-cheek tutorial on my blog one day or another.
    Bye,
    Flavio
    http://www.oraclequirks.com

  • Keeps asking for rpt file when executing store procedure

    Hi all,
      I have coded an standard stored procedure but when I execute it, Management Studio keeps asking for .rpt file to save the results. I am using Enterprise 2008 R2. 
    This is the code:
    USE [mydatabase]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[usp_chart](
    @parameters)
    AS
    BEGIN
     SET NOCOUNT ON;    
     DECLARE @query NVARCHAR(4000)
        DECLARE @total INT
        DECLARE @strDescriptor NVARCHAR(4000)
        DECLARE @dsvalues NVARCHAR(4000)
        DECLARE @strCache NVARCHAR(2000)
        SET @strDescriptor = dbo.udf_chart_derived_descriptor_intotemp(@derivation_Id)
     SET @dsvalues =  dbo.udf_chart_derived_dynamic_query_fortopn(  @derivation_Id,
           @cache_Id,
           @topn,
          @flt_customer_Id,
          @flt_user_Id,
          @flt_datefrom,
          @flt_dateto,
          @product_Id
        SET @strCache = 'SELECT top ' + @topn + 'PERCENT g.Supplier_Id Supplier_Id 
    INTO #T_CacheTopN
    FROM T_CacheSupp g 
    WHERE g.Cache_Id = ' + @cache_Id + 
    ' ORDER BY g.Position'
        IF @strFilter is null 
         BEGIN
    SET @query = @strCache + ';' + @strDescriptor + ';' +
    'DECLARE @total INT;' +
    @dsvalues +
    'SELECT @total = COUNT(*)
     FROM #T_Condition; 
     SELECT c.Condition_Index, ROUND(COUNT(*)/CAST(@total as float),2)*100
     FROM #T_Condition c
     GROUP BY c.Condition_Index';
         END
        ELSE
         BEGIN
           DECLARE @sqlfilter NVARCHAR(2000)
      SET @sqlfilter =  dbo.udf_chart_dynamic_query_filter_fortopn(@strFilter,@product_Id,@topn, @cache_Id)
      SET @query = @strCache + ';' +@strDescriptor + ';' +
    'DECLARE @total INT;' +
    @dsvalues +
    'SELECT @total = COUNT(*)
     FROM #T_Condition;'+ @sqlfilter +
     ';SELECT c.Condition_Index, ROUND(COUNT(*)/CAST(@total as float),2)*100 
     FROM #T_Condition c LEFT OUTER JOIN #T_NotWanted d
     ON c.Data_Id = d.Data_ID
     WHERE d.Data_Id is null
     GROUP BY c.Condition_Index';
         END 
        EXEC(@query)
        RETURN
    END
    When I execute:
    DECLARE
    @parameters NVARCHAR(4000)
    execute usp_chart_derived_fortopn @parameters
    it asks me for a .rpt file.
    Why is that? I am not running a report.
    Thanks

    As other have said, you have set Results to File.
    But since you posted your code, I had a look at it. I was not able to understand why you use dynamic SQL. For instance, this:
        SET @strCache = 'SELECT top ' + @topn + 'PERCENT g.Supplier_Id Supplier_Id 
    INTO #T_CacheTopN
    FROM T_CacheSupp g 
    WHERE g.Cache_Id = ' + @cache_Id +  ' ORDER BY g.Position'
    Can be written as
    SELECT top (@topn) PERCENT g.Supplier_Id Supplier_Id 
    INTO #T_CacheTopN
    FROM T_CacheSupp g 
    WHERE g.Cache_Id = @cache_Id  
    ORDER BY g.Position
    If you can avoid dynamic SQL, your code becomes easier to maintain, and less vulnerable for nasty surprises.
    And if you use dynamic SQL, you should use sp_executesql and pass parameter values as parameters instead of inlining them.
    Erland Sommarskog, SQL Server MVP, [email protected]
    Links for SQL Server Books Online:
    SQL 2008, SQL 2005 and 
    SQL 2000.
    (Just click the link you need.)

  • ORA-06502 PL/SQL: numeric or value error ORA-06512 when calling a procedure

    Hi,
    I have been using ODP.net for a while now and have been calling lots of procedures without issue, however today I put together one to insert key, value parameters into a simple table and it is failing on me Intermittently with the ORA-06502... I have checked the code and I do not see any problems and am thoroughly frustrated... When I call the procedure directly it all works perfectly so the problem is not in the db!
    Please can you help? Code follows:
    Table defined as:
    CREATE TABLE REPORT_REQUEST_PARAMETERS
    (     REQUEST_ID NUMBER,
         PARAM_NAME VARCHAR2(50 BYTE),
         PARAM_VALUE VARCHAR2(255 BYTE)
    Stored procedure defined as:
    create or replace PROCEDURE SP_WRITE_REQUEST_PARAMS
    ( in_request_id number, in_param_name char, in_param_value char )
    AS
    BEGIN
    INSERT INTO REPORT_REQUEST_PARAMETERS ( REQUEST_ID, PARAM_NAME, PARAM_VALUE )
    VALUES
    ( in_request_id, in_param_name, in_param_value );
    END SP_WRITE_REQUEST_PARAMS;
    Finally the ODP.net code which calls this looks like:
    using (OracleConnection connection = new OracleConnection(...blah...))
    using (OracleCommand command = connection.CreateCommand())
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "SP_WRITE_REQUEST_PARAMS";
    OracleParameter p1 = new OracleParameter("in_request_id", OracleDbType.Int32);
    OracleParameter p2 = new OracleParameter("in_param_name", OracleDbType.Char);
    OracleParameter p3 = new OracleParameter("in_param_value", OracleDbType.Char);
    p1.Direction = ParameterDirection.Input;
    p1.Value = requestId;
    p2.Direction = ParameterDirection.Input;
    p2.Size = paramName.Length;
    p2.Value = paramName;
    p3.Direction = ParameterDirection.Input;
    p3.Size = paramValue.Length;
    p3.Value = paramValue;
    command.Parameters.Add(p1);
    command.Parameters.Add(p2);
    command.Parameters.Add(p3);
    connection.Open();
    command.ExecuteNonQuery();
    connection.Close();
    }

    What version of database? If it's 9206 this is a known database problem, and should be resolved by patching the database to 9208. I don't have the bug number handy though.
    Simply because it succeeded in sqlplus doesnt mean it's not a database problem, as the problem was intermittent and succeeded from odp sometimes too.
    Thanks
    Greg

  • ORA-00904 when execute query

    Similar to the SRDemo Search and Results on the same page example, if I put in an invalid query in a numeric field such as "> ddd", I get the error ORA-00904: "DDD": invalid identifier. If I hit my Clear Criteria button (Delete action), I get the same message three times. I get the three messages no matter how many times I hit the button.
    If I manually clear the field and hit the button, I get two of the above messages and the result iterator shows many rows which are all blank.
    A couple of questions:
    What is the best way to validate the query before it is executed?
    I want to avoid too much coding and I can modify the error message if needed. Is there another way to reset the the query form?
    Using JDev 10.1.3.2.0 ADF BC
    Thanks,
    Tom

    Thanks Tif. I will definitely bookmark this link.
    However, my users are not that sophisticated. I really need a form based query.
    The error is easily reproducible. Just go to the SRDemo application and to the Advanced Search tab. Put in any non-numeric character in the Request field and click Find. Click the Clear button to clear the query and you'll get the ORA error several times. You'll keep getting those errors no matter how many times you click it.
    Now, blank out the value you entered in the Request field and hit Clear again. You'll get the ORA errors again but you'll also see the Results table fill with rows but they will all be blank.
    I really like the QBE feature (it gives the user flexibility with little coding from me) but I need a way (easily, hopefully) to trap the error and to be able to clear the query.
    I'm fairly new to JDev so I may be missing something obvious here.
    Thanks,
    Tom

  • ORA-07445 When executing a query.

    Hello,
    I am executing a query that contains a lot of ansi inner join and one left join, whenever I try to execute this query I get an error. By looking at the alert log I can detect the following oracle error
    ORA-07445: encontrada excepção: core dump [kkqstcrf()+1541] [ACCESS_VIOLATION] [ADDR:0x71] [PC:0x4C8E699] [UNABLE_TO_READ] []
    We are using Oracle 11.2.0.1.
    If someone can help me on this, I would appreciate it
    Regards
    Edited by: user2934071 on 21-Jun-2011 06:52

    user2934071 wrote:
    Hello,
    I am executing a query that contains a lot of ansi inner join and one left join, whenever I try to execute this query I get an error. By looking at the alert log I can detect the following oracle error
    ORA-07445: encontrada excepção: core dump [kkqstcrf()+1541] [ACCESS_VIOLATION] [ADDR:0x71] [PC:0x4C8E699] [UNABLE_TO_READ] []
    After some research I have found the following bug description in Metalink:
    Doc ID 9050716.8, Bug 9050716 “Dumps on kkqstcrf with ANSI joins and Join Elimination”, affects Oracle Database release versions below 11.2.0.2
    As we are using Oracle 11.2.0.1, this seems to be what I am looking for. If someone can provide me this document since I do not have a metalink account, I woud appreciate it.
    RegardsDistribution of MetaLink content is a violation of the usage agreement. Anyone providing it would be in violation and at risk of having their contract terminated. The only way to legally get it is to have an account.

  • Error when executing d2kwutil.pll procedure

    Hi all,
    I use a client/server architecture.
    There was an error when executing the procedure write_registry in the w2kutil.pll. I created a test forms , and I just created a control block containing a button. In the when-button-pressed trigger I coded : win_api_environment.write_registry('HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE','TEST_REGISTR','D:\MYLOGS',true); . I already attached the d2kwutil.pll to the form module.
    The error is : FRM-40734: internal error : pl/sql error occurred.
    So how to resolve it ?
    Thank you very much indeed.

    You have that atachar the bookstore to the form and then you can make use of the contained functions inside the bookstore.

  • Encountered ORA-01722 Invalid number when query doc from  view

    Hi all,
    I have the following view.
    Select item, to_number(wo) a
    from tablea
    union all
    select item, wo
    from tablebb
    The problem rise ( ORA-01722) when I try to search for wo from the view after the view has been created. The wo field in tablea was varchar2 where user will key in the number only. And wo in tabebb is number, I can't change the column format as it is belong the my standard application table. How to solve this problem ?
    Thanks
    Lim

    sm**** wrote:
    I try to simplified my query. In fact, there are several where clause for both tables. The reason is because of the varchar2 field in WO at tablea versus the numeric field in WO for tableb. OK. The problem then is almost certainly that you have non-numeric characters in the column but you don't happen to have non-numeric characters in the columns that match all the other predicates.
    Oracle is free to apply the TO_NUMBER function before it applies some or all of the predicates you specify in your WHERE clause. If it happens to apply the TO_NUMBER on a row that has non-numeric data before it applies the condition in the WHERE clause that filters out that particular row, you'll get an error. If, on the other hand, Oracle happens to filter out the row before applying the TO_NUMBER, you'll get the results you expect. It all comes down to which plan Oracle picks. But, in general, there is no guarantee about whether you'll get an error or whether you'll get the data you want.
    You can define your own function
    CREATE OR REPLACE FUNCTION my_to_number( p_str IN VARCHAR2 )
      RETURN number
    IS
      l_num NUMBER;
    BEGIN
      l_num := to_number( p_str );
      RETURN l_num;
    EXCEPTION
      WHEN others THEN
        RETURN null;
    END;and use that instead of to_number in your query. That will catch the exception if the function is applied to a row before one of the predicates is applied.
    Justin

  • Getting ORA-01403:, when it shouldn't

    Greetings, i apologize beforehand for my spelling, name(takes 6 hours to change) and the headache you migth get, however,
    i bring you the following code, and test results:
    ------Procedure wich throws the error-------
    create or replace
    procedure P_COLEGAS(x in number) as
    ctipo varchar2(20);
    asd varchar2(20);
    cursor curnombre is
    select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo and elemento.ciudad=asd);
    begin
    select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=x and elemento.id_elem=x;
    for blah in curnombre loop
    DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    end loop;
    end;
    -what i get when executing the procedure-
    Error que empieza en la línea 1 del comando:
    exec p_colegas(19)
    Informe de error:
    ORA-01403: no data found
    ORA-06512: at "BD00.P_COLEGAS", line 9
    ORA-06512: at line 1
    01403. 00000 - "no data found"
    *Cause:
    *Action:-----------------------------------------------------------
    -----------------the real problem--------------------
    if in that procedure i were to write
    (1)
    select unidad.tipo into ctipo from unidad where unidad.id_elem=x;(2)
    select elemento.ciudad into asd from elemento where elemento.id_elem=x;instead the single query i wrote, we get the following:
    (1) works wonderfull, only gets the error when there are no matches for x.
    (2) throws the error i showed before.
    however when i do the following query in the worksheet and execute it:
    (3)
    select elemento.ciudad from elemento where elemento.id_elem=x;i get what i expected to get 1 row 1 column.(yes it has data)
    note: in (3) the only difference is that i remove the into clause, and x is the same number i used when i execute the procedure.
    --------------------the question------------------------
    why in the procedure, the query (2) fail to fetch the data, the same data wich the query(3) does not fail to fetch?
    i'm getting ORA-01403, when i shouldn't?
    is there a work around to this problem?
    --------------------what i try------------------------------
    nested the query with it's own error handle exception, getting the same results, just catches the error with a different handling.
    tool used: sql developer
    -Example data--
    tested the procedure with the following example data in a brand new workspace getting the same error.
    --  DDL for Table ELEMENTO
      CREATE TABLE "ELEMENTO"
       (     "ID_ELEM" NUMBER,
         "CIUDAD" VARCHAR2(20),
         "TIPO" CHAR(1),
         "X" NUMBER,
         "Y" NUMBER,
         "FECHAHORA_CREACION" TIMESTAMP (6)
    --  DDL for Table UNIDAD
      CREATE TABLE "UNIDAD"
       (     "ID_ELEM" NUMBER,
         "PORCENTAJE_SALUD" NUMBER,
         "NOMBRE" VARCHAR2(20),
         "TIPO" VARCHAR2(20)
    REM INSERTING into ELEMENTO
    SET DEFINE OFF;
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (12,'Infernalia','U',10,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (15,'Infernalia','U',10,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (19,'Infernalia','U',15,9,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (23,'Infernalia','U',16,8,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (27,'Infernalia','C',15,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (52,'Humania','U',26,10,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (58,'Humania','U',24,9,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (62,'Humania','U',27,11,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (64,'Humania','C',25,8,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (78,'GruntVille','U',47,32,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (84,'GruntVille','U',42,28,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (89,'GruntVille','U',43,29,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (91,'GruntVille','C',44,37,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (29,'Infernalia','C',16,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (90,'GruntVille','U',49,36,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    REM INSERTING into UNIDAD
    SET DEFINE OFF;
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (12,100,'Grang','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (15,100,'Krout','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (19,100,'Warf','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (23,100,'Puaj','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (52,100,'Marcelus','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (58,100,'Claudius','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (62,100,'Arturius','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (78,100,'Klaknot','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (84,100,'Staisht','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (89,100,'Bjorkson','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (90,100,'Sknot','Médico');
    --  Constraints for Table ELEMENTO
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_CHK1_TIPO" CHECK (TIPO IN ('U', 'C')) ENABLE;
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
      ALTER TABLE "ELEMENTO" MODIFY ("ID_ELEM" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("CIUDAD" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("TIPO" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("X" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("Y" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("FECHAHORA_CREACION" NOT NULL ENABLE);
    --  Constraints for Table UNIDAD
      ALTER TABLE "UNIDAD" MODIFY ("ID_ELEM" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("PORCENTAJE_SALUD" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("NOMBRE" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("TIPO" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
    --  Ref Constraints for Table ELEMENTO
    --  Ref Constraints for Table UNIDAD
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_ELEMENTO_FK1" FOREIGN KEY ("ID_ELEM")
           REFERENCES "ELEMENTO" ("ID_ELEM") ENABLE;
    /Edited by: 975362 on 06-12-2012 04:47 AM
    Edited by: BluShadow on 06-Dec-2012 12:51
    added {noformat}{noformat} tags for readability of code/data.  Please read {message:id=9360002} and learn to do this yourself in future.
    Edited by: 975362 on 06-12-2012 05:44 AM
    added example data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Oops, I mi9ssed table ELEMENTO has column X. When you use:
    where unidad.id_elem=x and elemento.id_elem=x;column names take precedence over PL/SQL variables wnd X is resolved as table ELEMENTO column X. not as PL/SQL procedure parameter X. Change PL/SQL procedure parameter name:
    SQL> create or replace
      2  procedure P_COLEGAS(x in number) as
      3  ctipo varchar2(20);
      4  asd varchar2(20);
      5  
      6  cursor curnombre is
      7  select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo
    and elemento.ciudad=asd);
      8  
      9  begin
    10  select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=x
    and elemento.id_elem=x;
    11  for blah in curnombre loop
    12  DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    13  end loop;
    14  end;
    15  /
    Procedure created.
    SQL> exec p_colegas(19)
    BEGIN p_colegas(19); END;
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at "SCOTT.P_COLEGAS", line 9
    ORA-06512: at line 1
    SQL> create or replace
      2  procedure P_COLEGAS(p_x in number) as
      3  ctipo varchar2(20);
      4  asd varchar2(20);
      5  
      6  cursor curnombre is
      7  select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo
    and elemento.ciudad=asd);
      8  
      9  begin
    10  select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=p_
    x and elemento.id_elem=p_x;
    11  for blah in curnombre loop
    12  DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    13  end loop;
    14  end;
    15  /
    Procedure created.
    SQL> exec p_colegas(19)
    PL/SQL procedure successfully completed.
    SQL> SY.

Maybe you are looking for

  • Calling PL\SQL procedures

    What's the best way to invoke a PL\SQL procedure using Java? I am hoping to use the values passed from the JSP into the database for computations but don't know how to call the procedure after the commit. Any ideas? Thanks a lot!

  • Security stack and caching initial context

    We are using weblogic60 sp2, when we using Optimizeit tool to profile weblogic server and we found build up initial context is very expensive, can we cache the initial context? Is it thread safe? I know there is a issue related with security stack, t

  • Is it possible to generate a user event when shared variable value change on RT target?

    Hi,     I wonder if it is possible to generate a user event when a network published shared variable value change?     Thanks a lot!     Regards,     Tom

  • Toggle Dropdown Menu, Help Please

    I have this CSS below, and it works like a charm for what it's supposed to do, but I noticed that the dropdown menu only comes down when the mouse hovers over the button. I want it so that it only drops down when clicked on, allowing the user to togg

  • Keyboard disabled during install

    Attempting to install xp on my my macpro desktop. When I get to the point where I have to press "enter" the keyboard appears to be disabled. Any thoughts? thanks That's in Snow Leopard, by the way.