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,964 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SYS password changed. Now can't log in as SYS 27 62
Error in creating a view. 8 52
Read CLOB data from Oracle using JAVA 3 44
Sorting a SQL script 5 42
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

752 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