Error in pl/sql  block with parameters

Hi,
I have the following code which works in normal cursor forloops,
Can some one please check how to achive the same functionality using bulk insert.( i want to use parameterised cursor)
step 1 ---working
declare
CURSOR DEPT_inst
is
select d.deptno
from dept d where d.dname='RESEARCH';
CURSOR emp_inst (p_dept in number)
         IS
     SELECT e.empno ,
            e.ename  ,
            e.deptno
       from emp1 e
      where e.deptno = p_dept;
begin
for i in dept_inst loop
   delete from emp2 where deptno=i.deptno;
   for j in emp_inst(i.deptno) loop
      INSERT INTO emp2(empno,
                           ename,
                           deptno )
                   VALUES (j.empno,
                           j.ename,
                          j.deptno
end loop;
end loop;
commit;
exception
when others then
dbms_output.put_line( 'exception in err insert'||SQLERRM);
ROLLBACK;
end;
step - 2  compilation error
declare
CURSOR DEPT_inst
is
select d.deptno
from dept d where dname='RESEARCH';
CURSOR emp_inst (p_dept in number)
         IS
     SELECT e.empno ,
            e.ename  ,
            e.deptno
       from emp1 e
      where e.dept = p_dept;
TYPE id_tab_dep_1 IS TABLE OF dept_inst%ROWTYPE
            INDEX BY PLS_INTEGER;
     t_id_dep_1       id_tab_dep_1;
    TYPE id_tab_det_1 IS TABLE OF emp_inst(t_id_det_1(indxi).deptno)%ROWTYPE
            INDEX BY PLS_INTEGER;
     t_id_det_1       id_tab_det_1;
       BEGIN
         OPEN dept_inst;
           FETCH dept_inst
           LOOP
           BULK COLLECT into t_id_dep_1 LIMIT 100;
           EXIT WHEN t_id_dep_1.count <= 0;
         FOR indxi IN t_id_det_1.FIRST  .. t_id_det_1.LAST LOOP
               delete from emp2 where deptno=t_id_det_1(indxi).deptno;
         OPEN emp_inst;
         LOOP
         FETCH emp_inst(t_id_det_1(indxi).deptno)
             BULK COLLECT INTO t_id_det_1  limit 100;
             EXIT WHEN t_id_det_1.count <= 0;
         FOR indxj IN t_id_det_1.FIRST  .. t_id_det_1.LAST LOOP
                 INSERT INTO emp2(empno,
                           ename,
                           deptno )
                   VALUES (t_id_det_1(indxj).empno,
                           t_id_det_1(indxj).ename,
                          t_id_det_1(indxj).deptno
          END LOOP;
          END LOOP;
          CLOSE emp_inst;
          END LOOP;
          END LOOP;
          CLOSE dept_inst;
        EXCEPTION
               WHEN OTHERS
               THEN
                  dbms_output.put_line( 'exception in err insert' || SQLCODE ||' ' ||SQLERRM);
                  ROLLBACK;
                  RETURN;
        END;
I am getting below error
    TYPE id_tab_det_1 IS TABLE OF emp_inst(t_id_det_1(indxi).deptno)%ROWTYPE
ERROR at line 16:
ORA-06550: line 16, column 69:
PLS-00103: Encountered the symbol "%" when expecting one of the following:
; not null alter index characterEdited by: user11289444 on Dec 26, 2010 3:58 AM

hoek wrote:
I was referring to OP's second Bulk DML, the insert part.
You cannot reference individual columns there.Then you have to be even more specific. You cannot reference individual columns there unless you are on 11g:
SQL> select * from v$version
  2  /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> declare
  2    cursor dept_inst
  3    is
  4    select d.deptno
  5    from   dept d
  6    where  d.dname = 'RESEARCH';
  7    --
  8    cursor emp_inst(b_deptno in number)
  9    is
10    select e.empno
11    ,      e.ename
12    ,      e.deptno
13    from   emp1 e
14    where  e.deptno = b_deptno;
15    --
16    type depttype is table of number index by binary_integer;
17    depttab depttype;
18    type emptype is table of emp_inst%rowtype /*this will not work*/ index by binary_integer;
19    emptab emptype;
20    --
21  begin
22    --
23    open dept_inst;
24    loop
25     
26      fetch dept_inst bulk collect into depttab limit 100;
27      forall i in depttab.first..depttab.last
28        delete from emp2 where deptno = depttab(i);
29         --
30        dbms_output.put_line(sql%rowcount||' records were deleted from table emp2');
31        --
32  --      open emp_inst(depttab(i));
33        open emp_inst(depttab(1));
34        loop
35          fetch emp_inst bulk collect into emptab limit 100;
36          forall j in emptab.first..emptab.last
37            insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
38          --
39          exit when emp_inst%notfound;
40          --
41        end loop;
42        exit when dept_inst%notfound;
43        close dept_inst;         
44      --
45    end loop;
46    close dept_inst;
47  end;
48  /
          insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
ERROR at line 37:
ORA-06550: line 37, column 35:
PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
table of records
ORA-06550: line 37, column 35:
PLS-00382: expression is of wrong type
ORA-06550: line 37, column 51:
PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
table of records
ORA-06550: line 37, column 51:
PLS-00382: expression is of wrong type
ORA-06550: line 37, column 67:
PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
table of records
ORA-06550: line 37, column 67:
PLS-00382: expression is of wrong type
ORA-06550: line 37, column 35:
PL/SQL: ORA-22806: not an object or REF
ORA-06550: line 37, column 11:
PL/SQL: SQL Statement ignored
SQL> select * from v$version
  2  /
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> declare
  2    cursor dept_inst
  3    is
  4    select d.deptno
  5    from   dept d
  6    where  d.dname = 'RESEARCH';
  7    --
  8    cursor emp_inst(b_deptno in number)
  9    is
10    select e.empno
11    ,      e.ename
12    ,      e.deptno
13    from   emp1 e
14    where  e.deptno = b_deptno;
15    --
16    type depttype is table of number index by binary_integer;
17    depttab depttype;
18    type emptype is table of emp_inst%rowtype /*this will not work*/ index by binary_integer;
19    emptab emptype;
20    --
21  begin
22    --
23    open dept_inst;
24    loop
25     
26      fetch dept_inst bulk collect into depttab limit 100;
27      forall i in depttab.first..depttab.last
28        delete from emp2 where deptno = depttab(i);
29         --
30        dbms_output.put_line(sql%rowcount||' records were deleted from table emp2');
31        --
32  --      open emp_inst(depttab(i));
33        open emp_inst(depttab(1));
34        loop
35          fetch emp_inst bulk collect into emptab limit 100;
36          forall j in emptab.first..emptab.last
37            insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
38          --
39          exit when emp_inst%notfound;
40          --
41        end loop;
42        exit when dept_inst%notfound;
43        close dept_inst;         
44      --
45    end loop;
46    close dept_inst;
47  end;
48  /
PL/SQL procedure successfully completed.
SQL> SY.

Similar Messages

  • Cell Offload will Happen for pl/sql Block with variables

    Hello Experts,
    i am working on procedures on exadata now. i was confused with cell offload in exadata. somehow offload is not happening when i ran the sql statement in in pl/sql block with variables.
    here are my findings.
    when i ran insert into from select with values at toad, my query response time is very good. the total process is completed in less than a minute.
    i checked offload is happening.
    same sql statement is placed in plsql block with variable, procedure is taking lot of time and it is not completing. this case offload is not happening.
    is it true, if i use variables in pl/sql block will not use cell offload and smart scan?
    if yes, what is the work around.
    Thanks
    #! Pavan

    Hello Marc,
    Thanks for quick response.
    when i ran the query with literals in toad session i am getting response.
    when i run it with pl/sql block , block is not completing at all.
    here is the plsql block:
    My Apologies for sending big code,with out proper format.
    DECLARE
    P_BUSINESS_DATE DATE;
    P_BATCH_ID NUMBER;
    UTC_OFFSET NUMBER;
    BEGIN
    P_BUSINESS_DATE := to_date('02/01/2012', 'MM/DD/YYYY');
    P_BATCH_ID := 1;
    UTC_OFFSET := 0;
    INSERT /*+ APPEND */ INTO UPL_CLIENT_tbl
    ( reportdate,
    LastName,
    FirstName,
    MiddleInitial,
    AccountNumber,
    Address,
    City,
    State,
    Zip,
    HomePhone,
    WorkPhone,
    BirthDate,
    Age,
    Sex,
    NumberOfChildren,
    Occupation,
    LeadSource,
    Consultant,
    ProgramDirector,
    CallTaker,
    LeadDate,
    FirstVisitDate,
    LastVisitDate,
    BillType,
    ClientType,
    PreviousClientType,
    AppointmentDate,
    DoctorLetterRequired,
    OneYearPermStabilizationDate,
    UnlimitedPermStabilizationDate,
    MaritalStatus,
    ReferrerName,
    ReferrerCentreID,
    CentreID,
    PaymentDateOne,
    PaymentAmountOne,
    PaymentDateTwo,
    PaymentAmountTwo,
    PaymentDateThree,
    PaymentAmountThree,
    PaymentDateFour,
    PaymentAmountFour,
    LibraryPurchased,
    BalanceDue,
    FoodNSFBalance,
    ProductNSFBalance,
    ProgramNSFBalance,
    StartWeight,
    CurrentWeight,
    GoalWeight,
    Height,
    DateGoalWeightAchieved,
    DateSuccessPlusPurchased,
    ReturnToActiveDate,
    VersionNumber,
    HalfWayDate,
    LastLSCDate,
    LastUpdatedDate,
    VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    DiabetesClient,
    DietControlled,
    TakingOralMed,
    TakingInsulin,
    EmailId,
    CTADate,
    RWLDate,
    Address2)
    (SELECT /*+ full(S_CONTACT) full(REFERRER) full(Consultant) full(ProgramDirector) full(CallTaker) full(S_CONTACT_X) full(a) full(a2) full (a3) */ distinct p_business_date reportdate,
    SUBSTR(S_CONTACT.LAST_NAME,1,25) AS LastName,
    SUBSTR(S_CONTACT.FST_NAME,1,25) AS FirstName,
    SUBSTR(S_CONTACT.MID_NAME,1,1) AS MiddleInitial,
    S_CONTACT.X_JC_ACNT_NUM + 900000000 AS AccountNumber,
    SUBSTR(S_ADDR_PER.ADDR,1,40) AS ADDRESS,
    SUBSTR(S_ADDR_PER.CITY,1,20) AS City,
    S_ADDR_PER.STATE AS State,
    SUBSTR(S_ADDR_PER.ZIPCODE,1,15) AS Zip,
    SUBSTR(REPLACE(S_CONTACT.HOME_PH_NUM,'-',''),1,10) AS HomePhone,
    SUBSTR(REPLACE(S_CONTACT.WORK_PH_NUM,'-',''),1,10) AS WorkPhone,
    S_CONTACT.BIRTH_DT AS BirthDate,
    CASE WHEN FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) < 0 THEN NULL ELSE FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) END AS AGE,
    S_CONTACT.SEX_MF AS SEX,
    NULL AS NumberOfChildren,
    S_CONTACT_X.ATTRIB_34 AS OCCUPATION,
    CASE WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Othe' THEN 'Othr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Inte' THEN 'Intr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Prin' THEN 'News'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Gues' THEN 'Gst'
    ELSE SUBSTR(S_CONTACT_X.ATTRIB_37,1,4) END AS LeadSource,
    SUBSTR(Consultant.EMP_NUM,1,10) AS CONSULTANT,
    ProgramDirector.EMP_NUM AS ProgramDirector,
    CallTaker.EMP_NUM CallTaker,
    S_CONTACT.X_LEAD_DT AS LeadDate,
    LEAST(nvl(S_CONTACT.X_LAST_CONSULTATION_DATE,O.FirstPurchaseDate ), nvl(O.FirstPurchaseDate,S_CONTACT.X_LAST_CONSULTATION_DATE+1) ) AS FirstVisitDate, --X_LAST_CONSULTATION_DATE stores the performed date or the legacy client firstvisitdate
    GREATEST(nvl(S_CONTACT_XM.X_CONSULTATION_DT ,S_CONTACT_X.ATTRIB_29), nvl(S_CONTACT_X.ATTRIB_29, S_CONTACT_XM.X_CONSULTATION_DT-1) ) AS LastVisitDate,
    CASE WHEN S_CONTACT.X_INSTALLMENT_BALANCE > 0 THEN 'B' ELSE NULL END AS BillType,
    ct.current_client_type ClientType,
    SUBSTR(ct.saved_client_type,1,1) PreviousClientType,
    S_CONTACT.LAST_CREDIT_DT AS AppointmentDate,
    CASE WHEN a.X_DR_LETTER_STATUS IS NOT NULL THEN 'Y' ELSE 'N' END AS DoctorLetterRequired,
    NULL AS OneYearPermStabilizationDate,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT ,NULL) AS UnlimitedPermStabilizationDate,
    SUBSTR(S_CONTACT.MARITAL_STAT_CD,1,1) AS MaritalStatus,
    SUBSTR(REFERRER.FST_NAME ||' '|| REFERRER.LAST_NAME,1,34) AS ReferrerName,
    ORGEXT_REF.LOC AS ReferrerCentreID,
    S_ORG_EXT.LOC AS CentreID,
    NULL AS PaymentDateOne,
    NULL AS PaymentAmountOne,
    NULL AS PaymentDateTwo,
    NULL AS PaymentAmountTwo,
    NULL AS PaymentDateThree,
    NULL AS PaymentAmountThree,
    NULL AS PaymentDateFour,
    NULL AS PaymentAmountFour,
    NULL AS LibraryPurchased,
    nvl(S_CONTACT.X_INSTALLMENT_BALANCE,0) + nvl(S_CONTACT.X_PREPAID_BALANCE,0) AS BalanceDue, -- Changed operation from (-) prepaid to (+) prepaid since the sign was flipped in OLTP.
    NULL AS FoodNSFBalance,
    NULL AS ProductNSFBalance,
    NULL AS ProgramNSFBalance,
    a2.X_START_WEIGHT AS StartWeight,
    a2.X_CURRENT_WEIGHT AS CurrentWeight,
    a2.X_GOAL_WEIGHT AS GoalWeight,
    a3.X_HEIGHT AS Height,
    a2.X_FAXSENT_DATETIME DateGoalWeightAchieved,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT,NULL) AS DateSuccessPlusPurchased,
    CASE WHEN A2.ARCHIVE_FLG = 'N' THEN a2.START_DT ELSE NULL END AS ReturnToActiveDate,
    600 VersionNumber,
    a2.X_FAXRECV_DATETIME AS HalfWayDate,
    NULL AS LastLSCDate,
    TRUNC(S_CONTACT.LAST_UPD-UTC_OFFSET/24) AS LastUpdatedDate,
    NULL AS VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    CASE WHEN (a.X_DIABETES_NO_MEDS_FLG='Y' OR a.X_DIABETES_ORAL_MEDS_FLG = 'Y' OR a.X_DIABETES_ON_INSULIN_FLG = 'Y') THEN 'Y' ELSE 'N' END AS DiabetesClient,
    DECODE(a.X_DIABETES_NO_MEDS_FLG,'Y','Y','N') AS DietControlled,
    a.X_DIABETES_ORAL_MEDS_FLG AS TakingOralMed,
    a.X_DIABETES_ON_INSULIN_FLG AS TakingInsulin,
    S_CONTACT.EMAIL_ADDR AS EmailId,
    NULL CTADATE,
    NULL RWLDATE,
    SUBSTR(S_ADDR_PER.ADDR_LINE_2,1,40) AS Address2
    FROM S_CONTACT,
    S_CONTACT REFERRER,
    S_CONTACT Consultant,
    S_CONTACT ProgramDirector,
    S_CONTACT CallTaker,
    S_CONTACT_X,
    (SELECT /*+ parallel full(S_CONTACT_XM) */ PAR_ROW_ID, attrib_05, MAX(X_CONSULTATION_DT) AS X_CONSULTATION_DT FROM S_CONTACT_XM
    WHERE (S_CONTACT_XM.last_upd_by < '1-14WD'
    or S_CONTACT_XM.last_upd_by > '1-14WD')
    AND S_CONTACT_XM.ATTRIB_05 IN (SELECT row_id FROM S_ORG_EXT WHERE S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) LOC IN (SELECT centreid FROM UPL_LIVE_CENTRES WHERE LIVE = 'Y' AND BATCHID = p_batch_id)) where S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) --
    GROUP BY PAR_ROW_ID, attrib_05) S_CONTACT_XM,
    (SELECT CONTACT_ID, ACCNT_ID,
    MAX(LastSupplementPurchaseDate) AS LastSupplementPurchaseDate,
    MAX(LastSupplementCodePurchased) AS LastSupplementCodePurchased,
    MAX(LastTotalSupplementSupplyCycle) AS LastTotalSupplementSupplyCycle,
    MAX(LastAddtlSupplPurchaseDate) AS LastAddtlSupplPurchaseDate,
    MAX(LastAddtlSupplCodePurchased) AS LastAddtlSupplCodePurchased,
    MAX(LastAddtlSupplSupplyCycle) AS LastAddtlSupplSupplyCycle,
    MIN(FirstPurchaseDate) AS FirstPurchaseDate,
    MAX(LastPurchaseDate) AS LastPurchaseDate
              FROM (
              SELECT /*+ parallel full(S_ORDER) full(S_ORDER_XM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
    NULL AS LastSupplementPurchaseDate,
    NULL AS LastSupplementCodePurchased,
    NULL AS LastTotalSupplementSupplyCycle,
    NULL AS LastAddtlSupplPurchaseDate,
    NULL AS LastAddtlSupplCodePurchased,
    NULL AS LastAddtlSupplSupplyCycle,
    (S_ORDER_XM.X_BUSINESS_DATE) FirstPurchaseDate,
    (S_ORDER_XM.X_BUSINESS_DATE) LastPurchaseDate
              FROM S_ORDER,S_ORDER_XM
              WHERE S_ORDER.ROW_ID = S_ORDER_XM.PAR_ROW_ID
              AND S_ORDER.STATUS_CD IN ('Complete', 'Submitted', 'Ready')
              AND TRUNC(S_ORDER_XM.X_BUSINESS_DATE - UTC_OFFSET/24) <= (p_business_date)
              --GROUP BY S_ORDER.CONTACT_ID
              UNION ALL
              SELECT /*+ parallel full(S_ORDER) full (S_ORDER_ITEM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN S_ORDER.CREATED ELSE NULL END) AS LastSupplementPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 931 ELSE NULL END) AS LastSupplementCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 7 ELSE NULL END) AS LastTotalSupplementSupplyCycle,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN S_ORDER.CREATED ELSE NULL END) AS LastAddtlSupplPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 920 ELSE NULL END) AS LastAddtlSupplCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 28 ELSE NULL END) AS LastAddtlSupplSupplyCycle,
              NULL FirstPurchaseDate,
              NULL LastPurchaseDate
              FROM S_ORDER,S_ORDER_ITEM, S_PROD_INT
              WHERE S_ORDER_ITEM.PROD_ID = S_PROD_INT.ROW_ID
                   AND S_ORDER.ROW_ID = S_ORDER_ITEM.ORDER_ID
                   AND S_ORDER_ITEM.qty_req <> 0
                   AND s_order.created_by <> '1-14WD'
                   AND S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   AND (S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   OR EXISTS (select 1 from S_ORDER_ITEM i2,s_prod_int p
    where i2.row_id = S_ORDER_ITEM.PAR_ORDER_ITEM_ID
    and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    and i2.prod_id = p.row_id
                   AND S_ORDER.status_cd in ('Complete', 'Submitted', 'Ready')
                   and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    GROUP BY CONTACT_ID,ACCNT_ID) O,
    S_CONTACT_TNTX,
    S_ORG_EXT,
    S_ORG_EXT ORGEXT_REF,
    S_ADDR_PER,
    S_ASSET a,
    S_PROD_INT,
    S_ASSET a2,
    S_ASSET a3,
    UPL_CLIENT_TYPES ct,
    (select /*+ parallel */ o.contact_id, o.accnt_id
    from S_ORDER o, S_ORDER_XM oxm
    where o.row_id = oxm.par_row_id
    and trunc(oxm.X_BUSINESS_DATE - (UTC_OFFSET/24)) = trunc(p_business_date)
    group by o.contact_id, o.accnt_id) oxm2
    WHERE S_CONTACT.ROW_ID = S_CONTACT_X.PAR_ROW_ID
    AND S_CONTACT_X.ROW_ID = S_CONTACT_XM.PAR_ROW_ID (+)
    AND (S_ORG_EXT.ROW_ID = S_CONTACT.PR_DEPT_OU_ID
    OR S_ORG_EXT.ROW_ID = oxm2.accnt_id
    OR S_ORG_EXT.ROW_ID = S_CONTACT_XM.attrib_05)
    AND ORGEXT_REF.ROW_ID(+) = REFERRER.PR_DEPT_OU_ID
    AND S_CONTACT.CON_ASST_PER_ID = Consultant.ROW_ID
    AND S_ORG_EXT.X_DIRECTOR_ID = ProgramDirector.ROW_ID (+)
    AND S_CONTACT.CREATED_BY = CallTaker.ROW_ID
    AND S_CONTACT.ROW_ID = a.PR_CON_ID (+)
    AND S_CONTACT.PR_PER_ADDR_ID = S_ADDR_PER.ROW_ID (+)
    AND S_CONTACT_TNTX.PAR_ROW_ID (+) = S_CONTACT.ROW_ID
    AND REFERRER.ROW_ID(+) = S_CONTACT_TNTX.REFERRED_BY_ID
    AND a.PROD_ID = S_PROD_INT.ROW_ID (+)
    AND O.CONTACT_ID (+) = S_CONTACT.ROW_ID
    AND a.STATUS_CD (+) = 'Active'
    AND a.TYPE_CD (+) ='Program'
    AND S_CONTACT.ROW_ID = a2.PR_CON_ID (+)
    AND a2.STATUS_CD (+) = 'Active'
    AND a2.TYPE_CD (+) = 'Lifecycle'
    AND a3.PR_CON_ID(+) = S_CONTACT.ROW_ID
    AND a3.STATUS_CD (+) = 'Active'
    AND a3.TYPE_CD (+) = 'HealthSheet'
    AND S_CONTACT.X_JC_ACNT_NUM = ct.CLIENT_NUMBER (+)
    --AND S_ORG_EXT.LOC NOT LIKE 'F%'
    AND S_ORG_EXT.ACCNT_TYPE_CD NOT IN 'Division'
    --AND S_ORG_EXT.Loc in (select to_char(centreid) from UPL_LIVE_CENTRES where LIVE = 'Y')
    AND (trunc(S_CONTACT.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) or trunc(S_CONTACT_X.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) OR (S_CONTACT_XM.X_CONSULTATION_DT = p_business_date) OR oxm2.CONTACT_ID IS NOT NULL)
    AND S_CONTACT.last_upd_by not in ('1-14WD')
    AND oxm2.CONTACT_ID (+) = o.CONTACT_ID
    AND S_ORG_EXT.LOC <> 'CW_846'
    AND (a.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a.pr_accnt_id is null)
    AND (a2.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a2.pr_accnt_id is null)
    AND (a3.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a3.pr_accnt_id is null));
    rollback;
    END;
    --------------------------------------------------------------------------------------------------

  • Tune the PL/SQL block with SQL_ID

    Hi There,
    I have found some recommendation in ADDM report as follows.
    "" Action
    Tune the PL/SQL block with SQL_ID "48trcns4mx5bk". Refer to the "Tuning
    PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide and
    Reference".
    Related Object ""
    can any one let me how to Tune the PL/SQL block with SQL_ID?
    looking forward.
    Db: 11.1.0.7
    OS: OracleLinux5-86*64
    Regards,
    Mohsin

    Hi,
    you can't tune a PL/SQL block directly. Instead, you'll need to profile it first (i.e. see how much time SQL statements inside it consume) using dbms_profiler or some other tool. If you find that the problem is that some SQL is called too frequently because of flawed PL/SQL logic, then you'll need to address that. Otherwise, you'll need to take the top time consuming statement(s) and tune it (them).
    Best regards,
    Nikolay

  • Error executing pl sql block

    Hii All,
    I'm facing the following error
    ERROR at line 66:
    ORA-06550: line 66, column 20:
    PLS-00306: wrong number or types of arguments in call to '||'
    ORA-06550: line 66, column 11:
    PL/SQL: Statement ignoredVersion Details
    SQL> select * from v$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 Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionMy pl sql block
    Declare
        p_table_name  clob := 'CP_CA_DTLS' ;
        Type t_column_name_tab is table of varchar2(4000)
        index by binary_integer;
        l_table_tab      t_column_name_tab;
        l_file_name constant varchar2(5000) := 'column_counts';
        l_count      number;
        l_tab_count    number;
        l_str    varchar2(32000);
        l_tbl_str  varchar2(32000);
      Cursor c_table_columns(c_table_name user_tables.table_name%type)
      Is
        Select  column_name
        from  user_tab_cols
        where  table_name = upper(c_table_name);
      Type t_table_columns is table of c_table_columns%rowtype;
       l_column_name_tab  t_table_columns;
    Begin
        --Splitting comma seperated data
        Select  regexp_substr(p_table_name,'[^,]+{1}',1,level)
        bulk collect into  l_table_tab
        from  dual
        connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
        for k in 1..l_table_tab.count
        loop
         -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');   
          Begin
              l_tbl_str := 'Select count(*) from '||l_table_tab(k);
              execute immediate l_tbl_str into l_tab_count;
            --  dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_count);   
          End;
       -- dbg_print(l_file_name,'Column Name '||','||'Count'); 
        Open c_table_columns(l_table_tab(k));
        loop
          Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
          exit when l_column_name_tab.count = 0;
          dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
            for i in 1..l_column_name_tab.count
            loop
            Begin
              l_str := 'Select count(*) ' ;
              l_str := l_str||' from  '||l_table_tab(k) ;
              l_str := l_str||' where '||l_column_name_tab(i);
              l_str := l_str||' is null'  ;
              Execute Immediate l_str into l_count;
            End;
            --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
            end loop;
        end loop;
        Close c_table_columns;
      end loop;
          dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    End;Even I'm not able to print l_column_name_tab(i) using dbms_output.
    (Later I came to know that this information can be achieved using user_tab_col_statistics table)
    But would like to know whats wrong with my code.???
    Plz help me .
    Edited by: 792353 on Dec 3, 2010 1:26 AM

    Hii RDB,
    when I comment this part of code
      --   l_str := l_str||' where '||l_column_name_tab(i);
           --   l_str := l_str||' is null'  ;
    SQL> Declare
      2 
      3 
      4      p_table_name  clob := 'CP_CA_DTLS' ;
      5 
      6      Type t_column_name_tab is table of varchar2(4000)
      7      index by binary_integer;
      8     
      9      l_table_tab      t_column_name_tab;
    10    
    11 
    12 
    13 
    14      l_file_name constant varchar2(5000) := 'column_counts';
    15      l_count      number;
    16      l_tab_count    number;
    17      l_str    varchar2(32000);
    18      l_tbl_str  varchar2(32000);
    19   
    20    Cursor c_table_columns(c_table_name user_tables.table_name%type)
    21    Is
    22      Select  column_name
    23      from  user_tab_cols
    24      where  table_name = upper(c_table_name);
    25     
    26     
    27    Type t_table_columns is table of c_table_columns%rowtype;
    28   
    29   
    30     l_column_name_tab  t_table_columns;
    31   
    32  Begin
    33      --Splitting comma seperated data
    34     
    35      Select  regexp_substr(p_table_name,'[^,]+{1}',1,level)
    36      bulk collect into  l_table_tab
    37      from  dual
    38      connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
    39     
    40      for k in 1..l_table_tab.count
    41      loop
    42       -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');   
    43       
    44        Begin
    45            l_tbl_str := 'Select count(*) from '||l_table_tab(k);
    46       
    47            execute immediate l_tbl_str into l_tab_count;
    48       
    49          --  dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_coun
    t);   
    50 
    51        End;
    52 
    53     -- dbg_print(l_file_name,'Column Name '||','||'Count'); 
    54 
    55      Open c_table_columns(l_table_tab(k));
    56      loop
    57        Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
    58        exit when l_column_name_tab.count = 0;
    59        dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    60          for i in 1..l_column_name_tab.count
    61          loop
    62          
    63          Begin
    64            l_str := 'Select count(*) ' ;
    65            l_str := l_str||' from  '||l_table_tab(k) ;
    66         --   l_str := l_str||' where '||l_column_name_tab(i);
    67         --   l_str := l_str||' is null'  ;
    68         
    69            Execute Immediate l_str into l_count;
    70 
    71          End;
    72         
    73          --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
    74       
    75          end loop;
    76      end loop;
    77      Close c_table_columns;
    78    end loop;
    79 
    80        dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    81  End;
    82  /
    PL/SQL procedure successfully completed.its running fine so the problem is l_column_name_tab(i) !!!!!!
    and there is nothing wrong with l_table_tab(k) and its declaration.
    Edited by: 792353 on Dec 3, 2010 2:17 AM

  • Creating a PL/SQL-Block with Boolean-Return and Check

    Hello folks,
    I have some kind of tricky problem. Actually, I want to integrate a small Task-System on my Apex 2.2 installation. Every task is intended to have a field with a anonymous PL/SQL-block in the shape of:
    Declare
    Begin
    return true/false;
    End;
    It is comparable to the condition-PL/SQL-block you can set for almost ev'ry item.
    It's not the problem to write this block half-automated, but how do I check it? Is there any kind of Database-Function?
    Thanks for your replies.
    Matthias.

    I believe Struct is basically used for SQL types , and your 'T_NACHRICHT' is a type of Objects so please pass the objects array to STRUCT.
    For example if type is :
    CREATE OR REPLACE TYPE T_NACHRICHT AS OBJECT
    ID_Nachricht NUMBER,
    ID_Vorgang NUMBER,
    --datum                 TIMESTAMP(6),
    Betreff VARCHAR2(400),
    -- Nachricht CLOB,
    ID_Antwort NUMBER,
    ist_neu VARCHAR2(5),
    CONSTRUCTOR FUNCTION T_NACHRICHT(
    p_ID_Vorgang NUMBER,
    p_Betreff VARCHAR2) RETURN SELF AS RESULT
    then call the struct in below way:
    STRUCT nachrichtSTRUCT = null;
    StructDescriptor structDesc = StructDescriptor.createDescriptor("T_NACHRICHT", conn);
              Object [] obj = {123456,123456,"ABC",123456,"ABCD"};
    nachrichtSTRUCT = new STRUCT(structDesc, conn, obj);

  • Can't create a sequence within a pl/sql block with execute immediate.

    Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
    Thanks,
    Mark

    In a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
    There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
    Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
    You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
    And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
    Justin

  • Exception error  in PL/SQL block

    Hi,
    do the following conditions in a PL/SQL block cause an exception error to occur ?
    A- Select statement does not return a row.
    B- Select statement returns more than one row.
    Thank you.

    If you're talking about SELECT INTO then yes:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as cmza
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_text varchar2(4000);
      3  begin
      4    -- question 1
      5    select banner
      6      into v_text
      7      from v$version;
      8  end;
      9  /
    declare
      v_text varchar2(4000);
    begin
      -- question 1
      select banner
        into v_text
        from v$version;
    end;
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at line 6
    SQL> declare
      2    v_text varchar2(4000);
      3  begin
      4    -- question 2
      5    select banner
      6      into v_text
      7      from v$version
      8     where 1 = 2;
      9  end;
    10  /
    declare
      v_text varchar2(4000);
    begin
      -- question 2
      select banner
        into v_text
        from v$version
       where 1 = 2;
    end;
    ORA-01403: no data found
    ORA-06512: at line 6
    SQL>

  • Error in PL/SQL Block of Trigger

    Hi all,
    I have written a trigger whose PL/SQL block contains a simple select statment among many other statements.
    Now I find that, if the select statement returns no rows the trigger does not continue its operation further and aborts there itself. And if the select statement returns some rows, then it works fine.
    I tried to execute a simplified PL/SQL block of the trigger in SQL*Plus and following were the results:
    declare
    tempdate date;
    begin
    select trdt into tempdate from inv_trans;
    if sql%notfound then
    null;
    end if;
    end;
    When no data is present in inv_trans table, the result was:
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 4
    And when the table inv_trans had data, the result was:
    PL/SQL procedure successfully completed.
    Why is the piece of code flashing an error when I have already given a treatment if no data is found.
    Why is it taking "No Data in table" as an abnormal condition and not normal?
    THanks in advance
    Warm Regards
    Manu

    In your case you have to use a cursor:
    declare
      cursor c_cur is
        select trdt from inv_trans;
      r_cur   c_cur%rowtype;
    begin
      open c_cur;
      fetch c_cur into r_cur;
      if c_cur%notfound then
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • PL/SQL Block with Cursor

    I was trying to create a PL/SQL block where I am trying to call all the SQL Plans and then drop them one by one. Here is how I am doung -
    SET SERVEROUT ON;
    DECLARE
    EXECSTR VARCHAR2(50);
    v_plans_dropped pls_integer;
    CURSOR C1 IS SELECT SQL_HANDLE FROM DBA_SQL_PLAN_BASELINES;
    BEGIN
    FOR I IN C1 LOOP
    EXECSTR := ''''||I.SQL_HANDLE||'''';
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>EXECSTR);
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR while dropping SQL PLAN: ' || SQLCODE || ' : ' || SQLERRM);
    END;
    This is giving me error like - ERROR while dropping SQL PLAN: -38131 : ORA-38131: specified SQL handle
    'SYS_SQL_1470897e7b72c982' does not exist
    Whereas this SQL Plan is there in the baseline - SELECT sql_handle FROM dba_sql_plan_baselines;
    SQL_HANDLE
    SYS_SQL_1470897e7b72c982
    SYS_SQL_75ac336a8071cb06
    SYS_SQL_269cdcd4862f8685
    SYS_SQL_269cdcd4862f8685
    SYS_SQL_0ffdb3bddbe422e2
    SYS_SQL_14d81bbae4a7cc93
    SYS_SQL_5c512b58e7795ba2
    SYS_SQL_33515785e80b75d0
    Above PL/SQL block should be same as like deleting it one by one -
    DECLARE
    v_plans_dropped pls_integer;
    BEGIN
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>'SYS_SQL_1470897e7b72c982');
    END;
    If I run this then it will be sucessul but when I run under a PL/SQL block using cursor then it is giving me error ORA-38131.
    Can you please tell me where I am going wrong here.
    Thanks for your time!

    I have this PL/SQL block -
    DECLARE
    v_plans_dropped pls_integer;
    CURSOR C1 IS SELECT SQL_HANDLE FROM DBA_SQL_PLAN_BASELINES;
    BEGIN
    FOR I IN C1 LOOP
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>I.SQL_HANDLE);
    END LOOP;
    END;
    Requirement - This PL/SQL block should read all the records from DBA_SQL_PLAN_BASELINES table and drop all the plans one by one.
    Problem - It gives me error like this -
    SQL> 2 3 4 5 6 7 8 9 DECLARE
    ERROR at line 1:
    ORA-38131: specified SQL handle SYS_SQL_45c1170505dda9a9 does not exist
    ORA-06512: at "SYS.DBMS_SPM", line 2444
    ORA-06512: at line 6
    Analysis: When I ran it 4 times, it showed me that the remaining records after the pl/sql run was like -
    SQL> SELECT COUNT(*) FROM DBA_SQL_PLAN_BASELINES;
    After First Run -
    COUNT(*)
    33429
    After Second Run -
    COUNT(*)
    33255
    After Third Run -
    COUNT(*)
    33228
    After Fourth Run -
    COUNT(*)
    32988
    So, it deletes records but errors out in between. Is it because the PL/SQL block/cursor is not structured properly?
    Thanks for your advice!

  • Execute PL/SQL block with named binds from within java code?

    Hi guys,
    Is there any good way to execute my PL/SQL code, for example
    BEGIN         :x := :x+1; END;
    from my Java code? I need nothing complicated, just static code block with named binds.
    I have tried the Oracle exetnded JDBC (setXXXbyName methods):
      public static void main(String[] args){     try {     Class.forName("oracle.jdbc.driver.OracleConnection");     Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password"); String SQL="begin :x:=:x+1; end;"; OracleCallableStatement stmt; stmt=(OracleCallableStatement)conn.prepareCall(SQL); stmt.setIntAtName("x", 5); stmt.registerOutParameter("x", Types.INTEGER); stmt.execute(); System.out.println(stmt.getInt("x"));     } catch (Exception x) { x.printStackTrace();    }   }
    And get the java.sql.SQLException: operation not allowed: Ordinal binding and Named binding cannot be combined!
    Then i've tried SQLJ appoach:
      public static void main(String[] args){     try {     Class.forName("oracle.jdbc.driver.OracleConnection");     Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password");       Oracle.connect(conn);       System.out.println("Connected!");           int x=3;       #sql { BEGIN         :x := :x+1;       END; };           System.out.println("x=" + x);     } catch (Exception x) { x.printStackTrace();    }   }
    And x=3 had retuned... Although 4 expected.
    Then, I've set parameter sqlj.bind-by-identifier=true
    And result is another exception! java.sql.SQLException: Missing IN or OUT parameter at index:: 2
    Can you please mark my mistakes/point to correct solution?
    Thanks in advance,
    Alexey

    Found another solution, this time working at least...
      public void testPLSQL() {
           String dynamicSQL=
                "declare\n" +
                "  v_CursorID  INTEGER;\n" +
                "  v_BlockStr  VARCHAR2(500);\n" +
                "  v_Dummy     INTEGER;\n" +
                "  v_x         String(18);\n" +
                "BEGIN\n" +
                "  v_CursorID := DBMS_SQL.OPEN_CURSOR;\n" +
                "  v_BlockStr :=?;" +
                "  DBMS_SQL.PARSE(v_CursorID, v_BlockStr, DBMS_SQL.V7);\n" +
                "  v_x:=?;"+
                "  DBMS_SQL.BIND_VARIABLE(v_CursorID, ':x', v_x,18);\n" +
                "  v_Dummy := DBMS_SQL.EXECUTE(v_CursorID);\n" +
                "  DBMS_SQL.VARIABLE_VALUE(v_CursorID, ':x', v_x);\n" +
                "  DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
                "  ?:=v_x;"+
                "  COMMIT;\n" +
                "EXCEPTION\n" +
                "  WHEN OTHERS THEN\n" +
                "    DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
                "    RAISE;\n" +
                "END DynamicPLSQL;";
             try {
                   Class.forName("oracle.jdbc.driver.OracleConnection");
                   Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user", "password");
                   System.out.println("Profit");
         String SQL="begin :x:=:x+1; end;";
         OracleCallableStatement stmt;
         stmt=(OracleCallableStatement)conn.prepareCall(dynamicSQL);
         stmt.setString(1, SQL);
         int x=3;
         stmt.setInt(2, x);
         stmt.registerOutParameter(3,     Types.INTEGER);
         stmt.execute();
         x=stmt.getInt(3);
         System.out.println(x);
         assertEquals(4, x);
             } catch (Exception ex) {
                  ex.printStackTrace();
                  assertTrue(false);
      }Now the only thing I need is to code some kind of preprocessor of SQL block, to prepare the dynamicSQL lair for SQL critter...
    Please please please show me something less complicated! :8}

  • FRM-92101 Error by calling the form with parameters

    Hi All!
    After the migration Oracle Forms from version 6i to 10g by calling the form with parameters the error FRM-92101 occurs. In Application Server log shows the following:
    08/12/01 10:26:20 formsweb: Forms session <5> aborted: unable to communicate with runtime process.
    08/12/01 10:26:20 formsweb: Forms session <5> exception stack trace:
    java.io.IOException: FRM-93000: Unexpected internal error.
    Details : No HTTP headers received from runform
    at oracle.forms.servlet.ListenerServlet.forwardResponseFromRunform(Unknown Source)
    at oracle.forms.servlet.ListenerServlet.doPost(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    System: Oracle Application Server 10.1.2.0.2 with Red Hat Enterprise Linux Release 4. Client PC: Windows XP SP3 and Internet Explorer 7.
    Please help me if anybody has this problem before.
    Sergey

    Hi Sergei,
    I've just finished a three day search for a FRM-92101problem, so I want to post my case, just in case it helps someone.
    My case is similar to yours, in that you have a Forms 6i form migrated to 10g and deployed on Linux, although my problem was "very" specific, and thus very hard to find, this might give you some light.
    I had a visual attribute that defined the property "Fill Pattern" as "none" applied to a canvas, and it deployed without any problem on 10gR2/Windows, but when deployed on Linux (10gR2/SUSE 9) it would abort the application getting a FRM-92101.
    The solution in this case was just changing "none" to "Transparent".
    Hope this helps.
    Regards,
    Miguel.

  • Pl/sql block with "insert into" and schema qualified table throws "error"

    Simplified test case:
    Oracle9i EE Release 9.2.0.3.0
    Oracle JDeveloper 9.0.3.2 Build 1145
    create user u1 identified by u1
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u1;
    revoke unlimited tablespace from u1;
    create user u2 identified by u2
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u2;
    revoke unlimited tablespace from u2;
    As user u2:
    create table u2.t
    c1 number
    grant select, update, insert, delete on u2.t to u1;
    As user u1:
    create or replace package test_pkg as
    procedure do_insert (p_in number);
    end;
    create or replace package body test_pkg as
    procedure do_insert (p_in number) is
    begin
    insert into u2.t values (p_in);
    commit;
    end;
    end;
    All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
    Thanks in advance for any suggestions, etc...

    Hi Bryan,
    Thanks for following up on this. I will look for the bug fix to be published.
    - Mark

  • FND_REQUEST PL/SQL procedure with parameters

    Hi guys
    I have created a concurrent program, using PL/SQL procedure which has 2 in parameters. I am trying to call the concurrent program using
    v_req_id :=FND_REQUEST.SUBMIT_REQUEST('INV','OMS_POP_INVVALUES_P',
    NULL,SYSDATE,FALSE,l_on_date, l_org_id,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
    COMMIT;
    However, the concurrent program always failing with
    **Starts**26-AUG-2013 14:02:31 ORACLE error 6550 in FDPSTP Cause: FDPSTP failed due to ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'OMS_POP_INVVALUES_P' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    and I doubt it is because the database procedure call is not proper.
    I have set four parameters with the concurrent program, as they were with the procedure itself, which are
    p_on_date IN DATE, p_org_id IN NUMBER, errbuff   OUT VARCHAR2,retcode   OUT VARCHAR2
    Please help
    regards,
    raj

    Okay I fixed the problem by
    1. Changing the order of parameters with Procedure like following
    CREATE OR REPLACE PROCEDURE OMS_POP_INVVALUES_P (
    errbuff   OUT VARCHAR2,retcode   OUT NUMBER, p_on_date IN DATE, p_org_id IN NUMBER)
    IS
    and then changing the concurrent program call like following
    l_req_id :=
          fnd_request.submit_request('INV','OMS_POP_INVVALUES_P',
                                                                        NULL,SYSDATE,FALSE,l_in_date, l_org_id,CHR(0));
       :SYSTEM.Message_Level := '25';
       COMMIT;
    after removing all the parameters from the program parameter list. No need to pass any value for errbuff and retcode, just pass other parameters and end the parameter list with CHR(0). Hope this is useful for somebody else out there.
    Regards,
    raj

  • ADF BC connection to SQL Server with parameterized variable for View Object

    Hi everyone
    I'm developing a BPM Application using Oracle BPM 11.1.1.5.0 and JDeveloper 11.1.1.5.0
    Following the thread from the link below, since this is a new topic, I decided to open a new thread.
    Re: ADF method call to fetch data from DB before the initiator page loads
    what I'm trying to do is to get a record from a database and show it to the user on the initiator UI using ADF BC and not the Database Adapter.
    I have been able to work with ADF BC and View Objects to get all the rows and show them to the user in a table.
    However, when I try to run the same query in the parameterized form to just return a single row, I hit a wall.
    In short, My problem is like this:
    I have an Application Module which has an entity object and a view object.
    My database is SQL Server 2008.
    when I try to create a new read only view object to return a single row I face the problem.
    The query I have in the query section of my View Object is like this:
    select *
    from dbo.Employee
    where EmployeeCode= 99which works fine.
    However when I define a bind variable, input_code for example, and change the query to the following it won't validate.
    select *
    from dbo.Employee
    where EmployeeCode= :input_codeIt just keeps saying
    >
    incorrect syntax near ":"
    >
    I don't know if this has to do with my DB not being Oracle or I'm doing something wrong.
    Can someone help me with this problem please?
    thanks in advance

    Hi
    This all seems complicated to me so I think my simplest way would be to use the java code in the aformentioned thread by Sudipto:
    public String getUserLogin() throws WorkflowException,
    BPMIdentityException,
    BPMUnsupportedAttributeException {
    String userId = "";
    IWorkflowServiceClient wfSvcClient;
    ITaskQueryService queryService;
    IWorkflowContext wfContext;
    // Get username of User Login
    String contextStr = ADFWorklistBeanUtil.getWorklistContextId();
    wfSvcClient = WorkflowService.getWorkflowServiceClient();
    queryService = wfSvcClient.getTaskQueryService();
    wfContext = queryService.getWorkflowContext(contextStr);
    userId = wfContext.getUser();
    return userId;
    } I don't know where and how I should put the code to be called when the view object loads though.
    I have created a class in the java class section of my view object which has two methods related to the bind variable input_empCode:
    getinput_empcode and setinput_empcode , as expected.
    however any code i try to put in those two would not be called at all!
    for example:
        public Integer getinput_empCode() {
            //return (Integer)getNamedWhereClauseParam("input_empCode");
            return 1444;
        }and
        public void setinput_empCode(Integer value) {
            //setNamedWhereClauseParam("input_empCode", value);
            setNamedWhereClauseParam("input_empCode", 666);
        }It just keeps filled with the values in the bind variable section.
    I don't know what I'm doing wrong here.
    would you show me the way?
    Thanks again

  • N00b is in ddesperate need of some SQL help with parameters

    SO I am trying to create a report that will allow the operator to select an application name (appname from table) which I have working as a ripoff of the AdventureWorks db for passing parameters (stored procedure);
    USE [Test]
    GO
    /****** Object:  StoredProcedure [dbo].[App_Get]    Script Date: 2/19/2015 9:40:58 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[App_Get]
    @GetName NVARCHAR(500)
    AS
    BEGIN
    ;WITH CTE1
    AS
    SELECT CAST(('<i><j>' + REPLACE(@GetName, ',', '</j></i><i><j>') + '</j></i>' ) AS XML) CSV
    ),CTE2
    AS
    SELECT CAST(i.query('./text()') AS VARCHAR(100))CSV
    FROM CTE1
    CROSS APPLY CSV.nodes('/i/j') As x(i)
    SELECT * FROM ae_apps
    WHERE appname IN (SELECT * FROM CTE2)
    END
    AND I have the script that will allow me to pull the information from the multiple tables;
    select ae_login.usrid, ae_login.usrnam, ae_login.fullnam, ae_audit.tsstamp, ae_audit.eventid, ae_agdesc.description, ae_audit.appid, ae_apps.appname
     FROM ae_login, ae_audit, ae_agdesc, ae_apps
     WHERE ae_login.usrid = ae_audit.usrid
     AND ae_audit.eventid = ae_agdesc.eventid
    AND ae_audit.appid = ae_apps.appid
    order by ae_audit.appid, ae_audit.tsstamp
    BUT I do not know how to tie that selected parameter (appname) from the dropdown list.  Essentially I want the operator to select the (appname) and have the report generate the audit information from script above for just that selected (appname). 
    Any Thoughts would be appreciated.

    Hi cnelsonaa27,
    According to your description, you want to add parameter to the report, then users can select an application name from the parameter drop down list when they preview the report, but you don’t know how to tie the dataset and parameter, right?
    To achieve the goal, please refer to the following steps:
      1. In design surface, in Report Data pane, right-click Data Sources and click Add Data Source.
      2. Type data source name, select Embedded connection, then type select Type and type connection string, or select a shared data source.
      3.Right-click Datasets and click Add Dataset.
      4.Select Use a dataset embedded in my report, the default name is Dataset1, then select data source you added in step2, then copy the query to Query text box:
    select ae_login.usrid, ae_login.usrnam, ae_login.fullnam, ae_audit.tsstamp, ae_audit.eventid, ae_agdesc.description, ae_audit.appid, ae_apps.appname
    FROM ae_login, ae_audit, ae_agdesc, ae_apps
    WHERE ae_login.usrid = ae_audit.usrid
    AND ae_audit.eventid = ae_agdesc.eventid
    AND ae_audit.appid = ae_apps.appid
    order by ae_audit.appid, ae_audit.tsstamp
      5.Right-click Datasets and click Add Dataset.
      6.The default name is Dataset2, select data source from drop down list, then copy the query used to create parameter to Query text box.
      7.Right-click Parameters and click Add parameter, type parameter name and prompt.
      8.Click Available Values in left pane, select Get values from a query, select Dataset2 from Dataset drop down list, select appname as Value field, select appname as Label field.
      9.Right-click Dataset1 to open Dataset Properties dialog box, click Filters in left pane, click Add button.
      10.Select appname from Expression drop down list, set Operator to =, then set value to [@ParameterName], click OK.
    For more information about Adding Parameters to a Report, please refer to the following document:
    https://technet.microsoft.com/en-us/library/aa337432%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

Maybe you are looking for

  • How to enable blackberry balance

    Plz provide in detail

  • Sql query in report/source

    Is possible use this kind of select select a,(select b from b) from b in sql query in report/source?

  • File Location in Aperture Library

    So, I'm new to aperture having transitioned from Lightroom. When I set up my aperture ilbrary I oould have sworn I maked keep images in current location (where I had them stored in LR). Those files show in finder to be 681GB. When I look at my new ap

  • 'connect to itunes problem' HELP NEEDED

    hi, My iPod touch screen is frozen on a picture of the iTunes icon above the USB connector. I am assuming this is telling me to connect it to my iTunes. this happened after i tried downloading the 4.0 software. when i connect my ipod, i get the messa

  • Using EBS Oracle views with Discoverer

    Hi everyone Does anyone have experience of working with the standard EBS BI install for R12? If so, I'd like the opportunity to discuss it with you. Please email me on [email protected] so I can pick your brains. :-) Best wishes Michael