Owa_util.who_called_me

When i am using the procedure owa_util.who_called_me as explained below I am getting some error message displayed on my browser. What is wrong with my code? How should I rectify it?
(variables declared)
v_rp_owner      varchar2(32767);
v_rp_name      varchar2(32767);
v_rp_lineno      number;
v_rp_caller_t      varchar2(32767);
(code in executable section of a packaged procedure)
owa_util.WHO_CALLED_ME(owner=>v_rp_owner,name=>v_rp_name,
     lineno=>v_rp_lineno,caller_t=>v_rp_caller_t);
htp.comment('Owner: ' || v_rp_owner);
htp.comment('Name: ' || v_rp_name);
htp.comment('LineNo: ' || to_char(v_rp_lineno));
htp.comment('Caller T: ' || v_rp_caller_t);
(Error Message displayed on browser)
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SYS.OWA_UTIL", line 1614
ORA-06512: at "AJ.GRS_SEARCH_AGENT", line 247
ORA-06512: at line 7
There is some error in the call to the procedure "owa_util.WHO_CALLED_ME", but I am unable to sort it out.

I tried the same same test and it works fine
Here is the procedure i tried
create or replace procedure test2 as
v_rp_owner varchar2(32767);
v_rp_name varchar2(32767);
v_rp_lineno number;
v_rp_caller_t varchar2(32767);
begin
owa_util.WHO_CALLED_ME(owner=>v_rp_owner,name=>v_rp_name, lineno=>v_rp_lineno,caller_t=>v_rp_caller_t);
htp.comment('Owner: ' || v_rp_owner);
htp.comment('Name: ' || v_rp_name);
htp.comment('LineNo: ' || to_char(v_rp_lineno));
htp.comment('Caller T: ' || v_rp_caller_t);
htp.p ('Hello => View source of the response');
end test2;
Please try this simpler test to see if it works.
I am not sure if you are outputting more stuff prior to calling this. One reason for the problem could
be a character set difference between the iAS middle-tier and the database.
Make sure that the DAD "nls_lang" is setup to be the same as
the database character-set
e.g. if you have a UTF8 database, $IAS_HOME/Apache/modplsql/cfg/wdbsvr.app has the following DAD setting
nls_lang=AMERICAN_AMERICA.UTF8

Similar Messages

  • Why WHO_CALLED_ME return me ANONYMOUS BLOCK ?

    I would like to know the name of the current of stored procedure with the name of the package.
    So I use OWA_UTIL.WHO_CALLED_ME function but it returns ANONYMOUS BLOCK and not "PROCEDURE" and the name of my procedure.
    Do you know why ?
    Example :
    create or replace
    PACKAGE BODY     RDF_UTILS AS
       PROCEDURE T1
       IS
             owner varchar2(30);
             nom varchar2(200);
             lineno number;
             caller_t varchar2(200);
       BEGIN
            sys.DBMS_OUTPUT.PUT_LINE (sys.DBMS_UTILITY.FORMAT_CALL_STACK);
            sys.DBMS_OUTPUT.NEW_LINE();
            sys.DBMS_OUTPUT.NEW_LINE();
            sys.OWA_UTIL.WHO_CALLED_ME(owner, nom, lineno, caller_t);
            sys.DBMS_OUTPUT.PUT_LINE('owner ='||owner||'name = '||nom||'lineno = '||lineno||'caller_t = '||caller_t);
       END;
    END RDF_UTILS;

    Because that's the way it works.I thought we were all making a concerted effort not to post sarcastic one-liners.
    @sed: The who_called_me function is intended to return the user who called your function / procedure, not the immediate caller of the 'who_called_me' function.
    Perhaps Tom Kyte's original post will be of help (compare with the who_am_i function).
    http://asktom.oracle.com/tkyte/who_called_me/
    http://asktom.oracle.com/tkyte/who_called_me/who.sql

  • Need Help to see why the performance is not good

    Hi,
    We have an application that all process are developed in PL/SQL on Oracle 9i Database :
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    Why I have created this package. the application is a production management on chemical industries. I need to sometimes trace the Manufacturing order execution to eventually answer some incoherent data. If I analyze directly the data in the Table is not always responding because the origin of problem can be provide of some execution that perform some calculation.
    In the procedure or function a use my package PAC_LOG_ERROR.PUT_LINE(xxxxxx) to save the information. This command save the information in the memory before. At the end of the procedure or function a perform the insert with the COMMIT calling PAC_LOG_ERROR.LOGS or PAC_LOG_ERROR.ERRORS on the catch exception.
    This package is always call. On each routines performed I execute it. In the trace log of the database we have see a problem we the procedure GET_PROC_NAME in the package. We have identify that is called more that 800x and increase the performance. Who increase is this select command :
        SELECT * INTO SOURCE_TEXT
        FROM (SELECT TEXT FROM all_source
            WHERE OWNER = SOURCE_OWNER AND
                  NAME=SOURCE_NAME AND
                  TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
                  LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
            ORDER BY LINE DESC)
        WHERE ROWNUM = 1;I use it to get the procedure or function name where my log proc is called. I now that I can pass in parameters, but I have think to use an automatic method, that can help to not have some problem with others developer team to make a copy/past and not update the parameters. Because the Log info is read by the Help Desk and if we have an error on the information, it not a good help.
    COULD YOU PLEASE HELP ME TO OPTIMIZE OR SAID THE BETTER METHOD TO DO IT ?
    Here my package :
    create or replace
    PACKAGE PAC_LOG_ERROR AS
    -- Name         : pac_log_error.sql
    -- Author       : Calà Salvatore - 02 July 2010
    -- Description  : Basic Error and Log management.
    -- Usage notes  : To active the Log management execute this statement
    --                UPDATE PARAM_TECHNIC SET PRM_VALUE = 'Y' WHERE PRM_TYPE = 'TRC_LOG';
    --                COMMIT;
    --                To set the period in day before to delete tracability
    --                UPDATE PARAM_TECHNIC SET PRM_VALUE = 60 WHERE PRM_TYPE = 'DEL_TRC_LOG';
    --                COMMIT;
    --                To set the number in day where the ERROR is save before deleted
    --                UPDATE PARAM_TECHNIC SET PRM_VALUE = 60 WHERE PRM_TYPE = 'DEL_TRC_LOG';
    --                COMMIT;
    -- Requirements : Packages PAC_PUBLIC and OWA_UTIL
    -- Revision History
    -- --------+---------------+-------------+--------------------------------------
    -- Version |    Author     |  Date       | Comment
    -- --------+---------------+-------------+--------------------------------------
    -- 1.0.0   | S. Calà       | 02-Jul-2010 | Initial Version
    -- --------+---------------+-------------+--------------------------------------
    --         |               |             |
    -- --------+---------------+-------------+--------------------------------------
      PROCEDURE INITIALIZE;
      PROCEDURE CLEAN;
      PROCEDURE RESETS(IN_SOURCE IN VARCHAR2 DEFAULT NULL);
      PROCEDURE PUT_LINE(TXT IN VARCHAR2);
      PROCEDURE ERRORS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99', ERR_CODE IN NUMBER DEFAULT SQLCODE, ERR_MSG IN VARCHAR2 DEFAULT SQLERRM);
      PROCEDURE LOGS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99');
    END PAC_LOG_ERROR;
    create or replace
    PACKAGE BODY PAC_LOG_ERROR
    AS
      /* Private Constant */
      CR    CONSTANT CHAR(1)  := CHR(13);  -- Retour chariot
      LF    CONSTANT CHAR(1)  := CHR(10);  -- Saut de ligne
      CR_LF CONSTANT CHAR(2)  := LF || CR; --Saut de ligne et retour chariot
      TAB   CONSTANT PLS_INTEGER := 50;
      sDelay   CONSTANT PLS_INTEGER := 30;
      /* Private Record */
      TYPE REC_LOG IS RECORD(
        ERR_DATE TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
        ERR_TXT  VARCHAR2(4000)
      /* Private Type Table */
      TYPE TAB_VALUE IS TABLE OF REC_LOG INDEX BY PLS_INTEGER;
      TYPE TAB_POINTER IS TABLE OF TAB_VALUE INDEX BY VARCHAR2(80);
      /* Private Variables Structures */
      LOG_TRC PARAM_TECHNIC.PRM_VALUE%TYPE;
      LIST_PARAM TAB_POINTER;
      /* Private Programs */
      FUNCTION GET_PROC_NAME( SOURCE_OWNER IN all_source.OWNER%TYPE
                             ,SOURCE_NAME  IN all_source.NAME%TYPE
                             ,SOURCE_LINE  IN all_source.LINE%TYPE) RETURN VARCHAR2
      AS
        SOURCE_TEXT  all_source.TEXT%TYPE;
        TYPE RECORD_TEXT IS TABLE OF all_source.TEXT%TYPE;
        RETURN_TEXT     RECORD_TEXT;
      BEGIN
        SELECT * INTO SOURCE_TEXT
        FROM (SELECT TEXT FROM all_source
            WHERE OWNER = SOURCE_OWNER AND
                  NAME=SOURCE_NAME AND
                  TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
                  LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
            ORDER BY LINE DESC)
        WHERE ROWNUM = 1;
        IF SOURCE_TEXT IS NOT NULL OR  SOURCE_TEXT != '' THEN
          SOURCE_TEXT := TRIM(SUBSTR(SOURCE_TEXT,1,INSTR(SOURCE_TEXT,'(')-1));     
          SOURCE_TEXT := LTRIM(LTRIM(TRIM(SOURCE_TEXT),'PROCEDURE'),'FUNCTION');
          SOURCE_TEXT := SOURCE_NAME||'.'|| TRIM(SOURCE_TEXT);
        ELSE
          SOURCE_TEXT := 'ANONYMOUS BLOCK';
        END IF;
        RETURN SOURCE_TEXT;
      END GET_PROC_NAME;
      PROCEDURE SELECT_MASTER(REF_TYPE IN VARCHAR2, PARAM_VALUE IN VARCHAR2, SITE OUT VARCHAR2, REF_MASTER OUT VARCHAR2)
      AS
      BEGIN
          REF_MASTER := '';
          SITE := '99';
          CASE UPPER(REF_TYPE)
            WHEN 'PO' THEN -- Process Order
              SELECT SITE_CODE INTO SITE FROM PO_PROCESS_ORDER WHERE PO_NUMBER = PARAM_VALUE;
            WHEN 'SO' THEN -- Shop Order
              SELECT P.SITE_CODE,P.PO_NUMBER INTO SITE,REF_MASTER FROM SO_SHOP_ORDER S
              INNER JOIN PO_PROCESS_ORDER P ON P.PO_NUMBER = S.PO_NUMBER
              WHERE S.NUMOF = PARAM_VALUE;
            WHEN 'SM' THEN -- Submixing
              SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SO_SUBMIXING WHERE IDSM = PARAM_VALUE;
            WHEN 'IDSM' THEN -- Submixing
              SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SO_SUBMIXING WHERE IDSM = PARAM_VALUE;
            WHEN 'PR' THEN -- Pourring
              SELECT B.SITE_CODE,P.NUMOF INTO SITE,REF_MASTER FROM SO_POURING P
              INNER JOIN SO_SUBMIXING B ON B.IDSM=P.IDSM
              WHERE P.IDSM = PARAM_VALUE;
            WHEN 'NUMSMP' THEN -- Pourring
              SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SAMPLE WHERE NUMSMP = TO_NUMBER(PARAM_VALUE);
    --        WHEN 'MSG' THEN -- Messages
    --          SELECT SITE_CODE,PO_NUMBER INTO SITE,REF_MASTER FROM CMS_INTERFACE.MAP_ITF_PO WHERE MSG_ID = PARAM_VALUE;
            ELSE
              SITE := sys_context('usr_context', 'site_attribute');
          END CASE;
      EXCEPTION
        WHEN OTHERS THEN
          REF_MASTER := '';
          SITE := sys_context('usr_context', 'site_attribute');
      END SELECT_MASTER;
      PROCEDURE ADD_LIST_PROC
      AS
      PRAGMA AUTONOMOUS_TRANSACTION;
      BEGIN
        MERGE INTO LOG_PARAM A
        USING (SELECT OWNER, TYPE
                     ,NAME PROC
                     , CASE NAME WHEN SUBNAME THEN NULL
                                 ELSE SUBNAME
                       END SUBPROC
               FROM (
                  SELECT owner,TYPE,UPPER(NAME) NAME,UPPER(trim(substr(substr(trim(text),1,instr(trim(text),'(')-1),instr(substr(trim(text),1,instr(trim(text),'(')-1),' ')))) SUBNAME
                         FROM ALL_SOURCE where owner in ('CMS_ADM','CMS_INTERFACE')
                                             and type in ('FUNCTION','PROCEDURE','PACKAGE BODY')
                                             and (instr(substr(trim(text),1,instr(trim(upper(text)),'(')-1),'FUNCTION') = 1 or instr(substr(trim(text),1,instr(trim(upper(text)),'(')-1),'PROCEDURE')=1)
               )-- ORDER BY OWNER,PROC,SUBPROC NULLS FIRST
        ) B
        ON (A.OWNER = B.OWNER AND A.TYPE = B.TYPE AND A.PROC=B.PROC AND NVL(A.SUBPROC,' ') = NVL(B.SUBPROC,' '))
        WHEN NOT MATCHED THEN
          INSERT (OWNER,TYPE,PROC,SUBPROC) VALUES (B.OWNER,B.TYPE,B.PROC,B.SUBPROC)
        WHEN MATCHED THEN
          UPDATE SET ACTIVE = ACTIVE;
        DELETE LOG_PARAM A
        WHERE NOT EXISTS (SELECT OWNER, TYPE
                     ,NAME PROC
                     , CASE NAME WHEN SUBNAME THEN NULL
                                 ELSE SUBNAME
                       END SUBPROC
               FROM (
                  SELECT owner,TYPE,NAME,upper(trim(substr(substr(trim(text),1,instr(trim(text),'(')-1),instr(substr(trim(text),1,instr(trim(text),'(')-1),' ')))) SUBNAME
                         FROM ALL_SOURCE where owner in ('CMS_ADM','CMS_INTERFACE')
                                             and type in ('FUNCTION','PROCEDURE','PACKAGE BODY')
                                             and (instr(substr(trim(text),1,instr(trim(text),'(')-1),'FUNCTION') = 1 or instr(substr(trim(text),1,instr(trim(text),'(')-1),'PROCEDURE')=1)
               ) WHERE A.OWNER = OWNER AND A.TYPE = TYPE AND A.PROC=PROC AND NVL(A.SUBPROC,' ') = NVL(SUBPROC,' '));
        COMMIT;
      EXCEPTION
        WHEN OTHERS THEN
          NULL;
      END ADD_LIST_PROC;
      PROCEDURE INITIALIZE
      AS
      BEGIN
        LIST_PARAM.DELETE;
        CLEAN;
    --    ADD_LIST_PROC;
      EXCEPTION
        WHEN OTHERS THEN
          NULL;
      END INITIALIZE;
      PROCEDURE CLEAN
      AS
        PRAGMA AUTONOMOUS_TRANSACTION;
        dtTrcLog DATE;
        dtTrcErr DATE;
      BEGIN
        BEGIN
          SELECT dbdate-NUMTODSINTERVAL(to_number(PRM_VALUE),'DAY') INTO dtTrcLog
          FROM PARAM_TECHNIC WHERE PRM_TYPE = 'DEL_TRC_LOG';
        EXCEPTION
          WHEN OTHERS THEN
            dtTrcLog := dbdate -NUMTODSINTERVAL(sDelay,'DAY');
        END;
        BEGIN
          SELECT dbdate-NUMTODSINTERVAL(to_number(PRM_VALUE),'DAY') INTO dtTrcErr
          FROM PARAM_TECHNIC WHERE PRM_TYPE = 'DEL_TRC_ERR';
        EXCEPTION
          WHEN OTHERS THEN
            dtTrcErr := dbdate -NUMTODSINTERVAL(sDelay,'DAY');
          END;
        DELETE FROM ERROR_LOG WHERE ERR_TYPE ='LOG' AND ERR_DATE < dtTrcLog;
        DELETE FROM ERROR_LOG WHERE ERR_TYPE ='ERROR' AND ERR_DATE < dtTrcErr;
        COMMIT;
      EXCEPTION
        WHEN OTHERS THEN
          NULL; -- Do nothing if error occurs and catch exception
      END CLEAN;
      PROCEDURE RESETS(IN_SOURCE IN VARCHAR2 DEFAULT NULL)
      AS
        SOURCE_OWNER all_source.OWNER%TYPE;
        SOURCE_NAME      all_source.NAME%TYPE;
        SOURCE_LINE      all_source.LINE%TYPE;
        SOURCE_TEXT  all_source.TEXT%TYPE;
        SOURCE_PROC  VARCHAR2(32727);
      BEGIN
        OWA_UTIL.WHO_CALLED_ME(owner    => SOURCE_OWNER,
                               name     => SOURCE_NAME,
                               lineno   => SOURCE_LINE,
                               caller_t => SOURCE_TEXT);
        IF SOURCE_PROC IS NULL THEN
          SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,125);
        ELSE
          SOURCE_PROC := IN_SOURCE;
        END IF;
        LIST_PARAM.DELETE(SOURCE_PROC);
      EXCEPTION
        WHEN OTHERS THEN
          NULL;
      END RESETS;
      PROCEDURE PUT_LINE(TXT IN VARCHAR2)
      AS
        PRAGMA AUTONOMOUS_TRANSACTION;
        SOURCE_OWNER     all_source.OWNER%TYPE;
        SOURCE_NAME     all_source.NAME%TYPE;
        SOURCE_LINE     all_source.LINE%TYPE;
        SOURCE_TEXT all_source.TEXT%TYPE;
        SOURCE_PROC VARCHAR2(128); 
      BEGIN
        IF TXT IS NULL OR TXT = '' THEN
          RETURN;
        END IF;
        OWA_UTIL.WHO_CALLED_ME(owner    => SOURCE_OWNER,
                               name     => SOURCE_NAME,
                               lineno   => SOURCE_LINE,
                               caller_t => SOURCE_TEXT);
        SOURCE_PROC := GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE);
        IF LIST_PARAM.EXISTS(SOURCE_PROC) THEN
          LIST_PARAM(SOURCE_PROC)(LIST_PARAM(SOURCE_PROC).COUNT+1).ERR_TXT := TXT;
        ELSE 
          LIST_PARAM(SOURCE_PROC)(1).ERR_TXT := TXT;
        END IF;
      EXCEPTION
        WHEN OTHERS THEN
          NULL;   
      END PUT_LINE;
      PROCEDURE LOGS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99')
      AS
        PRAGMA AUTONOMOUS_TRANSACTION;
        MASTER_VALUE ERROR_LOG.ERR_MASTER%TYPE;
        SITE PARAMTAB.SITE_CODE%TYPE;
        SOURCE_OWNER     all_source.OWNER%TYPE;
        SOURCE_NAME     all_source.NAME%TYPE;
        SOURCE_LINE     all_source.LINE%TYPE;
        SOURCE_TEXT all_source.TEXT%TYPE;
        SOURCE_PROC VARCHAR2(128);
        ERR_KEY NUMBER;
      BEGIN
    --    NULL;
        OWA_UTIL.WHO_CALLED_ME(owner    => SOURCE_OWNER,
                               name     => SOURCE_NAME,
                               lineno   => SOURCE_LINE,
                               caller_t => SOURCE_TEXT);
        SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,128);
        LIST_PARAM.DELETE(SOURCE_PROC);
    --    SELECT NVL(MAX(ACTIVE),'N') INTO LOG_TRC FROM LOG_PARAM WHERE TRIM(UPPER((PROC||'.'||SUBPROC))) = TRIM(UPPER(SOURCE_PROC))
    --                                      AND OWNER =SOURCE_OWNER AND TYPE = SOURCE_TEXT ;
    --    IF LOG_TRC = 'N' THEN
    --      LIST_PARAM.DELETE(SOURCE_PROC);
    --      RETURN;
    --    END IF;   
    --    SELECT_MASTER(REF_TYPE => UPPER(REF_TYPE), PARAM_VALUE => REF_VALUE, SITE => SITE, REF_MASTER => MASTER_VALUE);
    --    ERR_KEY := TO_CHAR(LOCALTIMESTAMP,'YYYYMMDDHH24MISSFF6');
    --    FOR AIX IN 1..LIST_PARAM(SOURCE_PROC).COUNT LOOP
    --      INSERT INTO ERROR_LOG (ERR_KEY, ERR_SITE,ERR_SLAVE  ,ERR_MASTER  ,ERR_TYPE ,ERR_PROC,ERR_DATE,ERR_TXT)
    --      VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,'LOG',SOURCE_PROC,LIST_PARAM(SOURCE_PROC)(AIX).ERR_DATE ,LIST_PARAM(SOURCE_PROC)(AIX).ERR_TXT);
    --    END LOOP; 
    --    UPDATE SESSION_CONTEXT SET SCX_ERR_KEY = ERR_KEY WHERE SCX_ID = SYS_CONTEXT('USERENV','SESSIONID');
    --    LIST_PARAM.DELETE(SOURCE_PROC);
    --    COMMIT;
      EXCEPTION
        WHEN OTHERS THEN
          LIST_PARAM.DELETE(SOURCE_PROC);
      END LOGS;
      PROCEDURE ERRORS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99', ERR_CODE IN NUMBER DEFAULT SQLCODE, ERR_MSG IN VARCHAR2 DEFAULT SQLERRM)
      AS
        PRAGMA AUTONOMOUS_TRANSACTION;
        MASTER_VALUE ERROR_LOG.ERR_MASTER%TYPE;
        SITE         PARAMTAB.SITE_CODE%TYPE;
        SOURCE_OWNER all_source.OWNER%TYPE;
        SOURCE_NAME      all_source.NAME%TYPE;
        SOURCE_LINE      all_source.LINE%TYPE;
        SOURCE_TEXT  all_source.TEXT%TYPE;
        SOURCE_PROC  VARCHAR2(4000);
        ERR_KEY NUMBER := TO_CHAR(LOCALTIMESTAMP,'YYYYMMDDHH24MISSFF6');
      BEGIN
        OWA_UTIL.WHO_CALLED_ME(owner    => SOURCE_OWNER,
                               name     => SOURCE_NAME,
                               lineno   => SOURCE_LINE,
                               caller_t => SOURCE_TEXT);
        SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,125);
        SELECT_MASTER(REF_TYPE => UPPER(REF_TYPE), PARAM_VALUE => REF_VALUE, SITE => SITE, REF_MASTER => MASTER_VALUE);
       IF LIST_PARAM.EXISTS(SOURCE_PROC) THEN
          FOR AIX IN 1..LIST_PARAM(SOURCE_PROC).COUNT LOOP
            INSERT INTO ERROR_LOG (ERR_KEY,ERR_SITE,ERR_SLAVE,ERR_MASTER,ERR_PROC,ERR_DATE,ERR_TXT,ERR_CODE,ERR_MSG)
            VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,SOURCE_PROC,LIST_PARAM(SOURCE_PROC)(AIX).ERR_DATE, LIST_PARAM(SOURCE_PROC)(AIX).ERR_TXT,ERR_CODE,ERR_MSG);
          END LOOP; 
         LIST_PARAM.DELETE(SOURCE_PROC);
        ELSE
          INSERT INTO ERROR_LOG (ERR_KEY,ERR_SITE,ERR_SLAVE,ERR_MASTER,ERR_PROC,ERR_DATE,ERR_TXT,ERR_CODE,ERR_MSG)
          VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,SOURCE_PROC,CURRENT_TIMESTAMP,'Error info',ERR_CODE,ERR_MSG);
        END IF;
        UPDATE SESSION_CONTEXT SET SCX_ERR_KEY = ERR_KEY WHERE SCX_ID = sys_context('usr_context', 'session_id');
        COMMIT;
      EXCEPTION
        WHEN OTHERS THEN
          LIST_PARAM.DELETE(SOURCE_PROC);
      END ERRORS;
    END PAC_LOG_ERROR;

    This package is always call. On each routines performed I execute it. In the trace log of the database we have see a problem we the procedure GET_PROC_NAME in the package. We have identify that is called more that 800x and increase the performance. Who increase is this select command :
        SELECT * INTO SOURCE_TEXT
        FROM (SELECT TEXT FROM all_source
            WHERE OWNER = SOURCE_OWNER AND
                  NAME=SOURCE_NAME AND
                  TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
                  LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
            ORDER BY LINE DESC)
        WHERE ROWNUM = 1;Complex SQL like inline views and views of views can overwhelm the cost-based optimizer resulting in bad execution plans. Start with getting an execution plan of your problem query to see if it is inefficient - look for full table scans in particular. You might bet better performance by eliminating the IN and merging the results of 3 queries with a UNION.

  • Trigger - find triggering statement

    Heyho there,
    I have a question: can a trigger somehow find out, which statement caused the trigger to fire? And if so, is it possible to find out the session?
    thx for your help in advance
    René

    Hello
    Within a trigger, you can access the session id via SYS_CONETEXT('USERENV','SESSIONID') - that will give you the audsid value that you'd find in v$session.audsid. You could use this to query v$session if you wanted to get sid and serial#.
    In terms of finding out which statement caused the trigger to fire, that's a little more difficult. The issue is that the statement could have been as a result of someone connecting via a development tool and issuing a dml statement, or it could be as a result of calling a stored procedure. When it's the result of a procedure call, you could find the caller details like so
    X>create table dt_test
      2  (id number)
      3  /
    Table created.
    Elapsed: 00:00:01.09
    X>create or replace trigger dt_test_trg
      2  before insert or update on dt_test
      3  for each row
      4  declare
      5
      6      v_Owner         VARCHAR2(30);
      7      v_Name          VARCHAR2(30);
      8      v_Line          NUMBER;
      9      v_Caller        VARCHAR2(30);
    10
    11  BEGIN
    12
    13      owa_util.who_called_me
    14      (   v_Owner ,
    15          v_Name  ,
    16          v_Line  ,
    17          v_Caller
    18      );
    19
    20      dbms_output.put_line('Owner '||v_Owner);
    21      dbms_output.put_line('Name '||v_Name);
    22      dbms_output.put_line('Line '||v_Line);
    23      dbms_output.put_line('Caller '||v_Caller);
    24
    25
    26  end;
    27  /
    Trigger created.
    Elapsed: 00:00:00.57
    X>create or replace procedure p_test
      2  is
      3
      4  begin
      5
      6      insert into dt_test values(1);
      7
      8  end;
      9  /
    Procedure created.
    Elapsed: 00:00:00.35
    X>set serveroutput on
    X>
    X>ev_ec p_test;
    Owner SWAPP_OWNER
    Name P_TEST
    Line 6
    Caller PROCEDURE
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.25But note that if it is a package that contains the stored procedure, you'll get the line number and the name of the package, not the name of the procedure...
    X>create or replace package pkg_test
      2  is
      3
      4      procedure p_test;
      5
      6  end;
      7  /
    Package created.
    Elapsed: 00:00:00.07
    X>
    X>create or replace package body pkg_test
      2  is
      3
      4      procedure p_test
      5      is
      6
      7      begin
      8
      9          insert into dt_test values(1);
    10
    11      end;
    12  end;
    13  /
    Package body created.
    Elapsed: 00:00:00.10
    X>exec pkg_test.p_test;
    Owner SWAPP_OWNER
    Name PKG_TEST
    Line 9
    Caller PACKAGE BODYand if this is just a stand alone SQL statement that's not being called from a stored procedure, you won't get any caller info...
    X>insert into dt_test values(1);
    Owner
    Name
    Line
    Caller
    1 row created.
    Elapsed: 00:00:00.00Hope that helps
    David
    Edited by: 950453 on Sep 10, 2012 10:37 AM
    Just saw the link to the solution that searches the shared pool for the triggering statement which will give a much more detailed view of what's caused the statement to fire. Bravo.

  • Ora-06502:pl/sql and ora-06512 at sys.owa_util errors

    Greetings -
    I have just installed APEX 2.2 in my 9.2.0.7 database and am going through the exercises in the "2 Day+ Application Express Developer's Guide." I was making good progress, until I got to Chapter 5, How to Control Form Layout. I created the script "ht_emp", as instructed. Everything in the script works, except for the "create or replace trigger bi_ht_emp" part. It fails with the following errors:
    ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", lone 328 ORA-06512: at "SYS.HTP", line 862 ORA-06512: at "SYS.HTP", line 977 ORA-06512: at "SYS.HTP", line 995 ORA-06512: at "FLOWS_020200.WWV_FLOW_SW_API", line 428 ORA-01003: no statement parsed. I have confirmed that nls_length_semantics = BYTE
    Any suggestions?
    Thanks in advance - Gail

    Scott -
    Here's the part of the script that chokes --
    CREATE OR REPLACE TRIGGER bi_ht_emp
    BEFORE INSERT ON ht_emp
    FOR EACH ROW
    BEGIN
    SELECT ht_emp_seq.nextval
    INTO :new.emp_id
    FROM DUAL;
    :new.rec_create_date := SYSDATE;
    END;
    Thanks fro helping -
    Gail

  • Error while setting Owa_Util.Mime_Header

    Hi.....
    I have to make code to download BLOB file from my custom table Oracle APEX.
    I am setting MIME Header using the following statement.
    owa_util.mime_header(nvl( v_mime,'application/octet'), FALSE );
    htp.p('Content-type: ' || v_mime);
    htp.p('Content-length: ' || v_length);
    htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
    owa_util.http_header_close;
    I am using this code to download BLOB file from table.
    But i am getting following error:
    Error report:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 354
    ORA-06512: at "SYS.OWA_UTIL", line 413
    ORA-06512: at line 10
    06502. 00000 - "PL/SQL: numeric or value error%s"
    Can anyone tell me how to come out of this error.
    I am not able to understand this error.
    Thanks in advance.
    Edited by: user639262 on Sep 4, 2008 11:06 AM

    tward wrote:
    I'm trying to use:
    owa_util.mime_header('application/vnd.ms-excel', FALSE)
    htp.p('Content-Disposition: filename="test.xls"');
    owa_util.http_header_close;
    htp.htmlopen;
    htp.bodyopen;
    htp.tableopen(cattributes=>'border="1" width="100%" align="CENTER"');
    htp.tablerowopen;--(cattributes => 'align="LEFT", bgcolor="LIGHTGRAY"');
    htp.tableheader(cattributes=>'width="10%"', cvalue => 'Header 1');
    htp.tableheader(cattributes=>'width="15%"', cvalue => 'Header 2');
    htp.tableheader(cattributes=>'width="20%"', cvalue => 'Header 3');
    htp.tableheader(cattributes=>'width="10%"', cvalue => 'Header 4');
    htp.tableheader(cattributes=>'width="20%"', cvalue => 'Header 5');
    htp.tableheader(cattributes=>'width="25%"', cvalue => 'Header 6');
    htp.tablerowclose;
    htp.tableclose;
    htp.bodyclose;
    htp.htmlclose;
    My understanding is that this will open the window to Open/Save/Cancel the output in Excel.....
    But for some reason, it simply displays in a browser window.....
    The first line in the windows is:
    Content-type: application/vnd.ms-excel Content-Disposition: filename="test.xls"
    followed by the HTML Table....
    Why will it not open in Excel for me?Something is not getting recognized properly.
    Try hard-coding the functionality you want into a static HTML document. Then work on using owa_util.mime_header or Like MichaelS suggested htp.p surrounded by any needed tags w/options to duplicate the working static document's functionality.

  • Owa_util.mime_header not working like it should

    I have written a PL/SQL procedure that functions as a report using htp and htf tags. I wish to give the user the option to display the report in MS Excel. In the procedure, I have the following line:
    OWA_UTIL.MIME_HEADER('application/vnd.ms-excel');
    This has worked fine for me on several previous occasions, but at this particular client all I get is an output of
    Content-type: application/vnd.ms-excel
    in the browser, without Excel being opened.
    Is there a server/DB/Portal setting that may be restricting Portal from sending this report to Excel? I'm using portal 9.0.2.6.18 on a Sun/Unix platform.

    I've been struggling with this too. I've ceated a test procedure which includes:
    htp.init;
    owa_util.mime_header('application/excel');
    htp.p('ID;ORACLE;N;E');
    htp.p('line 1 col 1');
    htp.p('line 1 col 2');
    htp.p('line 1 col 1');
    htp.p('line 2 col 2');
    but when I open it in Excel I get:
    "Error reading record 5"
    Can anyone suggest what I'm doing wrong?

  • ORA-06502/ORA-06512 at execution owa_util.mime_header

    Hi, APEX gurus!
    I try to write a procedure to display bfile contention /images/ into APEX page.
    I have a table :
    -TEMP_FLAGS (ID NUMBER(3) NOT NULL, NAME BFILE)
    - procedure display_country_flags_bfile
    display_country_flags_bfile (p_id NUMBER) is
    CURSOR c_flags(p_flag NUMBER) IS
    SELECT name
    FROM temp_flags_bfile
    WHERE id = p_flag;
    r_flags c_flags%ROWTYPE;
    v_bfile bfile;
    lgh_file number;
    v_dir_alias varchar2(256);
    v_filename varchar2(256);
    v_mime varchar2(255);
    begin
    open c_flags(p_id);
    fetch c_flags INTO r_flags;
    CLOSE c_flags;
    v_bfile := r_flags.name;
    dbms_lob.filegetname(v_bfile, v_dir_alias, v_filename);
    lgh_file := dbms_lob.getlength(v_bfile);
    Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    htp.p('Content-length: '||lgh_file);
    htp.p('Content-Disposition: attachment; filename="'||v_filename||'"');
    owa_util.http_header_close;
    wpg_docload.download_file(v_bfile);
    Dbms_Lob.Fileclose(v_bfile);
    end display_country_flags_bfile;
    If i execute directly in Toad i get error below:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 354
    ORA-06512: at "SYS.OWA_UTIL", line 413
    ORA-06512: at "STAT.DISPLAY_COUNTRY_FLAGS_BFILE", line 20
    ORA-06512: at line 1
    In Report attributes of APEX page, i use HTML expression to populate column value as call this procedure with appropriate parameter but image just not showing.
    I appreciate any help and opinion.
    P.S. I'm a newbie in APEX and have minimal experience.
    P.S.2 I forgot - Oracle 10g XE and APEX 2.1 built-in
    Thanks, Rado
    Edited by: user7637288 on 16-Dec-2008 05:12

    Thanks, rafix.
    But i'm using Oracle XE with storage limit /1GB/ and i don't want store any images in database. I prefer to use bfile type with link to files on OS level.
    By the way , just for tests, i try to use blobs on my own table with simular procedure, which throws the same error - with owa_util.mime_header. And think that the problem is related to owa_util package.
    My APEX version is 2.1 - built-in in Oracle XE, not 3.1

  • Owa_util.get_cgi_env( 'REMOTE_ADDR' ) fails with PLSQL numeric error

    APEX Listener 2.0.1
    APEX 4.2.2
    Oracle 11gR2
    Linux RHEL 6.3
    Glassfish 3.1.2
    =============
    After upgrading from APEX Listener 1.1.4 -> 2.0.1 the procedure owa_util.get_cgi_env( 'REMOTE_ADDR' ) fails to return the remote IP Address and instead I get the error
    ORA-06502: PL/SQL: numeric or value error
    Has something changed with the new APEX Listener 2.0.1?  Is there a configuration element in the config or web.xml file that has to be changed before deploying the APEX Listener to GlassFish?
    Thanks.

    Hi I cannot reproduce this issue, here's the test case I used, can you try this and report the output generated:
    create or replace procedure test_cgi as
    begin
    owa_util.print_cgi_env;
    htp.prn(owa_util.get_cgi_env( 'REMOTE_ADDR' ));
    end;
    grant execute on test_cgi to apex_public_user
    Then I invoke the above procedure as follows:
    http://localhost:8080/apex/<workspace-schema-name>.test_cgi
    where <workspace-schema-name> is the database schema that the APEX workspace is using.
    Which produces output like the following:
    host = localhost:8080
    user-agent = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
    accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    accept-language = en-US,en;q=0.5
    accept-encoding = gzip, deflate
    dnt = 1
    connection = keep-alive
    cookie = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
    APEX_LISTENER_VERSION = 2.0.3.199.09.35
    DAD_NAME =
    DOC_ACCESS_PATH =
    DOCUMENT_TABLE =
    GATEWAY_IVERSION = 3
    GATEWAY_INTERFACE = CGI/1.1
    HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_ENCODING = gzip, deflate
    HTTP_ACCEPT_LANGUAGE = en-US,en;q=0.5
    HTTP_ACCEPT_CHARSET =
    HTTP_IF_MODIFIED_SINCE =
    HTTP_IF_NONE_MATCH =
    HTTP_HOST = localhost:8080
    HTTP_ORACLE_ECID =
    HTTP_PORT = 8080
    HTTP_REFERER =
    HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
    PATH_ALIAS =
    PATH_INFO = /resteasy.test_cgi
    PLSQL_GATEWAY = WebDb
    QUERY_STRING =
    REMOTE_ADDR = 0:0:0:0:0:0:0:1
    REMOTE_USER = apex
    REQUEST_CHARSET = AL32UTF8
    REQUEST_IANA_CHARSET = UTF-8
    REQUEST_METHOD = GET
    REQUEST_PROTOCOL = http
    REQUEST_SCHEME = http
    SCRIPT_NAME = /apex
    SCRIPT_PREFIX =
    SERVER_NAME = localhost
    SERVER_PORT = 8080
    SERVER_PROTOCOL = HTTP/1.1
    SERVER_SOFTWARE = Mod-Apex
    WEB_AUTHENT_PREFIX =
    HTTP_COOKIE = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
    0:0:0:0:0:0:0:1

  • Reg. owa_util.ident_arr

    Hi Experts,
    I'm stuck up with a procedure where i need to pass multiple checkbox values. So, i'm using owa_util.ident_arr.
    But i'm not able to pass any default value for the same (required when 1st time loading the page).
    Please consider this a bit urgent.
    Help really appreciated.
    Best Regards,
    Ranit B.

    ranitB wrote:
    Hi Experts,
    I'm stuck up with a procedure where i need to pass multiple checkbox values. So, i'm using owa_util.ident_arr.
    But i'm not able to pass any default value for the same (required when 1st time loading the page).
    Please consider this a bit urgent.
    Help really appreciated.
    Best Regards,
    Ranit B.Urgent issues should be raised with Oracle Support. Urgent issues typically relate to commercially live systems, so posting urgent issues here is a breach of the terms of use of the forums...
    >
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle.
    >
    It is also considered very rude to expect the volunteers of these forums to ignore all other things they are doing or other posts they are answering to help you with your urgent issue, and it is also rude to all the other people posting questions to assume that your question is somehow more important than theirs.
    Read the FAQ: {message:id=9360002} especially point 2.
    Also, consider that SQL and PL/SQL does not have checkboxes, so your question isn't likely to be relevant to this particular forum, so read that FAQ and ensure you either a) provide sufficient information so that people can help you or b) post sufficient information in the correct forum.

  • Owa_util.ident_arr

    Does anyone know how to use this datatype? From what I understand, I use this to capture multiple selections from a drop list. That's all well and good, but is there any way to convert that into a string (delimited) that I can stick into a database column of type varchar2? Help! Please!

    You should define an empty variable for the package where you will use this type as a default and for the procedure that will read the array. The code should look something like this...
    create package test_package as
    empty_array owa_util.ident_arr;
    procedure read_proc (the_array owa_util.ident_arr default empty_array);
    procedure read_proc is
    end;
    To grab the data from the array you can then have the procedure perform a loop through the array and reads the values as follows:
    create procedure read_proc (the_array owa_util.ident_arr default empty_array) is
    begin
    for i in 1..the_array loop
    htp.p('Value at '&#0124; &#0124;i&#0124; &#0124;'= '&#0124; &#0124;the_array(i));
    end loop;
    (This is pretty much a high level example). Hope this helps,
    - Alex
    null

  • Unable to run procedure due to error in package OWA_UTIL

    Hi,
    I have written a nice PL/SQL procedure called 'send_notification'.. My procedure begins like this :
    create or replace
    procedure             send_notification
    is
    ws_id               number;
    l_body              clob;
    l_url               varchar2(256);
    l_cgi_var_name      varchar2(100) default 'SERVER_NAME'; 
    l_server_name       varchar2(2000) ;
    begin
    l_server_name := owa_util.get_cgi_env(l_cgi_var_name) ;
    The procedure is nicely compiled without errors. When I run the procedure "send_notification", I get these error messages :
    ORA-06502: PL/SQL : erreur numérique ou erreur sur une valeur
    ORA-06512: à "SYS.OWA_UTIL", ligne 356
    ORA-06512: à "SIVOA.SEND_NOTIFICATION", ligne 10
    ORA-06512: à ligne 2
    The lines 354-356 of the package OWA.UTIL shows this :
    function get_cgi_env(param_name in varchar2) return varchar2 is
    upper_param_name varchar2(2000) := upper(param_name);
    begin
    I have successfully compiled the package OWA_UTIL.
    Thank you for your kind help.
    Christian

    Thierry,
    Your solution is working nicely.
    create or replace
    procedure                   send_notification
    is
    ws_id               number;
    l_body              clob;
    l_url               varchar2(256);
    l_cgi_var_name      varchar2(100) default 'SERVER_NAME'; 
    l_server_name       varchar2(2000) ;
    nm owa.vc_arr;
    vl owa.vc_arr;
    begin
    nm(1) := 'X';
    vl(1) := 'Y';
    owa.init_cgi_env( nm.count, nm, vl );
    l_server_name := owa_util.get_cgi_env(l_cgi_var_name) ;
    select max(workspace_id) into ws_id from apex_applications ;
    wwv_flow_api.set_security_group_id(ws_id);
    FOR C1 IN ( SELECT id, email, nature_contrat
                 from   contrats_maintenance
                 where  email is not null
                 and    alert = 1
                 and    DATE_ENVOI_PROCHAIN_MAIL <= SYSDATE
                 and    (email_sended IS NULL OR email_sended = 0)
    loop
          l_url := 'http://'||l_server_name||':7777/pls/apex/f?p=109:29:::NO::P29_ID:'||C1.ID ;     
          l_body := l_body ||chr(13)||'Bonjour,'||chr(13)||chr(13);
          l_body := l_body ||chr(13)||'Un contrat de maintenance arrivera à échéance -> '||l_url;
          l_body := l_body ||chr(13)||'Cliquez sur le lien pour y accéder.';
          l_body := l_body ||chr(13)||'Cordialement.'||chr(13)||chr(13);
          l_body := l_body ||chr(13)||'Le robot Oracle.';
          APEX_MAIL.SEND(
          P_TO       => c1.email,
          P_FROM     => '[email protected]',
          P_BODY     => l_body,
          P_SUBJ     => 'Notification d''échéance d''un contrat de maintenance : '|| c1.Nature_contrat );
          APEX_MAIL.PUSH_QUEUE;
          update contrats_maintenance
                 set    email_sended = 1, email_send_date = sysdate
                 where  ID = C1.ID;
      end loop;
    end send_notification;Thank you very much !
    Edited by: Christian on Jan 19, 2011 2:51 AM

  • Cannot Pass owa_util.ident_arr variable to function

    I have the following procedure using a cursor with a where clause that depends on a function. The function uses an owa_util.ident_arr type variable. For some reason the package fails to compile due to PLS-00382: Expression is of wrong type. If the function is stripped from the cursor and placed in the body of the package it will compile and execute as expected. Anyone have any ideas what I'm doing wrong?
    Compilation errors for PACKAGE BODY WSANDBOX
    Error: PLS-00382: expression is of wrong type
    Line: 86
    Text: WHERE f_ms_val(pv_select , my_table.column1) = 1;
    Error: PLS-00306: wrong number or types of arguments in call to 'F_MS_VAL'
    Line: 86
    Text: WHERE f_ms_val(pv_select , my_table.column1) = 1;
    Yada, yada, yada ...
    CREATE OR REPLACE PACKAGE wsandbox IS
    PROCEDURE p_print(pv_select IN owa_util.ident_arr);
    FUNCTION f_ms_val (pv_choice IN owa_util.ident_arr , pv_compare VARCHAR2) RETURN NUMBER;
    END wsandbox;
    CREATE OR REPLACE PACKAGE BODY wsandbox IS
    PROCEDURE p_print(pv_select IN owa_util.ident_arr) IS
    CURSOR c_rpt IS
    SELECT *
    FROM my_table
    WHERE f_ms_val(pv_select , my_table.column1) = 1; --<<<pv_select causes error
    lv_rpt c_rpt%ROWTYPE;
    BEGIN
    OPEN c_rpt;
    LOOP
    FETCH c_rpt
    INTO lv_rpt;
    EXIT WHEN c_rpt%NOTFOUND;
    htp.print(lv_rpt.column2);
    htp.nl;
    END LOOP;
    END p_print;
    FUNCTION f_ms_val (pv_choice IN owa_util.ident_arr , pv_compare VARCHAR2) RETURN NUMBER IS
    lv_result NUMBER;
    lv_select VARCHAR2(10000);
    BEGIN
    FOR i IN 1.. pv_choice.COUNT LOOP
    lv_select := lv_select || ' : ' || pv_choice(i);
    lv_result := instr( ' : ' || lv_select || ' : ',
    ' : ' || pv_compare || ' : ');
    IF lv_result > 0 THEN
    RETURN 1;
    END IF;
    END LOOP;
    RETURN 0;
    END f_ms_val;
    END wsandbox;

    owa_util.ident_array is defined as
    type ident_arr is table of varchar2(30) index by binary_integer;and as such a plsql array and as such not recognizable by the sql engine. You need to convert to a proper sql type (e.g. to sys.dbms_debug_vc2coll) to be utilizable by a select statement.

  • ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL"

    Was working on tutorial from the:
    Oracle Database Express Edition 2 Day Plus Application Express Developer Guide
    Working on the section 4: How to Control Form Layout.
    Ran into a problem trying to compile the Create HT-EMP Table script.
    keep getting this error for this particular segment creating the bu_ht_emp trigger:
    pp. 4-2 and 4-3
    CREATE OR REPLACE TRIGGER bi_ht_emp
    BEFORE INSERT ON ht_emp
    FOR EACH ROW
    BEGIN
    SELECT ht_emp_seq.nextval
    INTO :new.emp_id
    FROM DUAL;
    :new.rec_create_date := SYSDATE;
    END;
    ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", line 354....etc
    I've check the syntax for the entire script and it all checks out. Does anyone have a clue why this is failing?

    If I'm looking at the same DDL, not seeing where it would throw an owa_util error, are you running it in the apex script editor?
    Just plain sqlplus doesn't like the empty line stuck in with the list of check constraints on the emp_dept column, after fixing that up (and dropping the sequence that got created on the first pass) the DDL and insert runs fine-

  • Can you set username and password when using OWA_UTIL.REDIRECT_URL?

    If you have a PSP that runs under a DAD that includes username and password and therefore doesn't require users to log in and you want it to do OWA_UTIL.REDIRECT_URL to another PSP that runs under another DAD that normally requires login using basic database authentication and the first PSP already "knows" the user's username and password, is there any way to use them to skip the login dialog of the second page? Maybe hack into the request and use UTL_HTTP.SET_AUTHENTICATION somehow...?

    That doesn't seem to work, and trying that kind of url directly from the browser says "invalid syntax error", so maybe Oracle appserver just doesn't let you do that.
    I got the idea of trying to add an authorization header:
    OWA_UTIL.MIME_HEADER(BCLOSE_HEADER => FALSE);
    HTP.P( 'Authorization: Basic mybase64encodedcredentials' );
    OWA_UTIL.REDIRECT_URL('myurl', FALSE);
    OWA_UTIL.HTTP_HEADER_CLOSE;
    ...but it didn't work either and with a little further thought I guess it's obvious why: any code here modifies the response header for this request, not the request header for the redirect.
    Message was edited by:
    psalmu

Maybe you are looking for