Solved

Error: ORA-00604: error produced at level 1 of recursivo - SQL ORA-01400: an insertion NULL cannot be made in ("SYS"."obj$"."name")

Posted on 2007-04-02
3
2,971 Views
Last Modified: 2013-12-07
I have this pl/sql function:
------------------
CREATE OR REPLACE
FUNCTION GET_ISSUER (CpyCode VARCHAR2, ItemId VARCHAR2, TitleType VARCHAR2, InvEntity VARCHAR2)
 RETURN VARCHAR2
IS

 type issuer_type is ref cursor;
 c_issuer  issuer_type;
 
 v_issuer  ISSUER_CFG%ROWTYPE;
 type issuer_rec is record
   (num_errors ISSUER_CFG.ACEPTED%TYPE,
    issuer_id  ISSUER_CFG.ISSUER_ID%TYPE);
 type v_issuers is table of issuer_rec
   index by binary_integer;  
 v_iss v_issuers;
 
 i binary_integer := 0;

 aux1 varchar2(12);
 aux2 number(1);
 sSQL varchar2(2000);
 
BEGIN
 
   sSQL :=
      'SELECT CPY_CODE, ISSUER_ID, TITLE_TYPE, INV_ENTITY, NAME, ACEPTED ' ||
      'FROM ISSUER_CFG ' ||
      'WHERE ' ||
      ' CPY_CODE = "' || CpyCode || '" AND TITLE_TYPE = "' || TitleType || '"';
         
   IF InvEntity != null AND trim(InvEntity) != "" THEN
      sSQL := sSQL || ' AND INV_ENTITY = "' || InvEntity || '"';
   END IF;

   OPEN c_issuer FOR sSQL;
       
   -- get cursor      
   LOOP    
     FETCH cur_issuer INTO v_issuer;
     EXIT WHEN cur_issuer%NOTFOUND;
     i := i + 1;
     v_iss(i).issuer_id  := v_issuer.ISSUER_ID;       
     -- get errors number
     v_iss(i).num_errors := GET_COINCIDENCES(ItemId, v_iss(i).issuer_id);          
   END LOOP;    

   -- order issuers by less number errors      
   FOR j IN 1 .. v_iss.COUNT-1 LOOP    
     IF  v_iss(j).num_errors >  v_iss(j+1).num_errors THEN
        aux1 := v_iss(j).num_errors;
        aux2 := v_iss(j).issuer_id;

        v_iss(j).num_errors := v_iss(j+1).num_errors;
        v_iss(j).issuer_id  := v_iss(j+1).issuer_id;

        v_iss(j+1).num_errors := aux1;
        v_iss(j+1).issuer_id  := aux2;
     END IF;          
   END LOOP;

   IF v_iss.COUNT = 0  OR v_iss(1).num_errors = length(ItemId) THEN
      RETURN '0';
   ELSE  
      RETURN v_iss(1).issuer_id;
   END IF;  
END;

------------------

When I compile it gives me this error:

Error: ORA-00604: error produced at level 1 of recursive SQL
ORA-01400: an insertion NULL cannot be made in ("SYS"."obj$"."name")


What can I do?
Help me plase
0
Comment
Question by:jorgeani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
sujith80 earned 500 total points
ID: 18835171
You have used the same name for two types, that is the reson for the conflict.
change the declarations as:
CREATE OR REPLACE
FUNCTION GET_ISSUER (CpyCode VARCHAR2, ItemId VARCHAR2, TitleType VARCHAR2, InvEntity VARCHAR2)
 RETURN VARCHAR2
IS

 type issuer_type is ref cursor;
 c_issuer  issuer_type;
 
 v_issuer  ISSUER_CFG%ROWTYPE;
 type issuer_type_rec is record
   (num_errors ISSUER_CFG.ACEPTED%TYPE,
    issuer_id  ISSUER_CFG.ISSUER_ID%TYPE);
 type v_issuers is table of issuer_type_rec
   index by binary_integer;  
 v_iss v_issuers;
 
.
.
.
.
Regarding the second error, seems to be nothing to do with this function, may be something in another function being called here.
0
 

Author Comment

by:jorgeani
ID: 18835190
Ok I changed the duplicated definition, but I still get this error:

Error: ORA-00604: error produced at level 1 of recursive SQL
ORA-01400: an insertion NULL cannot be made in ("SYS"."obj$"."name")

What does it mean? What can I do?
0
 

Author Comment

by:jorgeani
ID: 18835197
Ok, my error was in this line...
 IF InvEntity != null AND trim(InvEntity) != "" THEN

I replaced by:

IF InvEntity is not null and trim(InvEntity) != '' THEN

thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question