ORA-01006 in execute immediate

Hi Everyone!
Please help!
What's wrong with this code?
create or replace procedure rgo_test_forall
as
  v_actie                        varchar2( 200 ) := 'BEGIN';
  cursor c_sjv
  is
    select   1 netb_totaal
           , 'prf' profiel
           , 'naam' netbeheerder
        from dual;
  type tt_sjv is table of c_sjv%rowtype
    index by binary_integer;
  t_sjv_netb                         tt_sjv;
  l_idx_netb                     pls_integer;
  cursor c_sjv_ean(
    b_profiel                   in       varchar2
  , b_netbeheerder              in       varchar2
  , b_netb_totaal               in       number )
  is
    select 1  ean_totaal
         , 1 / b_netb_totaal fractie
         , 'loc' locatie
         , 'prf' profiel
         , 'ptf' portfolio
         , b_netbeheerder netbeheerder
    from   dual;
  type tt_sjv_ean is table of c_sjv_ean%rowtype
    index by binary_integer;
  t_sjv_ean                         tt_sjv_ean;
  l_idx_ean                     pls_integer;
  type tt_fractie is table of number
         index by binary_integer;
  type tt_netbeheerder is table of varchar2( 400 )
         index by binary_integer;
  type tt_profiel is table of varchar2( 400 )
         index by binary_integer;
  t_fractie                        tt_fractie;
  t_netbeheerder                   tt_netbeheerder;
  t_profiel                        tt_profiel;
  v_maand                       date := to_date( '200711', 'yyyymm' );
  v_aantal_toegevoegd           pls_integer := 0;
  v_fractie                     number;
  procedure splits_tabel(
               origtable_in     in     tt_sjv_ean
             , fractie_tab_out     out tt_fractie
             , netb_tab_out        out tt_netbeheerder
             , profiel_tab_out     out tt_profiel )
   is
     l_idx    pls_integer := origtable_in.first;
   begin
     while l_idx is not null
     loop
        fractie_tab_out( l_idx ) := origtable_in( l_idx ).fractie;
        netb_tab_out( l_idx ) := origtable_in( l_idx ).netbeheerder;
        profiel_tab_out( l_idx ) := origtable_in( l_idx ).profiel;
        l_idx := origtable_in.next( l_idx );
     end loop;
   end splits_tabel;
begin
  open c_sjv;
  loop
    v_actie := 'bulk collect';
    fetch c_sjv
    bulk collect into t_sjv_netb limit 1000;
                           -- only 200 rows are expected
    exit when t_sjv_netb.count = 0;
    l_idx_netb := t_sjv_netb.first;
    while l_idx_netb is not null
    loop
      open c_sjv_ean(
              t_sjv_netb( l_idx_netb ).profiel
            , t_sjv_netb( l_idx_netb ).netbeheerder
            , t_sjv_netb( l_idx_netb ).netb_totaal );
      loop
        v_actie := 'bulk collect EAN';
        fetch c_sjv_ean
        bulk collect into t_sjv_ean limit 10000;
        exit when t_sjv_ean.count = 0;
        v_actie := 'splits tabel';
          splits_tabel(
               origtable_in     => t_sjv_ean
             , fractie_tab_out  => t_fractie
             , netb_tab_out     => t_netbeheerder
             , profiel_tab_out  => t_profiel );
        v_actie := 'forall insert';
        forall i in t_sjv_ean.first .. t_sjv_ean.last
          execute immediate
          'insert into rgot( ptf, volume_plat ) values( ' ||
          '                  substr( '':netbeheerder'' || '' '' || '':profiel'', 1, 30 ) ' ||
          '                , '':fractie'' )'
           using t_netbeheerder( i ), t_profiel( i ), t_fractie( i );
      end loop;
      l_idx_netb := t_sjv_netb.next( l_idx_netb );
    end loop;
  end loop;
exception
when others
then
   dbms_output.put_line( 'OTHERS: ' || sqlcode || ': ' || substr( sqlerrm, 1, 100 ) );
end rgo_test_forall;
sho errI get ORA-01006 when I run it. I have tried replacing the execute immediate statement with the code below, but that way I cannot compile the code.
        forall i in t_sjv_ean.first .. t_sjv_ean.last
          execute immediate
          'insert into rgot( ptf, volume_plat ) values( ' ||
          '                  substr( '''||:netbeheerder||''' || '' '' || '''||:profiel||''', 1, 30 ) ' ||
          '                , '''||:fractie||''' )'
           using t_netbeheerder( i ), t_profiel( i ), t_fractie( i );Next, I tried with the code below, but then no row was inserted.
        forall i in t_sjv_ean.first .. t_sjv_ean.last
          execute immediate
          'insert into rgot( ptf, volume_plat ) values( ' ||
          '                  substr( ''''||:netbeheerder||'''' || '' '' || ''''||:profiel||'''', 1, 30 ) ' ||
          '                , ''''||:fractie||'''' )'
           using t_netbeheerder( i ), t_profiel( i ), t_fractie( i );Any ideas?
By the way: the cursor definitions have been simplified for readability, of course.
Message was edited by:
RemcoGoris

I am sorry, I am but a simple silly little developer who doesn't have good ideas.
Since you are someone who has good ideas, I would consider myself a very very happy man if you were to tell me what the result of the 'debugging' should be.
This?
INSERT INTO rgot(
       ptf
     , volume_plat )
VALUES(
      substr( :netbeheerder || ' ' || :profiel, 1, 30 )
    , :fractie );Humble thanks!

Similar Messages

  • Execute immediate on DBMS_METADATA.GET_DDL with error of ORA-01031: insufficient privileges

    I want to mirror a schema to a existing schema by creating DDL and recreate on the other schema with same name.
    I wrote the code below:
    create or replace
    PROCEDURE                                    SCHEMA_A."MAI__DWHMIRROR"
    AS
    v_sqlstatement CLOB:='bos';
    str varchar2(3999);
    BEGIN
      select
        replace(
          replace(replace(
          replace(DBMS_METADATA.GET_DDL('TABLE','XXXX','SCHEMA_A'),'(CLOB)',''),';','')
        ,'SCHEMA_A'
        ,'SCHEMA_B'
      into v_sqlstatement
      from dual;
      select  CAST(v_sqlstatement AS VARCHAR2(3999)) into str from dual;
      execute immediate ''||str;
    END;
    And Executing this block with below code:
    set serveroutput on
    begin
    SCHEMA_A.MAI__DWHMIRROR;
    end;
    But still getting the following error code:
    Error report:
    ORA-01031: insufficient privileges
    ORA-06512: at "SCHEMA_A.MAI__DWHMIRROR", line 47
    ORA-06512: at line 2
    01031. 00000 -  "insufficient privileges"
    *Cause:    An attempt was made to change the current username or password
               without the appropriate privilege. This error also occurs if
               attempting to install a database without the necessary operating
               system privileges.
               When Trusted Oracle is configure in DBMS MAC, this error may occur
               if the user was granted the necessary privilege at a higher label
               than the current login.
    *Action:   Ask the database administrator to perform the operation or grant
               the required privileges.
               For Trusted Oracle users getting this error although granted the
               the appropriate privilege at a higher label, ask the database
               administrator to regrant the privilege at the appropriate label.

    user5199319 wrote:
    USER has DBA Role
    when all  else fails Read The Fine Manual
    DBMS_METADATA

  • EXECUTE IMMEDIATE ORA-01722 invalid number

    hi all
    i have a plsql procedure in which the following statement which gives this error ORA-01722: invalid number
    sql_stmt :='UPDATE Student set '||stu_gradefor||'=TO_NUMBER('||stu_marks||') where UserID='||stu_UID;
    EXECUTE IMMEDIATE sql_stmt;
    here all variables (stu_marks,stu_gradefor and stu_UID) are varchar2 coming from different procedure(form) but in the table named Student column HW1 (stu_gradefor) is of datatype number.
    I have tried a lot but could not make it to work. Is it that we cannot enter an number through EXECUTE IMMEDIATE? If Possible can somebody help me with this?
    Thanks a lot.
    Regards
    Jyoti

    create table Student(UserID varchar2(8) not null, HW1 number(3) , HW2 number(3) , PA1 number(3) , ................);
    create table Domain(R_Domain varchar2(11) not null, R_Status char(1) not null, R_Date Date null,R_Value varchar2(11) null, R_Mean varchar2(300) not null);
    insert into Domain( R_Domain, R_Status, R_Value, R_Mean )values(
         'Term','t','PA1','First Programming Assignment');
    Full names for HW1, HW2, PA1....are in the Domain table. so in variable stu_gradefor we get the R_Value.
    this is true :variable stu_marks is not actually a number, so the TO_NUMBER is causing the error. stu_marks is of datatype varchar2 but the field HW1,.. are all expecting a numeric value.
    i tried SELECT TO_NUMBER(stu_marks) INTO gmark FROM DUAL;
    sql_stmt :='UPDATE Student set '||stu_gradefor||'=(:1) where UserID='||stu_UID;
    EXECUTE IMMEDIATE sql_stmt using gmark;
    where gmark is a number but noting works.same error
    This can be true:the column userid is a varchar2 column with a mix of numeric and alpha numeric values. userid value that i inserted was'12345678'
    i there any other way to handle this situation?
    Thanks for replying
    Jyoti

  • ORA-14552: cannot perform a DDL in a execute immediate - proc

    Hi All,
    I am trying to disable triggers in a stored procedure:
    PROCEDURE Alter_trigger_DISBALE
    IS
    BEGIN
         execute immediate ('alter trigger BEI_INS_MY DISABLE');
    END;
    I get the following error:
    ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
    Is there a solution for this problem ?
    Best Regards
    Friedhold

    How are you calling the procedure?
    I assume that, since your procedure actually compiles, it doesn't have the parenthesis around the EXCEUTE IMMEDIATE string and that there is a CREATE before the PROCEDURE. I hope that "disable" is spelled correctly in the real thing.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Execute Immediate giving ORA-00942: table or view does not exist

    Hi,
    I am trying to create a table using a execute immeidate in PL/SQL it is giving table or view does not exists. Where as same create table sql is running fine outside the PL/SQL.
    g_sql :=
    ' CREATE TABLE '||l_tmptable1||' as '||
    ' SELECT decode(gsisource,null,''WEBSTORE'',gsisource) as "SOURCE", COUNT(1) as "ADD_COUNT" '||
    ' FROM SCHEMA_NAME.t_master '||
    ' WHERE add_date between to_date('''||g_startDateChrTrunc||''',''MM/DD/YYYY'') '||
    ' AND to_date('''||g_endDateChrTrunc||''',''MM/DD/YYYY'') '||
    ' GROUP BY DECODE(gsisource,null,''WEBSTORE'',gsisource) ';
    EXECUTE IMMEDIATE g_sql;
    Any help is appreciated.
    Regards

    Hi,
    It sounds like you have privileges only through a role. Roles don't count in AUTHID DEFINER stored procedures. Have the table owner grant the necessary privileges directly to the proceudre owner.
    By the way, creating tables in PL/SQL is almosty never the right way to do whatever it is you need. What is the purpose of this table? Why can't it be created once, and be TRUNCATEd when necessary?

  • About ora-01006 :bind variable does not exist

    Hi all of you,i have this dynamic sql :
    DECLARE
    v_query clob;
    cpt number;
    begin
    v_query:='
    SELECT
    count(TBA.ANT_ID)
      FROM
    WHERE TBA.ANT_FUT_ID = TFT.FUT_ID
           AND TBA.ANT_KATEGORIE_CODE_ID = TAKCL.ANT_KATEGORIE_CODE_ID(+)
           AND TBA.ANT_KFZ_REIHEN_ID = TKR.KFZ_REIHEN_ID(+)
           AND TBA.ANT_ID = F1.ANT_ANT_ID(+)
           AND TBA.ANT_ID = F2.ANT_ANT_ID(+)
           AND TBA.ANT_ID = F3.ANT_ANT_ID(+)
           AND TBA.ANT_ID = ERS.ers_bdk(+)
           AND TBA.ANT_ID = F1_2.ANT_ANT_ID(+)
           AND TBA.ANT_ID = F2_3.ANT_ANT_ID(+)
           AND TBA.ANT_ID = MFU.MFU_ANT_ID(+)
           AND MFU.MFU_NIETGEOMETRIE_ID = NG.NG_ID(+)
           AND MFU.MFU_MATRIZEN_BEICHNUNG_ID = MZB.MZB_ID(+)
        -- Suchkriterien: --
        --Ersteller
        AND  DECODE( ERS.ers_id, NULL, ''%'', ERS.ers_name ) LIKE DECODE('':1'',NULL,''%'','''')||''''|| :1 ||''''||DECODE('':1'',NULL,''%'','''')
         --Fahrzeug
        AND  DECODE( TKR.NAME, NULL, ''%'', TKR.NAME ) LIKE DECODE('':2'',NULL,''%'','''')||''''|| :2 ||''''|| DECODE('':2'',NULL,''%'','''')
         --BDK
        AND  DECODE( fuege_db.bdk_nummer( TBA.ANT_ID,''.'' ), NULL, ''%%'',
       fuege_db.bdk_nummer( TBA.ANT_ID,''.'' ) )   LIKE ''%''||:3||''%''
        --Technologie
        AND  TBA.ANT_FUT_ID LIKE DECODE('':4'',NULL,''%'','''')||''''|| :4 ||''''||DECODE('':4'',NULL,''%'','''')
         --Art
        AND ((TBA.ANT_WFP_ID is null and 1=DECODE('':5'',NULL,1,1,1) ) or (TBA.ANT_WFP_ID is not null and 2=DECODE('':5'',NULL,2,2,2)))
        --VTA
        AND TBA.ANT_VTA = decode('':6'',1,1,TBA.ANT_VTA)  ';
    execute immediate v_query
    into cpt USING
    'Dominik Hussmann',
    'AU736_Q7_SUV' ,
    'WPS Stahl',
    '0';  
    end ;
    In the execution,i have this error :ora-01006 :bind variable does not exist, after analyzing,i have found that the problem is with parameters :5 and :6 ,i don't understand they have the same syntax
    as bind variables 1,2,3 and 4.
    Than you for any suggestion.

    I hope you do realise that there are 13 bind-variables in your sql, not 6?
    Variables are bound by position. You cannot use the same bind variable twice, they will be 2 distinct bind variables.
    For example, you use :1 three times, so you need to provide three arguments, in this case three times the same value.

  • ORA-01006:bind variable does not exist for the QUERY

    Dear All,
    Please help on below query :
    DECLARE
    P_ROTATION_NO GCH_VSL_REGN.ROTATION_NO%TYPE :=21;
    P_VESL_NO GCH_VSL_MASTER.VESL_NO%TYPE := NULL;
    P_VESL_NAME GCH_VSL_MASTER.VESL_NAME%TYPE:= NULL;
    P_FROM_REG_DATE GCH_VSL_MASTER.CREATED_DATE%TYPE:= NULL;
    P_TO_REG_DATE GCH_VSL_MASTER.CREATED_DATE%TYPE:= NULL;
    P_FROM_ARRIVAL_DATE GCH_VSL_REGN.ARRIVAL_DATE%TYPE:= NULL;
    P_TO_ARRIVAL_DATE GCH_VSL_REGN.ARRIVAL_DATE%TYPE:= NULL;
    P_CLOSE_TYPE GCH_VSL_CLOSE_DTLS.CLOSE_TYPE%TYPE:= NULL;
    P_RESULT_LIST SYS_REFCURSOR;
    P_TOTAL_LENGTH NUMBER;
    P_ERROR_MESSAGE VARCHAR2(1000);
    lv_sql1 VARCHAR2(5000);
    lv_sql2 VARCHAR2(5000);
    lv_whereClause VARCHAR2(5000);
    pv_text VARCHAR2(1000);
    BEGIN
    pv_text := NULL;
    lv_whereClause := ' WHERE GVM.VESL_MASTER_NUM = GVR.VESL_MASTER_NUM
    AND GVR.ROTATION_NO = GVCH.ROTATION_NO
    AND GVCH.CLOSE_HDR_ID = GVCD.CLOSE_HDR_ID(+)
    AND (:P_ROTATION_NO IS NULL OR
    (:P_ROTATION_NO IS NOT NULL AND
    GVR.ROTATION_NO LIKE % :P_ROTATION_NO %))
    AND GVM.IS_VALID = 1';
    lv_sql1 := 'SELECT COUNT(gvr.rotation_no)
    FROM gch_vsl_close_hdr gvch,
    gch_vsl_master gvm,
    gch_vsl_regn gvr,
    gch_vsl_close_dtls gvcd'||lv_whereClause;
    dbms_output.put_line (lv_sql1);
    EXECUTE IMMEDIATE lv_sql1 INTO :P_TOTAL_LENGTH
    USING P_ROTATION_NO;
    END;
    I am getting below error when running the above query
    ORA-01006:     bind variable does not exist

    why (date datatype assumed for variables with names containing DATE)
    PROCEDURE XVY(P_ROTATION_NO IN GCH_VSL_REGN.ROTATION_NO%TYPE,
                  P_VESL_NO IN GCH_VSL_MASTER.VESL_NO%TYPE,
                  P_VESL_NAME IN GCH_VSL_MASTER.VESL_NAME%TYPE,
                  P_CM_REGN_NO IN GCH_VSL_REGN.CM_REGN_NO%TYPE,
                  P_FINAL_CLOSE_STA IN GCH_VSL_CLOSE_HDR.FINAL_CLOSE_STA%TYPE,
                  P_FROM_REG_DATE IN GCH_VSL_MASTER.Created_Date%TYPE,
                  P_TO_REG_DATE IN GCH_VSL_MASTER.CREATED_DATE%TYPE,
                  P_FROM_ARRIVAL_DATE IN GCH_VSL_REGN.ARRIVAL_DATE%TYPE,
                  P_TO_ARRIVAL_DATE IN GCH_VSL_REGN.ARRIVAL_DATE%TYPE,
                  P_RESULT_LIST OUT SYS_REFCURSOR,
                  P_TOTAL_LENGTH OUT NUMBER,
                  P_ERROR_MESSAGE OUT VARCHAR2
                 ) AS
      lv_sql1        VARCHAR2(4000);
      lv_sql2        VARCHAR2(4000);
      lv_whereClause VARCHAR2(4000);
    BEGIN
    --  pv_text := NULL;
      lv_whereClause := ' WHERE gvm.vesl_master_num = gvr.vesl_master_num '||
                          ' AND GVR.ROTATION_NO(+) = GVCH.ROTATION_NO '||
                          ' AND (:P_ROTATION_NO IS NULL '||
                          '  OR  (:P_ROTATION_NO IS NOT NULL '||
                          ' AND   gvch.rotation_no LIKE ''%'' || :P_ROTATION_NO || ''%'' ' ||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_CM_REGN_NO IS NULL '||
                          '  OR  (:P_CM_REGN_NO IS NOT NULL '||
                          ' AND   gvr.cm_regn_no LIKE ''%'' || :P_CM_REGN_NO || ''%'' '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_VESL_NAME IS NULL '||
                          '  OR  (:P_VESL_NAME IS NOT NULL '||
                          ' AND   gvm.vesl_name LIKE ''%'' || :P_VESL_NAME || ''%'' '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_VESL_NO IS NULL '||
                          '  OR  (:P_VESL_NO IS NOT NULL '||
                          ' AND   GVM.vesl_no LIKE ''%'' || :P_VESL_NO || ''%'' '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_FINAL_CLOSE_STA IS NULL '||
                          '  OR  (:P_FINAL_CLOSE_STA IS NOT NULL '||
                          ' AND   gvch.imp_close_sta LIKE ''%'' || :P_FINAL_CLOSE_STA || ''%'' '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_FROM_REG_DATE IS NULL '||
                          '  OR  (:P_FROM_REG_DATE IS NOT NULL '||
                          ' AND   gvch.created_date >= :P_FROM_REG_DATE '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_TO_REG_DATE IS NULL '||
                          '  OR  (:P_TO_REG_DATE IS NOT NULL '||
                          ' AND   gvch.created_date <= :P_TO_REG_DATE '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_FROM_ARRIVAL_DATE IS NULL '||
                          '  OR  (:P_FROM_ARRIVAL_DATE IS NOT NULL '||
                          ' AND   gvch.arrival_date >= :P_P_FROM_ARRIVAL_DATE '||
                          '      ) '||
                          '     ) '||
                          ' AND (:P_TO_ARRIVAL_DATE IS NULL '||
                          '  OR  (:P_TO_ARRIVAL_DATE IS NOT NULL '||
                          ' AND   gvch.arrival_date <= :P_TO_ARRIVAL_DATE '||
                          '      ) '||
                          '     ) '||
                          ' AND gvm.is_valid = 10 ';
      lv_sql1 := 'SELECT COUNT(gvr.rotation_no) '||
                 '  FROM xvz gvch, '||
                 '       zxsc gvm, '||
                 '       dsae gvr, '||
                 '       vvsd gvcd '|| lv_whereClause;
      lv_sql2 := ' SELECT gvch.close_hdr_id, '||
                 '        gvch.rotation_no, '||
                 '        gvr.cm_regn_no, '||
                 '        gvm.vesl_no, '||
                 '        gvm.vesl_name, '||
                 '        gvch.final_close_sta, '||
                 '        gvr.arrival_date, '||
                 '        gvch.close_date, '||
                 '        gvr.created_date '||
                 '   FROM xvz gvch, '||
                 '        zxsc gvm, '||
                 '        dsze gvr '|| lv_whereClause || 'ORDER BY gvch.rotation_no';
      EXECUTE IMMEDIATE lv_sql1 INTO P_TOTAL_LENGTH
                  USING P_ROTATION_NO,P_ROTATION_NO,P_ROTATION_NO,
                        P_CM_REGN_NO,P_CM_REGN_NO,P_CM_REGN_NO,
                        P_VESL_NAME,P_VESL_NAME,P_VESL_NAME,
                        P_VESL_NO,P_VESL_NO,P_VESL_NO,
                        P_FINAL_CLOSE_STA,P_FINAL_CLOSE_STA,P_FINAL_CLOSE_STA,
                        P_FROM_REG_DATE,P_FROM_REG_DATE,P_FROM_REG_DATE,
                        P_TO_REG_DATE,P_TO_REG_DATE,P_TO_REG_DATE,
                        P_FROM_ARRIVAL_DATE,P_FROM_ARRIVAL_DATE,P_FROM_ARRIVAL_DATE,
                        P_TO_ARRIVAL_DATE,P_TO_ARRIVAL_DATE,P_TO_ARRIVAL_DATE;
      OPEN P_RESULT_LIST
       FOR lv_sql2 USING P_ROTATION_NO,P_ROTATION_NO,P_ROTATION_NO,
                         P_CM_REGN_NO,P_CM_REGN_NO,P_CM_REGN_NO,
                         P_VESL_NAME,P_VESL_NAME,P_VESL_NAME,
                         P_VESL_NO,P_VESL_NO,P_VESL_NO,
                         P_FINAL_CLOSE_STA,P_FINAL_CLOSE_STA,P_FINAL_CLOSE_STA,
                         P_FROM_REG_DATE,P_FROM_REG_DATE,P_FROM_REG_DATE,
                         P_TO_REG_DATE,P_TO_REG_DATE,P_TO_REG_DATE,
                         P_FROM_ARRIVAL_DATE,P_FROM_ARRIVAL_DATE,P_FROM_ARRIVAL_DATE,
                         P_TO_ARRIVAL_DATE,P_TO_ARRIVAL_DATE,P_TO_ARRIVAL_DATE;
    END;instead of (the where clauses should be equivalent)
    PROCEDURE XVY(P_ROTATION_NO IN GCH_VSL_REGN.ROTATION_NO%TYPE,
                  P_VESL_NO IN GCH_VSL_MASTER.VESL_NO%TYPE,
                  P_VESL_NAME IN GCH_VSL_MASTER.VESL_NAME%TYPE,
                  P_CM_REGN_NO IN GCH_VSL_REGN.CM_REGN_NO%TYPE,
                  P_FINAL_CLOSE_STA IN GCH_VSL_CLOSE_HDR.FINAL_CLOSE_STA%TYPE,
                  P_FROM_REG_DATE IN GCH_VSL_MASTER.Created_Date%TYPE,
                  P_TO_REG_DATE IN GCH_VSL_MASTER.CREATED_DATE%TYPE,
                  P_FROM_ARRIVAL_DATE IN GCH_VSL_REGN.ARRIVAL_DATE%TYPE,
                  P_TO_ARRIVAL_DATE IN GCH_VSL_REGN.ARRIVAL_DATE%TYPE,
                  P_RESULT_LIST OUT SYS_REFCURSOR,
                  P_TOTAL_LENGTH OUT NUMBER,
                  P_ERROR_MESSAGE OUT VARCHAR2
                 ) AS
      lv_sql1        VARCHAR2(4000);
      lv_sql2        VARCHAR2(4000);
      lv_whereClause VARCHAR2(4000);
    BEGIN
      SELECT COUNT(gvr.rotation_no)
        INTO P_TOTAL_LENGTH
        FROM xvz gvch,
             zxsc gvm,
             dsae gvr,
             vvsd gvcd
       WHERE gvm.vesl_master_num = gvr.vesl_master_num
         AND GVR.ROTATION_NO(+) = GVCH.ROTATION_NO
         AND (P_ROTATION_NO IS NULL
          OR  (P_ROTATION_NO IS NOT NULL
         AND   gvch.rotation_no LIKE '%' || P_ROTATION_NO || '%'
         AND (P_CM_REGN_NO IS NULL
          OR  (P_CM_REGN_NO IS NOT NULL
         AND   gvr.cm_regn_no LIKE '%' || P_CM_REGN_NO || '%'
         AND (P_VESL_NAME IS NULL
          OR  (P_VESL_NAME IS NOT NULL
         AND   gvm.vesl_name LIKE '%' || P_VESL_NAME || '%'
         AND (P_VESL_NO IS NULL
          OR  (P_VESL_NO IS NOT NULL
         AND   GVM.vesl_no LIKE '%' || P_VESL_NO || '%'
         AND (P_FINAL_CLOSE_STA IS NULL
          OR  (P_FINAL_CLOSE_STA IS NOT NULL
         AND   gvch.imp_close_sta LIKE '%' || P_FINAL_CLOSE_STA || '%'
         AND (P_FROM_REG_DATE IS NULL
          OR  (P_FROM_REG_DATE IS NOT NULL
         AND   gvch.created_date >= P_FROM_REG_DATE
         AND (P_TO_REG_DATE IS NULL
          OR  (P_TO_REG_DATE IS NOT NULL
         AND   gvch.created_date <= P_TO_REG_DATE
         AND (P_FROM_ARRIVAL_DATE IS NULL
          OR  (P_FROM_ARRIVAL_DATE IS NOT NULL
         AND   gvch.arrival_date >= P_P_FROM_ARRIVAL_DATE
         AND (P_TO_ARRIVAL_DATE IS NULL
          OR  (P_TO_ARRIVAL_DATE IS NOT NULL
         AND   gvch.arrival_date <= P_TO_ARRIVAL_DATE
         AND gvm.is_valid = 10;
      OPEN P_RESULT_LIST
       FOR SELECT gvch.close_hdr_id, 
                  gvch.rotation_no, 
                  gvr.cm_regn_no, 
                  gvm.vesl_no, 
                  gvm.vesl_name, 
                  gvch.final_close_sta, 
                  gvr.arrival_date, 
                  gvch.close_date, 
                  gvr.created_date 
             FROM xvz gvch, 
                  zxsc gvm, 
                  dsze gvr
            WHERE gvm.vesl_master_num = gvr.vesl_master_num
              AND GVR.ROTATION_NO(+) = GVCH.ROTATION_NO
              AND gvch.rotation_no LIKE '%' || nvl(P_ROTATION_NO,gvch.rotation_no) || '%'
              AND gvr.cm_regn_no LIKE '%' || nvl(P_CM_REGN_NO,gvr.cm_regn_no) || '%'
              AND gvm.vesl_name LIKE '%' || nvl(P_VESL_NAME,gvm.vesl_name) || '%'
              AND gvm.vesl_no LIKE '%' || nvl(P_VESL_NO,gvm.vesl_no) || '%'
              AND gvch.imp_close_sta LIKE '%' || nvl(P_FINAL_CLOSE_STA,gvch.imp_close_sta) || '%'
              AND gvch.created_date BETWEEN nvl(P_FROM_REG_DATE,gvch.created_date) AND nvl(P_TO_REG_DATE,gvch.created_date)
              AND gvch.arrival_date BETWEEN nvl(P_FROM_ARRIVAL_DATE,gvch.arrival_date) AND nvl(P_TO_ARRIVAL_DATE,gvch.arrival_date)
              AND gvm.is_valid = 10;
            ORDER BY gvch.rotation_no;
    END;Regards
    Etbin
    Edited by: Etbin on 8.4.2012 14:37
    In order not to waste your time in the future:
    Don't execute dynamic SQL until it works !!!
    Write out what you managed to put together using dbms_output.
    Paste that into the SQL window of your client tool (SQL Developer ...)
    Convert parameters to bind variables (replace p_ with :p_)
    Try to run it.
    If errors are thrown correct them, adjust the procedure/function set up to write your dynamic SQL accordingly
    Repeat the cycle until no errors are thrown
    Comment out the dbms_output. ... line
    Uncomment the execute immediate ... line

  • Update_Task results in ORA-01006: bind variable does not exist - bug?

    Hi,
    I have successfuly created projects/tasks, and updated projects. However, when I tried to call pa_project_pub.update_task, I get an error
    U(nexpected):
    PROCEDURE_NAME update_one_task
    PKG_NAME PA_PROJECT_PVT
    FND FND_AS_UNEXPECTED_ERROR
    ERROR_TEXT ORA-01006: bind variable does not exist
    As far as I can see, this must be a bug, because the API must have created an excecute immediate/dbms_sql statement with at least one extra bind variable (i.e. execute '... :a, :b' using a, b, c)
    I've tried with different combinations of arguments to the API, all resulting in the same error:
    The id's and data are taken from a an already created project/task in my apps-instance:
    pa_project_pub.update_task(
    p_api_version_number => 1.0
    ,p_commit => xxpa_opop2pa_interface_utils.g_FALSE
    ,p_msg_count => l_msg_count
    ,p_msg_data => l_msg_data
    ,p_return_status => l_return_status
    ,p_pm_product_code => l_pm_product_code
    ,p_pm_project_reference => '100394'
    ,p_pm_task_reference => 'add_task_1.0'
    -- ,p_ref_task_id => ''
    ,p_task_number => 4
    -- ,p_pa_task_id => '19079'
    ,p_task_name => 'add_task_1.0'
    ,p_long_task_name => 'p_task_name'
    ,p_task_start_date => p_start_date
    ,p_task_completion_date => p_completion_date
    ,p_task_description => 'update-task:'||p_description
    ,p_out_pm_task_reference => l_out_pm_task_reference
    ,p_out_pa_task_id => p_task_id_out
    Am I missing anything, or this really must be a bug in the API?
    Does anyone have any other idea?
    I have looked at the API implementation, and found a use of dbms_sql, a long code constructing a statement then binding variables in if-then clauses.
    Regards,
    ps: ->
    system info
    Database Server
    RDBMS : 11.1.0.6.0
    Oracle Applications : 12.0.6
    System Date : 11-MAY-2009 10:41:50
    Forms Server
    Current Form
    Form Application : Application Object Library
    Form Name : FNDPOMPO
    Form Version : 12.0.2
    Form Last Modified : $Date: 2006/03/23 13:54 $
    Forms
    APPSTAND : 12.0.6.12000000.3
    FNDPOMPO : 12.0.2
    FNDSCSGN : 12.0.14.12000000.3
    Form Menus
    FNDMENU : 12.0.2
    Forms PL/SQL
    APPCORE : 12.0.21.12000000.13
    CUSTOM : 12.0.0
    FNDSQF : 12.0.3
    GHR : 12.0.22.12000000.26
    GLOBE : 12.0.62.12000000.13
    GMS : 12.0.42.12000000.11
    IGILUTIL2 : 12.0.24.12000000.3
    IGILUTIL : 12.0.1.12000000.3
    OPM : 12.0.7.12000000.2
    PQH_GEN : 12.0.7
    PSA : 12.0.17
    PSAC : 12.0.4.12000000.2
    PSB : 12.0.2
    VERT1 : 12.0.0
    VERT2 : 12.0.0
    VERT3 : 12.0.0
    VERT4 : 12.0.0
    VERT5 : 12.0.0
    VERT : 12.0.0
    **********************

    Hello,
    This issue is fixed in the bug 4692368. So you can get a patch from Oracle.
    Hope this helps !
    Thanks,
    Sathish
    www.projectsaccounting.com

  • ORA-01006 using Dynamic SQL

    Hello,
    I'm trying to create a function utilizing Dynamic SQL. The function compiles fine, but when I go to call it using the select staement below, I get :
    ORA-01006: bind variable does not exist
    ORA-06512: at "ICIM.PROD_SALES_DATA", line 24
    select prod_sales_data('09','I',2009,'Awning')
    from dual;
    CREATE OR REPLACE FUNCTION prod_sales_data
    (p_ahl1 IN VARCHAR2, p_phl1 IN VARCHAR2, p_fisyr IN NUMBER,
    p_prod_str IN VARCHAR2)
    RETURN NUMBER IS
    v_return NUMBER;
    query_str VARCHAR2(10000);
    BEGIN
    query_str :='select sum(a.qsh*a.unitcnt)'||chr(13)
    ||'from sh_units a, sh_product_desc b, sh_ad_glass c'||chr(13)
    ||'where a.unittype = b.unittype'||chr(13)
    ||'and a.sh_id = c.sh_id(+)'||chr(13)
    ||'AND a.ahl1 = '||chr(39)||p_ahl1||chr(39)||chr(13)
    ||'AND a.phl1 = '||chr(39)||p_phl1||chr(39)||chr(13)
    ||'AND a.fisyr ='|| p_fisyr||chr(13)
    ||'AND UPPER(b.descrip) = UPPER('||chr(39)||p_prod_str||chr(39)||')'||chr(13)
    ||'AND a.invdt between b.eff_beg and b.eff_end'||chr(13)
    ||'and a.parts_flag <>'||chr(39)||'Y'||chr(39)||chr(13)
    ||'and a.unittype <>'||chr(39)||'OTHE'||chr(39)||chr(13)
    ||'and icim.sh_rept_chk_ortp(a.ortp) = 1'||chr(13)
    ||'and A.REPT_RELEASE_DT is not null';
    DBMS_OUTPUT.PUT_LINE(query_str) ;
    EXECUTE IMMEDIATE query_str
    INTO v_return
    USING p_ahl1,p_phl1,p_fisyr,p_prod_str;
    RETURN v_return;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END prod_sales_data ;
    Any help as to what is going wrong would be greatly appreciated.
    Thanks,
    Tyler

    Hello,
    >
    I'm trying to create a function utilizing Dynamic SQL. But why?
    Whenever you turn towards dynamic SQL, ask yourself why?
    I bet for a couple of years you aren't able rto come up with an answer. Meaning you shouldn't.
    Even if you do come up with an answer, think again. The answer may very well be wrong.
    Wouldn't it be nice if your function was as simple as:
    CREATE OR REPLACE FUNCTION prod_sales_data
       ( p_ahl1      IN VARCHAR2
       , p_phl1      IN VARCHAR2
       , p_fisyr     IN NUMBER,
         p_prod_str  IN VARCHAR2)
    RETURN NUMBER
    IS
       v_return NUMBER;
    BEGIN
        select sum(a.qsh*a.unitcnt)
          into v_return
          from sh_units a
             , sh_product_desc b
             , sh_ad_glass c
         where a.unittype = b.unittype
           and a.sh_id = c.sh_id(+)
           and a.ahl1 =  p_ahl1
           and a.phl1 =  p_phl1
           and a.fisyr = p_fisyr
           and upper(b.descrip) = upper(p_prod_str)
           and a.invdt between b.eff_beg and b.eff_end
           and a.parts_flag != 'Y'
           and a.unittype != 'OTHE'
           and icim.sh_rept_chk_ortp(a.ortp) = 1
           and a.rept_release_dt is not null;
    RETURN v_return;
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RETURN NULL;
    END prod_sales_data ;
    /Now using proper bind variables, plain static pre-compiled SQL. And even works properly WITH NO DATA FOUND.
    I know it's dangerous to use words as always and never, but i dare say
    Always (Whenever you can) use static SQL. Never (Unless you must) use dynamic SQL (When you can use static).
    Regards
    Peter

  • ORA-01006: bind variable does not exist Error

    Hi All
    I am trying to dynamically call a stored proc using the syntax:
    plsql_block := 'BEGIN PKG_TEST.SP_GET_USERDETAILS(a, :b, :c); END;';
    EXECUTE IMMEDIATE plsql_block USING OUT lt_metadatasummary, pv_acctnum, pv_reportdate;
    But I am getting an ORA-01006 exception and I do not understand what its means exactly.
    Here pv_acctnum is of type VARCHAR2(30)
    pv_reporttype of type VARCHAR2(30)
    and
    lt_metadatasummary of type CVIM_REPORT_METADATASUMMARY_TB
    My called Procedure defintion looks like:
    PROCEDURE SP_GET_USERDETAILS
    pt_metadatasummary OUT CVIM_REPORT_METADATASUMMARY_TB
    , pv_acctnum IN VARCHAR2
    , pv_reportdate IN VARCHAR2
    -- CVIM_REPORT_METADATASUMMARY_TB is my custom table type

    yes. you may write for IN variables as following with concatenation. but for OUT variables there is no other option(s):
    plsql_block := 'BEGIN PKG_TEST.SP_GET_USERDETAILS(:a, '' '|| b ||' '', '' '|| c ||' ''); END;';ps. but it is recommended use BİND variables - for increase performance of repeated calls and for accurately use.

  • Error while insert data using execute immediate in dynamic table in oracle

    Error while insert data using execute immediate in dynamic table created in oracle 11g .
    first the dynamic nested table (op_sample) was created using the executed immediate...
    object is
    CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
    mark1 number,
    mark2 number
    t_sub_mark is a class of type sub_mark
    CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
    create table sam1(id number,name varchar2(30));
    nested table is created below:
    begin
    EXECUTE IMMEDIATE ' create table '||op_sample||'
    (id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
    end;
    now data from sam1 table and object (subject_obj) are inserted into the dynamic table
    declare
    subject_obj t_sub_mark;
    begin
    subject_obj:= t_sub_mark();
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
    end;
    and got the below error:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7
    then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
    execute immediate 'insert into '||dynam_table ||'
    (SELECT

    887684 wrote:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
    If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically.

  • Strange Case on Security Rights and Dynamic SQL (Execute Immediate)

    Hi friends, (forgive me if I write with wrong grammar and sentence, I not used English for daily)
    I got a weird trouble yesterday.
    I created a package (we can called it X, OK!?) which containing Execute Immediate Statement, that function to delete a table (we can called it Y).
    Several days ago, it's worked, but yesterday it wasn't. Last things happened before was recreate those table, and regrant to a role which including user account that execute package X.
    Error Msg shown is ORA-00942 : Table or view does not exist. After rechecked and rechecked, I found nothing that could trigger that error, I used DBMS_OUTPUT.PUT_LINE to debug and show what statement resulted and executed, I cut and paste, and it's worked. I created anonymous PL/SQL Block, and wrote it and executed it, and worked.
    Finally, today, We Grant explicitly those table to user account Y, not via Role, ... and it's work. Interesting thing I think :P
    And, I revoke, execute package and run. I think, there's something about Oracle he..he.. :D .
    Can somebody help me and explain me the reason of that strange symptomp? and right solution? I must know it, because several days again, it's launched / install.
    TIA

    Here is the procedure that get troubled into :)
    PROCEDURE DeleteOld_Job(
    p_Job_Code IN VARCHAR2,
    p_User_Id IN VARCHAR2,
    p_Parameter_Entry IN VARCHAR2,
    p_Status OUT NUMBER )
    IS
    StrSql VARCHAR2(1000);
    CURSOR CTable_Used_By_Report IS
    SELECT TABLE_NAME
    ,TABLE_OWNER
    FROM TABLE_USED_BY_JOB
    WHERE
    Job_Code = p_Job_Code
    BEGIN
    p_Status := 1;
    DBMS_OUTPUT.PUT_LINE('p_Job_Code '&#0124; &#0124;p_Job_Code );
    DBMS_OUTPUT.PUT_LINE('p_Parameter_Entry '&#0124; &#0124;p_Parameter_Entry );
    FOR Item IN CTable_Used_By_Report
    LOOP
    StrSql := 'DELETE '&#0124; &#0124;Item.TABLE_OWNER&#0124; &#0124;'.'&#0124; &#0124;Item.TABLE_NAME&#0124; &#0124;' T WHERE EXISTS ( SELECT 1 FROM USERBATCH.HISTORY_JOB H WHERE H.USER_ID = ' ;
    StrSql := StrSql&#0124; &#0124;''''&#0124; &#0124;p_User_Id&#0124; &#0124;''''&#0124; &#0124;' AND H.Job_Code = '&#0124; &#0124;''''&#0124; &#0124;p_Job_Code&#0124; &#0124;''''&#0124; &#0124;' AND H.PARAMETER_ENTRY = '&#0124; &#0124;'''' &#0124; &#0124;p_Parameter_Entry&#0124; &#0124;''''&#0124; &#0124;' AND T.SESSION_ID = H.TRANSACTION_ID)';
    DBMS_OUTPUT.PUT_LINE(StrSql);
    DBMS_OUTPUT.PUT_LINE(Item.TABLE_OWNER&#0124; &#0124;'.'&#0124; &#0124;Item.TABLE_NAME);
    EXECUTE IMMEDIATE StrSql;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('DELETE USERBATCH.HISTORY_JOB WHERE USER_ID ='''&#0124; &#0124; p_User_Id &#0124; &#0124;'''
    AND Job_Code ='''&#0124; &#0124; p_Job_Code &#0124; &#0124;''' AND PARAMETER_ENTRY = '''&#0124; &#0124; p_Parameter_Entry &#0124; &#0124;'''');
    EXECUTE IMMEDIATE 'DELETE USERBATCH.HISTORY_JOB WHERE USER_ID ='''&#0124; &#0124; p_User_Id &#0124; &#0124;'''
    AND Job_Code ='''&#0124; &#0124; p_Job_Code &#0124; &#0124;''' AND PARAMETER_ENTRY = '''&#0124; &#0124; p_Parameter_Entry &#0124; &#0124;'''';
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    p_Status := 0;
    DBMS_OUTPUT.PUT_LINE( SUBSTR(SQLERRM,1,255) );
    END DeleteOld_Job;
    TIA
    null

  • Execute immediate and dynamic sql

    Dear all;
    Just curious....Why do developers still use dynamic sql..and execute immediate, because I always thought dynamic sql were bads and the use of execute immediate as well...
    or am I missing something...

    There are no 'bad' things and 'good' things.
    There are 'correctly used' and 'incorrectly used' features.
    It depends what you want to do.
    One simple example: Oracle 11.2 - you write a package that fetches data from range interval partitioned table (a new partition is created automatically every day when new key values are inserted). If you use static SQL then whenever Oracle creates a new partition then your package gets invalidated and has to be compiled. If your package is heavily used (by many sessions running in parallel) then you may get this:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "PACKAGE.XXXXX" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "PACKAGE.XXXXX" Nice, isn't it?
    You can avoid this kind of problems by simply using dynamic SQL. You break dependency with the table and your package is not invalidated when new partition is created.

  • [Solved] Reference apex_application.g_fXX in "execute immediate" statement

    Hi!
    I created a dynamically generated tabular form - the number of columns is not known in advanced. Each cell of the form is a text item generated with apex_item.text().
    I want to write an after-submit process that saves the values from the form into a database table. In this process I already know how many columns there are in the report so I want to do the following:
    --for each row...
    for i in 1..apex_application.g_f01.count loop
      -- and for each column in that row (number of columns is in v_col_count)
      for j in 1..v_col_count loop
        -- get the value of text item
        v_query := 'select apex_application.g_f0' || j || '(' || i || ')' || ' from dual';
        execute immediate v_query into v_value;
        -- now do some DML with v_value
      end loop;
    end loop;The problem is that I get an error: ORA-06553: PLS-221: 'G_Fxx' is not a procedure or is undefined where xx is the number from the generated query.
    My question is - am I doing something wrong or is is just not possible to reference apex_application.g_fxx in "execute immediate"? Will I have to manually check for all 50 possibilites of apex_application.g_fxx? Is there another way?
    TIA,
    Jure

    Well now I know what was wrong and what you were trying to tell me - apex_application.g_fxx is not visible in "plain" SQL. And now I also have a solution to this problem. The point is to wrap the select statement with begin - end block so that the statement is rendered as pl/sql:
    --for each row...
    for i in 1..apex_application.g_f01.count loop
      -- and for each column in that row (number of columns is in v_col_count)
      for j in 1..v_col_count loop
        -- get the value of text item
        v_query := 'begin select apex_application.g_f0' || j || '(:i)' || ' into :x from dual; end;';
        execute immediate v_query using i, out v_value;
        -- now do some DML with v_value
      end loop;
    end loop;This works great :).
    Jure

  • Java Stored Procedure in EXECUTE IMMEDIATE

    Hi,
    I need advice for the following.
    I'm on Oracle 11g R2. I'm testing application in Oracle 11gR1 and R2 and Oracle Express.
    Purpose is to generate XML reports.
    I have PLSQL Stored Procedure which does that, but since there is bug in Oracle11gR2 related to XMLTRANSFORM I have and Java Stored Procedure which is workaround. They are both compiled, valid etc.
    Java class is :
    import java.io.PrintWriter;
    import java.io.Writer;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XMLDocument;
    import oracle.xml.parser.v2.XSLProcessor;
    import oracle.xml.parser.v2.XSLStylesheet;
    * This class is used as Java stored procedure
    * There is a bug on Oracle11gR2, related to the limitation on the number of style sheet instructions
    * This stored procedure is workaround when PLSQL code can not be used.
    * File must not have package, otherwise is wrongly compiled in DB
    public class JavaXslt {
         public static void XMLTtransform(oracle.sql.CLOB xmlInput,oracle.sql.CLOB xslInput,oracle.sql.CLOB output) throws Exception{
              DOMParser parser;
              XMLDocument xml;
              XMLDocument xsldoc;
              try{
                   parser = new DOMParser();
                   parser.parse(xmlInput.getCharacterStream());
                   xml = parser.getDocument();
                   parser.parse(xslInput.getCharacterStream());
                   xsldoc = parser.getDocument();
                   XSLProcessor processor = new XSLProcessor();
                   XSLStylesheet xsl = processor.newXSLStylesheet(xsldoc);
                   Writer w = output.setCharacterStream(1L);
                   PrintWriter pw = new PrintWriter(w);
                   processor.processXSL(xsl, xml, pw);
              }catch (Exception ex){
                   throw ex;
    PROCEDURE Java_XmlTransform (xml CLOB, xslt CLOB, output CLOB) AS LANGUAGE JAVA
    NAME 'JavaXslt.XMLTtransform(oracle.sql.CLOB, oracle.sql.CLOB, oracle.sql.CLOB)';
    I'm calling Java stored procedure from PLSQL Stored procedure (if it is Oracle11gR2) like that :
    Java_Proc.Java_XmlTransform(inputXML, xslt, res);
    So till here everything works ok. XSLT as applied and output XML (res) is OK.
    But when Oracle Express is used Java is out of the question, so there is no Java stored procedure. Howewer PLSQL Stored procedure is still needed.
    So I had to put call to Java Stored procedure in EXECUTE IMMEDIATE statement in order to compile to PLSQL package.
    But when I do that :
    EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING inputXML, xslt, res;
    result value CLOB (res) has zero length...
    What am I missing? Should i set return value to Java class?
    Hope my explanations are clear though.
    Thanks

    Hi odie_63,
    Thanks for quick response.
    I didn't clearly explained.
    When using Oracle 11gR1 and Oracle Express I'm using only PLSQL Procedure.
    When using Oracle 11gR2 i have to use Java Stored procedure because there is documented bug in R2.
    That's why i have to use EXECUTE IMMEDIATE. I don't know which version is the client DB and whether there is or no Java procedures.
    I did tried
    EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, OUT res; and the result was ORA-06537: OUT bind variable bound to an IN position
    When using IN OUT for last parameter i.e.
    EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, IN OUT res;
    there is no exception, but still DBMS_LOB.getlength(res) = 0
    Thanks

Maybe you are looking for

  • A security question pertaining to disabling the root login. [SOLVED]

    I've recently been configuring sudo and came across the following piece of advice: https://wiki.archlinux.org/index.php/Su … root_login After making my normal user a full fledged sudoer I followed the advice in the link above. passwd -l root worked b

  • ITunes 11: Can't remove Genres column in playlist List View

    In previous versions, when playing playlists, I use List View, displaying only Artists and Albums. In iTunes 11, I'm unable to remove the Genres column; the items in View > Column Browser are grayed out. Also, ⌘-L (Go to Current Song) doesn't work.

  • Regarding performance tuning for BSEG & BKPF table data fetch

    Hi Friends:    Plz see the below select queries. This is really impacting the performance of my report. Plz suggest the steps to increase the performance of the report.Points will be rewarded. Thanks: FORM GET_DATA . Selecting the Document number fro

  • Transfer of values from one application to other

    hi, Can i update second plng application members from first application's default.lgf file. Can i anyone give simple example on before range & after range options? thanks,

  • Email subject filter

    I'm having trouble getting the email subject filter to work.  I am currently using redirector on my work laptop to push email to my Blackberry handset.  I am trying to build a subject filter that looks for one word in the subject line and does not fo