SP2-0552: Bind variable not declared

Hi,
I am using below bind values in a sql query.
declare
B1 number;
B2 varchar2(10);
B3 varchar2(10);
B4 number;
B5 date;
B6 date;
B7 varchar2(30);
B8 number;
B9 number;
B10 varchar2(9);
B11 number;
Begin
:B1 := 24152;
:B2 := 'CR_CORP';
:B3 := 'COST';
:B4 := 24152;
B5 := TO_DATE('01/29/12 23:20:34','MM/DD/YY HH24:MI:SS');
B6 := TO_DATE('02/27/12 21:10:58','MM/DD/YY HH24:MI:SS');
:B7 := 'BEGIN';
:B8 := 945142827;
:B9 := 483695;
:B10 := 'CR_CORP';
:B11 := 7;
End;
and even tried as below:
declare
variable B1 number;
variable B2 varchar2(30);
variable B3 varchar2(30);
variable B4 number;
B5 date;
B6 date;
variable B7 varchar2(30);
variable B8 number;
variable B9 number;
variable B10 varchar2(30);
variable B11 number;
Begin
:B1 := 24152;
:B2 := 'CR_CORP';
:B3 := 'COST';
:B4 := 24152;
B5 := TO_DATE('01/29/12 23:20:34','MM/DD/YY HH24:MI:SS');
B6 := TO_DATE('02/27/12 21:10:58','MM/DD/YY HH24:MI:SS');
:B7 := 'BEGIN';
:B8 := 945142827;
:B9 := 483695;
:B10 := 'CR_CORP';
:B11 := 7;
End;
Resulting in SP2-0552: Bind variable "B7" not declared.
Kindly help!

Try this:
/* Formatted on 14-3-2012 12:02:31 (QP5 v5.163.1008.3004) */
DECLARE
   B1             NUMBER;
   B2             VARCHAR2 (10);
   B3             VARCHAR2 (10);
   B4             NUMBER;
   B5             DATE;
   B6             DATE;
   B7             VARCHAR2 (30);
   B8             NUMBER;
   B9             NUMBER;
   B10            VARCHAR2 (9);
   B11            NUMBER;
BEGIN
   B1          := 24152;
   B2          := 'CR_CORP';
   B3          := 'COST';
   B4          := 24152;
   B5          := TO_DATE ('01/29/12 23:20:34', 'MM/DD/YY HH24:MI:SS');
   B6          := TO_DATE ('02/27/12 21:10:58', 'MM/DD/YY HH24:MI:SS');
   B7          := 'BEGIN';
   B8          := 945142827;
   B9          := 483695;
   B10         := 'CR_CORP';
   B11         := 7;
SELECT                                              /*+ USE_HASH(SUB_DD,BK) */
      DH.ASSET_ID,
       DH.CODE_COMBINATION_ID,
       NULL,
       DECODE (:B3,
               'COST', CB.ASSET_COST_ACCT,
               'CIP COST', CB.CIP_COST_ACCT,
               'RESERVE', CB.DEPRN_RESERVE_ACCT,
               'REVAL RESERVE', CB.REVAL_RESERVE_ACCT),
       DECODE (
          :B3,
          'RESERVE', DECODE (DD.DEPRN_SOURCE_CODE, 'D', :B7, 'ADDITION'),
          'REVAL RESERVE', DECODE (DD.DEPRN_SOURCE_CODE,
                                   'D', :B7,
                                   'ADDITION'),
          :B7),
       DECODE (:B3,
               'COST', DD.COST,
               'CIP COST', DD.COST,
               'RESERVE', DD.DEPRN_RESERVE,
               'REVAL RESERVE', DD.REVAL_RESERVE),
       :B11
  FROM FA_DEPRN_DETAIL DD,
       FA_DISTRIBUTION_HISTORY DH,
       FA_ASSET_HISTORY AH,
       FA_CATEGORY_BOOKS CB,
       FA_BOOKS BK,
       (  SELECT ASSET_ID, DISTRIBUTION_ID, MAX (PERIOD_COUNTER) MPC
            FROM FA_DEPRN_DETAIL
           WHERE BOOK_TYPE_CODE = :B2 AND PERIOD_COUNTER <= :B1
        GROUP BY ASSET_ID, DISTRIBUTION_ID) SUB_DD
WHERE DH.BOOK_TYPE_CODE = :B10
       AND DECODE (DD.DEPRN_SOURCE_CODE, 'D', :B6, :B5) BETWEEN DH.DATE_EFFECTIVE
                                                            AND NVL (
                                                                   DH.DATE_INEFFECTIVE,
                                                                   SYSDATE)
       AND DD.ASSET_ID = DH.ASSET_ID
       AND DD.BOOK_TYPE_CODE = :B2
       AND DD.DISTRIBUTION_ID = DH.DISTRIBUTION_ID
       AND DD.PERIOD_COUNTER <= :B1
       AND DD.ASSET_ID BETWEEN :B9 AND :B8
       AND DECODE (:B3,
                   'CIP COST', DD.DEPRN_SOURCE_CODE,
                   DECODE (:B7, 'BEGIN', DD.DEPRN_SOURCE_CODE, 'D')) =
              DD.DEPRN_SOURCE_CODE
       AND DD.PERIOD_COUNTER = SUB_DD.MPC
       AND DD.DISTRIBUTION_ID = SUB_DD.DISTRIBUTION_ID
       AND SUB_DD.ASSET_ID = DD.ASSET_ID
       AND AH.ASSET_ID = DD.ASSET_ID
       AND AH.ASSET_TYPE <> 'EXPENSED'
       AND DECODE (DD.DEPRN_SOURCE_CODE, 'D', :B6, :B5) BETWEEN AH.DATE_EFFECTIVE
                                                            AND NVL (
                                                                   AH.DATE_INEFFECTIVE,
                                                                   SYSDATE)
       AND CB.CATEGORY_ID = AH.CATEGORY_ID
       AND CB.BOOK_TYPE_CODE = DD.BOOK_TYPE_CODE
       AND BK.BOOK_TYPE_CODE = CB.BOOK_TYPE_CODE
       AND BK.ASSET_ID = DD.ASSET_ID
       AND DECODE (DD.DEPRN_SOURCE_CODE, 'D', :B6, :B5) BETWEEN BK.DATE_EFFECTIVE
                                                            AND NVL (
                                                                   BK.DATE_INEFFECTIVE,
                                                                   SYSDATE)
       AND NVL (BK.PERIOD_COUNTER_FULLY_RETIRED, :B1 + 1) > :B4
       AND DECODE (
              :B3,
              'COST', DECODE (AH.ASSET_TYPE,
                              'CAPITALIZED', CB.ASSET_COST_ACCT,
                              NULL),
              'CIP COST', DECODE (AH.ASSET_TYPE,
                                  'CIP', CB.CIP_COST_ACCT,
                                  NULL),
              'RESERVE', CB.DEPRN_RESERVE_ACCT,
              'REVAL RESERVE', CB.REVAL_RESERVE_ACCT)
              IS NOT NULL;
END;
/             HTH,
Thierry

Similar Messages

  • SP2-0552: Bind variable not declared error. Any help please?

    Hi Experts,
    I have a question regarding the error that I am getting: SP2-0552: Bind variable "V_COUNT_TOT_BAL" not declared.
    I have 'out' parameters declared in my procedure and executing the same from sql script as shown below:
    set ver off
    set serverout on
    set linesize 8000
    Declare
    Variable v_count_dtl_bal NUMBER(10);
    Variable v_updat_dtl_bal NUMBER(10);
    Variable v_count_tot_bal NUMBER(10);
    Begin
    execute load_abc.insert_abc_bal(:v_count_dtl_bal,:v_updat_dtl_bal,:v_count_tot_bal);
    End;
    exit;
    So, when this sql script runs it given me the above error. However, all the result looks good and there's no problem with the data or anything else that might be impacted. I suspect this error stems from the code in the sql script above.
    Any idea what am I doing wrong?
    Thanks in advance for any inputs.

    Thanks Frank. I still receive the same error if I follow your example or any of the ones explained above. This is what I am getting and still an error underneath:
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
              VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
              NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
              BINARY_FLOAT | BINARY_DOUBLE ] ]
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
              VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
              NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
              BINARY_FLOAT | BINARY_DOUBLE ] ]
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
              VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
              NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
              BINARY_FLOAT | BINARY_DOUBLE ] ]
    SP2-0552: Bind variable "V_COUNT_TOT_BAL" not declared.

  • SP2-0552: Bind variable "SV_STUDENT_ID" not declared.

    I get this error:
    SP2-0552: Bind variable "SV_STUDENT_ID" not declared.
    DECLARE
    sv_student_id NUMBER;
    v_student_id NUMBER := &sv_student_id;
    v_enrolled VARCHAR2(3) := 'NO';
    BEGIN
    DBMS_OUTPUT.PUT_LINE ('Check if the student is enrolled');
    SELECT 'YES'
    INTO v_enrolled
    FROM enrollment
    WHERE student_id = v_student_id;
    DBMS_OUTPUT.PUT_LINE ('The student is enrolled into one course');
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    DBMS_OUTPUT.PUT_LINE ('The student is not enrolled');
    WHEN TO_MANY_ROWS
    THEN
    DBMS_OUTPUT.PUT_LINE ('The student is enrolled to many courses');
    END;

    Define &sv_student_id;
    DECLARE
      v_student_id NUMBER := &sv_student_id;
      v_enrolled VARCHAR2(3) := 'NO';
    BEGIN
      DBMS_OUTPUT.PUT_LINE ('Check if the student is enrolled');
      SELECT 'YES'
        INTO v_enrolled
        FROM enrollment
       WHERE student_id = v_student_id;
      DBMS_OUTPUT.PUT_LINE ('The student is enrolled into one course');
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        DBMS_OUTPUT.PUT_LINE ('The student is not enrolled');
      WHEN TO_MANY_ROWS THEN
        DBMS_OUTPUT.PUT_LINE ('The student is enrolled to many courses');
    END;

  • Varray of Objects "Bind variable not declared" error.. I don't want a bind variable.

    Hello.
    This program is supposed to pull values from a table using a loop, and in the loop, put the values in objects in a varray.  I'm new to objects and am stumped trying to get this program to run.  When I attempt to run it in SQL*Plus  I get the following feedback:
    Type created.
    Type body created
    SP2-0552: Bind variable "MY_VARRAY_EMP1" not declared.
    I don't think I even need a bind variable.  Any feedback would be appreciated.  Here's the program:
    -- Enable screen I/O
    SET SERVEROUTPUT ON SIZE 1000000
    SET VERIFY OFF
    -- begin object spec
    CREATE OR REPLACE TYPE employee3 AS OBJECT
      ename CHAR (20 char),
      empno NUMBER (4),
      sal NUMBER (10),
      MEMBER FUNCTION get_ename RETURN CHAR, MEMBER PROCEDURE set_ename (SELF IN OUT NOCOPY employee3),
      MEMBER FUNCTION get_empno RETURN NUMBER, MEMBER PROCEDURE set_empno (SELF IN OUT NOCOPY employee3),
      MEMBER FUNCTION get_sal RETURN NUMBER, MEMBER PROCEDURE set_sal (SELF IN OUT NOCOPY employee3)
    -- begin object body
    CREATE OR REPLACE TYPE BODY employee3 AS
      -- gets
      MEMBER FUNCTION get_ename RETURN CHAR IS
      BEGIN
      RETURN self.ename;
      END;
      MEMBER FUNCTION get_empno RETURN NUMBER IS
      BEGIN
      RETURN self.empno;
      END;
      MEMBER FUNCTION get_sal RETURN NUMBER IS
      BEGIN
      RETURN self.ename;
      END;
      -- sets
      MEMBER PROCEDURE set_ename(SELF IN OUT employee3) IS
      BEGIN
      self.ename := ename;
      END;
      MEMBER PROCEDURE set_empno(SELF IN OUT employee3) IS
      BEGIN
      self.empno := empno;
      END;
      MEMBER PROCEDURE set_sal(SELF IN OUT employee3) IS
      BEGIN
      self.sal := sal;
      END;
    END;
    DECLARE
      TYPE emp_varray IS VARRAY(10) OF EMPLOYEE3;
      my_varray_emp1 EMP_VARRAY;
      -- List of EMPNO's in order of appearance in EMP table (for cross-referencing, single-line retrieval)
      TYPE MYCREF_VARRAY IS VARRAY(10) OF NUMBER(4);
      varray_mycref MYCREF_VARRAY := MYCREF_VARRAY(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
      this_object EMPLOYEE3;
      -- make a variable to store one empno
      thisno NUMBER(4);
      -- make a counter
      counter INT;
      -- query variables for the set calls
      q_ename CHAR(20 CHAR);
      q_empno NUMBER(4);
      q_sal NUMBER(10);
      my_result INT;
    BEGIN
      --my_varray_emp1 := EMP_VARRAY(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
      -- Put the first 10 EMPNO's in my cref array
      SELECT empno BULK COLLECT INTO varray_mycref FROM emp WHERE ROWNUM < 11;
      -- Use a loop to retrieve the first 10 objects in the "emp" table and put them in the varray of objects
      q_ename := NULL;
      q_empno := NULL;
      q_sal := NULL;
      my_result := NULL;
      this_object := NULL;
      counter := 1;
      FOR counter IN 1..10 LOOP
      thisno := varray_mycref(counter);
      this_object := my_varray_emp1(counter);
      SELECT ename INTO q_ename FROM emp WHERE empno = thisno;
      my_result := this_object.set_ename(q_ename, NULL);
      SELECT empno INTO q_empno FROM emp WHERE empno = thisno;
      my_result := this_object.set_empno(q_empno, NULL);
      SELECT sal INTO q_sal FROM emp WHERE empno = thisno;
      my_result := this_object.set_sal(q_sal, NULL);
      END LOOP;
      -- Use another loop to display the information in the reverse order.
      FOR counter in REVERSE 1..10 LOOP
      this_object =: my_varray_emp1(counter);
      dbms_output.put_line((this_object.get_ename()) || CHR(9) || (this_object.get_empno()) || CHR(9) || (this_object.get_sal()));
      END LOOP;
    END;

    Cleaning up your code for errors and eliminating unnecessary complexity...
    Add a user-defined constructor which takes all attributes and calls the "setter" procedures in one trip:
    -- Enable screen I/O
    set SERVEROUTPUT on size 1000000
    set VERIFY off
    -- begin object spec
    create or replace type employee3 as object
      ename CHAR (20 char),
      empno NUMBER (4),
      sal NUMBER (10),
    constructor function employee3(
        self    in out nocopy    employee3,
        aEname    in        char,
        aEmpNo    in        integer,
        aSal    in        number
      return self as result,
      member function get_ename return CHAR, member procedure set_ename (SELF in out nocopy employee3, ename in char),
      member function get_empno return NUMBER, member procedure set_empno (SELF in out nocopy employee3, empno in integer),
      member function get_sal return NUMBER, member procedure set_sal (SELF in out nocopy employee3, sal in integer)
    -- begin object body
    create or replace type body employee3 as
      constructor function employee3(
        self    in out nocopy    employee3,
        aEname    in        char,
        aEmpNo    in        integer,
        aSal    in        number
      return self as result
      is
      begin
        self.set_ename(aEname);
        self.set_empno(aEmpNo);
        self.set_sal(aSal);
        return;
      end;
      -- gets
      member function get_ename return CHAR is
      begin
      return self.ename;
      end;
      member function get_empno return NUMBER is
      begin
      return self.empno;
      end;
      member function get_sal return NUMBER is
      begin
      return self.sal;
      end;
      -- sets
      member procedure set_ename(SELF in out employee3, ename in char) is
      begin
      self.ename := ename;
      end;
      member procedure set_empno(SELF in out employee3, empno in integer) is
      begin
      self.empno := empno;
      end;
      member procedure set_sal(SELF in out employee3, sal in integer) is
      begin
      self.sal := sal;
      end;
    end;
    (Since I don't have EMP handy at the moment, create a simple view instead)
    create or replace view emp
    as
    select    'EMP' || to_char(level) ename
    ,    level + 100 empno
    ,    DBMS_RANDOM.VALUE(25000,75000) sal
    from    DUAL
    connect by
        level <= 20
    Get rid of your loop and individual SELECTs, and replace it with a single SELECT BULK COLLECT INTO...
    declare
      type emp_varray is varray(10) of EMPLOYEE3;
      my_varray_emp1 EMP_VARRAY;
      this_object EMPLOYEE3;
    begin
      -- No need for a loop. Use SELECT BULK COLLECT INTO, together with a user-defined constructor call (since the
      -- user-defined constructor overrides the default constructor we need to call it using named-parameter notation):
      select    new employee3(
                aEname    => e.ename,
                aEmpNo    => e.empno,
                aSal    => e.sal
      bulk collect into
            my_varray_emp1
      from        emp e
      where        rownum <= 10;
      -- Use another loop to display the information in the reverse order.
      for counter in reverse 1..10 loop
      this_object := my_varray_emp1(counter);
      dbms_output.put_line((this_object.get_ename()) || chr(9) || to_char(this_object.get_empno()) || chr(9) || to_char(this_object.get_sal()));
      end loop;
    end;
    EMP10        
    110    60110
    EMP9         
    109    67485
    EMP8         
    108    58242
    EMP7         
    107    47597
    EMP6         
    106    58995
    EMP5         
    105    49098
    EMP4         
    104    47406
    EMP3         
    103    67574
    EMP2         
    102    59663
    EMP1         
    101    52929
    PL/SQL procedure successfully completed.
    Gerard

  • Bind variable not declared - please help

    Hello,
    I have wrote a PL/SQL script to update some order_id's in a table. I have declared all my variables but get an error -- bind variable not declared. Can anyone tell me what the problem might be?
    DECLARE
             last_ship      DATE ;
             last_order     NUMBER;
             last_cust      NUMBER;
    VARIABLE curr_item      NUMBER;
    VARIABLE curr_order     NUMBER;
             aorder_id      CHAR(6);
             aitem_id       CHAR(2);
             acust_id       NUMBER(6);
             aship_date     DATE;
    CURSOR c1 IS
          SELECT 
                  order_id,
                  item_id,
                  ship_date,
                  cust_id
          FROM
                  test_sales
          ORDER BY
                  1,2,3,4,5;
    BEGIN
          SELECT
                  MAX(order_id)
          INTO
                   curr_order
          FROM
                   sales_order;
    OPEN c1;
         LOOP
             FETCH c1 INTO aorder_id, aitem_id, aship_date, acust_id;
             EXIT WHEN c1%NOTFOUND;
               last_cust      := c1.cust_id;          -- Saves the last values to check if processing same order
               last_order     := c1.aorder_id;        --
               last_ship      := c1.aship_date;       --
               IF c1.aorder_id = last_order AND c1.cust_id = last_cust AND c1.ship_date = last_ship THEN
                  curr_item   := curr_item  +1;
                  UPDATE test_sales SET c1.aorder_id = :curr_order;
                  UPDATE test_sales SET c1.aitem_id  = :curr_item;
               ELSE
                  curr_order := curr_order + 1;
                  curr_item  := 1;
                  UPDATE test_sales SET c1.aorder_id =  :curr_order;
                  UPDATE test_sales SET c1.aitem_id  = :curr_item;
               END IF; 
        END LOOP;
    CLOSE c1;
    END;
    /Cheers
    Mike

    check yours code you are direct accesing cusrsor named directly which is not allowed
      1  DECLARE
      2  vemp  emp.empno%TYPE;
      3  vemp1 emp.empno%TYPE;
      4  CURSOR c1 IS SELECT empno FROM emp;
      5  BEGIN
      6   OPEN c1;
      7    LOOP
      8     FETCH c1 INTO vemp;
      9     EXIT WHEN c1%NOTFOUND;
    10     vemp1:=c1.empno;
    11    END LOOP;
    12   CLOSE c1;
    13* END;
    SQL> /
       vemp1:=c1.empno;
    ERROR at line 10:
    ORA-06550: line 10, column 14:
    PLS-00225: subprogram or cursor 'C1' reference is out of scope
    ORA-06550: line 10, column 4:
    PL/SQL: Statement ignored
    SQL> DECLARE
      2  vemp emp.empno%TYPE;
      3  CURSOR c1 IS SELECT empno FROM emp;
      4  BEGIN
      5   OPEN c1;
      6    LOOP
      7     FETCH c1 INTO vemp;
      8     EXIT WHEN c1%NOTFOUND;
      9    END LOOP;
    10   CLOSE c1;
    11  END;
    12  .
    SQL> /
    PL/SQL procedure successfully completed.Yours code
    OPEN c1;
    LOOP
    FETCH c1 INTO aorder_id, aitem_id, aship_date, acust_id;
    EXIT WHEN c1%NOTFOUND;
    last_cust:= c1.cust_id;
    last_order:= c1.aorder_id;
    END LOOP;
    CLOSE c1;
    END;You sholud move it c1.cust_id within fetch statment or
    bind the cursor name with another local cursor variable
    then fetch into this local bind variable and use cursor
    via this variable
    e.g
    DECLARE
    CUSRSOR c1 IS SELECT cust_id,aorderid
        FROM <TABLE>;
    c2      c1%ROWTYPE;
    OPEN c1;
    LOOP
    FETCH c1 INTO c2;
    aorder_id:=c2.aorderid;
    last_cust:= c1.cust_id;
    last_order:= c1.aorder_id;
    END LOOP;
    CLOSE c1;
    END;Khurram

  • Bind variable not declared

    hi all
    declare jobno number;
    BEGIN
    DBMS_JOB.SUBMIT(:jobno,
    'proc_mvref;',
    SYSDATE, 'SYSDATE + 1');
    commit;
    END;
    when i run this statement,I get the follwing error.
    P2-0552: Bind variable "JOBNO" not declared.
    But I cannot locate the error.
    Thanks in Advance

    variable jobno number
    BEGIN
    DBMS_JOB.SUBMIT(:jobno,
    'proc_mvref;',
    SYSDATE, 'SYSDATE + 1');
    commit;
    END;
    print jobno
    Now it'll work.
    or
    set serveroutput on
    declare jobno number;
    BEGIN
    DBMS_JOB.SUBMIT(jobno, -- note the edit
    'proc_mvref;',
    SYSDATE, 'SYSDATE + 1');
    dbms_output.put_line(jobno);
    commit;
    END;
    This will work too...
    Sybrand Bakker

  • Bind variable not fully enabled

    Hello to everyone.
    I'm debugging a VBA macro with the following code:
    Dim qry_1 As String
    OraDatabase.Parameters.Add "ext_var1", UserForm3.TextBox1.Text, 1
    qry_1 = "begin SELECT max(name) into :clinom FROM sap_customers WHERE & " cust_number = :ext_var1; end;"
    OraDatabase.Parameters.Add "clinom", 0, ORAPARM_OUTPUT
    While executing the last code line i'm receiving the following message:
    OIP-04122:Bind variable not fully enabled
    Can please anyone tell me what am i doing wrong?
    Thanks in advance.
    Octavio

    ORAPARM_OUTPUT isnt defined in vbscript. You need to either define it, or replace it with the defined value like you did with the other parameter.
    ORAPARM_OUTPUT = 2
    Hope it helps
    Greg

  • Java.sql.BatchUpdateException: ORA-01027: bind variables not allowed for da

    Hi guys, I m facing a problem while executing below query .Query is working fine in toad i don't know what is the issue with the code
    <code>
    String url3 = "CREATE OR REPLACE VIEW Table2(PERIOD, YEARS, COST_CENTRE, S_DIR_PERM, S_DIR_CONT, S_INDIR_PERM, S_INDIR_CONT, O_DIR_PERM, O_DIR_CONT, O_INDIR_PERM, O_INDIR_CONT)AS select period, year, cost_center, sum(s_dir_perm), sum(s_dir_cont), sum(s_indir_perm), sum(s_indir_cont), sum(o_dir_perm), sum(o_dir_cont), sum(o_indir_perm), sum(o_indir_cont) from ( select b.period, b.year, a.cost_center, sum(a.perm_dir_hc) as s_dir_perm, sum(a.contract_dir_hc) as s_dir_cont, sum(a.perm_indir_hc) as s_indir_perm, sum(a.contract_indir_hc) as s_indir_cont, 0 as o_dir_perm, 0 as o_dir_cont, 0 as o_indir_perm, 0 as o_indir_cont from ZVHR_ACT_HC_ASOF_FISPRD a, pertable b where to_char(as_of_date, 'mm/dd/yyyy') = b.ENDPERIOD and shift not in ('G','N','O2','O7') and b.endperiod = ? group by b.period, b.year, a.cost_center union select b.period, b.year, a.cost_center, 0 as s_dir_perm, 0 as s_dir_cont, 0 as s_indir_perm, 0 as s_indir_cont, sum(a.perm_dir_hc) as o_dir_perm, sum(a.contract_dir_hc) as o_dir_cont, sum(a.perm_indir_hc) as o_indir_perm, sum(a.contract_indir_hc) as o_indir_cont from ZVHR_ACT_HC_ASOF_FISPRD a, pertable b where to_char(as_of_date, 'mm/dd/yyyy') = b.ENDPERIOD and shift in ('G','N','O2','O7') and b.endperiod = ? group by b.period, b.year, a.cost_center) group by period, year, cost_center";
    PreparedStatement statement3 = connection.prepareStatement(url3);
    statement3.setString(1, "12/10/2008");
    statement3.setString(2, "12/10/2008");
    statement3.addBatch();
    statement3.executeBatch();
    </code>
    i m getting the following error
    java.sql.BatchUpdateException: ORA-01027: bind variables not allowed for data definition operations
    can any1 help me with this.

    Can you explain what you are trying to do from a business perspective?
    If you are creating a view, it doesn't make sense to pass bind variables to that DDL statement. The view definition itself is going to have to end up with hard coded date values there. So what possible benefit is there to using bind variables?
    As an aside, if you are using bind variables and you have DATE columns, you really want to pass in the proper data type (i.e. setDate or setTimestamp rather than setString). Otherwise, Oracle has to do implicit string to date conversion, which depends on the session's NLS settings, which is likely to be different on different client machines and lead to all sorts of odd errors and behaviors down the line.
    Are you trying to build a view that takes parameters? If so, there are a few options for that sort of thing.
    Justin

  • Problem with Bind Variable not updatable.

    Hi all,
    I'm using Jdev 11.1.2.3.0. In my VO, I created a Bind Variable and set it NOT UPDATABLE. Then I created a View Criteria with some other Bind Variables.
    I use this View Criteria in a search page, but at runtime I see also an inpunt text for the variable that is set NOT UPDATABLE and I can change its value.
    Of course if I try to change the value and I do the search, I get an error.
    This is the VO source:
    <Variable
    Name="UlssVar"
    Kind="where"
    Type="java.lang.String"
    IsUpdateable="false">
    <TransientExpression><![CDATA[adf.context.current.sessionScope.get('ulss')]]></TransientExpression>
    </Variable>
    Is it a ADF bug?
    Thank in advance.

    Hi,
    try selecting the bind variable and open the Property Inspector, under UI Hints, set the "Display Hint" to hide. This should hide it (No bug for this reason)
    Frank

  • Bind Variable NOT working in APEX 4.0 within charts SQL

    All,
    I had a chart working fine in 3.2 which had a bind variable like :P11_EMP_NAME, when I created the same chart in 4.0 using the same query it did not work, until I changed the variable to v('P11_EMP_NAME'). Does anyone have experienced the same behaviour?
    Thanks
    Venkat

    Hi Deb,
    Both of your queries are using multi-series syntax i.e. returning more than one series of data, therefore your generated chart is actually generating 6 series rather than just the two that you're aiming for. You could try changing your queries to ensure they each generate a single series of information, which would then result in the extra Y-axis being applied to your "Series 2". Here's an example of what I mean:
    Series 1:
    select null link, label, value from (
    select 'test' label, 1 value from dual
    union all
    select 'test2' label, 2 value from dual
    union all
    select 'test3' label, 3 value from dual
    )Series 2:
    select null link, label, value from (
    select 'test' label, 100 value from dual
    union all
    select 'test2' label, 200 value from dual
    union all
    select 'test3' label, 300 value from dual
    )I hope this helps.
    Regards,
    Hilary

  • Bind Variable Not Being Reset

    I am using JDeveloper 11.1.1.2 and ADF with BC. I have the following situation:
    I have a view object whose where clause has multiple bind variables. On one of my pages, I dragged this view object as a form onto the page. I also dragged the ExecuteWithParams method for this view object onto my page as a command button. I dynamically set the bind variables for this action via EL-based NamedData elements. When I click the button, the query is run with the bind variables I specify. Everything looks great.
    On another page, I am programmatically setting one of the bind variables (let's call it bv1) for the same view object and then navigating to the page described above. The data displays fine. However, when I try to use the command button (ExecuteWithParams) with a different value for bv1, the query continues to use the value that I set programmatically.
    It seems like the bind variable value set programmatically (using vo.setNamedWhereClauseParam) always trumps the one that gets set using the NamedData element in ExecuteWithParams. Why doesn't this value get reset with the value from the NamedData element?
    Thanks,
    Brad

    hi Brad
    ... It seems as if once the bind variable gets set on the view object programatically, the corresponding parameter in ExecuteWithParams does not overwrite it. ...Looks similar to the behaviour I describe in forum thread forum thread "10g versus 11g : bind variable issue"
    at 10g versus 11g : bind variable issue
    regards
    Jan Vervecken

  • Bind variable not picking up a global value... FUSTRATING!!! :(

    Its pretty simple, but I dont know whats going on... heres a brief example of whats going on....
    :GLOBAL.VARIABLE1 := 1;
    MESSAGE(:GLOBAL.VARIABLE1);
    MESSAGE(:GLOBAL.VARIABLE1);
    :LOAN_DEALS.DEAL_KEY := :GLOBAL.VARIABLE1;
    MESSAGE(:LOAN_DEALS.DEAL_KEY);
    MESSAGE(:LOAN_DEALS.DEAL_KEY);
    so basically im setting the global variable to 1, debug message it out and it looks right from forms... I set the bind variable to the global variable and debug message it out and its NOT 1... its the previous value (which is 5 to begin with)....
    The global is assigned by another form using the CALL_FORM built in, but I dont think it matters since the value made it through the exit_form of the form being called... anyone run into this before? Please let me know... thanks in advance..

    I figured it out.
    The coding was in a when button pressed trigger. In this trigger there is coding that updates the child record of the parent bind variable I was trying to change. The child record had a trigger which updates the parent record from the backend, which in turn locks the record from the forms end. Since I didnt requery before attempting to change a locked record, the changes simply just dont take....
    Took me 6 hours to figure that one out!!!

  • JBO-27122:SQL error during statement preparation + ORA-01006:bind variable not exists

    (1) I have built a BC4J View called CallFunctionView which acts as a view i used to call existing PL/SQL functions. My implementation servlet code is presented with the following structure:
    public class MyServlet extends HttpServlet {
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule1(am, i);
    MyRow.checkRule2(am, i);
    (2) Both checkRule1 and checkRule2 will call the ViewObject CallFunctionView. Related codes for checkRule1 and checkRule2 are listed as follows:
    public void checkRule1(ApplicationModule am, int intRowIndex)
    throws JboException, Exception {
    ViewCdCallFunctionImpl vo = (CallFunctionViewImpl) am.findViewObject("CallFunctionView");
    if (vo == null) {             
    throw new JboException("View Object is null!");
    vo.setQuery("SELECT PKG1.MyFunctionOne(?,?,?,?) FROM DUAL");
    vo.setWhereClauseParam(0, param1); // param1 is string
    vo.setWhereClauseParam(1, param2); // param2 is string
    vo.setWhereClauseParam(2, param3); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(3, param4)); // param4 is String.value Of(int)
    vo.executeQuery(); <- Point of exit where my mentioned error occurs at the second loop
    public void checkRule2(ApplicationModule am, int intRowIndex)
    throws JboException, Exception {
    ViewCdCallFunctionImpl vo = (CallFunctionViewImpl) am.findViewObject("CallFunctionView");
    if (vo == null) {             
    throw new JboException("View Object is null!");
    vo.setQuery("SELECT PKG2.MyFunctionTwo(?,?,?,?) FROM DUAL");
    vo.setWhereClauseParam(0, param1); // param1 is string
    vo.setWhereClauseParam(1, param2); // param2 is string
    vo.setWhereClauseParam(2, param3); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(3, param4)); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(4, (blnYes)?"Y":null);
    vo.setWhereClauseParam(5, (blnYes)?"Y":null));
    vo.executeQuery();
    (3)The called functions are from different package and with different parameters. For the loop i = 0, no error occurs and both functions generates expected result. For execution of the first function in the second loop (when i = 1), error occurs with the following messages(JBO-27122: SQL error during statement preparation. + java.sql.SQLException: ORA-01006: bind variable does not exist):
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT PKG1.MyFunctionOne(?,?,?,?) FROM DUAL
         void oracle.jbo.server.QueryCollection.executeQuery(java.lang.Object[], int)
         void oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(java.lang.Object, java.lang.Object[], int)
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetImpl.executeQuery()
         void oracle.jbo.server.ViewObjectImpl.executeQuery()
         void MyPkg.objects.MyVectorRow.checkRule1(oracle.jbo.ApplicationModule, int)
         void MyPkg.servlet.MyServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    ## Detail 0 ##
    java.sql.SQLException: ORA-01006: bind variable does not exist
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
         void oracle.jdbc.ttc7.TTIoer.processError()
         void oracle.jdbc.ttc7.Oall7.receive()
         void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)
         int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)
         void oracle.jdbc.driver.OracleStatement.doExecuteQuery()
         void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()
         int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()
         java.sql.ResultSet oracle.jdbc.driver.OraclePreparedStatement.executeQuery()
         void oracle.jbo.server.QueryCollection.executeQuery(java.lang.Object[], int)
         void oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(java.lang.Object, java.lang.Object[], int)
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetImpl.executeQuery()
         void oracle.jbo.server.ViewObjectImpl.executeQuery()
         void MyPkg.objects.MyVectorRow.checkRule1(oracle.jbo.ApplicationModule, int)
         void MyPkg.servlet.MyServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    I have tried commented either MyRow.checkRule1 or MyRow.checkRule2 for execution. No error occurs for that. The problem occurs when i put the two together in a loop ... the parameter number for Pkg1.MyFunctionOne is less than Pkg2.MyFunctionTwo, which corresponds to the error message 'Bind variable does not exist' ... any cache for calling the function that causes the error at running the vo.executeQuery statement?
    Question: Does anyone has any ideas about the error origin and solution? (It is very important to me because i still have several check rules in addition to those mentioned 2 rules.)
    Thanks for replying!

    Oic ... thanks for your help, but i find a strange thing. No error message is prompted when i break the loop as follows:
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule1(am, i);
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule2(am, i);
    It works, but quite strange ... is it a bug for calling the interface setWhereClauseParam(int, object)? As long as all the bind variables have value (your bind-var array is filled perhaps due to previous setWhereClauseParam, the query will work. What's critical is you get the right query every time :)

  • Interactive Report Bind variable not working ?

    Hello,
    i am new to APEX and trying to find how to use APEX Interactive Reports them with bind variables. So, i have created one with the following query:
    SELECT i1.if_bic_code, b.bicname, count(*) cnt
    FROM IF_DATA i1, bic b
    WHERE i1.if_bic_code = b.biccode(+)
    AND i1.insert_date BETWEEN :P40_X1 AND :P40_X2
    GROUP BY i1.if_bic_code, b.bicname
    The Report is supposed to show a count of submissions per bic_code (=bicname) from the table IF_DATA for the specified time period.
    These 2 bind variables are actually 2 Items in the same region, using a Date Picker for them. They have no initial values. So, the report initially displays no records. After either using the Date Picker or manually entering values in these 2 Items, and pressing Go button still displays no rows. Am i missing something here? It seems that either the query is not submitted again to database, or the bind variables are not taken the values entered to them.
    TIA

    I tried with the date mask you proposed with no success though. It seems that it does not take into consideration the values of those items (variables) and i am wondering whether i have missed any step in this. The items are also of Date type with those settings for them under Source Group:
    Source Used
    Always, replacing any existing value in session state Only when current value in session state is null
    Source Type
    Static Assignment (value equals source attribute)
    My aim is to filter the rows in the where statement through these variables(items), so this way letting the user specify the range and also display the report with the grouped values. The date field (insert_date) is not part of the Select part of the sql statement.
    Also if i eliminate the date part of the where clause of the sql statement, the report displays correctly, but of course with the full date range, which is not what i want.

  • View Accessor Bind Variables not implemented yet

    When i try to use a view aceesor that has bind variables, and try to configure the value of the bind variable the message is that it is not implemented yet...
    Will this be in the next release?
    Is there a workaround?
    I am trying to use this for list of values fields, can i pass the variable in any other way?

    Well, probably this is one more issue fixed after TP2 release...
    I just have an entity based view and a query bessed view with a bind variable.
    I add the query based view in the accessors of Entity Based view in order to create a LOV item.
    I select edit to edit the accessor.
    I see my bind variable in the bind parameter values region.
    i click on the value field to set the value.
    A button (edit) apears to the left ot the field.
    I click that button and a popup message a message apears: Business Components E_NOTIMP Not Implemented, yet.
    Does that work for you?
    I just want to set the value equal to an Attribute of my entity based view, should i just type the attribute name?

Maybe you are looking for

  • Enhancement of MIGO

    Hi all, I have a requirement to post  an accounting entry into 2 gl accounts when a migo (Good Reciept [both posting and rversal] ) is done on a particular type of purchase order (this is apart from the normal ones which have been added by the MM per

  • Problem Creation of New Tax code

    Hello gurus, the client has new requirement 3 % cst the S.D. people have configured the condition type for CST 3%. and it is reflected in pricing procedure. how i should configure the same in taxinj procedure with tax code. pls urgently help. points

  • TS3212 how do I upgrade my itunes on my pc

    I had itunes but apparently need to upgrade because as of this week I can no longer see anything. How do I upgrade itunes? Is it the same as just downloading it again? I don't want to loose the music I already have. Thanks

  • Stop yesterday's Word docs from re-opening

    Since my upgrade to Lion, whenever I open a Word document, all the Word documents I had open yesterday also re-open. The same happens with Excel. How do I stop this? Thanks,

  • How can I use capacity splits in Machines "001" using PS work centers ?

    Hello Experts I want to manage capacity splits for machines in PS using work centers. I create work center CNR1 "Capacity Category 001 <Machine>", maintain the capacity header and maintain the rest of the work center as usual. If I create a pooled ca