Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    136

    Unanswered: PLS-00222: no function with name 'LENGTH' exists in this scope?

    Hello All!

    Compiling an error-package having
    PHP Code:
    .........
    WHILE 
    vIndex LENGTH(ErrorStackLOOP
    ......... 
    i've got an error:
    PLS-00222: no function with name 'LENGTH' exists in this scope
    Why?

    Thanks in advance!




    The whole code:
    PHP Code:
    CREATE OR REPLACE PACKAGE PKG_ERROR AS

        
    PROCEDURE PRC_HANDLE_ALL(pTop BOOLEAN);
        
        
    PROCEDURE PRC_PRINT_STACKS(pModule IN ERRORS.MODULE%TYPE
                                   
    pSeqNum IN ERRORS.SEQ_NUMBER%TYPE);
                                 
        
    PROCEDURE PRC_STRORE_STACKS(pModule     IN  ERRORS.MODULE%TYPE
                                    
    pSeqNum     OUT ERRORS.SEQ_NUMBER%TYPE
                                  
    pCommitFlag BOOLEAN DEFAULT FALSE);
                                  
    END PKG_ERROR;

    PHP Code:
    CREATE OR REPLACE PACKAGE BODY PKG_ERROR AS
           
    NewLine    CONSTANT CHAR(1) := CHR(10);
           
    Handled    BOOLEAN := FALSE;
           
    ErrorStack VARCHAR2(2000);
           
    CallStack  VARCHAR2(2000);    

        
    PROCEDURE PRC_HANDLE_ALL(pTop BOOLEANIS
         BEGIN
                 
    IF pTop THEN
                   Handled 
    := FALSE;
              
    ELSIF NOT Handled THEN
                   Handled 
    := TRUE;
                 
    ErrorStack := DBMS_UTILITY.format_error_stack;
                 
    CallStack := DBMS_UTILITY.format_call_stack;
              
    END IF;
        
    END PRC_HANDLE_ALL;        
        
        
    PROCEDURE PRC_PRINT_STACKS(pModule IN ERRORS.MODULE%TYPE
                                   
    pSeqNum IN ERRORS.SEQ_NUMBER%TYPEIS
           TimeStamp ERRORS
    .TIMESTAMP%TYPE;
           
    ErrorMsg  ERRORS.ERROR_MESG%TYPE;
           
           
    CURSOR CallCur IS
                 SELECT OBJECT_HANDLE
    LINE_NUMOBJECT_NAME FROM CALL_STACKS
              WHERE MODULE 
    pModule AND SEQ_NUMBER pSeqNum 
              ORDER BY CALL_ORDER
    ;
               
           
    CURSOR ErrorCur IS
                 SELECT FACILITY
    ERROR_NUMBERERROR_MESG FROM ERROR_STACKS
              WHERE MODULE 
    pModule AND SEQ_NUMBER pSeqNum 
              ORDER BY ERROR_ORDER
    ;       

         
    BEGIN
               SELECT TIMESTAMP
    ERROR_MESG INTO TimeStampErrorMsg FROM ERRORS
              WHERE MODULE 
    pModule AND SEQ_NUMBER pSeqNum;
              
              -- 
    Output general Error-Information 
              DBMS_OUTPUT
    .PUT(to_char(TimeStamp'DD_MON_YYYY HH24:MI:SS'));
                
    DBMS_OUTPUT.PUT('  Module: '|| pModule);
                 
    DBMS_OUTPUT.PUT('  Error #: '|| pSeqNum || ': ');
                 
    DBMS_OUTPUT.PUT_LINE(ErrorMsg);
              
              -- 
    Output Call Stack  
              DBMS_OUTPUT
    .PUT_LINE('Complete Call Stack: ');
                
    DBMS_OUTPUT.PUT_LINE('  Object Handle    Line Number    Object Name ');
                 
    DBMS_OUTPUT.PUT_LINE('  -------------    -----------    ------------');
              
              FOR 
    CallRec in CallCur LOOP
                    DBMS_OUTPUT
    .PUT(RPAD('  ' || CallRec.OBJECT_HANDLE15));
                    
    DBMS_OUTPUT.PUT(RPAD('  ' || to_char(CallRec.LINE_NUM), 13));
                    
    DBMS_OUTPUT.PUT_LINE('  ' || CallRec.OBJECT_NAME);                   
              
    END LOOP;
              
              -- 
    Output error Stack  
              DBMS_OUTPUT
    .PUT_LINE('Complete Error Stack: ');
                
              FOR 
    ErrorRec in ErrorCur LOOP
                    DBMS_OUTPUT
    .PUT('  ' || ErrorRec.FACILITY || '-');
                    
    DBMS_OUTPUT.PUT(to_char(ErrorRec.ERROR_NUMBER) || ': ');
                    
    DBMS_OUTPUT.PUT_LINE(ErrorRec.ERROR_MESG);                   
              
    END LOOP;    
        
    END PRC_PRINT_STACKS;
        
        
    PROCEDURE PRC_STRORE_STACKS(pModule     IN  ERRORS.MODULE%TYPE
                                    
    pSeqNum     OUT ERRORS.SEQ_NUMBER%TYPE
                                  
    pCommitFlag BOOLEAN DEFAULT FALSEIS
            SeqNum NUMBER
    ;
            
    vIndex NUMBER;
            
    Length NUMBER;
            
    vEnd NUMBER;
            
    Call VARCHAR2(100);
            
    CallOrder NUMBER := 1;
            
    Handle CALL_STACKS.OBJECT_HANDLE%TYPE;
            
    LineNum CALL_STACKS.LINE_NUM%TYPE;
            
    ObjectName CALL_STACKS.OBJECT_NAME%TYPE;
            
    Error VARCHAR2(120);
            
    ErrorOrder NUMBER := 1;
            
    Facility ERROR_STACKS.FACILITY%TYPE;
            
    ErrNum ERROR_STACKS.ERROR_NUMBER%TYPE;
            
    ErrMsg ERROR_STACKS.ERROR_MESG%TYPE;
            
            
    FirstErrNum ERRORS.ERROR_NUMBER%TYPE;
            
    FirstErrMsg ERRORS.ERROR_MESG%TYPE;
            
          
    BEGIN
              SELECT SEQ_ERROR
    .NEXTVAL INTO SeqNum FROM DUAL;
            
    pSeqNum := SeqNum;
            
    INSERT INTO ERRORS (MODULESEQ_NUMBERERROR_STACKCALL_STACKTIMESTAMP)
                           
    VALUES (pModuleSeqNumErrorStackCallStackSYSDATE);
            
    vIndex := 1;
            
        
    /*ERROR */    WHILE vIndex LENGTH(ErrorStackLOOP
              vEnd 
    := INSTR(ErrorStackNewLinevIndex);
              
    Error := SUBSTR(ErrorStackvIndexvEnd vIndex);
              
    vIndex := vIndex LENGTH(Error) + 1;
              
    Facility := SUBSTR(Error13);
              
    Error := SUBSTR(Error5);
              
    ErrNum := TO_NUMBER(SUBSTR(Error1INSTR(Error':') - 1));
              
    Error := SUBSTR(Error8);
              
    ErrMsg := Error;
              
              
    INSERT INTO ERROR_STACKS (MODULESEQ_NUMBERERROR_ORDERFACILITY
                                                    
    ERROR_NUMBERERROR_MESG
                             
    VALUES (pModulepSeqNumErrorOrderFacilityErrNumErrMsg);

              IF 
    ErrorOrder 1 THEN
                     FirstErrNum 
    := ErrNum;
                
    FirstErrMsg := Facility || '-' || TO_NUMBER(ErrNum) || ': ' || ErrMsg
              
    END IF;
              
              
    ErrorOrder := ErrorOrder 1;                             
            
    END LOOP;
            
            
    UPDATE ERRORS SET ERROR_NUMBER FirstErrNumERROR_MESG FirstErrMsg
                             WHERE MODULE 
    pModule AND SEQ_NUMBER SeqNum;
            
            
    vIndex := INSTR(CallStack'name') + 5;
            
        
    /*ERROR */ WHILE vIndex LENGTH(CallStackLOOP
               vEnd 
    := INSTR(CallStackNewLinevIndex);
               
    Call := SUBSTR(CallStackvIndexvEnd vIndex);
               
    vIndex := vIndex LENGTH(Call) + 1;
               
    Call := LTRIM(Call);
               
    Handle := Substr(Call1INSTR(Call' '));
               
    Call := SUBSTR(CallLENGTH(Handle) + 1);
               
    Call := LTRIM(Call);
               
    LineNum := TO_NUMBER(SUBSTR(Call1INSTR(Call' ')));
               
    Call := SUBSTR(CallLENGTH(LineNum) + 1);
               
    Call := LTRIM(Call);
               
    ObjectName := Call;
               
               IF 
    CallOrder 1 THEN
                     INSERT INTO CALL_STACKS 
    (MODULESEQ_NUMBERCALL_ORDEROBJECT_HANDLE
                                                    
    LINE_NUMOBJECT_NAME
                                 
    VALUES (pModuleSeqNumCallOrderHandleLineNumObjectName);
               
    END IF;
               
               
    CallOrder := CallOrder 1;
                                  
            
    END LOOP;
                
            IF 
    pCommitFlag THEN          
              commit
    ;
            
    END IF;    
                
        
    END PRC_STRORE_STACKS;
           
    END PKG_ERROR
    Last edited by julla27; 05-11-04 at 11:41.
    Regards,
    Julia

  2. #2
    Join Date
    Mar 2004
    Posts
    23

    length

    Length NUMBER;

    Major faux pas. Variable is same name as ORACLE char function. Try changing this var.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    yup, don't name variables the same name as oracle objects (functions in this case).
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    136
    Thanks to All!
    I have totally overlooked the variable Length!
    Now it works!
    Regards,
    Julia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •