This discussion is archived
2 Replies Latest reply: Nov 25, 2012 9:26 PM by Mindmap RSS

Can you please delete this thread, I got the answer from PL/SQL Forum.

Mindmap Pro
Currently Being Moderated
Can you please delete this thread, I got the answer from PL/SQL Forum.

Edited by: Fateh on Nov 26, 2012 7:23 PM
  • 1. Re: Cannot apply ORDSYS.ORDImage.process twice
    damorgan Oracle ACE Director
    Currently Being Moderated
    What does "In short, the problem is that I cannot use ORDSYS.ORDImage.process Two times even though it is applied on different variables." mean?

    That an exception is generated?
    That the system freezes?
    That smoke starts coming out of the power supply?

    I don't see anything in your code analogous to:
    INSERT INTO t_image VALUES (1, ordsys.ordimage.init());
    Why?
  • 2. Re: Cannot apply ORDSYS.ORDImage.process twice
    Mindmap Pro
    Currently Being Moderated
    Sorry,
    I admit that my post was not clear,,, Anyhow, I got the solution:

    h1. WORKING CODE
    DECLARE
    
    
    type char_col is table of images_test.filename%type index by pls_integer ;
    V_filename char_col;
    V_mimetype char_col;
    V_filename2 char_col;
    V_mimetype2 char_col;
    
    type source_col is table of blob index by pls_integer ;
    V_source source_col;
    V_source2 source_col;
    
    Type id_col is table of photos_temp.id%type index by pls_integer;
    V_id id_col;
    
    added_image       BLOB;
    prop ordsys.ord_str_list;
    logging VARCHAR2(2000);
    
    x integer ;
    
    BEGIN
    
    SELECT count (nvl(watermarked,1))  INTO x 
    FROM photos_temp   WHERE  temp = :P700_TEMP_IMAGE ;
    IF x > 0 then 
    
    SELECT content,filename,mimetype,id bulk collect
    INTO V_source,v_filename,v_mimetype,v_id
    FROM photos_temp  
    WHERE  temp = :P700_TEMP_IMAGE   FOR UPDATE  ;
    
    
    
    SELECT img INTO added_image FROM timg WHERE N = 1;
    
    prop := ordsys.ord_str_list(
                       'position=middlecenter',
                       'transparency=0.5',
                        'width=500',
                        'height=400'
    );
    
    FOR i IN V_source.first .. V_source.last 
    LOOP
    ORDSYS.ORDImage.process(V_source(i), 'fixedScale=800 500');
    ORDSYS.ORDImage.applyWatermark
    (V_source(i), added_image, V_source(i), logging, prop);
    END LOOP;
    
    FORALL i in V_source.first .. V_source.last 
    
    insert INTO IMAGES_TEST 
    (ID, res_id ,CONTENT,filename,
    mimetype,filesize,watermarked)
    VALUES
    (v_id(i),:P700_res_ID ,V_source(i),V_filename(i),
    V_mimetype(i),dbms_lob.getlength(V_source(i)), 'Y');
    
    COMMIT;
    
    
    
    SELECT content,filename,mimetype,id bulk collect 
    INTO V_source2,v_filename2,v_mimetype2,v_id
    FROM photos_temp
    WHERE  temp = :P700_TEMP_IMAGE   FOR UPDATE  ;
    
    FOR j IN V_source2.first .. V_source2.last 
    loop
    ORDSYS.ORDImage.process(V_source2(j), 'fixedScale=150 120');
    end loop;
    
    FORALL j IN V_source2.first .. V_source2.last 
    insert INTO IMAGES_T
    (res_id ,CONTENT,filename,
    mimetype,filesize,image_id)
    VALUES
    (:P700_res_ID ,V_source2(j),V_filename2(J),
    V_mimetype2(J),dbms_lob.getlength(V_source2(j)), v_id(j));
    COMMIT;
    
    delete photos_temp WHERE temp = :P700_TEMP_IMAGE;
    
    
    COMMIT;
    
    END IF;
    EXCEPTION
       WHEN OTHERS THEN
       RAISE;
    END;

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points