Very weird ORA-06502 error while creating procedure

Hi All,
i try to create the following procedure (on a 10.2 database):
create or replace procedure audit_report
as
cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;
v_db_name varchar2(255);
begin
-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);
end;
This gives me the following error:
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 8
When i try to create the procedure as this, i get the same error:
create or replace procedure audit_report
as
/*cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;*/
v_db_name varchar2(255);
begin
/*-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);*/
null;
end;
So all code is commented out, but still the error.
Any ideas?
Kind regards,
Dave

just out of interest, what output do you get if you desc user_source?
I get:
NAME                                               VARCHAR2(30)               
TYPE                                               VARCHAR2(12)               
LINE                                               NUMBER                     
TEXT                                               VARCHAR2(4000)        

Similar Messages

  • ORA-12571 error while creating packages from Windows clients

    Hello,
    We are facing the ORA-12571 error while creating / replacing packages from Windows Clients connected to a 8.1.7.2.0 db on a Solaris server.
    However, there are
    1. no errors in connecting and creating transactions from a Sql session
    2. no errors in creating / replacing unwrapped/wrapped small (few lines) packages
    3. no errors in connecting from a Unix session (remote telnet sessions inclusive).
    This happens only when creating wrapped/unwrapped packages, source code of which is greater than 500 kb approx.
    Can somebody help me resolve this issue. Any Help would be greatly appreciated.
    Regards.
    Lakshmanan, K

    Update: I had unintentionally left my custom tablespace in READONLY state after an earlier experiment with transportable tablespaces. After putting the tablespace back into READ WRITE mode and creating a new template, I was successfully able to create a new db from the template.
    I'm still a little curious why this procedure wouldn't work properly with a READONLY tablespace, however.
    Ben

  • Dbms_xmlschema.registerschema, (ORA-31084: error while creating table )..

    Hello,
    I have some problems with dbms_xmlschema.registerschema
    My database is: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    My XSD schema is (SEPA pain.002.001.03.xsd) also available on this url: http://code.google.com/p/leontestbed/source/browse/trunk/bc2/sample/Schema/pain.002.001.03.xsd?r=241
    After
    begin
       DOK_XML_UTIL.p_vnesi_xsd_blob(401941242); -- store a XSD on file system from blob field
       dbms_xmlschema.registerschema(
        schemaurl => 'http://localhost/TEST1.XSD',
        schemadoc => bfilename('ETAX_LOAD','TEST1.XSD'),
        csid => nls_charset_id('AL32UTF8'));
    commit;
    end;I get:
    ORA-31084: error while creating table "INIS_PROD"."Document2781_TAB" for element "Document"
    ORA-02320: failure in creating storage table for nested table column "XMLDATA"."CstmrPmtStsRpt"."OrgnlPmtInfAndSts"
    ORA-01792: maximum number of columns in a table or view is 1000
    ORA-02310: exceeded maximum number of allowable columns in table
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 65
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 136
    ORA-06512: at line 4
    What I'am doing wrong or what is the reason for this error..

    Arrgghhh.....
    begin
       DOK_XML_UTIL.p_vnesi_xsd_blob(401941242);
       dbms_xmlschema.registerschema(
        schemaurl => 'http://localhost/TEST1.XSD',
        schemadoc => bfilename('ETAX_LOAD','TEST1.XSD'),
        csid => nls_charset_id('AL32UTF8')
        , local => true
      , genTypes => false
      , genTables => false);
    commit;
    end;sorry...

  • Compilation error while creating procedure

    Hi,
    I am getting compilation error while creating procedure
    CREATE OR REPLACE My_CHANGEDATE IS
    error_string VARCHAR2(400) := NULL;
    BEGIN
    Create table set_temp as select * from set;
    CURSOR c1 is
         SELECT a.SETNUM, b.CHANGEDATE from
         set a, setsp_t2 b
         where a.setnum = b.setnum
         and trunc(a.changedate) < trunc(b.CHANGEDATE);
    BEGIN
         FOR rec IN c1 LOOP
              UPDATE set SET changedate = rec.changedate
              WHERE setnum = rec.setnum;
              Insert into set_temp select * from set where setnum = rec.setnum;
              END LOOP;
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
              NULL;
         WHEN OTHERS THEN
                   error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
    DBMS_OUTPUT.PUT_LINE(error_string);
                   RAISE;
    END My_CHANGEDATE;

    I have taken your code and cleaned it up to be more readable. Please see the comments in the code.
    CREATE OR REPLACE My_CHANGEDATE
    IS
            error_string VARCHAR2(400) := NULL;
    BEGIN
            /* The only way to issue DDL in a procedure is to either user
             * DBMS_SQL or EXECUTE IMMEDIATE. Creating objects is generally
             * not needed or recommended in frequently run code.
            Create table set_temp as select * from set;    
            /* The cursor declarations need to go in the declaration section of the
             * procedure (between IS .. BEGIN).
            CURSOR c1 is                                   
            SELECT a.SETNUM, b.CHANGEDATE from
            set a, setsp_t2 b
            where a.setnum = b.setnum
            and trunc(a.changedate) < trunc(b.CHANGEDATE);
            BEGIN   /* Where is the END that goes with this begin? */
            /* Single record processing is generally not recommended. It is considered a "slow-by-slow" method. */
            FOR rec IN c1 LOOP
                    UPDATE set SET changedate = rec.changedate
                    WHERE setnum = rec.setnum;
                    Insert into set_temp select * from set where setnum = rec.setnum;
            END LOOP;
    EXCEPTION
            WHEN NO_DATA_FOUND THEN
                    NULL;
            WHEN OTHERS THEN
                    error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
                    DBMS_OUTPUT.PUT_LINE(error_string);
                    RAISE;
    END My_CHANGEDATE;My general recommendations are as follows:
    1. Remove the CREATE TABLE from the procedure altogether.
    2. Don't use reserved words for object names (e.g. SET)
    3. Remove the record by record processing and consolidate it to a single UDPATE statement as follows (note untested):
    UPDATE  set s
    SET     changedate = (
                            SELECT  CHANGEDATE
                            FROM    SET A
                            ,       SETSO_T2 B
                            WHERE   A.SETNUM = B.SETNUM
                            AND     S.SETNUM = A.SETNUM
                            AND     TRUNC(A.CHANGEDATE) < TRUNC(B.CHANGEDATE)
    WHERE EXISTS(
                    SELECT  NULL
                    FROM    SET A
                    WHERE   A.SETNUM = S.SETNUM
                    )HTH!

  • ORA-15180 Error while creating a new DB

    Hi,
    I am creating a Production db for version 11.1.0.7.
    I am getting this error while creating the database:
    ORA-15180: could not open dynamic library odm library0, error [open]
    What steps i need to follow to diagnose this?
    Cheers,
    Kunwar

    15180, 00000, "could not open dynamic library %s, error [%s]"
    // *Cause:  The library was not accessible
    // *Action: Correct the permissions of the library and try again.                                                                                                                                                                                                                                                                                                                                                           

  • Error while creating procedure and package

    Hi,
    I am getting an error while creating an procedure
    create or replace procedure mke_test (mke_gender varchar2) is
    begin
    declare global temporary table mag_hotline_glob
    INDIVIDUAL_ID NUMBER,
    ONE_MONTH NUMBER,
    THREE_MONTH NUMBER,
    SIX_MONTH NUMBER,
    TWELVE_MONTH NUMBER,
    CHILDREN_PRES VARCHAR2(1 BYTE)
    ) with replace on commit preserve rows not logged;
    begin
    insert into mag_hotline_glob
    select * from magazine_gender;
    end;
    end;
    can anybody plz suggest

    It's a total mess. You need to read the documentation first.
    Create your table separately
    CREATE global temporary table mag_hotline_glob(INDIVIDUAL_ID NUMBER,
                                                ONE_MONTH NUMBER,
                                                THREE_MONTH NUMBER,
                                                SIX_MONTH NUMBER,
                                                TWELVE_MONTH NUMBER,
                                                CHILDREN_PRES VARCHAR2(1 BYTE)) with replace on commit preserve rows not logged;Then use the procedure (I don't know why, this INSERT statement you can fire yourself)
    create or replace procedure mke_test(mke_gender varchar2) is
    begin
        insert into mag_hotline_glob
          select * from magazine_gender;
    end;If you want to create the GTT inside the procedure(should be avoided) then Use EXECUTE IMMEDIATE.
    By the way, where are you using the IN parameter ? It' unnecessary.

  • ORA-06550 error while executing procedure

    HI Friends,
    I have written a proc for the below process.
    SP_Control (table)
    sno     campgn_id     campgn_typ     campgn_no     current_wave
    1     ET07001     ONB     ONB01     1
    2     ET07001     ONB     CNB01     1
    3     ET03053     IAL     IAL1A     A
    4     ET03053     IAL     IAL2A     A
    5     ET03053     IAL     IAL3A     A
    6     ET03053     IAL     IAL4A     A
    After calling the procedures with bellow parameters
    Get_next_campgn(‘ONB01’,’ONB’);
    Get_next_campgn(‘CNB01’,’ONB’);
    Get_next_campgn(‘IAL1A’,’IAL’);
    Get_next_campgn(‘IAL2A’,’IAL’);
    Get_next_campgn(‘IAL3A’,’IAL’);
    Get_next_campgn(‘IAL4A’,’IAL’);
    …………… it should update the table with below data.
    sno     campgn_id     campgn_typ     campgn_no     current_wave
    1     ET07001     ONB     ONB02     2
    2     ET07001     ONB     CNB02     2
    3     ET03053     IAL     IAL1B     B
    4     ET03053     IAL     IAL2B     B
    5     ET03053     IAL     IAL3B     B
    6     ET03053     IAL     IAL4B     B
    I have written a procedure like this and its compliled successfully.
    But throws error while executing like
    execute Get_next_campgn(‘ONB01’,’ONB’);
    create or replace procedure Get_next_campgn(p_campgn varchar2,p_type varchar2)
    as
    begin
    update SP_Control set campgn_no = substr(p_campgn,1,length(p_campgn)-1)||to_char(ascii(substr(p_campgn,-1,1))+1) ,
    curr_wave = to_char(ascii(curr_wave)+1)
    where campgn_type = p_type
    and campgn_no = p_campgn ;
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    end Get_next_campgn;
    Error::::
    Error starting at line 15 in command:
    execute Get_next_campgn(‘ONB01’,’ONB’)
    Error report:
    ORA-06550: line 1, column 24:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    ( ) - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable>
    table continue avg count current exists max min prior sql
    stddev sum variance execute multiset the both leading
    trailing forall merge year month day hour minute second
    timezone_hour timezone_minute timezone_region timezone_abbr
    time timestamp interval date
    <a string literal with character set specification>
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    Please suggest....

    The procedure executed successfully for me.
    drop table sp_control;
    create table sp_control
      campgn_no varchar2(20),
      curr_wave varchar2(20),
      campgn_type varchar2(20)
    insert into sp_control values ('ONB01', '1', 'ONB');
    insert into sp_control values ('IAL1A', 'A', 'IAL');
    create or replace procedure Get_next_campgn(p_campgn varchar2,p_type varchar2)
    as
    begin
    update SP_Control set campgn_no = substr(p_campgn,1,length(p_campgn)-1)||to_char(ascii(substr(p_campgn,-1,1))+1) ,
    curr_wave = to_char(ascii(curr_wave)+1)
    where campgn_type = p_type
    and campgn_no = p_campgn ;
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    end Get_next_campgn;
    begin
      Get_next_campgn('ONB01','ONB');
    end;
    select * from sp_control;
    --Output as Follows:
    drop table sp_control succeeded.
    create table succeeded.
    1 rows inserted
    1 rows inserted
    procedure Get_next_campgn(p_campgn Compiled.
    anonymous block completed
    CAMPGN_NO            CURR_WAVE            CAMPGN_TYPE         
    ONB050               50                   ONB                 
    IAL1A                A                    IAL                 
    2 rows selectedJust a hunch, in the Procedure call
    execute Get_next_campgn(‘ONB01’,’ONB’);the "Single Quotes" does not appear correct. They were probably typed into some other editor.
    When executed as
    execute  Get_next_campgn(‘ONB01’,’ONB’);
    Error starting at line 1 in command:
    begin
      Get_next_campgn(‘ONB01’,’ONB’);
    end;
    Error report:
    ORA-06550: line 2, column 19:
    PLS-00103: Encountered the symbol "‘" when expecting one of the following:
       ( ) - + case mod new not null <an identifier>
       <a double-quoted delimited-identifier> <a bind variable>
       table continue avg count current exists max min prior sql
       stddev sum variance execute multiset the both leading
       trailing forall merge year month day hour minute second
       timezone_hour timezone_minute timezone_region timezone_abbr
       time timestamp interval date
       <a string literal with character set specification>
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:So, just replace them in any SQL editor and your Invoker block shall work properly.
    Regards,
    P.

  • Version 3.1 fault - ORA-06502 error when creating SQL Report Region/Page

    I usually perfect my query in SQL*PLUS before I create a new report region.
    Consequently, I copy the code into the region wizard to create the new page. However, since we have upgraded to Version 3.1, virtually every report I have tried to create has created the following error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    It would appear that a maximum of 960 characters can be used to create the region/page. Perversely, once the page/region has been created, I can then edit the source and include as much code as I want (so far I've not run up against a limit)
    As it's just annoying, but not stopping me doing what I wanted to do, I've not got around to mentioning this error previously, but it occurred to me that I should (so I am!)
    David

    Hi David,
    Thank you for reporting this. Unfortunately, this was a regression introduced in Application Express 3.1. The workaround is to edit the region, as you suggested. This has been filed as Bug 6956070 and will be corrected in the forthcoming Application Express 3.1.1 patch set.
    Joel

  • Security problem? (ORA-00942 error when creating procedure)

    First, in SQL*Plus connect as system user:
    SQL&gt;connect system/oracle
    Then, create table proctest for user scott and insert records:
    SQL&gt;create table scott.proctest ( name varchar2(10)) ;
    SQL&gt;insert into scott.proctest values ( 'bigboy' ) ;
    SQL&gt;select * from scott.proctest ;
    NAME
    bigboy
    Then, create procedure testproc for user system using table scott.proctest:
    SQL&gt;CREATE OR REPLACE PROCEDURE testproc AS
    2 v_name VARCHAR2(10) ;
    3 BEGIN
    4 SELECT Name INTO v_name FROM scott.proctest WHERE rownum &lt; 2 ;
    5 DBMS_OUTPUT.PUT_LINE( 'Name: ' || v_name ) ;
    6 END ;
    7 /
    Then, errs report:
    SQL&gt;show err;
    LINE/COL ERROR
    4/2 PL/SQL: SQL
    4/2 PL/SQL: SQL Statement ignored
    4/37 PL/SQL: ORA-00942: Table or view does not exist
    Then, explicitly grant select privilege on proctest to system:
    SQL&gt;grant select on scott.proctest to system ;
    And at this time compile the above precedure again, there's no errors.
    I have got some instruction that if a procedure wants to use some table,
    the owner of this procedure has to have corresponding privileges to use this table and
    these privileges have to be granted directly to the user. It doesn't work if
    the privileges are granted i.e. through roles.
    And in the example above the user has select on scott.proctest privilege but
    this privilege is granted through DBA role. So it doesn't work if
    I do not explicitly grant select privilege to system.
    My question is:
    Why does Oracle define this rule? Is it a kind of security consideration?

    Since stored procedures rely on privileges that are granted directly to the user, Oracle only needs to re-validate stored procedures when direct grants to the schema owner change. In general, the rate at which the privileges assigned to roles are changed is much higher than the rate at which privileges assigned to a particular user are changed, so this cuts down on on the cost of revalidating procedures.
    More importantly, Oracle roles can be assigned to users, but a user can also have non-default roles and password-protected roles. If Oracle allowed privileges through roles to affect the privileges of a stored procedure, handling these sorts of cases would be quite difficult and would result in far more confusion than in today's implementation.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • ORA-31061 error while creating XMLType table with virtual column

    I'm not calling it frustration ;)
    but still... what about this one :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7        passing object_value returning content)
      8        as number
      9      )
    10    )
    11  )
    12  ;
    Table created.Now, on the latest version :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7        passing object_value returning content)
      8        as number
      9      )
    10    )
    11  )
    12  ;
          passing object_value returning content)
    ERROR at line 7:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-31061: XDB error: dbms_xdbutil_int.get_tablespace_tab
    ORA-06512: at "XDB.DBMS_XDBUTIL_INT", line 1002Is there something I should be aware of?
    Right now, I'm just evaluating the version so I can't submit any SR.
    Thanks for anyone trying to reproduce the issue.

    Just tested again on a new installation (64-bit server).
    It works :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL>
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7                 passing object_value returning content)
      8        as number
      9      )
    10    )
    11  );
    Table created
    Now I'll try to see what are the differences between the two installations.
    Thanks Dan and Marco for looking into this.
    Edited by: odie_63 on 2 mai 2012 15:51

  • Ora-06502 error while running a form

    Hi
    DECLARE
    pl_id PARAMLIST;
    begin
         PL_ID:=GET_PARAMETER_LIST('TMP');
         IF NOT ID_NULL(PL_ID) THEN
              DESTROY_PARAMETER_LIST('TMP');
         END IF;
         PL_ID:=CREATE_PARAMETER_LIST('TMP');
         ADD_PARAMETER(PL_ID,'PARAMFORM','TEXT_PARAMETER','NO');
         /*ADD_PARAMETER(PL_ID,'Y_N','TEXT_PARAMETER',:L_CHOICE);
         add_parameter(pl_id,'WHERE','TEXT_PARAMETER',:TI_WHERE);
         add_parameter(pl_id,'ORDERBY','TEXT_PARAMETER',:TI_ORDERBY);*/
         RUN_PRODUCT(REPORTS,'LEXUSE1.REP',SYNCHRONOUS, RUNTIME, FILESYSTEM, PL_ID, NULL);
         EXCEPTION
              WHEN OTHERS THEN
              MESSAGE(SQLERRM);
              MESSAGE(' ');
    END;
    i am using the above code on when-button-pressed trigger to call a report, but when i press the button i get an error message ORA-06502 PL/SQL Numeric or Value Error. dont know why

    Remove single quotes around TEXT_PARAMETER
    ADD_PARAMETER(PL_ID,'PARAMFORM',TEXT_PARAMETER,'NO');

  • ORA-06502 Error while exporting to xls format

    While Exporting to xls format, the ORA-06502 crops up in the exported file.
    The print server is BI Publisher.
    The report has around 50 columns.
    Any help would be greatly appreciated.

    Any suggestions?

  • Oracle 8i, Getting ORA-1501 error while creating new DB

    Hi folks,
    I am trying create a new database on an HP Machine (Details given below) but getting following error.
    ORA-1501 - signalled during Create Database
    LOGFILE 'G:\logfiles\logaf1.ora'
    We actually have a custom application setup.exe to create new database.
    Same setup when installed on a different low end machine works fine.
    Before begining the setup in summary page it shows following information.
    Block buffer count = -3 Bytes
    Shared Pool Size = -41425 KBytes
    Yes the values displayed are in negative.
    Don't know if this is the reason for the ORA-1501 error.
    Can anyone please suggest how to resolve this issue.
    Machine configuration is as follows:
    H/W details:
    HP Server with RAID configuration
    4, PIII CPU's
    RAM: "4 GB"
    S/W details
    O.S:Windows 2000 Server with Service Pack-2
    Oracle Version: 8i
    Patch applied: Oracle8i Patch Set Version 8.1.7.3.0

    Try look to alert<SID>.log file for full error report (you could paste it here).
    Also from alert log you could get real values for db_block_buffers and shared_pool_size parameters that used during instance startup.

  • ORA-00439 error while Creating Roles

    Hi All,
    I am using Oracle 10.2.0.3. When I am trying to create role for ex: :"create role rolename identied globally" I am getting ORA-00439 Error. When I search in v$option view, almost all the values are disabled. Can anybody pls. let me know how to enable the features in v$option or the solution for the above error code.
    Appreciate your earlier response.
    Bhanu.

    I don't have much exposure to the feature,
    you can check Oracle document Configuring Enterprise User Security for Password Authentication
    Are you sure you want to use this feature? or you could just create the role identified externally instead of globally.

  • ORA-01152 error while creating db from custom template

    I have a database based on the "general purpose/transaction processing" db, but with a custom tablespace/data added. I have attempted to clone this database by using dbca to create a custom template (including data) from this database. The template creation appears to be successful -- however, when I use dbca to try to create a new db from this custom template, I get the following error when dbca attempts to initialize the instance:
    ORA-01152: file 5 was not restored from a sufficiently old backup
    ORA-01110: data file 5: <path to my custom tablespace .dbf>
    If I select "ignore" at this point, I get further errors, the next error is
    ORA-06550: line 1, column 7: PLS-00201: Identifier 'DBMS_SERVICE.DELETE_SERVICE' must be declared
    I'm using 11gR2, and am relatively inexperienced on the dba side, any help appreciated.
    Thanks,
    Ben

    Update: I had unintentionally left my custom tablespace in READONLY state after an earlier experiment with transportable tablespaces. After putting the tablespace back into READ WRITE mode and creating a new template, I was successfully able to create a new db from the template.
    I'm still a little curious why this procedure wouldn't work properly with a READONLY tablespace, however.
    Ben

Maybe you are looking for

  • Main warehouse

    dear all, i need your regarding how to map the following structure into SAP. we have a production plant in which many storage locations will be created (around 22 storage location) .. and we have a warehouse where we store some of the materials (raw

  • How do I disable Fast Fox

    I get Fast Fox popups when I don't want them. Fast Fox over rides all my web searches. Fast Fox is not always accurate and takes be down paths of misinformation. I want to disable Fast Fox. If it is not possible to disable Fast fox I will uninstall F

  • Recently added photos/movies missing after closing iPhoto '09

    I have iPhoto '09 (8.1.2 (424) running on an Intel iMac Core (1) Duo with Snow Leopard, all software updates current. Tonight I went to add several photos and movies to my iPhoto library (19,000+ photos). They imported fine. I moved some around with

  • 64-Bit Flash-Player (Language: German - Deutsch)

    Hallo, mittlerweile werden viele Computer mit 64-Bit Windows 7 ausgeliefert, wobei dort auch ein 64-Bit Internet-Explorer gibt. Seit 2009 setzt sich langsam die 64-Bit Technologie auch bei den Betriebssystemen durch, da diese doch einige Vorteile geg

  • Can we disable few items while edit

    Hi When we click "Edit" button, user can change the value in the items in the Report/Grid lay out. e.g If the report contains 4 columns with 5 rows and user selected 1st row to edit. then user can update the value in all the 4 columns and will click