Program units (Package) as global variable

Hi all,
Report 10g, generate PDF on the web.
I need to manage some informations as rowtype.
So, I defined a program unit as Package Spec VAR and defined v1 tablename%rowtype. When fired the trigger After Parameter Form run a procedure that populate the VAR.v1 and so I can use this information inside the column formula or format trigger without read the table many times.
I try on client / server and all is ok.
I try on the web and the package spec not work good. Exist some rule or bug about it?
I try to move the package on the DB as Stored Procedure and so the report is ok.
Thank you in advance.

But in report builder is it possible to use global variable define as rowtype?
I have some doubts about it.
About my problem I want add an example to understand better the situation:
As program unit I defined:
PACKAGE VAR IS
vTab0001 tab0001%rowtype;
END;
FUNCTION TAB0001_GET (pCom number) RETURN tab0001%rowtype IS
vTab0001rec tab0001%rowtype;
BEGIN
Select *
into vTab0001rec
from tab0001
where t0001soc = pCom;
return (vTab0001rec);
Exception when others Then
     return (null);
END;
About the After Parameter Form trigger:
var.vTab0001 := tab0001_get(:company_code);
With the srw.message(12345, var.vTab0001.t0001soc) check the value in all the report.
In client/server all it is ok.
In web I received the error
REP-0069: Internal error
REP-57054: In-process job terminated:Terminated with error:
REP-1418: 'cf_1formula': Passed null arguments to SRW.MESSAGE.
So, I have the evidence that the var.vTab0001.t0001soc is null.
Can you help me to find a way?
Is there someone that had this case in report builder?

Similar Messages

  • Global Variable in Storage Package.

    Hi,
    I have one storage package with global variable.
    if others procedures (in package) change this variable, in other sessions, it will not have the init value.
    I need reset this global variable.
    please help.
    thanks.

    Hello
    Variables in packages are only visible to the session they are used in i.e. each session that uses the package gets it's own "copy" of the package and it's variables. If you want to share data between sessions you could look at global application contexts :
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_5002.htm#sthref4478

  • How to auto create a global variable with specific variable name in a global vi ?

    how to auto create a global variable with specific variable name in a global vi using lv ? Because i need to add a lot of global variable in this global vi. But you know, if  i manually add them , it will be a much time-costing work. So i want to use someway to auto generate ? Can i ?? Thanks a lot !

    Hi
    what aartjan is saying is the way for you. but you can develop an utility which will actually help you create global variables. To get the details on this just have a look at VI Scripting section on LAVA forum.
    But i would like you to suggest few things
    1. If your programs have so many global variables (Thats why u want utility) then you should take out some time to read about LabVIEW design patterns. I think if programmer follows these practicess he dont need a single global variable.
    2. Their are some other ways to achieve similar functionality as of global variables (Uninitialized Shift Registers, Single Element Qs and so on) but they are much faster than global variables.
    I am Attaching Whatever Resources i am having I will also attach the template of the design pattern i generaly use in short duration
    Message Edited by Tushar Jambhekar on 10-06-2005 07:33 PM
    Message Edited by Tushar Jambhekar on 10-06-2005 07:36 PM
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog
    Attachments:
    LabVIEWDesignPatterns.zip ‏1505 KB
    Large_Code_Implementation.zip ‏522 KB
    Database Tests.zip ‏868 KB

  • About package global variable.

    Hi All,
    Could you please anyone tell me from which Data Dictionary tables we can find to definiton of Package global variables which is declared in specification part.
    I tried in ALL_ARGUMENTS but I failed to get it.
    Thanks in advance.

    Thanks James for you reply.
    We written an application using utPLSQL framework, which is used to write unit test cases for Oralce server side programs.
    In one of our Oracle package we have been using global variable and is been referred by all the public members.
    To initailize the package global variable based on our test case we need to know the package global variables.

  • Unit Testing and APEX Global Variables

    We've recently started to unit test our database level PL/SQL business logic.
    As such we have a need to be able to simulate or provide output from PL/SQL APEX components in order to facilitate testing of these components.
    Some of the most obvious portions that need simulation are:
    1. The existence of a session
    2. The current application ID
    3. The current page ID.
    We currently handle requirement #1 by using apex_040100.wwv_flow_session.create_new
    We handle 2 and 3 using the apex_application.g_flow_id and g_flow_step_id global variables.
    I'm just wondering, how safe is it for us to use wwv_flow_session.create_new to simulate the creation of a session at testing time for those things which need a session?
    I've also noticed that there are apex_application.get_application_id and apex_application.get_page_id functions whose output is not tied to the global variables (at least in our current version).
    Is it safe for us to expect that we can set these global variables for use in testing or is apex moving to get_application_id and get_page_id functions away from global variables?
    Will there be corresponding set_application_id and set_page_id functions in the future?
    Sorry for the question bomb. Thanks for any help.

    My first question would be why do you need to establish a session to test your PL/SQL?
    wwv_flow_session is a package internal to APEX, and you should probably leave it be.
    The get_application_id procedure you refer to is in apex_application_install, which is used for scripting installation of applications - not get/set of page ID like you're describing.
    If you're uncomfortable using apex_application.g_flow_id, you can use v('APP_ID') or preferably pass the app_id/page_id as parameters to your procedures.
    Your question seems to have a few unknowns, so that's the best I can describe.
    Scott

  • How to declare a global variable from a PL/SQL package

    Hi All,
    Using a global variable is a bad practise for all language. However, in my case, I have a PL/SQL package defines all constants, and I want to use them directly via SQL statement, for instance,
    PACKAGE my_const
    IS
         DEFAULT_ZIP_CODE CONSTANT VARCHAR2(5) := '00000';
    END;And I cannot referrence this variable from my select statement as
    SELECT my_const.DEFAULT_ZIP_CODE from dual;I have to create a function via my package, as,
    FUNCTION get_default_zip_code RETURN VARCHAR2
    IS
    BEGIN
         RETURN DEFAULT_ZIP_CODE;
    END;and
    SELECT my_const.get_default_zip_code from dual;I don't want to create functions to referrence the default varaibles. Does anyone have any clues?
    thanks
    Edited by: user4184769 on Jul 19, 2010 8:36 AM

    riedelme wrote:
    thanks for the info. Your scope explanation makes sense even though it is not intuitive to me. I think the usage of package variables should be supported by SQL (they're just values to be copied) Maybe look at it from another language's perspective. You want to use a global PL package variable in Java/C#/Delphi/VB/etc. How would you do it?
    None of these languages can crack open the data segment of a PL code unit, inspect the variables in it, and extract a value from it. Instead, it needs to be done as follows:
    Using sqlplus as the client illustrates how all these languages will need to do it:
    SQL> var value varchar2(20);
    SQL> begin
      2>     :value := SomePackage.someVar;
      3> end;
      4> /So why should SQL behave differently? It is not the same as the PL language. It is not a subset of the PL language. Yeah, PL/SQL blurs the line between these 2 languages making it very simple for us to mix their source code. But PL/SQL is SQL integrated with PL - not PL integrated with SQL. PL has tight hooks into SQL, creating cursors for you, defining bind variables, binding variables and doing the whole Oracle Call Interface bit for you.
    But SQL has no need for PL code, just as it has no need for Java code, or Delphi code or VB code. Yes, it is possible for it to call Java stored procs. As it is possible for it to call PL procs. But these are via the formal call interface of those languages - not via tight integration hooks that blur the languages and make SQL and Java, or SQL and PL, look like a single integrated source code unit.
    Thus SQL has the pretty much the same constraints in calling the PL language as other languages do. What SQL can do is use the PL engine's call interface and tell it "+execute this function and return the result of the function+".

  • Using global variable in package

    Hi. I have created a function (Retrieve_SerialNo) which returns a variable, which I use throughout my package. I would like to assign this variable as a global variable to be used by all functions and procedures in the package. Can someone help me in the declaration of this variable as a global variable? Also, is it necessary for me to initialize this variable whenever the package executes. If yes, how would I do this?
    CREATE OR REPLACE PACKAGE BODY Supply_Item_Interface AS
    FUNCTION Retrieve_SerialNo RETURN VARCHAR2 IS
        v_serial_no VARCHAR2(20);
        CURSOR Serial_Code IS
          SELECT S.Serial_Code
            FROM Spare_Parts s, Orders r
           WHERE s.serial_code = r.serial_code;
      BEGIN
        OPEN Serial_Code;
        LOOP
          FETCH Serial_Code
            INTO v_serial_no;
          EXIT WHEN Serial_Code%NOTFOUND;
          v_serial_no := v_serial_no;
        END LOOP;
        CLOSE Serial_Code;
        RETURN v_serial_no;
      EXCEPTION
        WHEN OTHERS THEN
          RETURN NULL;
      END;

    user13415143 wrote:
    Hi. I have created a function (Retrieve_SerialNo) which returns a variable, which I use throughout my package. I would like to assign this variable as a global variable to be used by all functions and procedures in the package.All variables have scope or "visibility". A variable defined in a procedure is only visible within that procedure.
    A variable defines in a package body. is visible within that package body (i.e. procedures and functions in that package body can "see" that variable.
    A variable defined in the package definition? Well, who can see the definitions of procedures and function in a a package header/definition? Everyone else basically (other PL/SQL packages and procedures and functions). So this is also true for variables defined in the package interface. These are global variables that not only can be used by the code in that package's body, but also can be used by other packages and PL/SQL code.
    So when you create a global variable you need to decide on its scope:
    - define it in package header for global usage in all PL/SQL code
    - define it in package body for global usage within that package only
    CREATE OR REPLACE PACKAGE BODY Supply_Item_Interface AS
    ..snipped..Ugly code as there is no need to use an explicit cursor if returning a value from a single row. Also buggy code. If there are multiple rows returned by the cursor, the function returns the serial of the last random row. How does this make sense?
    This is what I would expect to see from a function like this. You pass it a unique identifier and it returns the applicable attribute (column) value for it.
    E.g.
    create or replace function GetSerialNo( orderNo number ) return number is
      serialNo number;
    begin
      select
        s.serial_code into serialNo
      from spare_parts s,
           orders o  
      where s.serial_code = o.serial_code
      and o.order_no = orderNo;
      return( serialNo );
    exception when NO_DATA_FOUND then
      return( null )
    end;Also note that there is no need to write ugly uppercase code. This is not a proper coding standard. Programming standards for all languages (ranging from C# to Java to Delphi to Visual Basic to C/C++) specify that camelcase should be used for variables and pascalcase for procedures/functions/methods. Uppercase is very seldom used and then only for constant names and compiler options/flags for example.
    Coding reserved words in uppercase? That is just plain silly - and not found in today's programming languages. Do yourself a favour and forget the idiotic standards used by some for PL/SQL and look at the standards for Java and .Net/C# - as the latter are the de facto standards for programming (and have been for the last 2 decades and more).

  • Data manager package log does not show Global variables!!

    Hello Experts,
    We are using BPC 10 sp14 Microsoft version with SQL Server 2008 R2. We are seeing an issue where datamanager package log does not show the Global variables defined in package script whereas in BPC 7.5 Global variable were visible in package log.
    Please let us know is this behavior changed in BPC 10?
    Below is the package script having Global variables and Package log not showing any of them.
    Thanks & Regards,
    Rohit
    Package Script:
    Package Log:

    Hi Ergin,
    As far as I remember it's by design...
    Vadim

  • Pd0-ppu017 program unit source must define a  subprogram body  or package

    Hi
    Iam new to oracle l and trying to teach myself
    my problem is when I compile any function in program units of forms ,
    the following error message obtained:-
    pd0-ppu017 program unit source must define a subprogram body or package.
    for example this ready function that I have just copied ,pasted
    CREATE OR REPLACE FUNCTION TestTrig_body() RETURNS TRIGGER AS $$
    DECLARE
    v_TempRec temp_table%ROWTYPE;
    BEGIN
         INSERT INTO report_table(num_col, old_val, new_val)
              VALUES (NEW.num_col, OLD.char_col, NEW.char_col);
         RETURN NEW;
    END;
    what is the reason please?
    Windows OS
    Oracle 10g database
    oracle 6i developer
    regards

    VANPERSIE,
    It looks like you are mixing sytax. Some of the Syntax used in a Database trigger (such as Before Insert, After Insert, etc) is specific to database triggers. Referring to :NEW and :OLD are specific to database triggers and can't be used as you are using them, unless you have data blocks names NEW and OLD. Also, when you refer to a item in a block, you must prefix the block or item name with the colon ":". Also, as aweiden points out, you define your return data type as "TRIGGER". The return type of a Function must be a valid Oracle data type. Therefore, your function should return a BOOLEAN, NUMBER, VARCHAR, or even a Ref Cursor, just to name a few. From the looks of your code, your function would simply return a value to indicate that the INSERT was successful. Therefore, you could rewrite your function something like:
    CREATE OR REPLACE FUNCTION TESTTRIG_BODY() RETURNS BOOLEAN AS
    BEGIN
       /* This example assumes you have data blocks in your form called:  NEW_BLOCK and OLD_BLOCK. */
       INSERT INTO REPORT_TABLE
          (NUM_COL, OLD_VAL, NEW_VAL)
       VALUES
          (:NEW_BLOCK.NUM_COL, :OLD_BLOCK.CHAR_COL, :NEW_BLOCK.CHAR_COL);
       RETURN TRUE;
    EXCEPTION
       WHEN OTHERS THEN
          RETURN FALSE;
    END;Also, is there a particular reason you are manually INSERTing a record versus letting Oracle Forms handle this for you?
    Hope this helps.
    Craig...
    -- If my response or the response of another is helpful or answers your question please mark the response accordingly. Thanks!

  • Global variable in a package

    Hi,
    Can anyone tell me if this is possible?
    I have a table with some control values in it and want to be able to access some of these values in a package.
    In the spec of my package I want to be able to set a global variable for the value of a specific record.
    i.e. I want to be able to say something like:
    glo_value_1 := (select value_col from control_table where id_col = 1);
    I'm trying to avoid just creating a cursor that I will have to open/fetch/close for every procedure and function in my package. I'd like to be able to just set the value in the specification so that I can just refer to it as glo_value_1.
    Any ideas?
    Thanks
    Yog

    Well there is no support for scalar subquery in PL/SQL (in-line SELECT) but you could of course write a function to geth the control value based on it's id and assign the result of the function to the global, something like...
    glo_value_1 := control_value_function (1);

  • Global Variable in Package Specification

    Hello,
    I created global variable in package specification,
    Is it valid for the current session or it will work for all the session.
    Thanks,Kannan.K

    Package varaibles are session bound, to demonstrate, a simple test:
    --session 1:
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    SQL> exec dt_test_pack.set_global(50);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
            50
    --Session 2 at the same time
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    SQL> exec dt_test_pack.set_global(100);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
           100
    --Back to session 1:
    SQL> exec dt_test_pack.set_global(null);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    --Back to session 2:
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
           100HTH
    David

  • How to build labview global variable into dll?And how to use it in vc++ program?

    Hi!
       I want to build labview application into dll and use vc++ to call it.The labview program is a little complex,for it has many interface to vc++ and has while loop in it.When I use vc++ to call it,I must use vc++ to do other things.That is to say,vc++ creates a new thread to provide for the labview dll to run.the vc main thread goes on to other things.But the vc++ main thread must communicate with the labview dll by setting its inputs' parameters and get the results of running labview dll.Can you advise me how to realize it?
       I think global variable of labview could be useful when realizing the communication betweeb vc thread and labview dll.So I want to ask whether the labview global variable could also be built into dll and use it.Could you please tell me how to realize my idea?
       Thank you!

    [email protected] wrote:
    Hi!
    I want to build labview application into dll and use vc++ to call
    it.The labview program is a little complex,for it has many interface to
    vc++ and has while loop in it.When I use vc++ to call it,I must use
    vc++ to do other things.That is to say,vc++ creates a new thread to
    provide for the labview dll to run.the vc main thread goes on to other
    things.But the vc++ main thread must communicate with the labview dll
    by setting its inputs' parameters and get the results of running
    labview dll.Can you advise me how to realize it?
       I
    think global variable of labview could be useful when realizing the
    communication betweeb vc thread and labview dll.So I want to ask
    whether the labview global variable could also be built into dll and
    use it.Could you please tell me how to realize my idea?
       Thank you!
    You
    can't access LabVIEW globals directly from a caller to the LabVIEW DLL.
    However there is no problem in providing specific accessor VI functions
    to that global and export them as additional functions from the DLL.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • 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.

  • ABAP Program global variable print at runtime

    Hi,
      I have an abap program with more than 1000 global variables. I want to run the program and at a specific point show a report with names and runtime values of all the global variables in the program. Is there some system table which stores all the global variable names and source code? Kindly help.
    Satya

    Hello Satya,
    You can store all your global variables in one internal table.
    let's say your Itab contains 1000 fields. Now, if you want to retrive the name of the itab, you can use the system call.
    DATA: IT_COMP LIKE RSTRUCINFO OCCURS 0 WITH HEADER LINE.
    *-- Getting fields of internal table
      CALL 'AB_STRUC_INFO'
        ID 'PROGRAM'   FIELD SY-CPROG
        ID 'STRUCNAME' FIELD P_ITAB
        ID 'STRUCINFO' FIELD IT_COMP-SYS.
    After getting all your fields in it_comp table you can use field symbol to get the values of your fields.
    Regards,
    Reward points, if it is useful...!

  • What are the Advantages & Disadvantages of Global Variable at Package Level

    Dear Expprts
    Please tell me,
    What is mean by Global Variable?
    What are the Advantages and Disadvantages of Global Variable at Package Level against Private Variable?

    HI
    GLOBAL VARIABLE UR USE ANY BLOCK IN PLSQL
    BUT LOCAL VARIABLE USED ONLY THERE THEY DECLARE.
    REGARDS
    MOHAMMADI

Maybe you are looking for

  • OSB defaulting Content-Type to "multipart/related" in case of attachments

    I have scenario where I need to invoke a REST Webservice from OSB which accepts only media types which has "multipart/atom+xml". OSB is used for protocol transformation converting the SOAP request into the HTTP POST request with multipart. I have Pro

  • Losing vector image quality in PDF

    I have created designs in PS using vectors which were all hi res, when saving to PDF the images are all terrible quality- except the script that I have added which remains crystal clear. I have gone back and checked the saved resolution and it was fi

  • Search only portal pages

    I want to search on Pages, not iviews/worksets. Any ideas please?

  • N96 Firmware update 11.018

    Anyone else installed this. If so - thoughts?

  • Invalid Switch Executive References (once in while)

    Hi there, a colleague of mine is using a self-written little LV-sequencer to do UUT testing. At the beginnig of his "test sequence" he opens the corresponding SE-Session and does not close it before having performed the last test on the last UUT. He