Procedure with a variable number of columns

Hi, I have a procedure that looks like this:

PROCEDURE PROC (p_cursor sys_refcursor OUTPUT)

In the procedure, I build query dynamically and the number of columns varies during execution.

In the end I do

OPEN for REQUEST P_cursor


Then I do call it,.

call PROC (?)

My question is, how could I go on the running query of this procedure, and then adding lines or by modifying the existing results, then return the changed data?

I want to do is add a new rank based on a condition, so I still need to return any number of columns, but I need to modify the results before I return them.

Is it possible to do? I need to do some calculations on columns (variable columns), create a new line, insert in the result set and return this new set of results.

A sys_refcursor is ideal to return to a front end gui such as .NET or Java, which can then use this cursor to retrieve data.

In PL/SQL, there is no point in using a sys_refcursor unless you know, at the time of the design/build the columns returned are going to be.

If the columns resulting are dynamic, so you have no choice but to use the package DBMS_SQL, where you can analyze and run any SQL statement you like and then use the package DBMS_SQL to describe what are the columns that result and how they are. From this, you can reference the columns by position, rather than by name.

for example

CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
  v_v_val     VARCHAR2(4000);
  v_n_val     NUMBER;
  v_d_val     DATE;
  v_ret       NUMBER;
  c           NUMBER;
  d           NUMBER;
  col_cnt     INTEGER;
  f           BOOLEAN;
  rec_tab     DBMS_SQL.DESC_TAB;
  col_num     NUMBER;
  v_rowcount  NUMBER := 0;
BEGIN
  -- create a cursor
  c := DBMS_SQL.OPEN_CURSOR;
  -- parse the SQL statement into the cursor
  DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
  -- execute the cursor
  d := DBMS_SQL.EXECUTE(c);
  --
  -- Describe the columns returned by the SQL statement
  DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
  --
  -- Bind local return variables to the various columns based on their types
  FOR j in 1..col_cnt
  LOOP
    CASE rec_tab(j).col_type
      WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
      WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
      WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
    ELSE
      DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
    END CASE;
  END LOOP;
  --
  -- Display what columns are being returned...
  DBMS_OUTPUT.PUT_LINE('-- Columns --');
  FOR j in 1..col_cnt
  LOOP
    DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                              when 2 then 'NUMBER'
                                                                              when 12 then 'DATE'
                                                     else 'Other' end);
  END LOOP;
  DBMS_OUTPUT.PUT_LINE('-------------');
  --
  -- This part outputs the DATA
  LOOP
    -- Fetch a row of data through the cursor
    v_ret := DBMS_SQL.FETCH_ROWS(c);
    -- Exit when no more rows
    EXIT WHEN v_ret = 0;
    v_rowcount := v_rowcount + 1;
    DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
    DBMS_OUTPUT.PUT_LINE('--------------');
    -- Fetch the value of each column from the row
    FOR j in 1..col_cnt
    LOOP
      -- Fetch each column into the correct data type based on the description of the column
      CASE rec_tab(j).col_type
        WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                     DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
        WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                     DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
        WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                     DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
      ELSE
        DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
      END CASE;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('--------------');
  END LOOP;
  --
  -- Close the cursor now we have finished with it
  DBMS_SQL.CLOSE_CURSOR(c);
END;
/

SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
DEPTNO - NUMBER
SAL - NUMBER
-------------
Row: 1
--------------
EMPNO : 7782
ENAME : CLARK
DEPTNO : 10
SAL : 2450
--------------
Row: 2
--------------
EMPNO : 7839
ENAME : KING
DEPTNO : 10
SAL : 5000
--------------
Row: 3
--------------
EMPNO : 7934
ENAME : MILLER
DEPTNO : 10
SAL : 1300
--------------

PL/SQL procedure successfully completed.

SQL> exec run_query('select * from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
JOB - VARCHAR2
MGR - NUMBER
HIREDATE - DATE
SAL - NUMBER
COMM - NUMBER
DEPTNO - NUMBER
-------------
Row: 1
--------------
EMPNO : 7782
ENAME : CLARK
JOB : MANAGER
MGR : 7839
HIREDATE : 09/06/1981 00:00:00
SAL : 2450
COMM :
DEPTNO : 10
--------------
Row: 2
--------------
EMPNO : 7839
ENAME : KING
JOB : PRESIDENT
MGR :
HIREDATE : 17/11/1981 00:00:00
SAL : 5000
COMM :
DEPTNO : 10
--------------
Row: 3
--------------
EMPNO : 7934
ENAME : MILLER
JOB : CLERK
MGR : 7782
HIREDATE : 23/01/1982 00:00:00
SAL : 1300
COMM :
DEPTNO : 10
--------------

PL/SQL procedure successfully completed.

SQL> exec run_query('select * from dept where deptno = 10');
-- Columns --
DEPTNO - NUMBER
DNAME - VARCHAR2
LOC - VARCHAR2
-------------
Row: 1
--------------
DEPTNO : 10
DNAME : ACCOUNTING
LOC : NEW YORK
--------------

PL/SQL procedure successfully completed.

SQL>

11 g, you can create a sys_refcursor and the DBMS_SQL package then allows you to convert this refcursor in a DBMS_SQL cursor so that you can get the description of results and do the same thing. It is not available before 11 g well.

However_ before any of this, you should really ask yourself if there is a real need to create queries dynamically. There is rarely a need to do and if you find that it is common in your application, then it is often a sign of poor design or bad defined the needs of the business (leaving the technical side to try to be 'flexible' and hence leading to unmaintainable code etc..).

Tags: Database

Similar Questions

  • With a variable number of input ports on a Subvi

    How can I have a Subvi with a variable number of input ports that can be changed in the other VI that uses the Subvi?

    You can't actually do what you trying to do, how LabVIEW is implemented does not screw created by the user with arbitrary entries.  And to be honest, there is probably a better way to do whatever it is you want to do.

    If you really really want to do that, but... you can come kind of close.

    1. create a new VI

    2. change its connector to the one with the inputs and outputs pane more possible (terminals 8-6-6-8, 28)

    3 create controls/indicators for any desired input/output of not scaling can connect the (i.e. the error in / error, son of reference, etc.)

    4. hang them until the connector pane

    5 count how many entries are left and create a control for each entry and their son all

    6 drop your VI on the block diagram of the VI one another as a Subvi

    7. Note that when you mouseover, it looks like a Pincushion

    8. right click the VI and uncheck the "display as icon".

    9. you can now "slide down" at the bottom of the VI

    The terminals in the section "slide down" are as a package by name or node property that you can click on them to reallocate them to what it is not already selected.  The default is to make all the entries in alphabetical order, then all the outputs in alphabetical order.  If you rename the terminals that allows you to make appear in the order that you prefer is up to you.

    As all terminals, for the best that you can do to detect if they are wired is to define a default value that should never be used.  If she is floating points, you can use 'NaN' or 'Inf '.  If this is a cluster that you did, add an item more boolean which is true in the default values for this entry VI.

    Then just wire up all the identical terminals together in a table, filter the items which appear to be unwired and make all your treatment on the rest.

  • How to export data to excel that has 2 tables with the same number of columns and the column names?

    Hi everyone, yet once landed upward with a problem.

    After trying many things to myself, finally decided to post here...

    I created a form in form builder 6i in which clicking on a button, the data gets exported to the excel sheet.

    It works very well with a single table. The problem now is that I cannot do the same with 2 tables.

    Because the tables have the same number of columns and the columns names.

    Here are the 2 tables with column names:

    Table-1 (MONTHLY_PART_1) Table-2 (MONTHLY_PART_2)
    SL_NOSL_NO
    MODELMODEL
    END_DATEEND_DATE
    U-1U-1
    U-2U-2
    U-4U-4
    ..................
    ..................
    U-20U-20
    U-25U-25

    Given that the tables have the same column names, I get the following error :

    402 error at line 103, column 4

    required aliases in the SELECT list of the slider to avoid duplicate column names.

    So how to export data to excel that has 2 tables with the same number of columns and the column names?

    Should I paste the code? Should I publish this query in 'SQL and PL/SQL ' Forum?

    Help me with this please.

    Thank you.

    Wait a second... is this a kind of House of partitioning? Shouldn't it is a union of two tables instead a join?

    see you soon

  • AM Customer Interface + method with a variable number of parameters

    Hello

    I use JDev11 & ADF. I have an App Module exteding, an application custom module (ApplicationModuleImpl) class. I created a few methods and expose them in the Client Interface. I read that I can only use the return types and methods of simple or serialized attributes in the Client Interface of AM. I need to create a method with the variable number and type of parameters, something like "Createwithparams", something like:
        public void Method(String[] FieldNames, Object[] FieldValues)
    Is there a way to do it?

    TKS.

    You just did it. It should work as far as I know.
    If you can not make available the method try list instead of normal array.

    Timo

  • Variable number of columns

    Hello world

    I am a novice for Oracle SQL. I need to create a report where the number of columns, 1-6, be won't know until the report is run. Each column is a COUNT (*) business for a month.

    The user will provide the beginning month & year and the number of months to report.

    My challenge is to summarize the activity as is indicate below with the growing months from left to right and totals for the line.

    My sql is too less. It's a good start, or I'm in foul territory. I should add that eventually there will be multiple lines with line subtotals and totals in case it makes a difference at this point.

    How to genereate the right number of columns with the correct titles for each month?

    Thanks in advance for your help,

    Lou

    The SQL, I have developed so far
    SELECT
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198801') ' 01/1988 ',.
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198802') ' 02/1988 ',.
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198803') ' 03/1988 ',.
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198804') ' 04/1988 ',.
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198805') ' 05/1988.
    (COUNT (*) SELECT TABLE_NAME FROM WHERE TO_CHAR (DATE, 'YYYYMM') = '198806') ' 06/1988 ',.
    (SELECT COUNT (*) FROM TABLE_NAME WHERE TO_CHAR(DATE,'YYYYMM') BETWEEN ' 198801 'and ' 198806') 'Total '.
    FROM DUAL;

    Product of the results of this
    01/1988 02/1988-03/04/1988 of 1988 05/1988-06/1988 total
    111 97 122 110 123 126 689

    If you use SQL * as the reporting tool, you can creatively apply the substitution variables and statements of column redefine your topics (assuming you are using my code above with variable bind this code will rewrite headers, but you can disable output while the configurations):

    var year varchar2(4)
    var month varchar2(2)
    var months number
    
    begin
      :year := &year;
      :month := &month;
      :months := to_number(&months);
    end;
    /
    
    column h1 new_value h1 noprint
    column h2 new_value h2 noprint
    column h3 new_value h3 noprint
    column h4 new_value h4 noprint
    column h5 new_value h5 noprint
    column h6 new_value h6 noprint
    
    select 'c1 heading "' || :year || '-' || to_char(to_number(:month)+0,'fm00') ||
           '"' || case when 1 > :months then ' noprint' else ' print' end h1
         , 'c2 heading "' || :year || '-' || to_char(to_number(:month)+1,'fm00') ||
           '"' || case when 2 > :months then ' noprint' else ' print' end h2
         , 'c3 heading "' || :year || '-' || to_char(to_number(:month)+2,'fm00') ||
           '"' || case when 3 > :months then ' noprint' else ' print' end h3
         , 'c4 heading "' || :year || '-' || to_char(to_number(:month)+3,'fm00') ||
           '"' || case when 4 > :months then ' noprint' else ' print' end h4
         , 'c5 heading "' || :year || '-' || to_char(to_number(:month)+4,'fm00') ||
           '"' || case when 5 > :months then ' noprint' else ' print' end h5
         , 'c6 heading "' || :year || '-' || to_char(to_number(:month)+5,'fm00') ||
           '"' || case when 6 > :months then ' noprint' else ' print' end h6 from dual;  
    
    col &h1
    col &h2
    col &h3
    col &h4
    col &h5
    col &h6
    

    Published by: Sentinel on January 29, 2009 11:26

  • How can I play files CSV lines with a different number of columns?

    Hi all

    I am trying to load CSV with DIAdem 2014 files, and I found there is a great tool, "use".

    However, with the CSV use tool, there are critical problem with my data files. (See photo)

    As you can see the CSV file attached, it includes a lot of lines with different columns.

    And here, use read the number of columns of 1st line (e.g.: 4 columns) and set it as the number of columns to read.

    So I can not load all of the data (e.g.: 53 columns) if first row data were lower than columns.

    Can anyone recommend any approach, please?

    Kind regards

    Young

    Admin 24/03/16 Note: files deleted by request of the user

    I just add a few lines of script and fix the related use. (I just added the code to get a direct look).

    The uri of the file will appear as a new kind of load in the dialog file tiara is intalled by double click

    Would be nice if you could provide some information, how the data was created. Maybe we can it add as official of our web page to use plugin.

    Option Explicit

    Void ReadStore (File)

    File.Formatter.Delimiters = «»
    File.Formatter.LineFeeds = \n
    File.Formatter.DecimalPoint = '. '.

    Dim startLine: startLine = file. GetNextLine()
    <>InStr (startLine, ' [Tenergy Bus Log Data] "" ") then
    call RaiseError()
    end if

    And that not File.Position = File.Size
    Dim groupName: groupName = file. GetNextStringValue (eString)
    If it isn't root. ChannelGroups.Exists (groupName) then
    root. ChannelGroups.Add (groupName)
    end if
    Dim grp: set grp = root. ChannelGroups (groupName)
    Dim i: i = 1
    do for real
    Dim val: val = file. GetNextStringValue (eR64)
    If isempty (val) then
    Exit
    end if
    < i="">
    dial the grp. Channels.Add ("Brand" & I, eR64)
    end if
    protected chObj: set chObj = grp. Channels (i)
    chObj.Values (chObj.Size + 1) = val
    i = i + 1
    loop
    Call File.SkipLine)
    Wend

    End Sub

  • function with a variable number of cubic curves

    Hello

    I have a set of data : a set representing the independent variable and a set representing the dependent variable. I need to find the minimum number of cubic curves (find their coefficients) that reduce the average quadratic error less than a given tolerance. If the tolerance is higher than 17 particular segments, so I need to raise an error.

    You have an idea what function blocks, I need to?

    I could use general polynomial Fit VI with order 3 and its default method to check the residue. If the residue is greater than the given tolerance, so I could try to use two cubic curves and test them on different starting and ending points until the residue is less than the given tolerance. If tolerance is not guaranteed, I add another curve and I test again the Assembly as shown above. By iteration until the residue is less than the given tolerance, or until I would need to add 18th cubic curve.

    If there was something ready, I would be grateful.

    Thank you.

    Fabiobonelli wrote:

    Please, you can test your VI adding another point to four present?

    X =-6453

    Y =-266

    Check the residue.

    Thank you.

    Did you even read my response? You have a serious air conditioning problem because the data is on a narrow Beach far from zero. By example-6500 ^ 3 is smaller that - 2E11, i.e. a value that many (many!) is orders of magnitude different from that of the constant term (1). The linear algebra problem that results is very ill, conditioned and just blindly Ford over the accelerator pedal are bad advice here.

    This isn't a problem with the implementation of LabVIEW, but a fundamental vice that you encouter also (or worse) If you would do your own math. No way around it. (See also)

    My recommendation is to delete the X offset and add it later again. Now things work correctly. (Note that a second order polynomial fitting still works without twist it).

    Try the and see for yourself.

  • Reading the file in spreadsheet with a variable number of delimiters

    Dear Forum,

    I would like to read a file in spreadsheet (text) generated by a 3rd party program. It turns out that, while the program generates columns separated by spaces, the number of spaces between the columns varies in a way that I still have to sort out. This isn't a problem if I want to

    to read in the file in excel (or equivalent) - but the functions of 'chain of worksheet to the table' LabView does not seem to be able to deal with him - if I get home 'space' as a separator it only accepts one * only * space... is possible to indicate "zero or more" spaces to this function? [I know I can do a lot of loops and read the elements of a number at a time, but it is very slow, so I'd rather avoid it]

    Thank you

    Niels

    Hello Marshall,.

    The string of worksheet to the table can actually accept an array of delimiters, so you can wire a table 1 d that contains the delimiters you want to watch for--one, two, or three spaces, etc.

    To do this, simply create an array of strings 1 d containing delimiters and son in the entry delimiter in the upper part of the primitive.  Like most primitives, function is polymorphic.

    If the program that generates this file does not limit the spaces he inserts somehow or uses spaces elsewhere in the data, you might encounter problems, but for most cases, I think that should suffice.

    Best regards

  • Reading a CSV with a large number of columns

    Hello

    I tried to read data from files large csv with 38 columns by reading a line using readline and scan using the scan linebuffer.

    The file size can be up to 100 MB.

    Scan does not seem to support the large number of areas.

    Suggestions to the comma separated fields 38 reading. There is a header row in the file.

    Thank you

    Have you considered the use of the modifier "rep"? You can find examples in help, search for 'chain with real table ASCII Comma-separated numbers '.

  • Procedure with an infinite number of settings?

    Hello readers - good evening.
    I wonder how to create a procedure/function with several parameters.
    For example Oracle supplied function 'GREATEST', 'LESS '. I don't know if there is no limit on values how much we move to this, but for practical reasons, it is sufficient, if you want to spend 2 or 200.

    Have we not specify all the settings (by default NULL) at creation time? or is there a better way?

    Thank you
    Lherault

    Published by: viswapsp on December 20, 2010 20:53

    You can use the collection as a parameter
    For example:

    create function many_params(nc in sys.odcinumberlist)
    return number
    is
      ret number;
    begin
      select max(column_value) into ret from table(nc);
      return ret;
    end;
    /
    select many_params(sys.odcinumberlist(1,23,3,4,5,6)) from dual;
    

    Kind regards
    Sayan M.

    Published by: xtender on 21.12.2010 12:52

  • Is it possible to create a PDF with a variable number of lines?

    I am a very new adobe user, but before my company invests in software need to know if this is possible.  The general idea is that we need to be able to create a form in adobe/livecycle, that people who use the drive can be filled.  The problem is that whenever this form is completed, it will have a different number of lines.  Is it possible to create a form that whenever a row is filled (with a description and a price) which will be generated a new line with the same fields to serve?  Create lines on the form is not an option, because the range can be up to several hundred or beyond in some cases and it is not realistic for us to have several pages of lines to be used when the majority of the time, that only the first page will be used, then when the form is printed additional empty pages is printed.  Currently, we use an excel form to accommodate our needs with the only downfall being that all users of the form have to buy microsoft office.  Any help?

    Hello

    Yes it is possible, but you should ensure that you follow a few best practices to ensure that the form with several rows of hundred become slow or unstable.

    There are a few examples of dynamic tables here, which at least should give you an idea of what is possible. Open in Acrobat/Reader to see user experience, you can also open in the designer to see how the form is built.

    Index: http://assure.ly/lwQHm7.

    Sections and tables: http://assure.ly/fItII5.

    It's more detailed / teaching and shows how to place the form of dynamic behavior: http://assure.ly/gk8Q7a.

    Hope that helps,

    Niall

  • How to display a folder db with a variable number of attached documents

    I am building a website for a show air http://www.hollisterairshow.com and the organizer would like to put a list of things he needs for the show and have people to respond via the website. For example, it will take 20 tents, and potentially up to 20 people could answer, each offering a tent, or fewer people may each offer several tents. I would like to create a view showing the necessary point and below a line for every offer he receives. I already have a couple of tables defined, one called "needs" and the other called 'offer', the 'offers' table contains a column called 'needId' that is the index of the table needs.

    So far, I created a recordset to join the tables but each line contains the need and supply, so I see the need repeated on each line and I want only to see once. Here's the SQL code generated by DW CS4

    SELECT needs.needId, needs.title, needs. "description', needs.quantity, needs.needMet, offers.needId, offers.offerId, offers.name, offers.email, offers.phone, offers.quantity, offers"comment. "
    Needs, offers
    WHERE needs.needId = offers.needId
    ORDER BY needs.title

    I'm sure there must be a simple solution for this, but I am unable to understand. I am new to SQL and this as a volunteer for the aerospace industry.

    Thank you

    Tony

    > Is it possible to do this? I would like to

    > need a different set of records or am, I still

    > looking at a layout problem?

    You don't need a different set of records. It is only a slight modification. For each record, test if the ID has changed. If so, print the header, a line break, and then the details of the line. If this isn't the case, print only the details of the line.

  • Megasign for the Document with a variable number of signatories

    I can't seem to find any documentation on this and would appreciate any support that the community could provide.

    Here is the example:

    I have a CSV document that contains information specific to each child enrolled in a program, including parents or guardians names and e-mail addresses.

    I would like to send a waiver for every registered child who meets the relevant information about the child (allergies, registration dates, age, etc.) - and requires that all the signatures of parents and guardians on the same document before the respective instructor opposites.

    * Waiver of the child a required 5 signatures (mother, father, mother-in-law, Nanny, brother), while another waiver of the child could require only 1 signature (parent).

    Because I have 350 of them to issue, it is possible to use Megasign to send these waivers signed by the guardians respective all at once? If so, any guidance would be greatly appreciated.

    Hello

    Please refer to the links below: -.

    Public Knowledge Base

    Public Knowledge Base

    https://Adobe.echosign.com/doc/MegaSignTutorial.PDF

    Let me know if it helps.

    Kind regards

    Mohamed

  • How to recover the large number of columns for all items at once

    I have a table (T1) with a large number of columns (50). I am building a page on which I would like to consolidate these columns in some regions:

    Region: has
    Items i1 - i10

    Region: B
    I11 - i20 items

    Region: C
    I21 elements - i30

    Etc.

    The majority of the articles on this page are extracted from the same table (T1). So far, the type of each source element has the value SQL query and each item has the motion of the source is defined as:

    SELECT column1 FROM t1 WHERE t1id =: global_item

    What is the best practical approach to retrieve values for all items on this page? Is there a way to retrieve all the columns point at the same time, something like:

    SELECT column1, Column2, Column3, column50 FROM t1 WHERE t1id is: global_item

    Instead of:

    I1 point source:
    SELECT column1 FROM t1 WHERE t1id =: global_item

    Point source i2:
    SELECT Column2 FROM t1 WHERE t1id =: global_item

    Point i3 source:
    Column3 SELECT FROM t1 WHERE t1id =: global_item

    Item i50 source:
    SELECT column50 FROM t1 WHERE t1id =: global_item

    For each item on this page, when they are displayed?

    Thank you for your time.

    Daniel

    Set the source of static assignment type item and delete individual values of source of SQL query. Create a process before the header PL/SQL along the lines of

    begin
    
      select
                column1
              , column2
              , column3
                ...
              , column50
      into
                :i1
              , :i2
              , :i3
                ...
              , :i50
      from
                t1
      where
                t1id = :global_item;
    
    end;
    

    OR

    Create an automated process line go through the wizard for the table T1, then set the Source Type of the database column and the source values for each item in the name of the corresponding column in the T1.

  • Dynamic number of columns in the table

    Hello

    I use JDev 10.1.3.3.0 with ADF. I just want to create a table, with a dynamic number of columns in the table. The background is that a user of my webapplication can create and submit a sql query. Now, I have to show him the results. My idea was, I have save the result in a bean managed (ResultTable), which is stored in the session context and map at my table in my page.

    If I search the Forum and don't get only one useful thread: {: identifier of the thread = 971888}, but I don't exactly understand. What is the CollectionModel? Do I need this?

    I'm trying to report on the following:

    ResultTable
    public class ResultTable {
    
        public static final String SESSION_NAME = "ResultTable";
        private ArrayList<ResultColumn> columnList; 
        private CollectionModel collectionModel;
    
        public ResultTable() {
        }
    
        public ArrayList<ResultColumn> getColumnList() {
            return columnList;
        }
    
        public void setColumnList(ArrayList<ResultColumn> columnList) {
            this.columnList = columnList;
        }
    }
    ResultColumn
    public class ResultColumn {
        
        private ArrayList<ResultRow> rowList;
        private String name;
    
        public ResultColumn() {
        }
    
        public ArrayList<ResultRow> getRowList() {
            return rowList;
        }
    
        public void setRowList(ArrayList<ResultRow> rowList) {
            this.rowList = rowList;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    ResultTable
    public class ResultRow {
        
        private String value;
    
        public ResultRow() {
        }
    
        public String getValue() {
            return value;
        }
    
        public void setValue(String value) {
            this.value = value;
        }
    }
    My showResult.jspx
    <af:table emptyText="No items were found"
              value="ResultTable.columnList"
              var="column"
              varStatus="colStatus"
              id="table1">
      <af:forEach items="#{column.rowList}" var="row" varStatus="rowStatus">
        <af:column sortable="false" headerText="#{column.name}" 
                   id="column#{colStatus.index}">
          <af:outputText value="#{row.value}"
                         id="outputText#{rowStatus.index}"/>
        </af:column>
      </af:forEach>
    </af:table>
    The ResultTable was filled with data, but the Board is not filled. So, I think, it must be rejected to the data binding.

    I get warnings and errors to run too. But I don't know if they are the result or cause of my problem.
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.renderkit.core.xhtml.TableRenderer renderTableWithoutColumns
    WARNUNG: Table with id: form1:table1 has no visible columns!
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:span does not match start name:div
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:span does not match start name:div
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:form does not match start name:span
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:body does not match start name:form
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:html does not match start name:body
    Concerning

    Majo

    Hi Mario,.

    
      
        
          
        
      
    
    

    Note that your JSPX snippet above has serious shortcomings:

  • 'ResultTable.rowList' is not an EL expression, but the value attribute of the af: table must refer to an EL expression
  • Items AF:foreach = "#{row.cellList}"-you don't have to store information about the columns of all rows, more it won't work as af:forEach tag may not see the value of the expression of EL #{line} (or any component EL expression created). " See the tagdoc here: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/forEach.html
  • "ID =" Column #{cellStatus.index} "and id =" outputText #{rowStatus.index} "are invalid and that they don't compile even as id attributes cannot contain EL expressions.

    .

    I think to solve your problem, you need three things:

  • List of columns (for example the list If you need to store only the names of column or list If you need additional information),.
  • list of lines,
  • a line can be a map (with the name of the column - cell data mapping; card e.g.) or a list (with columns indexed; for examplelist).

    Example with the lines of the map:

    JSPX snippet:

    
      
        
          
        
      
    
    

    The ResultTable bean:

    public class ResultTable {
    
        private List columnList;
        private List> rowList; 
    
        public ResultTable() {
        }
    
        public List getColumnList() {
            return columnList;
        }
    
        public void setColumnList(List columnList) {
            this.columnList = columnList;
        }
    
        public List> getRowList() {
            return rowList;
        }
    
        public void setColumnList(List> rowList) {
            this.rowList= rowList;
        }
    
    }
    

    Type ResultColumn:

    public class ResultColumn {
    
        // additional fields if needed...
        private String name;
    
        public ResultColumn() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    

    AF:table display correctly after the initialization of the values in your beans properly filled ResultTalbe (e.g. to fill the list of rank with the lines).

    Hope this helps,
    Patrik

Maybe you are looking for

  • How can I change the value of a control on front panel?

    On the front panel, I'm doing a complex control that consists of a Slider control and control of the digital inputs. Both controls display the same information and either may be used for entry. When changing value, I want the other control to display

  • To access network shared files on active directory on one subnet to the other

    Hello, please, I have this problem with my network; I have a windows 2008 standard edition as my domain controller, I have a router cisco with two Lan port, a port has this subnet:172.29.24.0/24 and the other has this subnet 172.29.25.0/25.Both subne

  • HP Pavilion dv7-4295us Enterta: DVD/CD

    According to the specifications, this laptop has a BD player.  But does that mean I can burn BD discs (double layer)?  I found no related POSTS to answer my question.  I have VideoStudio Pro7 and get an error message every time that I try to burn a B

  • BBM BBM user ID

    Hello I signed yesterday for BBM on my IPHONE and initially thought it would be smart to create a new BBM account instead of using my existing account, that I already have contacts, etc on my BLACK BERRY work. I've reconsidered and now can not find a

  • navto://relative/parent does not work in the Web Viewer

    HelloWe have recently added in one of our app a menu navigation that points to a different section of a publication. We have also added the option to revert to the parent with the navto://relative/parent link collection.It works very well on tablets