Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
2,990 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 1500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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 copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

688 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