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,941 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now