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

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.

  • 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

  • Object variable not set (Error 91) in Input Enabled query

    Hello,
    I'm having the following issue.  I have created an input enabled query and included it in a planning workbook.  Every time I open the workbook or query, and I got to an input enabled cell, I get the error below:
    Object variable not set (Error 91)
    This client has not used planning workbooks before.  The system is on 7.10 SP10 for Bex Analyzer and SAP Gui 7.10 Patch Level 13. 
    I'm not finding any relevant so far in SDN.  Any help anyone can provide is greatly appreciated.
    Thanks,
    Senthil

    Hello,
    Just wanted to let you all know that this issue has been resolved after updating my SAP Gui to 7.2 Patch Level 4 (Patch Level 5 was causing some other issues so I decided to stay at Level 4).
    Thanks,
    Senthil

  • "Object Variable or With Block Variable not set" Error on Adobe Presenter 8 Ribbon on PPT 2010/2007

    Returning back from Adobe training at KEDRIYA VIDYALAYA no 1  Jalhalli Bangalore when I started Powerpoint to use Adobe Presenter 8  I am getting : "Object Variable or With Block Variable not set " error on clicking any of the menu features of the Presenter Ribbon. My Config are :
    i)             WINDOWS XP SP 3
    ii)            POWERPOINT 2007 / 2010 ( for both same error is coming)
    iii)           MS XML Library 4.0 installed.
    iv)           Adobe Presenter 8
    I am using all liscenced copies of softwares.
    Hardware specs are also as per Minimum Adobe standards.
    I Have tried a lot removing Data Execution Prevention Mode , but all in vain the problem still exists
    Why is this happening. Please help.
    Kamal K Gupta
    PGT Comp. SC.
    KV No. 2 Srivijaya nagar

    This is not really a "Downloading, Installing, Setting Up" question; you may get better help if you ask in the Presenter forum.

  • Object variable or With block variable not set (Error 91)

    I am not a developer, however i have to help to run a VB program.
    when using a local administrator to run this program there will be error :
    Object variable or With block variable not set (Error 91)
    however using a DOMAIN Administrator to run without problem.
    any idea

    Do you have the source code? The error itself is a nullreference error. It means the code is trying to use some object to access a property of method of that object, but the object is currently null so it fails. The fact that it runs different when you run
    as a domain admin versus local admin could mean that it does something via a network location or resource, and when running as a domain admin, it has access to that resource and succeeds, but the local admin doesn't have access to the needed resource, and
    the code doesn't check to see if the object is null before using it. If you don't have the source code, then it will be difficult to fix, other than giving the local admin the ability to access whatever it is the program is looking to access.
    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

  • Object variable or With block variable not set error message

    When processing the Rate application I get a "Object variable or With block variable not set error message" What is causing this error and how do I fix it?

    Hi Brian,
    I'm afraid that in some ways this reply won't be very helpful though it may help you save some time. 
    The error message you describe is a very generic one thrown by Microsoft .NET (the programming platform that SAP is written with, see the link at the bottom of this message) and not being 'handled' by SAP. 
    This means from a SAP perspective that any one of many unrelated things may be causing the error and that it gives you virtually no help in tracking the problem down in SAP.
    We've plagued by this message quite a bit, my advice is to look for clues at to what may be happening elsewhere, e.g. try:
    1. The windows event viewer, if you are in a multi-server environment then check the event log on all machines.
    2. The SQL Server event log (this can be found in Management Studio - Management - SQL Server Logs assuming you're using SQL Server 2005)
    3. IIS logs, usually these are text files in the following location -
    HTTP.SYS Error Log - %windir%\System32\LogFiles\HTTPERR
    IIS Website Log - %windir%\System32\LogFiles\W3SVC#
    It is dull work trawling through all these places looking for error events with a timestamp similar to the time your error was encountered, but by doing this we've been able to troubleshoot some issues that otherwise would have taken us ages to rectify via trial and error.
    Sorry that there is no definitive answer, but if itu2019s of any help there's many more of us out there who this error message causes trouble for.
    Regards,
    Iain
    Microsoft "Object variable or With block variable not set" error message link:
    http://support.microsoft.com/kb/316478

  • DBMS_PIPE : NOT DECLARED ERROR 발생 시

    제품 : PL/SQL
    작성날짜 : 1996-10-30
    DBMS_PIPE NOT DECLARED ERROR 발생 시
    ====================================
    발생원인 1)
    DBMS_PIPE는 oracle install시에 $ORACLE_HOME/rdbms/admin/catproc.sql을
    실행함으로써 생성되도록 되어 있는 stored package이다.
    다른 stored package(DBMS_OUTPUT....)등은 생성직후 sys를 owner로한
    stored package에 대해 public synonym을 생성한 후 바로 이 synonym에
    대해 public에게 execute previlege가 grant되지만 DBMS_PIPE는 생성만
    되도록 되어 있기 때문에 사용하고자 하는 user에게 별도의 grant작업이
    필요하다.
    -> 확인사항 및 해결 방법
    1) sqldba에서
    select * from dba_objects where object_name = 'DBMS_PIPE';
    를 수행하여 DBMS_PIPE에 관한 자료가 sys가 owner인 package
    spec,package body,synonym만 나타나야 한다.
    2) sqldba에서
    grant execute on DBMS_PIPE to user_name;
    을 실행하여 해당 user에게 grant한다.
    발생원인 2)
    DBMS_PIPE는 sys가 owner이어야 한다.
    user의 실수로 system이나 다른 별도의 user로 connect하여 catproc.sql을
    실행한 경우에 발생한다.
    -> 확인사항 및 해결방법
    1) sqldba에서
    select * from dba_objects where object_name = 'DBMS_PIPE';
    를 수행하여 DBMS_PIPE에 관한 자료가 sys나 public이 아닌 다른
    user가 owner로 되어 있는 DBMS_PIPE object를 drop시킨다.
    2) sqldba에서
    grant execute on DBMS_PIPE to user_name;
    을 실행하여 해당 user에게 grant한다.

    Your comments are inappropriate.
    First of all, documentation links outside Oracle might not contain the correct documentation, as Oracle fixes documentation bugs silently.
    Secondly, you should not post links to desupported release. You seem to have assumed the 8.1.5 solution still applies to newer releases, which is correct in this case but not necessarily in all cases.
    Finally in the time you took to flame Saubhik you could have helped someone else out.
    Sybrand Bakker
    Senior Oracle DBA

  • Erased all content on 3G but now won't sync with iTunes. Error states, "This iPhone cannot be used because the Apple Mobile Device service is not started." I don't want phone service on this old 3G. Just want to use it as an iTouch. Any suggestions?

    Erased all content on 3G but now won't sync with iTunes. Error states, "This iPhone cannot be used because the Apple Mobile Device service is not started." I don't want phone service on this old 3G. Just want to use it as an iTouch. Any suggestions?

    Type "Apple Mobile Device service " into the search bar at the top of this page by "Support"

  • 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

  • "Object variable or With block variable not set" error

    I have Presenter 6.2 installed into PowerPoint 2007 on a XP
    operating system. I have successfully used this product a couple of
    months ago.
    Evidently now I am getting an Adobe Presenter error prompt
    that says "Object variable or With block variable not set" for
    every feature I click on in PP.
    I have reinstalled Presenter to see if that would fix it. It
    did not. I uninstalled/deleted it from my PC and then installed a
    fresh copy. I still get the same issue prompt.
    Has anyone experienced this and if so got any suggestions on
    how to fix it?

    I am having the same problem, and I have since I installed this  add-in a month ago, honestly I am wondering why people use this  product.  Others around me are not having this issue so I don't know  what is going on.
    I have called Adobe 3 times,
    I  tried uninstalling and re-installing Presenter - no luck
    I tried  disabling and enabling the add-in - no luck
    I updated to version  7.0.5, http://www.adobe.com/support/downloads/product.jsp?product=153&platform=Windows   (make sure you install 7.0.1, then 7.0.2, then 7.0.5 in this order)  still  had problems - but I did just find this post from 2009, and I am going  to try starting a new presentation (updates would not help a current  PP), which really is not great because I have a 60 slide class at this  time.
    http://forums.adobe.com/message/2332717#2332717
    Give  it a try and let me know if it works or if you find a solution!

  • Importing existing worksheet yields "Object variable or With Block variable not set" error

    There is not much more to say.  I try to import the worksheet, but it gives that error.  I do not see anywhere I can enter VAB either.  FYI, I am working with SharePoint 2007 but there was no forum for that.

    Hi SAP collegues,
    At my site, BPC Excel created this problem too "Object Variable or With Block Variable not set" .
    It turned out that this is symptom of a a dys-functioning BPC COM Plug-in in XL2007 or XL2010!
    This is a consequence that your Excel recently crashed while using BPC. And it relates to an Excel Add-in becoming disabled when the applications crashes.  Please check the following.
    Note before doing the following, close all other open Excel and BPC sessions.
    Within Excel go to File à Options
    Select the Add-Ins option on the left
    Select the <<COM Add-ins >> option in the Manage drop down, and click Go
    Make sure that the Planning and Consolidation option is selected.  If not, mark this box and click OK.
    If you do not see anything listed, return to the Add-in screen and select the Disabled Items option, and see if Planning and Consolidation is listed there.
    Let me know if you have any queries,
    Kind Regards,
    robert ten bosch

  • 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

  • Object variable not set error in SAP-VB Connect.

    This is the coding part i have used for connecting SAP and VB for creating the Sales Order in SAP.
    But it gives the error in the line
    oheader.Value("DOC_TYPE") = Text1(0)
    as Object variable or With block variable not set.
    What could be the reason, pls advise me.
    Dim bapictrl As Object
    Dim boOrder As Object
    Dim oPartner As Object
    Dim oItemin As Object
    Dim oheader As Object
    Dim oreturn As Object
    Dim oconnection As Object
    Private Sub Command1_Click()
    Dim x As String
    oheader.Value("DOC_TYPE") = Text1(0)
    oheader.Value("SALES_ORG") = Text1(1)
    oheader.Value("DISTR_CHAN") = Text1(2)
    oheader.Value("DIVISION") = Text1(3)
    oheader.Value("PRICE_DATE") = Text1(4)
    oheader.Value("PURCH_NO") = Text1(5)
    oPartner.rows.Add
    oPartner.Value(1, "PARTN_ROLE") = Text1(6)
    oPartner.Value(1, "PARTN_NUMB") = Text1(7)
    oItemin.rows.Add
    oItemin.Value(1, "REQ_QTY") = Text1(8)
    oItemin.Value(1, "MATERIAL") = Text1(9)
    oItemin.Value(1, "COND_VALUE") = Text1(10)
    boOrder.createfromdata orderheaderin:=oheader, orderitemsin:=oItemin, orderpartners:=oPartner, return:=oreturn
    x = oreturn.Value("message")
    If x = "" Then
    MsgBox "Transactin Complete"
    Else
    MsgBox x
    End If
    End Sub
    Private Sub Form_Load()
    Text1(4) = Format(Now, "mm/dd/yyyy")
    Set bapictrl = CreateObject("SAP.BAPI.1")
    Set oconnection = bapictrl.Connection
    oconnection.logon
    Set boOrder = bapictrl.GetSAPObject("SalesOrder")
    'Set boOrder = bapictrl.GetSAPObject("BUS2032")
    Set oPartner = bapictrl.DimAs(boOrder, "CreateFromData", "orderpartners")
    Set oPartner = bapictrl.DimAs(boOrder, "CreateFromData", "orderitemsin")
    Set oPartner = bapictrl.DimAs(boOrder, "CreateFromData", "orderheaderin")
    End Sub
    Thanks in advance
    Regards
    Rajaram

    Hi,
       This error occurred in the page where I used the file upload control. The control was working fine before. We tried installing entire PDK again and then applying the hotfix-1, but nothing worked and then I had to use an URL iview to invoke an ASP .Net application just for uploading the files.
    Thanks
    Swetha

  • Variable not set (error 91)/Error during import (error 102)/execut bat file

    We are on BO 11.5.0.0 and using the COM SDK with Visual Basic to run multiple reports (sometimes multiple flavors of the same report) through a bat file.
    If we run the reports single-threaded through the bat file, the reports run fine.  However, if multiple versions of the bat file start at approximately the same time, we get one of two errors:
    91 Object variable or With block variable not set
    102 Error during import document -
    Here's the part of the code with the problem:
    Dim BOapp As busobj.Application
    Dim receiveDoc As busobj.Document
    Set BOapp = New busobj.Application
    BOapp.Interactive = False
    BOapp.Logon strUser, strPass, strFromSystem, "Enterprise", False, False
    BOapp.Visible = False
    Set receiveDoc = BOapp.Documents.OpenFromEnterprise(strFromRep, strFromFolder, boFolder)
    receiveDoc.SaveAs (strDocumentPath & strFromRep & ".REP")
    Values for the following variables are passed in from the bat file:
    strUser
    strPass
    strFromSystem
    strFromRep
    strFromFolder
    strDocumentPath
    If it fails on the OpenFromEnterprise statement, we get the 102 error.
    If it fails on the SaveAs statement, we get the 91 error.
    Running it through debug hasn't helped, since we are running only one report.
    Any thoughts on what could be going wrong?
    Thanks in advance

    I have tried this running the VB code on my desktop (outside of the bat file) and nothing out of the ordinary occurs.  The VB code runs fine with only one occurrence.
    I had seen on other posts "ThisDocument" and didn't know if it would be applicable in this situation.  I also wasn't sure how it should be used based on the rest of my code.  Would "ThisDocument" make a difference?
    Thanks again

Maybe you are looking for

  • Is there a setting in UCCX for long an agent phone rings before it sets him to NOT READY?

    Greetings, This is a new install, version 8.5.1.11..2-22, and we're in the testing phase. So, when calls are presented to an agent the phone rings for about 3 seconds (maybe 5) and then the agent is placed in the NOT READY state on the CAD and the ca

  • Staffing, Entering distribution hours for staffed resource

    For migration of ongoing projects to cProjects, we need to staff the projects. A holiday calendar is attached to the cProject, So working days are correctly calculated.  We are able to staff the resources with start and end dates through our program,

  • Pending Class onResult in custom class.

    Ok, I have a custom class with private field: private var test:Stringint the constructor I load the web service: pws = new WebService(Constants.getWsURL() + "?WSDL"); then I call a method on the WS: var pcLoadModel = pws.LoadModel(); pcLoadModel.onRe

  • Pdf in swf

    Hi, I want to import PDF-Data to a FLA movie but the import from Flash isn't very accurate. With swftools I can convert a Pdf perfectly to an swf but when importing the swf into Flash the import doesn't work very well again. I want to have editable t

  • Administrator access is broken!  Help please?

    at some (very much unknown) point, I have apparently broken my core administrator access to ColdFusion MX7.  We are in the process of upgrading to Coldfusion 8, and as I went to review some information in the older system, I have found that I no long