Dbms_lob.copy  ORA=21560 ORA-21560: argument 3 is null, invalid, or out of

I am trying to download a blob from a database table and I am getting ORA-21560: argument 3 is null, invalid, or out of range
this is my code:
PROCEDURE retrieve_document (p_pk_id in varchar2)
IS
size1 integer;
blob1 BLOB ;
tmpblob BLOB;
l_mimetype varchar2(4000);
BEGIN
BEGIN
insert into temp_document
select pk_id,document_file,mime_type
from portal_documents
where pk_id = p_pk_id;
select document_file, mime_type
into blob1, l_mimetype
from temp_document;
--insert into temp_stu_pic select student_id, student_picture from stu_pics
where student_id = 'CHS321';
--select student_picture into blob1 from temp_stu_pic where student_id = 'CHS321';
EXCEPTION when no_data_found then null;
END;
size1 := dbms_lob.getlength(blob1);
dbms_lob.createtemporary(tmpblob,true);
dbms_lob.copy(tmpblob,blob1,size1,1,1);
owa_util.mime_header(l_mimetype, false,null);
htp.p('Content-length: '|| size1);
htp.p('Pragma: no-cache');
htp.p('Cache-Control: no-cache');
htp.p('Expires: Thu, 01 Jan 1970 12:00:00
GMT');
owa_util.http_header_close;
wpg_docload.download_file(tmpblob);
dbms_lob.freetemporary(tmpblob);
END retrieve_document;
Anybody know why I would be getting this error?

In the future, use the PRE and /PRE tags, enclosed in [] to format your code.
You have commented out some code, and left other portions.
If you're actually getting an error when running (which i would guess you are based on the thread title) then show us the copy / paste of the error message which shows line numbers, etc...
PROCEDURE retrieve_document (p_pk_id in varchar2)
IS
   size1 integer;
   blob1 BLOB ;
   tmpblob BLOB;
   l_mimetype varchar2(4000);
BEGIN
   BEGIN
   insert into temp_document
   select pk_id,document_file,mime_type
   from portal_documents
   where pk_id = p_pk_id;
   select document_file, mime_type
   into blob1, l_mimetype
from temp_document;
--insert into temp_stu_pic select student_id, student_picture from stu_pics
where student_id = 'CHS321';
   --select student_picture into blob1 from temp_stu_pic where student_id = 'CHS321';
   EXCEPTION when no_data_found then null;
   END;
   size1 := dbms_lob.getlength(blob1);
   dbms_lob.createtemporary(tmpblob,true);
   dbms_lob.copy(tmpblob,blob1,size1,1,1);
   owa_util.mime_header(l_mimetype, false,null);
   htp.p('Content-length: '|| size1);
   htp.p('Pragma: no-cache');
   htp.p('Cache-Control: no-cache');
   htp.p('Expires: Thu, 01 Jan 1970 12:00:00
   GMT');
   owa_util.http_header_close;
   wpg_docload.download_file(tmpblob);
   dbms_lob.freetemporary(tmpblob);
END retrieve_document;Message was edited by:
Tubby

Similar Messages

  • "OCI-21560: argument 4 is null, invalid, or out of range"

    Hi,
    When I am running query *"select xmlelement("SQLX", 'Hello World!') from dual"* in Toad , i am getting below error -
    *"OCI-21560: argument 4 is null, invalid, or out of range"*
    In sql prompt also it is not runnig.Got below error.
    SQL> select xmlelement("SQLX", 'Hello World!') from dual
    2 /
    select xmlelement("SQLX", 'Hello World!') from dual
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    SQL>
    DB version -
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE 11.1.0.7.0 Production
    TNS for HPUX: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Please let me know the solution.
    Rg.
    Subir

    Error: ORA 3136
    Text: null common code generated
    Cause: This is an internal error.
    Action: Document messages and contact Oracle Worldwide Support.
    For more information about the Spatial Data option, see <Oracle7
    Spatial Data Option Reference and Administrator's Guide>.

  • Spatial: create index gets ORA-22060: argument [2] is an invalid number

    Hi,
    I'm trying to create a spatial index on an SDO_GEOMETRY column in 10gR2, but getting the following error:
    CREATE INDEX GR_TEST_ADDRP_SIDX ON GR_TEST
    (ADDRESS_POINT)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-22060: argument [2] is an invalid or uninitialized number
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10Any pointers to what I should be looking for here?

    Found solution to my problem. When inserting to USER_SDO_GEOM_METADATA I copied insert statement from existing metadata and insert statement had NULLs in the 3rd and 4th dimension. Took those out and now index creates okay.

  • Using DBMS_LOB.COPY - (ORA-22275)

    Hi All,
    I need to copy BLOB value from one table to another.
    For that i am using DBMS_LOB.COPY.
    I am not sure if this is the right approach. If not, can someone help me out.
    Mentioned below is my sample procedure:
    CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
    i_ID number,
    o_OutputStatus OUT NUMBER,
    o_OutputMessage OUT VARCHAR2
    as
    v_blob_data_d blob;
    v_blob_data_s blob;
    amt INTEGER := 4000;
    begin
    select BLOB_DATA
    into v_blob_data_d
    from blob_test_dest -- My Destination Table
    where id = i_ID
    for update;
    select BLOB_DATA
    into v_blob_data_s
    from blob_test -- My Source Table
    where id = i_ID;
    DBMS_LOB.COPY(v_blob_data_d, v_blob_data_s, amt);
    o_OutputStatus := 0;
    o_OutputMessage := 'SUCCESS';
    EXCEPTION
    WHEN OTHERS THEN
    o_OutputStatus := -1;
    o_OutputMessage := 'Procedure ins_upd_blob Failed at step no:- '||v_ErrorFlag|| ' SQL ERROR:- '||SUBSTR(SQLERRM,1,100);
    END;
    After execution i am getting following error:
    ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
    Thanks,
    Srikanth

    how about using merge instead of dbms_lob package?
    CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
    i_ID number,
    o_OutputStatus OUT NUMBER,
    o_OutputMessage OUT VARCHAR2)
    as
    v_blob_data_d blob;
    v_blob_data_s blob;
    amt INTEGER := 4000;
    begin
    merge into blob_test_dest b1
    using (select id, blob_data from blob_test) b2
    on (b1.id = i_id and b1.id = b2.id)
    when not matched then insert(b1.id, b1.blob_data) values(b2.id,b2.blob_data)
    when matched then update set b1.blob_data = b2.blob_data;
    END;
    /

  • ORA-27473: argument 1 does not exist

    Hello
    I've been trying to create a file_watcher to check for files arriving at the filesystem. But keep getting the error "ORA-27473: argument 1 does not exist ". I've searched forums but can't find an answer to get me on track.
    Does anyone know why I get this error?
    The examples I've been following are those provided by oracle and some from the web. All very simple and run, but mine does not.
    The system I'm using is a Oracle prebuilt VM 'Database App Development VM', where the OS is Oracle Linux 5 and Oracle Database 11.2 EE.
    An example is this: http://awads.net/wp/2011/03/29/did-you-know-about-file-watchers/
    /JacMa

    Just wondering whether your enter this part correctly ?
    BEGIN
    2 DBMS_SCHEDULER.create_program (
    3 program_name => 'image_watcher_p',
    4 program_type => 'stored_procedure',
    5 program_action => 'process_image_files',
    6 number_of_arguments => 1,
    7 enabled => FALSE);
    8 DBMS_SCHEDULER.define_metadata_argument (
    9 program_name => 'image_watcher_p',
    10 metadata_attribute => 'event_message',
    11 argument_position => 1);
    12 DBMS_SCHEDULER.enable ('image_watcher_p');
    13 END;
    14 /

  • ORA-30625: method dispatch on NULL SELF argument is disallowed (WWV-16016)

    I've created a master detail form.
    I only want the master record to be read only, as I have a separate form elsewhere that is used to enter all the fields in the table it is based on.
    I've hidden the fields in the form that I do not wish the user to see and set the onFocus validation to blur(); to prevent data entry.
    The problem is that when a user leaves the master block action to 'None' it produces the error:
    ORA-30625: method dispatch on NULL SELF argument is disallowed (WWV-16016)
    It runs fine on update mode after a record has been queried.
    The table has the correct privs as I already have built a simple form to test inserting records into the master table elsewhere.
    Ideally, I want to override the master block action via a bit of coding so to as to stop the user even attempting to create a new record in the master detail form:
    p_session.set_value (p_block_name => 'MASTER_BLOCK'
    , p_attribute_name => '_MASTER_ACTION'
    , p_value => 'NONE');
    Any ideas?
    cheers,
    John

    Oracle Portal Version: 10.1.2.0.0 (Build: 290)
    DB: 10.1.0.3.1

  • 10g ORA-30625: method dispatch on NULL SELF argument is disallowed Options

    I found this site for consuming a web service from oracle 9i. I'm trying
    it from 10g
    http://www.oracle-base.com/articles/9i/ConsumingWebServices9i.php
    I have an intranet web service (.NET) I know is working as I use it from
    other clients.
    But am getting this error when trying the example:
    Getting error: ORA-30625: method dispatch on NULL SELF argument is
    disallowed.
    on this line:
    l_fullname := soap_api.get_return_value(p_response => l_response,
    p_name => 'yyyResult',
    p_namespace =>
    'xmlns:ns1="urn:http://www.xxx.net/"');
    which calling this in the soap_api package i downloaded and installed
    from the stie:
    FUNCTION get_return_value(p_response IN OUT NOCOPY t_response,
    p_name IN VARCHAR2,
    p_namespace IN VARCHAR2)
    RETURN VARCHAR2 AS
    BEGIN
    RETURN p_response.doc.extract('//'||p_name||'/
    child::text()',p_namespace).getstringval();
    END;
    My test script:
    declare
    l_request soap_api.t_request;
    l_response soap_api.t_response;
    l_fullname varchar2(50);
    BEGIN
    l_request := soap_api.new_request(p_method => 'ns1:yyy',
    p_namespace =>
    'xmlns:ns1="urn:http://www.xxx.net"');
    soap_api.add_parameter(p_request => l_request,
    p_name => 'userName',
    p_type => 'xsd:string',
    p_value => 'somestring');
    l_response := soap_api.invoke(p_request => l_request,
    p_url => 'http://xx.xxx.xx.xx/
    securityservice/service.asmx',
    p_action => 'http://www.xxx.net/
    yyy');
    -- failing on the below line(21)
    l_fullname := soap_api.get_return_value(p_response => l_response,
    p_name => 'yyyResult',
    p_namespace =>
    'xmlns:ns1="urn:http://www.xxx.net/"');
    dbms_output.put_line(l_fullname);
    end;
    Thanks for any help or information.

    This rather cryptic message means that the PL/SQL variable or column whose method is being invoked is null.
    It's the equivilant of a null pointer exeception in java...

  • ORA-30625: method dispatch on NULL SELF argument is disallowed

    I have streams setup with table rules.( 3 tiers). It is working fine, besides for one table when insert record, apply has error "ORA-30625: method dispatch on NULL SELF argument is disallowed". I did include all columns in supplemental log group always. Is any limit for max columns for Oracle Streams. This table has 137 columns and I created 6 supplemental log groups.
    Please help

    Hi,
    No restrictions on number of columns in 10.2. Do you have any rule transformation or dml handler?
    Check also on your bdump if the apply generated any trace file that will allow you to identify the root cause of this error.
    Here is an explanation of why that error happens:
    The following error occurs when passing an uninitialized object to an Object's member procedure/function:
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    The following illustrates the error by first creating the Object specification. Notice there is one member procedure "initialize_object" that passes in SELF.
    CREATE OR REPLACE TYPE role_type AS OBJECT (
    role_name VARCHAR2(30),
    MEMBER PROCEDURE initialize_object(SELF IN OUT role_type));
    The next step is to create the body of the Object's member procedure. There is no need for any actual code as the error occurs when the NULL is attempted to be passed.
    CREATE OR REPLACE TYPE BODY role_type AS
    MEMBER PROCEDURE initialize_object (SELF IN OUT role_type) IS
    BEGIN
    NULL;
    END initialize_object;
    END;
    The following anonymous block passes in a NULL (Uninitialized Object) to the member procedure initialize_object.
    DECLARE
    V_TEMP role_type;
    BEGIN
    ROLE_TYPE.initialize_object(V_temp);
    END;
    ERROR at line 1:
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 4
    The example has nothing to do with streams but maybe you are trying to invoke an error handler or dml handler that is causing this issue.

  • ORA-00600:  arguments: [srsale_2], [0], [147], [], [], [], [], []

    Hi, I'm using Oracle Database 9.0.1.1.1 on MS NT SP6.
    Error: ORA-00600: arguments: [srsale_2], [0], [147], [], [], [], [], []
    This error happens when I create a Materialized View or a Table
    with a query, selecting data on more than one partition of a Partitioned Table
    the Partitioned Table is loaded every morning with SQL*Loader.
    CREATE MATERIALIZED VIEW DATAMART.MV_RESUMEN_CENTRAL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    AS
    SELECT FECHA, CLIENTE,
    H_AUDITOR, SUM(LLAMADAS) AS LLAMADAS, SUM(MIN_FL) AS MIN_FL,
    SUM(MIN_RN) AS MIN_RN, SUM(MIN_TZ) AS MIN_TZ
    FROM RESUMEN_CENTRALES_HR
    WHERE FECHA > 020600
    GROUP BY FECHA, CLIENTE, H_AUDITOR;
    If I use some like " FROM RESUMEN_CENTRALES_HR partition (rchrmX) "
    in de query, the error doesn't happens
    The table RESUMEN_CENTRALES_HR is
    CREATE TABLE DATAMART.RESUMEN_CENTRALES_HR
    FECHA NUMBER(6) NOT NULL,
    HR CHAR(2),
    CLIENTE VARCHAR2(5),
    ... more fields
    H_AUDITOR CHAR(1),
    LLAMADAS NUMBER,
    MIN_FL FLOAT,
    MIN_RN NUMBER(6),
    MIN_TZ FLOAT
    ) PARTITION BY RANGE(FECHA)
    (PARTITION rchrm1 VALUES LESS THAN (20200),
    PARTITION rchrm2 VALUES LESS THAN (20300),
    PARTITION rchrm3 VALUES LESS THAN (20400),
    PARTITION rchrm4 VALUES LESS THAN (20500),
    PARTITION rchrm5 VALUES LESS THAN (20600),
    PARTITION rchrm6 VALUES LESS THAN (20700),
    PARTITION rchrm7 VALUES LESS THAN (20800),
    PARTITION rchrm8 VALUES LESS THAN (20900),
    PARTITION rchrm9 VALUES LESS THAN (21000),
    PARTITION rchrm10 VALUES LESS THAN (21100),
    PARTITION rchrm11 VALUES LESS THAN (21200),
    PARTITION rchrm12 VALUES LESS THAN (21300));
    (This is a part of the INSTANCE_NAME_ALRT.LOG)
    Wed Aug 07 11:54:11 2002
    Errors in file F:\orant\oradata\mirtest\admin\mirtest\udump\ORA00261.TRC:
    ORA-00600: internal error code, arguments: [srsale_2], [0], [147], [], [], [], [], []
    Can anybody help me ??

    Yes, this problem happen when I'm creating the view !!!!
    I've created test tables with 1500 rows by partition in the partitioned table,
    and then the materialized view has been created successful.
    But with my real data (above 3,000,000 rows by partition) is when
    I get the error. I don't think that my data is too large because
    the tablespace is about 400 MB, but quickly will be increase.
    are there any problem with size of partition ???
    or there are a special configuration ????
    These are some querys of my data :
    SQL> SELECT count(rowid) FROM resumen_centrales_hr PARTITION(rchrm6);
    COUNT(ROWID)
    0
    SQL> SELECT count(rowid) FROM resumen_centrales_hr PARTITION(rchrm7);
    COUNT(ROWID)
    3330020
    SQL> SELECT count(rowid) FROM resumen_centrales_hr PARTITION(rchrm8);
    COUNT(ROWID)
    747114
    SQL> CREATE MATERIALIZED VIEW DATAMART.MV_RESUMEN_CENTRAL
    2 BUILD IMMEDIATE
    3 REFRESH COMPLETE ON DEMAND
    4 AS
    5 SELECT FECHA, CLIENTE,
    6 H_AUDITOR, SUM(LLAMADAS) AS LLAMADAS, SUM(MIN_FL) AS MIN_FL,
    7 SUM(MIN_RN) AS MIN_RN, SUM(MIN_TZ) AS MIN_TZ
    8 FROM RESUMEN_CENTRALES_HR
    9 WHERE FECHA > 020600
    10 GROUP BY FECHA, CLIENTE, CLIENTE_800, RUTA_A,
    11 ONOFF_A, CDMAT_A, RUTA_B, ONOFF_B, CDMAT_B, H_TELMEX,
    12 H_AUDITOR;
    FROM RESUMEN_CENTRALES_HR
    ERROR at line 8:
    ORA-00600: internal error code, arguments: [srsale_2], [0], [148], [], [], [],
    SQL>

  • Oracle ORA-01428: argument is out of range error

    Oracle ORA-01428: argument is out of range error

    I take it you don't feel like spending the extra money for the EE add-on that was designed to CREATE an INDEX on polygons of logitude,latitude values in such away that a simple
    SELECT * FROM ZIP_CODES WHERE SDO_WITHIN_DISTANCE( Z.ZIPCODE_AREA, /* point for zipcode */, 'distance=' || in_distance ) = 'TRUE';
    will be very efficient and fast.
    primary thing:
    you need to drop out the WHEN OTHERS THEN NULL;
    also, take advantage of the NO_ROWS_FOUND exception for finding out if a row exists in the database. (instead of doing an IF statement on the results of COUNT(*))
    back to your problem
    You'll need to investigate which row is causing the problem.
    Most likely, it is the zipcode that was the input for the search.  I've seen this occur many times on similar trigonometric calculations.
    You may have to surround a lot of those trigonometric functions with ROUND( ____, 25) to get it to work.
    However, I highly advise you to take a look at what can be done with Oracle Spacial
    MK

  • ORA-01428: argument '0' is out of range

    Hi,
    in 10g R2 , I created (code found in David Kurtz article) a function as follows but when use it I receive an error :
    SQL> CREATE OR REPLACE FUNCTION h2i (p_hash_value NUMBER) RETURN VARCHAR2 IS
      2  l_output VARCHAR2(10) := '';
      3  BEGIN
      4  FOR i IN (
      5  SELECT substr('0123456789abcdfghjkmnpqrstuvwxyz',1+floor(mod(p_hash_value/(POWER(32,LEVEL-1)),32)),1) sqlidchar
      6  FROM dual CONNECT BY LEVEL <= LN(p_hash_value)/LN(32) ORDER BY LEVEL DESC
      7  ) LOOP
      8  l_output := l_output || i.sqlidchar;
      9  END LOOP;
    10  RETURN l_output;
    11  END;
    12  /
    Function created.
    SQL> select SQL_PLAN_HASH_VALUE, sql_id ,h2i(SQL_PLAN_HASH_VALUE) from v$active_session_history;
    select SQL_PLAN_HASH_VALUE, sql_id ,h2i(SQL_PLAN_HASH_VALUE) from v$active_session_history
    ERROR at line 1:
    ORA-01428: argument '0' is out of range
    ORA-06512: at "SYS.H2I", line 4ANy idea ? Any help ,
    Thank you.

    Thaks Michael,
    SELECT sql_id, dbms_utility.sqlid_to_sqlhash (sql_id) hash,
           sql_plan_hash_value
      FROM v$active_session_history
    WHERE sql_plan_hash_value != 0
    SQL_ID              HASH SQL_PLAN_HASH_VALUE
    g1p4md32k85mv 3307476603           149324150
    bwhzpth8a3zgv  279051771          2848324471
    bwhzpth8a3zgv  279051771          2848324471
    0zcud3g9fky57 3538516135          2890534904
    0zcud3g9fky57 3538516135          2890534904
    0zcud3g9fky57 3538516135          2890534904
    08bqjmf8490s2 2420409090          2890534904
    4gd6b1r53yt88 3393152264          2675018582
    4gd6b1r53yt88 3393152264          2675018582
    26xbn5mhmjqn9 3778599561           381738983
    4gd6b1r53yt88 3393152264          2675018582Then can I conclude that h2i function is wrong and it would be better to use original oracle dbms_utility.sqlid_to_sqlhash ?

  • ORA-01428: argument '-1' is out of range

    hi
      here is the details: -
    Select walkin_id, applying_for from walkins where walkin_id =197
    WALKIN_ID     APPLYING_FOR
    197             CLASS1:CLASS2:OTHER /*stored colon seprated classification*/
    Select program_id, program_name, classification from ss_programs
    PROGRAM_ID     PROGRAM_NAME     CLASSIFICATION
    1             PG1                         CLASS1
    2             PG2                         CLASS1
    3             PG3                         CLASS3
    4             PG4                         CLASS1
    5             PG5                         CLASS1
    6             PG6                         CLASS1
    7             PG7                         CLASS1
    8             PG8                         CLASS1
    9             PG9                         CLASS1
    10             PG10                     CLASS2
    11             PG11                    CLASS2
    12             PG12                     CLASS3
    13             PG13                     CLASS1
    14             PG14                     CLASS1
    15             PG15                    CLASS1
    16             PG16                     CLASS1
    17             PG17                     CLASS1
    18             OTHER                     OTHER
    now i wanted to extract all the program_ids belongs to the  walkins.applying_for (colon seprated ss_programs.classification) and
    rebuild them into colon separated list
    like if
    walkins.applying_for is :  CLASS1:CLASS2:OTHER then the
    program_list would be : PG1:PG2:PG4:PG5:PG6:PG7:PG8:PG9:PG10:PG11:PG13:PG14:PG15:PG16:PG17:OTHER
    and for this i build the following query and its giving me
    "ORA-01428: argument '-1' is out of range" error and i am stucked.
    So could you please tell me where i am doing wrong
    and can we do this with SQL like below specified query or some other (SQL) way.
    SELECT SUBSTR (LTRIM(MAX (SYS_CONNECT_BY_PATH (program_id, ':')) KEEP (DENSE_RANK LAST ORDER BY curr),
                    ':'), 2) programs
    FROM               
    (SELECT walkin_id, program_id,
           row_number() over (partition by 1 order by program_id) curr,
           row_number() over (partition by 1 order by program_id)-1 prev
    FROM      
    (SELECT wp.walkin_id, sp.program_id
    FROM SS_PROGRAMS sp,
        (SELECT walkin_id, substr(val, decode(level, 1, 1, INSTR(val, ':', 1, LEVEL -1)+1),
               INSTR(val, ':', 1, level) - decode(level, 1, 1, INSTR(val, ':', 1, LEVEL -1)+1)) walkin_classif
           FROM      
           (SELECT walkin_id, DECODE(SUBSTR(applying_for, -1, 1), ':', applying_for, applying_for||':') val FROM walkins
        WHERE walkin_id =197)
        CONNECT BY INSTR(val, ':', 1, LEVEL) > 0) wp
    WHERE sp.classification = wp.walkin_classif))
    GROUP BY walkin_id
    CONNECT BY prev = PRIOR curr AND walkin_id = PRIOR walkin_id
            START WITH curr = 1;

    And if you want it to work for more than 1 walkin at the same time:
    SQL> create table walkins (walkin_id, applying_for)
      2  as
      3  select 197, 'CLASS1:CLASS2:OTHER' from dual union all
      4  select 198, null from dual union all
      5  select 199, 'CLASS4' from dual union all
      6  select 200, 'CLASS3:CLASS1' from dual
      7  /
    Table created.
    SQL> create table ss_programs (program_id, program_name, classification)
      2  as
      3  select 1, 'PG1', 'CLASS1' from dual union all
      4  select 2, 'PG2', 'CLASS1' from dual union all
      5  select 3, 'PG3', 'CLASS3' from dual union all
      6  select 4, 'PG4', 'CLASS1' from dual union all
      7  select 5, 'PG5', 'CLASS1' from dual union all
      8  select 6, 'PG6', 'CLASS1' from dual union all
      9  select 7, 'PG7', 'CLASS1' from dual union all
    10  select 8, 'PG8', 'CLASS1' from dual union all
    11  select 9, 'PG9', 'CLASS1' from dual union all
    12  select 10, 'PG10', 'CLASS2' from dual union all
    13  select 11, 'PG11', 'CLASS2' from dual union all
    14  select 12, 'PG12', 'CLASS3' from dual union all
    15  select 13, 'PG13', 'CLASS1' from dual union all
    16  select 14, 'PG14', 'CLASS1' from dual union all
    17  select 15, 'PG15', 'CLASS1' from dual union all
    18  select 16, 'PG16', 'CLASS1' from dual union all
    19  select 17, 'PG17', 'CLASS1' from dual union all
    20  select 18, 'OTHER', 'OTHER' from dual
    21  /
    Table created.
    SQL> with walkins_normalized as
      2  ( select walkin_id
      3         , substr
      4           ( ':' || applying_for || ':'
      5           , instr(':' || applying_for || ':',':',1,l) + 1
      6           , instr(':' || applying_for || ':',':',1,l+1) - instr(':' || applying_for || ':',':',1,l) -1
      7           ) applying_for_element
      8      from walkins w
      9         , ( select level l
    10               from ( select max(length(applying_for) - length(replace(applying_for,':')))+1 maxn
    11                        from walkins
    12                    )
    13            connect by level <= maxn
    14           ) m
    15     where l <= length(applying_for) - length(replace(applying_for,':'))+1
    16  )
    17  , string_aggregated as
    18  ( select walkin_id
    19         , rtrim(pl,':') program_list
    20         , rn
    21      from walkins_normalized w
    22         , ss_programs p
    23     where w.applying_for_element = p.classification
    24     model
    25           partition by (w.walkin_id)
    26           dimension by (row_number() over (partition by w.walkin_id order by p.program_id) rn)
    27           measures (cast(p.program_name as varchar2(100)) pl)
    28           rules
    29           ( pl[any] order by rn desc = pl[cv()] || ':' || pl[cv()+1]
    30           )
    31  )
    32  select walkin_id
    33       , program_list
    34    from string_aggregated
    35   where rn = 1
    36  /
    WALKIN_ID PROGRAM_LIST
           197 PG1:PG2:PG4:PG5:PG6:PG7:PG8:PG9:PG10:PG11:PG13:PG14:PG15:PG16:PG17:OTHER
           200 PG1:PG2:PG3:PG4:PG5:PG6:PG7:PG8:PG9:PG12:PG13:PG14:PG15:PG16:PG17
    2 rows selected.And by the way, you should think of redesigning your walkins table to something normalized...
    Regards,
    Rob.

  • ORA-30496: Argument Should Be A Constant

    Hi,
    I am getting ORA-30496: Argument Should Be A Constant message while modifying length of Char datatype from Char(1) to Char(2). I do not get this message if i modify the length of Varchar2 datatype. I have set CURSOR_SHARING=SIMILAR in init.ora file and when i change it's value to EXACT then i do not get the above mentioned error.
    Any Idea.

    sounds like a bug in the db. Not an OEM issue.

  • ORA-30625: method dispatch on NULL SELF error

    Can Someone help me? I'm new to oracle. I'm writing a procedure to copy a file from my hard drive to oracle. I am getting an error: ORA-30625: method dispatch on NULL SELF argument is disallowed. So I just broke the code down to this little piece. I still get the same error. I created a directory called INPUT_FILE and the file test.jpg is in that directory. What am I missing?
    1 Declare
    2 imag ordsys.ordimage;
    3 ctx raw(4000) :=null;
    4 BEGIN
    5 imag.setsource('FILE' , 'INPUT_FILE', 'test.jpg');
    6 imag.import(ctx);
    7* end;
    SQL> /
    Declare
    ERROR at line 1:
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 5
    null

    There is a sample code for importing an image from an external file into the database in the section 2.2.8 of the interMedia User's Guide:
    http://otn.oracle.com/doc/oracle8i_816/inter.816/a67299/mm_uses.htm#601053
    Basically, you have to have a table in which you store the image in the database first.

  • Dbms_lob.copy vs. variable assignment

    Cleanup of lob in java
    Scenerio.
    Java mid-tier application creates a CLOB variables to pass to Database PLSQL stored procedure One clob input, one output argument.
    Input clob variable setup with dbms_lob.createtemporary(a,true,dbms_lob.call);
    clob data taken from Front end written into with dbms_lob.writeappend.
    Mid-tier app does NOT do a dbms_lob.createtemporary for second output variable.
    Database stored procedure called to process data.
    java call sp1(a in clob, b in out clob);
    plsql sp on database...
    procedure sp1(a in clob,b out clob)
    is
    lcl_clob clob;
    begin
    dbms_lob.createtemporary(lcl_clob,true,dbms_lob.call);
    ---- procedure process input clob data and when complete. filling lcl_clob with dbms_lob.copy
    --When sp1 completes it does assignment to return data to java
    b := lcl_clob; --this does deep copy
    dbms_lob.freetemporary(lcl_clob);--free local temp clob
    end;
    Data gets back to JAVA midtier app. OK the Java app Read and Close clob.
    Concern is about java's b defined clob and memory. How is java's defined b clob deep copy cleaned up?
    Any memory/garbage issue on Java side with this? Mid tier server Weblogic on Win 2K
    any ideas or issues. DB Environment: Oracle 8.1.7.3 on HPUX 11

    documentation says
    There is also an interface to let you group temporary LOBs together into a logical bucket. The duration represents this logical store for temporary LOBs. Each temporary LOB can have separate storage characteristics, such as CACHE/ NOCACHE. There is a default store for every session into which temporary LOBs are placed if you don't specify a specific duration.
    important part is below
    Additionally, you are able to perform a free operation on durations, which causes all contents in a duration to be freed.
    also
    There is a default store for every session
    i suppose its probably related with duration of lob u have used

Maybe you are looking for