How to create a record structure dynamically

Hi,
I would like to create a record structure dynamically in the body of my pl/sql procedure.
I don't want to create the structure in the declaration because my record structure depends on some parameters that the procedure will receive.
Thank you

> I would like to create a record structure dynamically in the body of my pl/sql procedure
Terrible idea. Why? Because if the structure is dynamic then you need to write pretty complex code to handle this structure that could be anything. Complex code means buggy code. Inconsistent code. Weird run-time errors. Etc.
Yes, you can create dynamic "structures" - for example, you can create a user defined type that at execution time can decide what properties it has. Similar to a an object in an o-o language that has a RTTI (Run Time Type Information) interface.
But this is complex. And what did I say about complex code above? Not the best of ideas most of the time.
There is however a very easy way to deal with dynamic data via a "dynamic" structure that is in fact a statically defined structure. Arrays aka collections aka associative arrays.
E.g.
create or replace type TStrings as table of varchar2(4000);
Using this I can create a SQL statement (cursor) on any table, with any predicates, and pass the results (dynamic list of columns) to a procedure for processing:
select TStrings(object_id,object_type,object_name) as DYNAMIC_LIST from user_objects order by object_type, object_name
Using this I can create a procedure that accepts a dynamic list of values and process these:
create or replace procedure DynamicProcess( list TStrings ) as ...
So when thinking "dynamic structures" - think it through carefully. There is a difference between an UNKNOWN structure and a DYNAMIC structure.
The former needs a RTTI interface. You have no idea what the structure contains. You need an interface to call in order for it to describe the structure for you. This is complex stuff.
The latter means that you know the structure as it is pre-defined (statically defined). At run-time, it can contain any number of elements - thus making the structure dynamic. This is easy stuff.
I would rather go for the easy stuff than the complex stuff any time of the day - even when on my 3rd cup of coffee...

Similar Messages

  • How to Create a Table Component Dynamically based on the Need

    Hello all,
    I have a problem i need to create dynamically tables based on the no of records in the database. How can i create the table object using java code.
    Please help.

    Winston's blog will probably be helpful:
    How to create a table component dynamically:
    http://blogs.sun.com/roller/page/winston?entry=creating_dynamic_table
    Adding components to a dynamically created table
    http://blogs.sun.com/roller/page/winston?entry=dynamic_button_table
    Lark
    Creator Team

  • How to create a tree structure using forms.

    Hi,
    How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
    thanks in advance
    Regards
    Karthik

    The FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
    " in the online help this point to all the functions and triggers

  • How to create a record based on the name of a file in the file-system?

    Hi,
    With a lot of pictures I want to have a database to gather some information about these pictures.
    First question is how to generate a record based on a file in the file system?
    e.g. the pictures are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg" .
    now i want to create records with as one of the attributes the name of the picture (not the picture itself). how to create these records (based on the information of the file-ssytem). i.e. the number of records should be the same as the number of pictures.
    any suggestions?
    any reaction will be appreciated.
    Leo

    Link to Create directory
    http://www.adp-gmbh.ch/ora/sql/create_directory.html
    You can create a list of files in the directory and read the list files from that directory.
    [UTL_FILE Documentation |http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]
    [Solution using Java|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584]
    SS

  • How to create a record for table PLAF with order type 'NB'.

    How to create a record for table PLAF with order type 'NB'(standard purchase order).
    who can tell me the T-code or some usefull information?
    Thanks.

    Hi
    This will be updated automatically when generate planned orders thru MRP. (MD02)
    regards
    Srinivas

  • How to create a info structure for product allocation functionality

    Hi Experts,
    how to create a info structure for product allocation functionality
    For allocating fixed quantities to the specified customers at sales order
    Especially i need help in selecting the key figures and key charecterstics for at mc21 and mc24 t.codes(source feilds)
    plase provide product allocation functionality with screenhots
    thanks in advance
    rp
    Edited by: rajendraprasad vasam on May 21, 2008 2:19 PM
    Edited by: rajendraprasad vasam on May 21, 2008 2:19 PM
    Edited by: rajendraprasad vasam on May 21, 2008 2:20 PM

    Hello,
    please have a look at the infostructure S140 in transaction MC23 and MC26.
    this is the standard infostructure for product allocation.
    I hope that the information are helpful.
    Regards
    Claudia

  • How to create an UI element dynamically on action in drop down?

    Hi,
    How to create an UI element dynamically on action of selecting a value from the  drop down?
    help out with the steps i need to follow..

    Hi,
    <u><i><b>Dynamic UI Element creation</b></i></u>
    We can create it only in the WD Modify View.
    Get the instance for the Root UI Element Container.
    Create the UI element Ex: Input Field, Text View etc.
    Bind the UI Element to the Attribute Value.
    Now bind the UI Element to the Root UI Element Container.
              IWDTransparentContainer root =(IWDTransparentContainer)view.getRootElement();
              IWDDropdownByIndex DdbName = (IWDDropdownByIndex)view.createElement(IWDDropdownByIndex.class,"DdbName");
              IWDDropdownByIndex DdbAge = (IWDDropdownByIndex)view.createElement(IWDDropdownByIndex.class,"DdbAge");
              IWDDropdownByIndex DdbGender = (IWDDropdownByIndex)view.createElement(IWDDropdownByIndex.class,"DdbGender");
              IWDNode Mad =wdContext.getChildNode("Person",0);
              IWDAttributeInfo NameAtt = Mad.getNodeInfo().getAttribute("Name");
              IWDAttributeInfo AgeAtt = Mad.getNodeInfo().getAttribute("Age");
              IWDAttributeInfo GenderAtt = Mad.getNodeInfo().getAttribute("Gender");
              DdbName.bindValue(NameAtt);
              DdbAge.bindValue(AgeAtt);
              DdbGender.bindValue(GenderAtt);
              root.addChild(DdbName);     
              root.addChild(DdbAge);
              root.addChild(DdbGender);
    <u><i><b>Dynamic Action Creation</b></i></u>
    Create the Action in the Action tab.
    Create a Button.
    Get the reference for the created action (Through the Event Handler).
    Bind the Action to the Button.
    Bind the Button to the Root UI element Container.
    IWDButton ButGo = (IWDButton)view.createElement(IWDButton.class,"ButGo");
    IWDAction ActGo = wdThis.wdCreateAction(IPrivateStartView.WDActionEventHandler.GO,"Click");
    ButGo.setOnAction(ActGo);
    root.addChild(ButGo);
    Now write the required code for the Event Handler that is associated with the Action.
    //@@begin onActionGo(ServerEvent)
        IWDNode Mad = wdContext.getChildNode("Person",0);
         wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Name"));
         wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Age"));
         wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Gender"));
    //@@end
    Regards
    SURYA

  • How to create a project structure with the Business Bluprint transaction S

    Hi
    How to create a project structure and add the required scenarios for your SAP system to your project structure with the Business Bluprint transaction SOLAR01.
    Also how to add your SAP system configuration structures to your project structure with the configuration transaction SOLAR02
    Thanks,

    Dear fr
    Have u already created a project?
    select the same in solar01 and click the structure tab
    On the left side select business scenarios and on the right side select the structure tab
    Press F4 here and check the Busines process repository is selected
    Nw you hav all the standard business process
    For non-standard just type there name and press save button.
    Add the relevant one's
    Once added here in solar01 reflected in solar02 automatically with relevant data for standard business process.
    you hav to add manually for non stand scean you have added.
    Hope it clarifies.
    Pls assign pts.

  • How to create a tree structure using list items(tlist)

    HI every one,
    As we know how to create a tree structure using Hierarchy item type.
    We have a requirement to create The same tree like structure using List Item(Tlist)
    I would be so appreciated If you send with an example
    Thanks
    RangaReddy

    Hi all
    Any one help me please
    Actually our client requirement is creation of tree structure using list item,similar to what we used in oracle Application(FNDSCSGN) form.We did the tree structure using hierarchy tree using Htree and Ftree.It working excelently.For client requirement, we want to use list item.How PJC(Pluggable Java Components) is useful for using list item(Tlist).I can't understand how it is useful.
    Do you have any example please help me.
    Thanks
    RangaReddy

  • Creating a Record structure and passing this to a Procedure

    Hi there
    I have a query please.
    Can I create a Record Structure composed of fields
    from different tables and then pass this record structure
    to a procedure.?
    ie Create Procedure ProcedureTest(empRec empStructCreated%ROWTYPE)
    where empStructCreated is the RECORD STRUCTURE created
    and composed of fields from different tables.
    Please can some one help me on this.
    Assume that I have 3 tables and I am creating a record structure
    composed of 6 fields (2 fields from each of the 3 tables),and then
    once this record structure is created,I will be passing this to
    a procedure.

    SQL> create or replace package my_package as
      2  type my_rec is record (empno number,deptno number,dname varchar2(10),hiredate date);
      3  end;
      4  /
    Package created.
    SQL> create or replace procedure my_proc(rec1 my_package.my_rec) is
      2  begin
      3  dbms_output.put_line(rec1.empno||' '||rec1.dname||' '||rec1.hiredate);
      4  end;
      5  /
    Procedure created.
    SQL> declare
      2  rec1 my_package.my_rec;
      3  begin
      4  select empno,emp.deptno,dname,hiredate into rec1
      5  from emp,dept where  emp.deptno = dept.deptno and rownum =1;
      6   my_proc(rec1);
      7  end;
      8  /
    7369 RESEARCH 17-DEC-80
    PL/SQL procedure successfully completed.
    SQL>

  • How to create a organization structure?

    Hi all,
    How to create a organization structure for HR?
    I want to use this in my workflow for Approval or Rejection at different levels.
    Thanks and Regards,
    Arpita

    Hi,
    ppoc_old to create tcode
    PPom_old change tcode
    PPOs_old display tcode simple maintianence
    The above mentioned codes are useful to create the ORG STRUCTURE IN ONE mentod that is simplemaintainence
    there are so many way but at the initial stage follow these method
    Try to know abt the OBJECTS
    O org unit
    C JOP
    S Position
    K cost Centre
    P Person
    and know abt there Relationshiops
    u can check those things in tcode PP01 also
    [http://help.sap.com/saphelp_erp2005vp/helpdata/en/0b/dfba3692dc635ce10000009b38f839/frameset.htm]
    let me know if you have any queries.
    Regards,
    Raj

  • How to create a tree structure,like I want to create Bill/Payment Tree

    How to create a tree structure , like I want to create a Bill/Payment Tree containing a single node for all A/R related activities for a specific bill period, in reverse chronological order. Basically the tree should look like
    + Bill - Date: 03-17-2010 Complete
    +++++ CR Note - Date: 05-04-2010 Complete
    ++++++++++ Pay - Date: 05-04-2010 Frozen
    + Bill - Date: 03-17-2010 Complete
    +++++ Pay - Date: 05-04-2010 Frozen
    And finally this should be attached as tab on the control central

    The FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
    " in the online help this point to all the functions and triggers

  • How to create a table component dynamically in netbeans 6.0 (JSF 1.2)?

    How to create a table component dynamically in netbeans 6.0 (JSF 1.2)?
    This example http://developers.sun.com/jscreator/reference/techart/2/createTableDynamically.html works only with JSF 1.1.

    Please help my write correct code.
    How to replace this strings for run example?
    rowGroup.setValueBinding("sourceData", getApplication().createValueBinding("#{Page1.tripDataProvider}"));
    staticText1.setValueBinding("text", getApplication().createValueBinding("#{currentRow.value['TRIP.TRIPID']}"));

  • How to create soap envelope structure

    Hello Friends,
    I am working on a RFC to webservice sync scenario.Here I am getting response from webservice in soap envelope form which is not matching with my wsdl response structure. I have tried to create the envelope structure manually  but i dint get success. Can any body guide me how to over come with it.
    (I have already checked 'Do not create soap envelop' in receiver soap addapter).
    Regards,
    jayesh.

    Thanks Anupam and Jenny for your kind response.
    I am wrking on PI 7.0. I dnt want soap envelope in payload so I have already checked the 'Do not create response' button still in response message I am getting the soap envelope.
    I can use java or xslt but the the structure is not able to read the soap envelope. To read it I need to create same data structure which matches with the soap envelope.
    this is the response I am getting through webservice.
    <?xml version="1.0" encoding="UTF-8" ?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <createResponse>
    <result>
    <errors>
    <message>Config Master Record Type Name value is missing</message>
    <statusCode>FIELD_CUSTOM_VALIDATION_EXCEPTION</statusCode>
    </errors>
    <id xsi:nil="true" />
    <success>false</success>
    </result>
    </createResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    And this is the wsdl structure
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:createResponse xmlns:ns0="urn:enterprise.soap.sforce.com">
       <ns0:result>
          <ns0:errors>
             <ns0:fields/>
             <ns0:message/>
             <ns0:statusCode/>
          </ns0:errors>
          <ns0:id/>
          <ns0:success/>
       </ns0:result>
    </ns0:createResponse>
    Because of the soap envelope it is not able to read it. I have to create new structure.
    Experts please help me to solve this problem.
    Regards,
    Jayesh.

  • How to create the selection screen dynamically

    Hi,
    I have a requirement to create the selection screen Dynamically. All the fields that should appear on the selection screen will be available in a custom table. So, based on the entries available in the Z tables, the selection screen should be built. Eg. If there are 10 records available in the Z table, the selection screen should consist of 10 fields. If there are 100 entries, the Selection screen should contain 100 fields. and the logic to build this selection screen should be carried out dynamically in the program.
    Could anyone of you please share the valuable inputs on this. If anyone has the sample code to do this, please share.
    Thanks in advance.
    Regards,
    Paddu.

    Hi,
    Kindly go through this sample program below:
    DEMO_LIST_FORMAT_INPUT *and
    check this function module:
    FREE_SELECTIONS_DIALOG *.
    Hope it helps
    Regards
    Mansi

Maybe you are looking for

  • Problems with 7.1.6 on windows and foxfire

    I saw the answers about the problem of a ? when you go to a site with a quick time file. I can play some file that is quick time but when I go to a site that has a quick time Q on it, I get a ?. I read where no one has this problem with foxfire. I do

  • JOptionPane in JApplet

    If I display a JOptionPane through a JApplet, it has "Applet Window" written on its status bar. How do I get rid of the "Applet window" status bar on the message boxes using JOptionPane? From practical experience of applets on the net I'm not used to

  • Convert a JSP to PDF

    Hi everybody! can any one help me in converting the dynamic JSP page to a PDF file including the dynamic content of the page on fly. Please give the saple code too thanks

  • Trying to update payment information site won't work

    I am trying to update my payment yet the site says that it is under maintenance or something like that. It says that it will be back soon and I should check later however I have no access to my music and I would like to get my premium membership back

  • Load images in order

    I have an image gallery of 6 images on a frame of my timeline. what I want to happen is instead of all images trying to load up at the same time when at that point in the timeline I want the 1st image to process and load then move on to the 2nd image