Package variables

Hi, 
VS2008 
SQL 2008 R2 
Bit of a newbie with SSIS and script tasks.  I have a simple package that defines two package variables. 
I'm trying to read these in the Main() method of the C# script task. 
However this gives the following error. 
System.Runtime.InteropServices.COMException (0xC0010009): The element cannot be found in a collection.
This would imply that the variable does not exist in the variables collection, however it does.  I've tried both Package:: and User::, same result. 
Googling this seems to show that square brackets are correct for C#. 
Any ideas? 

Why are you assigning a single string value to object variable? you should be assigning it to a string variable.
Trial and error really.  I started with String and when it didn't work I changed to object. 
Did you pass the variable in Script Task properties? If you want to read the value alone include it within ReadOnly variables. If you want to modify value make it ReadWrite
If not you wont be able to use it in script body and will get element not found error.
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • How to get values from a stored package variable of type record ?

    Sir,
    In my JClient form, I need to get values from a database stored package variable of type record. And the values are retained in the JClient form for the whole session. The values are copied only once when the form is started.
    What is the best way to do that ?
    Thanks
    Stephen

    Stephen,
    not sure what your model is, but if it is Business Components, I think I would expose the properties as a client method on the application module. This way all JClient panels and frames will have access to it. You could use a HashMap to store the data in teh app module.
    If JDBC supports the record type, then you should be able to call it via a prepared SQL statement. If not, you may consider writing a PLSQL accessor to your stored procedure that returns something that can be handled.
    Steve Muench provides the following examples on his blog page
    http://otn.oracle.com/products/jdev/tips/muench/stprocnondbblock/PassUserEnteredValuesToStoredProc.zip
    http://otn.oracle.com/products/jdev/tips/muench/multilevelstproc/MultilevelStoredProcExample.zip
    Frank

  • Error trying to run SSIS Package via SQL Server Agent: DTExec: Could not set \Package.Variables[User::VarObjectDataSet].Properties[Value] value to System.Object

    Situation:
    SSIS Package designed in SQL Server 2012 - SQL Server Data Tools
    Windows 7 - 64 bit.
    The package (32 bit) extracts data from a SQL Server db to an Excel Output file, via an OLE DB connection.
    It uses 3 package variables:
    *) SQLCommand (String) to specify the SQL Statement to be executed by the package
    Property path: \Package.Variables[User::ExcelOutputFile].Properties[Value]
    Value: f:\Output Data.xls
    *) EXCELOutputFIle (String) to specify path and filename of the Excel output file
    Property path: \Package.Variables[User::SQLCommand].Properties[Value]
    Value: select * from CartOrder
    *) VarObjectDataSet (Object) to hold the data returned by SQL Server)
    Property path: \Package.Variables[User::VarObjectDataSet].Properties[Value]
    Value: System.Object
    It consists out of 2 components:
    *) Execute SQL Task: executes the SQL Statement passed on via a package variable. The resultng rows are stored in the package variable VarObjectDataSet
    *) Script Task: creates the physical output file and iterates VarObjectDataSet to populate the Excel file.
    Outcome and issue:The package runs perfectly fine both in SQL Server Data Tools itself and in DTEXECUI.
    However, whenever I run it via SQL Server Agent (with 32 bit runtime option set), it returns the errror message below.
    This package contains 3 package variables but the error stating that a package variable can not be set, pops up for the VarObjectDataSet only.  This makes me wonder if it is uberhaupt possible to set the value of a package variable
    of type Object.
    Can anybody help me on this please ?
    Message
    Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 32-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  6:40:20 PM  DTExec: Could
    not set \Package.Variables[User::VarObjectDataSet].Properties[Value] value to System.Object.  Started:  6:40:20 PM  Finished: 6:40:21 PM  Elapsed:  0.281 seconds.  The package execution failed.  The step failed.
    Thank you very much in advance
    Jurgen

    Hi Visakh,
    thank you for your reply.
    So, judging by your reply, not all package variables used inside a package need to be set a value for when run in DTEXEC ?
    I already tried that but my package ended up in error (something to do with "... invocation ...." and that error is anything but clearly documented. Judging by the error message itself, it looks like it could be just about anything. that is why I asked my
    first question about the object type package variable.
    Now, I will remove it from the 'set values' list and try another go cracking the unclear error-message " ... invocation ...". Does an error message about " ... invocation ..." ring any bells, now that we are talking about it here ?
    Thx in advance
    Jurgen
    Yes exactly
    You need to set values only forthem which needs to be controlled from outside the package
    Any variable which gets its value through expression set inside package or through a query inside execute sql task/script task can be ignored from DTExec
    Ok I've seen the invocation error mostly inside script task. This may be because some error inside script written in script task. If it appeared after you removed the variable then it may because some reference of variable existing within script task.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Package variable g_security_group_id must be set

    Hi all,
    i have the following problem.
    I have a form based on an interactive report.
    all standard made out of the apex possibilities.
    i have a number of validations, all automatically created by apex, in the form because of the not possible being null of certain columns in my database.
    when i press the insert button or save button when i didn't fill in all the necessary fields, i get the following error:
    ORA-20001: Package variable g_security_group_id must be set.
         Error      ERR-1023 Unable perform validations.
    OK      
    i allready checked my validations and i can't find something wrong with it.
    they haven't been modified neither after being automatically created by apex
    anyone any clue?
    thanks in advance,
    Mr. T

    Desmedt,
    Can you please demonstrate this on apex.oracle.com?
    Scott

  • Help needed for loss of package variables!

    Seem to have an annoying problem which may just be a misundertanding about libraries.
    I have two forms. Initially form 1 created initialised two package variables (of type ora_java.jobject) using the ora_java.new_global_ref function and these persisted across multiple user interactions and existed when form 2 was called (as new form / sharing libraries. Form 2 could call form 1 and the package variables still had values OK.
    These package variables were placed in library which only contained this package and was attached to both forms.
    I needed more functionality on form 2 so I created a menu module which had to run some code from form 2. I put most of the code (actually imported as it's mostly java classes) into the same library as the package containing the variables and attached the expanded pll to both forms and the menu module. Now when I run form 1 values for the package variables exist for the life of form 1 and form 2, but when I try to reference them after the initial display of form 2 they have disappeared!
    Also if form 1 is called again then it behaves differently in that references to the variable are lost after the form is first displayed.
    All forms and menus have shared libraries.
    I have spent some time playing with different variables and it's the same regardless of the variable type.
    Must be something to do with the library I think but don't know what - please help before I tear all my hair out!

    Ian,
    Ensure you have set the SHARE_LIBRARY_DATA parameter in your CALL_FORM statement.
    Also deleting the .fmx files, disconnecting from the database and re-building the form usually helps when everything else fails and you have not made any other changes you can think of that may have caused it to break.
    Also check that the forms are pointing to the right version of your .pll. Removing the attached library, adding it back and recompiling should do the trick.
    Hope this helps, before you lose your hair!

  • Package Variable Values in For Each Contaner

    I have a For Each File Container that loops through Excel files, executing a child package for each file found. I am using the RowCount transform to log the number of rows at various points in a DataFlow. When one file is processed the numbers are correct
    but when multiple files (e.g. 5) are processed some counts are zero when they shouldn't be. I have tried a 1 second sleep in the loop but that didn't fix the problem.
    R Campbell

    Please share more technical details
    numbers of what where, what Data Flaw how a package reports on the counts?
    Arthur
    MyBlog
    Twitter
    Actually, the title IS misleading.
    I have a parent package with a For Each File container
    and within that a child package is called, passing the file path and name. The child package has a
    DataFlow with quite a few branches in the flow. On some of those branches I have
    RowCount "transforms" each linked to its own
    package variable.
    At the CotrolFlow level a script is executed immediately after the DataFlow which writes the package variable values to the dts log.
    If I place one file at a time into the folder that the For Each Container is looking at and wait for it to be processed, the numbers are correct. If I place a number of files (say 5) in the folder at one time, some of the numbers logged are correct
    and some are zero.
    I did try a 1 second sleep at the start of the logging  script but, when I think about it, the package variables probably being read before the script starts to execute. If this is a timing issue (which I don't think that it should be) it might need
    to be a separate script between the DataFlow and the existing script, with a sleep in it.
    Because each loop of the parent package executes a new instance of the child package I am puzzled as to how there can be a timing issue. No matter how tight the loop might be, a new instance of the child package is executed each time.
    R Campbell

  • Passing Script variable to Package variable, ultimately used as fileName

    Following an excellent post by Geplaatst door Joost, I put together a script which SHOULD populate a package variable, then use that variable as a file name.
    The Script code is as follows:
    public class ScriptMain : UserComponent
    string iScriptVar;
    public override void PreExecute()
    base.PreExecute();
    public override void PostExecute()
    base.PostExecute();
    Variables.ExtractName = iScriptVar.ToString();
    public override void Input0_ProcessInputRow(Input0Buffer Row)
    if (!Row.CUSIP_IsNull)
    iScriptVar = Row.CUSIP.ToString();
    A Windows message box (put in as debug, but removed for brevity here) shows the correct value is being set to iScriptVar at all points it was inserted.
    The "ExtractName" variable is checked as a ReadWriteVariables for the Script properties.
    But, the "ExtractName" package variable is not being passed to the Expressions for the FlatFile Connection properties, which is set to:  @[User::ExtractName].
    Where have I gone wrong?

    Why not to provide the link to the post already?
    iScriptVar
    is a local to script variable this explains why it did not you need the full wiring
    e.g.
    Dts.Variables["User::iScriptVar"].Value = iScriptVar
    Arthur
    MyBlog
    Twitter

  • BC4J ApplicationModule Pooling and persitent package variables

    Scenario:
    HttpRequest
    starts=> - use SessionCookie API to get an Application Module
    - call pck.set_id (packaged procedure which sets i++ )
    - call pck.get_id (packaged function returning value of i)
    finish=> release application Module (***)
    What I've seen:
    (***) When release statelessly
    Two browser sessions (could) get the same Application Module, in which case the 'i' value is incremented 'by' both browser sessions.
    (***) When release statefully
    Two browser sessions get their 'own' Application Module and manipulate their own 'i' value (even) between consequitive HTTP Requests.
    If both situations are explained and viewed correctly, does BC4J application module pooling guarantee that whenever I want to use an AM statefully I get persistent package variable state reproduced in that AM???
    If I understand correctly this doesn't mean I get the 'same' AM instance each time, but the BC4J Application Module pooling makes sure that whichever AM I get has state reproduced?
    Thx for explaining/affirming?
    -J.

    Scenario:
    HttpRequest
    starts=> - use SessionCookie API to get an Application Module
    - call pck.set_id (packaged procedure which sets i++ )
    - call pck.get_id (packaged function returning value of i)
    finish=> release application Module (***)
    What I've seen:
    (***) When release statelessly
    Two browser sessions (could) get the same Application Module, in which case the 'i' value is incremented 'by' both
    browser sessions.
    (***) When release statefully
    Two browser sessions get their 'own' Application Module and manipulate their own 'i' value (even) between
    consequitive HTTP Requests.
    If both situations are explained and viewed correctly, does BC4J application module pooling guarantee that whenever
    I want to use an AM statefully I get persistent package variable state reproduced in that AM???In scenario2 above the reason that two different ApplicationModule instances are returned for each
    respective session is that the pool has not yet hit its recycle threshold. Once this threshold is hit then the pool will
    begin "recycling" the state managed instances and you will observe the same behaviour as in scenario 1.
    If I understand correctly this doesn't mean I get the 'same' AM instance each time, but the BC4J Application Module
    pooling makes sure that whichever AM I get has state reproduced?This is true for the state that BC4J is aware of (i.e. iterator state, pending transactional changes, etc).
    However, BC4J cannot reproduce user state, like the PL/SQL session state that you have defined above. In order
    to maintain "user" state it is necessary to:
    1. passivate/activate the user state when BC4J passivates/activates its own state. BC4J currently provides a hook for
    this via ApplicationModuleImpl.passivateState(Document, Element) and ApplicationModuleImpl.activateState(Element).
    2. reset user state when BC4J recycles an ApplicationModule. 9.0.2 does not define a great mechanism for
    resetting user state. However, the upcoming maintenance release will provide an ApplicationModuleImpl.reset
    hook to clean up session state properly when an ApplicationModule is recycled.
    Hope this helps.

  • Using Oracle package variables in JDBC.

    Can anybody know how we can use Oracle Package variable in Java/JDBC?
    I am using a insert trigger on a table which will initialize the login user
    from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.
    PLease let me know.

    Siva,
    You said:
    It is not inserting the user in the tableI see no table, here. Only a variable in a PL/SQL package.
    You also said:
    But the same is working in Oracle.Do you mean in SQL*Plus?
    Siva, try to forget how you are doing it, and tell me what you are trying to do.
    Do you have some UPDATE_USER column in your database tables where you record the username of the person who did the operation?
    Are you trying to write a trigger that populates this column?
    If so, then all you need is something like:
    create or replace trigger MY_TRIG
      after insert or update
      on MY_TABLE
      for each row
    begin
      :new.UPDATE_USER := user;
    end;Good Luck,
    Avi.
    P.S. By the way, what has this to do with OC4J?

  • Forms 10 and PL/SQL: Using a server package variable

    Hi,
    I have a variable created at package level in the server,
    When I try to assign its value to a Forms item, I get an error.
    "Unable to access distant package variable".
    What should I do to access this variable?
    Many thanks

    Hello,
    Add to the package a procedure to set this variable, and also a function that returns the variable content.
    Francois

  • Accessing database package variables from Forms

    I have a database package that populates a table of values, i.e.
    type t_route_list is table of rt_route.RTR_ID%type;
    route_list t_route_list
    route_list gets populated by a package function and I want to access route_list in the Form.
    While I can access other package variables by writing a function that returns the variable, Forms doesnt seem to like functions that return a user defined datatype as above. I have also tried using a procedure with an OUT param instead of a function but it also fails with same error.
    i.e.
    declare
    v_route_list pkg_bulk_route_replace.t_route_list;
    begin
    pkg_bulk_route_replace.init;
    pkg_bulk_route_replace.get_route_list(v_route_list);
    message(v_route_list(1));
    end;
    This will not compile, but removing the index (1) from the last line makes it compile but crash with ORA-0600.
    The code above with message replaced with dbms_out.put_line works fine on TOAD.
    So my question is......
    Can my database package return a plsql table to a form and if so, how?!

    Actually I've got this to work now!
    Thde main culprit appears to be a difference in the version of sql or pl/sql used on forms (version 5) and the database (8.1.7).
    I had defined my table as a nested table. By redefining this as a indexed table, simply by adding on 'index by binary_integer' on my server package, I am suddenly able to access the elements of the table on my form. Fortunately this did not break the server code either - the table was populated using bulk collect and that still works.
    Still got a bit of coding to do, but things are looking up now.

  • Global Variables Vs Form Library Package Variables Vs DB Package Variables

    I realise this question has been asked a few times with varying degrees of answers, but I am still seeking comment/advice from others.
    I am aware of following options for retaining persistent data to share between forms.
    1. Package variables in a library that you share in a session.
    This requires usage of SHARE_LIBRARY_DATA, there is risk that this not set, then does not share data.
    2. Package variables in a database package.
    Requires round trip to DB. Is this expensive for performance?
    What about risk of DB package becoming invalid and losing state?
    3. Use global variables
    Can be tricky to manage.
    4. Use parameters
    Only one way, ie called form cannot alter value that caller can see.
    Packages are closest to OO approach in using get and set modules. Allows all variables to be managed in one location. This appears best practice.
    Forms library packages appear risky if caller does not include SHARE_LIBRARY_DATA.
    DB packages have cost of round trip to DB. Does this become expensive is have to reference many times. Also topic of DB package becoming invalid and losing state?
    Forms global variables have regular disadvantages of globals, ie not sure who may modify. Need to manage carefully. Text only
    As a second related question, for value such as current user, for performance (and maintainability) is it better to obtain this from oracle user function each time, or save somewhere (in one of options above) and use that saved value each time.

    My personal opinion:
    I like the "packaged" version with getters and setters. In general, i create a client-side package in a pll which has methods to access the value by getters and setters. With that, the "implementation" is encapsulated and doesn't really matter to the rest of your system. All modules have to access the value using the getter and setter.
    Inside the procedure i use two approaches:
    1. If its for communication purposes between different forms i use globals, which are filled or extracted in the getter and setter (see this http://andreas.weiden.orcl.over-blog.de/article-28180655.html )
    2. If its for someother purpose where the value should be "session persistent" i use a database package with getters and setters, which are called from the client-side package getter and setter. If the value is quite "constant" throughout the session, i read the value once at initialization code of the client-side package and the getter just returns that "cached" value
    Hope this helps.

  • To view package variables in Forms 6i debugger

    Can anyone tell me how to view the value of the variables declared in the package spec(from forms side)? i can see only the local variables and global variables(declared using :GLOBAL) in the debugger window.

    In the 6i Debugger the visible Package variables are restricted to the Variables defined in the package body and these are only visible whilst you are instanciating the package for the first time - e.g. running through the anonymous block that you can have at the bottom of the package Definition.
    Otherwise they are invisble. Variables defined within Program units inside the Package are of course visble.
    The new Debugger in Forms 9i has fixed this problem and you can always view (and watch!) Variables defined both in the package Spec and Body.

  • Globals vs package variables

    We want to get rid of the Globals we currently use in forms. Thought of creating a package with package variables and setting these from the form. We do not really want to have to create a set and get function for each variable we create.
    I wanted to be able to pass the variable name to a function to set it or get it. This would be ok using a library in forms and using the COPY and NAME_IN built ins but we want to use a pl/sql package and these are not supported there .
    Any suggestions please.

    If you want an abstractable variable mechanism then you can do something like:
    1) Create a Record type which has two columns - key and value
    2) Create a PL/SQL Table of records of this type
    3) Write routines to get and put into this table based on the Key value.
    So you have a single array of global values which can be referenced using string keys (which of course can themselves be variables or constructed at runtime)

  • Referencing Package Variables

    Running Forms 6i and Oracle 8.1.6
    Can you reference server side package variables directly from Forms, or do you still have to write a wrapper procedures to "set" and "get" them.
    CREATE OR REPLACE package test_pkg as
    v_pkgvar varchar2(10) := 'TEST';
    TYPE r_emp_rec IS RECORD
    (empno emp.empno%TYPE,
         ename emp.ename%TYPE,
         mgr emp.mgr%TYPE,
         deptno emp.deptno%TYPE,
         dname dept.dname%TYPE,
         loc dept.loc%TYPE
    TYPE t_emp_rec IS TABLE OF r_emp_rec INDEX BY BINARY_INTEGER;
    end;
    DECLARE
    data_blk test_pkg.t_emp_rec;
    v_test varchar2(100) := test_pkg.v_pkg_var;
    BEGIN
    null;
    END;
    It seems funny that i can reference test_pkg.t_emp_rec;
    but not test_pkg.v_pkg_var;
    Thanks for your help

    You have to use wrapper setters and getters to reference package variables on Server side PL/SQL from client side PL/SQL (Forms) this will not change no matter what the versions concerned

  • Global package variable for the current rendering item

    I like to define a generic plsql function which handles all the page 0 item conditions. I will place this function call in all page 0 item conditions.
    Now I need a global (htmldb_application) package variable which I can use to identify for which item condition the function is executed.
    Which global variable can I use for this purpose or is there an other way to do this.
    I dont't want to give the the item names hardcode as argument of the function.

    Scott,
    I will try to clarify my question.
    I have lot of page 0 items.
    I like to give every item the same plsql condition such as htmldb_pck.show_item or
    htmldb_pck.show_item('#CURRENT_ITEM#').
    In my own htmldb_pck.show_item function I have all the display coding of the generic items.
    My problem is that I have to know from which item the function is called.
    Thanks,
    Fred.
    May be this is something for an enhancement. Not only for the items, but also for the buttons, tabs, tab sets and report columns. So you know in generic pl/sql from which object the pl/sql is called.

Maybe you are looking for

  • IDVD does not burn camera audio - does burn ITunes audio

    I have a Sony DCR-TRV460 video camera. The computer does not see my camera. I used an ADS Pyro A/V Link to get the movie from the camera to the computer. When I preview the movie in IMovie, I get the audio and video from the camera perfectly. When I

  • A report which displaies orders discerning SETTLED/NOT SETTLED

    Hi All, Could anyone show me a report which displaies the orders (and type orders) discerning between the orders settled and the ones not settled? Thanks Gandalf

  • QUICK MAX DUKE DOLLARS!!!

    Project.java is a simple drawing program. Modify the program to draw not only circles, but rectangles, filled circles, filled rectanges and lines. Modify the program so the user can change the color of a shape and clear the drawing. Use proper object

  • System error when archiving a photo

    Hi, I can store employee picture successfully in R3 (T-Code: OAOH). I can see it there too by Extract->Dispaly all facsimiles in PA30 for that employee. But I can't see the picture from ESS ,only a frame is coming. The URL of the picture is <R3 hostn

  • I've just installed acrobat reader 11 I can't use it: Impossible to click on any button no reaction

    I installed the last acrobat reader 11 version last wenesday. I lauched it, all seems OK. Since yesterday, I try to use it again but impossible to interact with the opened window or pop up, nothing happen. I ty to click on button, menu items lift, ot