Declare custom type as %ROWTYPE variable in package

I am creating a bunch of custom RECORD types in a package specification like so:
CREATE OR REPLACE PACKAGE mypackage AS
TYPE t1 IS RECORD (a number, b number);
...For consistency, I'd like to create a custom package type that uses a table %ROWTYPE, something like this:
TYPE t2 IS RECORD (table%ROWTYPE);Is that possible in any way?
Tom

Hi Tom.
You should read this: http://docs.oracle.com/cd/B10500_01/appdev.920/a96624/05_colls.htm
"The attribute %ROWTYPE lets you declare a record that represents a row in a database table. However, you cannot specify the datatypes of fields in the record or declare fields of your own. The datatype RECORD lifts those restrictions and lets you define your own records."
If you want to create a nested table of that records you can do this:
DECLARE
   TYPE RecTab IS TABLE OF dept%ROWTYPE;
   dept_recs RecTab;
...If you just need a record this may help you.
DECLARE
   dept_rec dept%ROWTYPE;
...Hope this helps.
Regards.

Similar Messages

  • How do I output the "Customer Type"

    I am want to hide some content in a secure zone based on the "Customer Type".
    How do I output this CRM field?

    What class is your req variable? If your using a HttpServletRequest, then there is no method req.setContentType("");
    In the HttpServletResponse this is for telling the web browser or receving medium what kind of mime type to expect.
    And what package is the HttpConnection class from?
    I think more precise info is required before this question can be answered.

  • Passing Record Variable through Packages

    I have a question and hope that someone can help me to find the solution.
    I'm developing an application and I need to pass values form one procedure PR in package B to a function FN in package A. The why I try to go is passing the values by using a variable of record type.
    I have defined in both packages the same record structure that I also use in the declarations of procedure and function. I first compiled successfully the package A but when I try to compile the package B I get a compilation error:
    PLS-00306: wrong number or types of arguments in call to 'B.FN'
    It looks like the parameter definition or reference gets lost.
    Here below a very schematic example of my application:
    create or replace package A is
    type Rec1 is record
    ( rf1 T.f1%type,
    rf2 T.f2%type,
    rf3 T.f3%type)
    function FN ( Par in Rec1 ) return boolean;
    end;
    create or replace package A is
    function FN ( Par in Rec1 ) return boolean is
    V_ret boolean;
    begin
    whatever it does
    return V_ret ;
    end;
    end;
    create or replace package B is
    type Rec1 is record
    ( rf1 T.f1%type,
    rf2 T.f2%type,
    rf3 T.f3%type)
    procedure PR ( Par in Rec1 ) return boolean;
    end;
    create or replace package B is
    procedure PR ( Par in Rec1 ) is
    VP Rec1;
    V_go boolean;
    begin
    VP.rf1:= something_1;
    VP.rf2:= something;
    VP.rf3:= something;
    V_go:=FN ( VP ); <= here the compiler complaints
    whatever it does
    end;
    end;
    Many thanks for a quick answer.

    Okay I didn't notice the error message text in the body of the paragraph above.
    PS. If I specify singularly the fields in the parameter list I pass the compilation
    but I would like to use a record variable as one.Did you see my post where I always reference the record variable in package A?
    create or replace package B is
    procedure PR ( Par in A.Rec1 ) return boolean;
    end;
    create or replace package B is
    procedure PR ( Par in A.Rec1 ) is
    VP A.Rec1;
    V_go boolean;
    begin
    VP.rf1:= something_1;
    VP.rf2:= something;
    VP.rf3:= something;
    V_go:=A.FN ( VP ); <= here the compiler complaintsIt should work.

  • Generating XML for an instance of a custom type

    I apologize for a silly question...
    How do I use the codec object that <autotype> generates for a custom type?
    The schema and WSDL files are written by hand, <autotype> generates java representation
    of the types along with serializer/deserializer classes for nested types and the
    main codec class fine. Now I need to manually generate XML for a particular instance
    of my custom type (at runtime). The codec class declares XML_TYPE as a private
    variable while it seems to be exactly what needs to be passed to codec’s serialize(),
    and the codec class is a final class... so how’s this class supposed to be used?
    Same with de-serialization.
    Any help will be greatly appreciated!
    Dmitriy

    also see http://edocs.bea.com/wls/docs81/webserv/customdata.html#1052981
    Bruce Stephens wrote:
    >
    Hi Dimtriy,
    I've attached an example using a custom codec with clientgen. If you
    could take a look and see if this ser/deser can provide you with some
    guidelines on what is required. Also, if you could bundle a small
    example that illustrates your custom type, it would be helpful.
    Thanks,
    Bruce
    Dmitriy Myaskovskiy wrote:
    I apologize for a silly question...
    How do I use the codec object that <autotype> generates for a custom type?
    The schema and WSDL files are written by hand, <autotype> generates java representation
    of the types along with serializer/deserializer classes for nested types and the
    main codec class fine. Now I need to manually generate XML for a particular instance
    of my custom type (at runtime). The codec class declares XML_TYPE as a private
    variable while it seems to be exactly what needs to be passed to codec’s serialize(),
    and the codec class is a final class... so how’s this class supposed to be used?
    Same with de-serialization.
    Any help will be greatly appreciated!
    Dmitriy------------------------------------------------------------------------
    Name: custom_codec.zip
    custom_codec.zip Type: Zip Compressed Data (application/x-zip-compressed)
    Encoding: base64

  • Any idea what this errorr means? the data type of the reference does not match the data type of the variable

    I am using Veristand 2014, Scan Engine and EtherCat Custom Device.  I have not had this error before, but I was trying to deploy my System Definition File (run) to the Target (cRio 9024 with 6 modules) and it failed. It wouldn't even try to communicate with the target. I get the 'connection refused' error.  
    I created a new Veristand project
    I added the Scan Engine and EtherCat custom device.
    I changed the IP address and auto-detected my modules
    i noticed tat Veristand didn't find one of my modules that was there earlier. (this week)
     So, i went to NiMax to make sure software was installed and even reinstalled Scan Engine and Veristand just to make sure.
    Now, it finds the module, but when i go to deploy it getsto the last step of deploying the code to the target, and then it fails.
    Any thoughts?
    Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Preparing to synchronize with targets...
    • Querying the active System Definition file from the targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.
    • Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Preparing to deploy the System Definition to the targets...
    • Compiling the System Definition file...
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Sending reset command to all targets...
    • Preparing to deploy files to the targets...
    • Starting download for target Controller...
    • Opening FTP session to IP 10.12.0.48...
    • Processing Action on Deploy VIs...
    • Setting target scan rate to 10000 (uSec)... Done.
    • Gathering target dependency files...
    • Downloading testChassis.nivssdf [92 kB] (file 1 of 4)
    • Downloading testChassis_Controller.nivsdat [204 kB] (file 2 of 4)
    • Downloading CalibrationData.nivscal [0 kB] (file 3 of 4)
    • Downloading testChassis_Controller.nivsparam [0 kB] (file 4 of 4)
    • Closing FTP session...
    • Files successfully deployed to the targets.
    • Starting deployment group 1...
    The VeriStand Gateway encountered an error while deploying the System Definition file.
    Details:
    Error -66212 occurred at Project Window.lvlibroject Window.vi >> Project Window.lvlib:Command Loop.vi >> NI_VS Workspace ExecutionAPI.lvlib:NI VeriStand - Connect to System.vi
    Possible reason(s):
    LabVIEW: The data type of the reference does not match the data type of the variable.
    =========================
    NI VeriStand: NI VeriStand Engine.lvlib:VeriStand Engine Wrapper (RT).vi >> NI VeriStand Engine.lvlib:VeriStand Engine.vi >> NI VeriStand Engine.lvlib:VeriStand Engine State Machine.vi >> NI VeriStand Engine.lvlib:Initialize Inline Custom Devices.vi >> Custom Devices Storage.lvlib:Initialize Device (HW Interface).vi
    • Sending reset command to all targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.

    Can you deploy if you only have the two 9401 modules in the chassis (no other modules) and in the sysdef?  I meant to ask if you could attach your system definition file to the forum post so we can see it as well (sorry for the confusion).  
    Are you using any of the specialty configurations for the 9401 modules? (ex: counter, PWM, quadrature, etc)
    You will probably want to post this on the support page for the Scan Engine/EtherCAT Custom Device: https://decibel.ni.com/content/thread/8671  
    Custom devices aren't officially supported by NI, so technical questions and issues are handled on the above page.
    Kevin W.
    Applications Engineer
    National Instruments

  • How do I use bin variable in package without asking a user?

    hi,
    I would like to write an SQL but I want to use bind variable in package as a static without asking user? Like below?
    I would like to ask you, below there is a emp_id variable? Is this BIND variable?
    DECLARE
    bonus NUMBER(8,2);
    emp_id NUMBER(6) := 100;
    BEGIN
    SELECT salary * 0.10 INTO bonus FROM employees
    WHERE employee_id = emp_id;
    END;
    If not, like this SQL how can define a BIND variable as static inside a code? not asking a user?
    db version. 9.2.0.8
    regards and thanks

    OracleADay wrote:
    I would like to ask you, below there is a emp_id variable? Is this BIND variable?
    DECLARE
    bonus NUMBER(8,2);
    emp_id NUMBER(6) := 100;
    BEGIN
    SELECT salary * 0.10 INTO bonus FROM employees
    WHERE employee_id = emp_id;
    END;
    /In the query "SELECT salary * 0.10 INTO bonus FROM employees WHERE employee_id = emp_id" emp_id is turned into a bind variable because
    if you are coding static SQL in PL/SQL then PL/SQL wil automatically use bind variables: please read http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/overview.htm#sthref145.
    This can also be proved with SQL trace. The following code:
    alter session set sql_trace=true;
    declare
    v number;
    c number;
    begin
    select count(*) into c
    from t
    where x=v;
    end;
    show errors
    alter session set sql_trace=false;generates following raw trace file section with 10G XE:
    =====================
    PARSING IN CURSOR #2 len=79 dep=0 uid=69 oct=47 lid=69 tim=33338762257 hv=2860574766 ad='3c10120c'
    declare
    v number;
    c number;
    begin
    select count(*) into c
    from t
    where x=v;
    end;
    END OF STMT
    PARSE #2:c=46800,e=329811,p=0,cr=9,cu=0,mis=1,r=0,dep=0,og=1,tim=33338762253
    =====================
    PARSING IN CURSOR #1 len=35 dep=1 uid=69 oct=3 lid=69 tim=33338788761 hv=3539261652 ad='3c10053c'
    SELECT COUNT(*) FROM T WHERE X=:B1
    END OF STMT
    PARSE #1:c=0,e=216,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=1,tim=33338788755
    =====================Edited by: P. Forstmann on 17 mai 2011 17:47
    Edited by: P. Forstmann on 17 mai 2011 17:55

  • How to Write a CUstomer Exit for a variable in BEx

    Hi,
    How to write a customer exit variable in bex Query designer
    Do i need developers key for this (If so what type of key do i need so that i can ask basis tean to generate)
    Info Object: ZEXP_DTE (Expiry Date)
    Variable on ZEXP_DTE :
    ZEDTE
    Type: Customer Exit
    Can any one please tell me how to write a code in CMOD from this (Step-by Step)
    Expiry Date > Current Cal Day
    As arun said
    'l_s_range-low = SY-DATUM.
    l_s_range-opt = 'I'.
    l_s_range-sign = 'GT'.
    APPEND l_s_range TO e_t_range.'
    I want to insert the above code for the above customer exit but as i am new to BW as  ABAP please explain me what are the steps involved in CMOD
    Thanks

    Hi,
    To write customer exit for a variable, you require Access key.
    Contact your BASIS to get that.
    Access Key,BASIS?
    To write Customer exit,
    User Exits
    User Exit for Variable
    /thread/809285 [original link is broken]
    Hope these helps u...
    Regards,
    KK.

  • ODI-SET VARIABLE IN PACKAGE

    HI.
    I am using odi11g.
    i set variable "STARTTIME" To sysdate .
    And "END_DATE" to a default value-- '20-JUNE-1981'.
    Now in package i dropped the variable "end_date",and put the TYPE to "SET VARIABLE" and the value as below:
    #VARIABLES_STARTTIME.[ The projects name is VARIABLES]
    But the value of "end-date" isnt getting reset to STARTTIME.
    should there be a different syntax.

    HI,
    Refresing the variable is working thanks.BUT i was trying to use the variable in a loop.
    Where when the package is run fo rthe 1'st time the variable 'LAST_UPDATE' value should be '20-JUNE-1981' and then it should get set to the value present in 'STARTTIME" for the next time the package is run.
    So, in this case, i need to set the value of the variable in the package itself.
    #VARIABLES.STARTTIME isnt getting set.
    i tried the package as per the below link:[ i use odi1g though]
    http://blogs.oracle.com/dataintegration/entry/using_variables_in_odi_the_tim

  • How to declare data type for DATE format

    Hi,
    I need the data format in this format  DD-MM-YYYY HH:MI:SS
    So, I m using    select TO_CHAR(Date_Column, 'DD-MM-YYYY HH:MI:SS')  from dual;
    Now, In my procedure I need to assign this to a OUT  variable, what should be the Data type of out variable.
    My OUT variable is used by other program.
    Thanks

    You can use VARCHAR2. Try the below
    CREATE OR REPLACE PROCEDURE proc_test(p_indate DATE, p_outdate OUT VARCHAR2) 
    AS 
    BEGIN 
       p_outdate:= TO_CHAR(p_indate,'DD-MON-YYYY HH:MI:SS'); 
    END; 
    SET SERVEROUTPUT ON
    DECLARE 
       v_date  VARCHAR2(50); 
    BEGIN 
       proc_test(SYSDATE,v_date);
       DBMS_OUTPUT.PUT_LINE(v_date);  
    END; 
    OUTPUT:-
    anonymous block completed
    15-JAN-2014 12:13:46

  • Reuse Variable In Packages

    I have a scenario where I need to reuse the variable in several packages without refreshing it. For example I have package 1, 2 and 3. I have defined a variable var_timestamp with latest value and declare this variable in package 3, I have generated scenario of package 1 and 2 and insert it in package 3. I refresh the variable as first step and reuse the variable in package 1 and 2 without refreshing it but var_timestamp value is not recognized in package 1 and 2.I didn't declare these variable in package 1 and 2 as I dont want it to be refresh again. I have tried Not Persistant variable as well but it didn't work. Any clue how can we reuse the variable without refreshing it in different packages.
    Thanks
    Kash

    When you use a variable in a package it is important to declare it
    Use the variable as Latest Value
    Dont use the Historize or Persistent
    If you have declared and refreshed it in package 3.......there might be 2 steps right?
    1st step as declare and another step as refresh
    In your packages 1 & 2, you should make a step as declare variable only, where you should drag your variable in the package and make it a declare variable step
    And re-generate the scenario to be able to get the effect of this change in your scenario
    Let me know in case you face any difficulties

  • Custom types for Developing Components

    I am creating the custom component for the LiveCycle and I ran into problems, because there are no sufficient documentation how to define and use a custom data types. I have read your article from the DevNet and you refer to the documentation many times. I was very disappointed, because the documentation isn’t handle the custom data types like you have described it. My problem is how to define the custom data type in the component xml. The structure of the custom data type is
    ScanProperties
    private String virusScanPath
    private Priority priority (Enum type)
    private Action action (Enum type)
    private boolean all
    private boolean allole
    private boolean archive
    private boolean mime
    private boolean mheur
    private boolean pheur
    I will use this custom data type as an input for my service. So my main problem is how I can define the correct set up of the object from the process using the correct editors?
    Posted on behalf of Veijo (last name withheld)

    Usually custom data types (such as the priority and action types you stated) are added to the component.xml file using the data-types element. 
    For example, I have created several custom types (Part, OrderResult, PartsOrdered, Pricing and PartColor) that I want to expose in LiveCycle.  I want the user to be able to select these types from the drop down when they create process variables inside Workbench.  This is done by adding the class’ for each type to the data-types tag:
          <data-types>
                <data-type id="com.adobe.samples.customTypes.Part" title="Part" standard="true">
                </data-type>
                <data-type id="com.adobe.samples.customTypes.OrderResult" title="Part Order Result" standard="true">
                </data-type>
                <data-type id="com.adobe.samples.customTypes.PartsOrdered" title="Parts Ordered" standard="true">
                </data-type>
                <data-type id="com.adobe.samples.customTypes.Pricing" title="Pricing" standard="true">
                </data-type>
                <data-type id="com.adobe.samples.customTypes.PartColor" title="PartColor" standard="true">
                </data-type>
          </data-types>
    The data-type attributes are:
      id - Required. The identifier used to look up a data type globally (across components). Its maximum length is 255.
      title - Short descriptive caption expected to be displayed in any related UI. The title is not defined if id is used in place of title.
      java-class - The underlying Java type for this data type that will be used internally and on the signature of an operation when used as input and output. If java-class is not defined, it is assumed that id is the Java class.
      standard - A Boolean flag specifying whether this data type is a standard data type. If true, it is expected that applications such as Workbench ES will show this data type by default and not require a search across the data type registry. The default is false.
    I also see that you want to use an enumerated type.  I’ll assume that you would like to see a drop down in the properties sheet that allows the user to select from a list of possible values.  To do that you want to use a property-editor with the type Enum in your input parameter section:
    <property-editor editor-id="com.adobe.idp.dsc.propertyeditor.system.Enum" />
    I’ve included a sample component.xml (the same one from my DevNet article) that should supply you with the context of the elements.

  • 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

  • How to invoke services with javabeans type or other customer type??

    Hi all,
    My BPELI will invoke a services and delivery a variable, but the variable is a javabeans type or other customer type.
    But, the BPEL Console trow a Exception Message...
    com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is b19473ef990d7108:148662:10d0cdbc8d7:-7ffc. Please check the process instance for detail.
    How to resolve my problem.
    I make a services, the services has a operation, the operation will return a javabean type.
    ex:
    Service
    public BeansServices {
    public Order setOrder(Order order) {
    order.setName("TEST");
    return order;
    JavaBeans
    public Order{
    String name = "";
    public void setName(String name) {
    thie.name = name;
    public String getName() {
    return this.name;
    /--------------------------------------------------/

    Hi
    The error doesnt seem to be related to the JavaBean.
    You can try changing the syncMaxWaitTime in the BPEL Console.
    This post might help:
    Re: How to longer the BPEL waiting timeout
    ^_^

  • INSERT using a %ROWTYPE variable

    In PL/SQL I need to "copy" a row in a table, changing the sequence number in a key and changing a couple of other columns. Most of the 20 or so columns are unchanged. I declare a variable using %ROWTYPE, to hold the entire row, and do a SELECT into it. Then I change the 3 columns, and want to do an INSERT, using the %ROWTYPE variable. But it seems that INSERT does not let me do this - I have to specify all the columns individually. This is tedious, and also means I have to know all the columns, which is bad for maintenance (new columns added in the future). Is there a way to INSERT the entire row? Whay does Oracle not allow this?
    Dave E. at McGill Univ.

    Oracle will allow this....but in Oracle9i and after. Right now you cannot do this in Oracle8i or less.
    Gio
    null

  • Select values from table%ROWTYPE variable into a cursor

    I have a stored procedure which has an OUT parameter of table1%ROWTYPE.
    In future we might have to add more OUT parameters of table2%ROWTYPE etc. But at any point of time only one will have values.
    So instead of having table%ROWTYPE as OUT parameter, can I send these single row ( with variable values) in a cursor, so that declaration part atleast will not change.
    Is it possible to select values from table%ROWTYPE variable into a cursor.
    cursorOUT IS
    SELECT * FROM varREC;
    where varREC is table.ROWTYPE variable.
    Or which is the better solution in this situation.
    Thanks.

    SQL> var a refcursor
    SQL> declare
      2   bb emp%ROWTYPE;
      3  begin
      4   select * into bb from emp where rownum = 1;
      5   open :a for select bb.ename ename, bb.empno empno from dual;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print a
    ENAME                                 EMPNO
    SMITH                                  7369Rgds.

Maybe you are looking for

  • Learning iPhone SDK - Trying to draw an image

    Although I have programmed for Mac in the last years, I have never used Mac-specific technologies as Cocoa (I have programmed more in OpenGL, SDL, and the like). Now I am getting started with the iPhone SDK. I'd like to do some OpenGL|ES stuff, but s

  • Is there a way to do without Floppy Drive ?

    Hi: To put it simple: I had to disconnect my Floppy Drive because randomly the system tried to read from it and all ended in a freezing status and a reboot.- This happened with or without a floppy in it and never asked by the user. After disconnectin

  • Attaching the tax discount invoice to the payment run F110

    Hi Guys, Im using BTE 2040 to email the Remittance Advice, i would like to attach the Tax Discount Invoice aswell to send both documents at the same time. Please assist me achieve this. Kind regards, Ndumiso

  • HT1923 ipad will not reconise in itunes

    new ipad will not come up in my itunes by wifi.

  • Whats about working with 2 computers ? lightroom 1.2

    on trip i use my laptop a macbook and at home i work with my working station, the big apple , both apple computers. how can i import all my work ,my photos, with all the metadatas i have changed on the laptop during travelling ? now i imported all my