Sys_refcursor from a table variable with columns per row not fixed

i am creating a crosstab aggregation report where the number of columns in a table is determined at runtime from the dataset.
so, i have:
type strArray is table of varchar2(32767);
type strArray2 is table of strArray index by pls_integer;
i want to return a sys_refcursor (created from a strArray2 type variable) so a BIRT .rptdesign file can use it.
sqldeveloper complains table not found when i do open for on the sys_refcursor.
i cannot do a table of user defined record type because the number of columns depends on the dataset and therefore not fixed.
how to get the sys_refcursor which upstream api can use ?

Not exactly sure what you want to do and why... Keep in mind that pulling data from the SQL engine into the PL/SQL engine (or into external code lke Java) and processing it there, can never be as fast or scale as well as crunching that data in the SQL engine instead. So where processing can be done in the SQL engine, do it there.
As for a 2D array definition and SQL projection, you can have a look at something like the following. Not sure if this is the approach you have in mind though. (note: the implicit cursor used could very easily be exposed to an external client via a ref cursor interface):
SQL> --// 1 dimensional array definition
SQL> create or replace type T1D is table of varchar2(4000);
  2  /
Type created.
SQL> --// 2 dimensional array definition
SQL> create or replace type T2D is table of T1D;
  2  /
Type created.
SQL>
SQL> declare
  2          arr2D   T2D;
  3  begin
  4          select
  5                  T1D( object_id, object_type, object_name )
  6                          bulk collect into
  7                  arr2D
  8          from    user_objects;
  9 
10          for x in 1..2   --// just showing the 1st 2 elements and not arr2D.Count
11          loop
12                  for y in 1..arr2D(x).Count
13                  loop
14                          DBMS_OUTPUT.put_line( 'x='||x||' y='||y||' value='||arr2D(x)(y) );
15                  end loop;
16          end loop;
17  end;
18  /
x=1 y=1 value=296403
x=1 y=2 value=PACKAGE
x=1 y=3 value=SYSLIB
x=2 y=1 value=296404
x=2 y=2 value=PACKAGE BODY
x=2 y=3 value=SYSLIB
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • How to rerieve records from the table starting with character 'D'

    Hi Folks,
    How to get the records from the table starting with character 'D'.
    Select Max (fld1) fron tab1 into tab1-fld1 where fld 2 = l_fld2 and starting character of fld(1) is 'D'.
    last record in the table starting with character 'D'
    How can i do that??
    Pl explain.
    Thanks,
    Matt

    Hi,
    Select Max (fld1) fron tab1 into tab1-fld1 where fld 2 = l_fld2 and starting character of fld(1) is 'D'.
    Select MAX (fld1)
       From  tab1
    into table itab
    where fld 2 = l_fld2
       and fld1 like 'D%'.

  • Interactive Report - Icon View - Dynamic Columns per Rows ?

    Hi all,
    We use the icon view functionnality in Interactive Report.
    Is there a way to display the 'columns per row' attribute as an application item and set it dynamical via PL/SQL ?
    Any suggestions?
    Thanks in advance for advices,
    Regards,
    Grégory

    Hi,
    Apex 4.0 interactive reports and images (Scott's thread)
    Have some useful information and pointers to the solution you are looking for.
    I hope this help.
    Thank you,
    Ranish

  • Hi! I lost my iphone. to search the police need the imei of my iphone. Box from iphone I have with itunes I have not synchronized. how do I know my phone IMEI??

    hi! I lost my iphone. to search the police need the imei of my iphone. Box from iphone I have with itunes I have not synchronized. how do I know my phone IMEI??

    Is the IMEI number on the box.
    These are the ways to get the IMEI http://support.apple.com/kb/ht4061
    If none of these help then you cannot get it

  • Querying the schema for table name with column value!

    In my schema i have 500+ tables and other objects.
    i have a column with the name BO_PRODUCT_CODE.
    I wants to know in what tables the value of BO_PRODUCT_CODE='FX03'.
    i have query the user_tab_columns which gives me the result with 90 tables having the column BO_PRODUCT_CODE.
    What is query which will give me the exact number/name of the table whose column value is FX03. ie, BO_PRODUCT_CODE='FX03'.

    Hi you can use this approach:
    BEGIN
    v_str VARCHAR2(250);
    v_count NUMBER :=0;
    DECLARE
    FOR loop_tbl IN ( SELECT DISTINCT table_name FROM USER_TAB_COLUMNS
    WHERE column_name ='BO_PRODUCT_CODE' )
    LOOP
    v_str := 'SELECT COUNT(*) FROM ' || loop_tbl.table_name || ' WHERE BO_PRODUCT_CODE=||'''' ||'FX03' || '''' '
    EXECUTE IMMEDIATE v_str INTO v_count ;
    IF v_count > 0 THEN
    DBMS_OUTPUT.PUT_LINE ('Table Name :'|| loop_tbl.table_name || ' Count :'||v_count);
    END IF;
    v_count :=0;
    END LOOP;
    EXCEPTION
    WHEN others THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END;
    Please remove if any syntax error.
    Regards

  • How do you select an item from a table indicator with a mouse click and then use that selection in code?

    Hi,
    I am displaying a list of filesfrom a directory  in a table on the front panel of a VI as part of a program I am developing. I would like the user to be able to select from that table so that particular file can be processed. Is there a way to do this?
    Thanks,
    Aaron

    you'll find that most of the useful functionality of the labview user control interface is hidden within the property node and invoke node functions. just right click a control or indicator terminal on the block diagram and mouse over to create, then to property node or invoke node. lots of fun stuff in there. attached is an example. one file is saved for labview 8.0, the other is saved for labview 8.6.
    Message Edited by Root Canal on 10-16-2008 11:17 AM
    global variables make robots angry
    Attachments:
    file selection table.vi ‏26 KB
    file selection table lv 8.0.vi ‏42 KB
    file selection table.PNG ‏18 KB

  • How to create advance table region with columns by code

    hello friends
    i need to create advance table region and columns dynamically ... for that i want to know any code snippet do you have
    please share with me that would be really great help

    Hi ,
    It is not possible through code but
    1.) U can create a new custom OAAdvanced table under a custom region using JDeveloper.
    2.) Create stack layout bean using personalization on the page ,and in extend property of StackLayoutBean mention the complete path of above custom region .
    Thank
    Pratap

  • How to select columns in a table by their column id and not the column name

    Hello,
    How do you select columns from a table based on their column_id.
    I have create a view
    but other than Select * , i cant now select one just one column from it
    the view as follow:
    create view count_student as
    select a.acode "acode",aname "Activity Name",count(ae.acode) "Number of student joined"
    from aenrol ae, activity a
    where a.acode= ae.acode
    group by a.acode,aname;

    The issue is that you have decided to use quoted column names. A pretty horrible idea (mostly for the reasons that you are now finding).
    Re-create the view and get rid of the silly double quotes.

  • How to get data from large table (more than 9 million rows) by EJB?

    I have a giant table, it has more than 9 million rows.
    I want to use ejb finders method to get data from this table but always get not enough memory error or time out error,
    Can anyone give me solutions?
    Thx

    Your problem may be that you are simply trying to load so many objects (found by your finder) that you are exceeding available memory. For example if each object is 100 bytes and you try to load 1,000,000 objects thats 100Mb of memory gone.
    You could try increasing the amount of memory available to OC4J with the appropriate argument on the command line (or in the 10gAS console). For example to make 1Gb available to OC4J you would add the argument:
    -Xmx1000m
    Of course you need have this available as hard memory on your server or you will incur serious swapping.
    Chris

  • Select from 1 table only if a value does not exist

    Hello all,
    I'm having problems devising a single select statement to accomplish a single return value. I have tried variations of DECODE and COALESCE, but it's escaping me.
    I have two tables that are as follows:
    NAME
    ID, FULLNAME
    1, Senior
    2, Junior
    3, Mister
    4, Senor
    5, Miss
    ABBREVIATION
    ID, ABBREV
    1, Sr
    2, Jr
    3, Mr
    5, Ms
    What I would like to do is select from the NAME table only if the value does not exist in the ABBREVIATION table.
    Ideally if I were to do something such as:
    SELECT * FROM .... WHERE (ID=1 or ID=2 or ID=4) ....
    I would receive the following output:
    1, Sr
    2, Jr
    4, Senor
    Thanks for reading!

    You want an outer join.
    SELECT decode(a.abbrev, NULL, n.fullname, a.abbrev)
    FROM name n,
    abbreviation a
    WHERE n.ID = a.ID(+)
      AND ....Something like that.
    Full example:
    with n as (
    select 1 as ID, 'Senior' as FULLNAME from dual UNION ALL
    select 2 as ID, 'Junior' as FULLNAME from dual UNION ALL
    select 3 as ID, 'Mister' as FULLNAME from dual UNION ALL
    select 4 as ID, 'Senor' as FULLNAME from dual UNION ALL
    select 5 as ID, 'Miss' as FULLNAME from dual),
    a as (
    select 1 as ID, 'Sr' as ABBREV from dual UNION ALL
    select 2 as ID, 'Jr' as ABBREV from dual UNION ALL
    select 3 as ID, 'Mr' as ABBREV from dual UNION ALL
    select 5 as ID, 'Ms' as ABBREV from dual)
    select decode(a.abbrev, NULL, n.fullname, a.abbrev)
    from a, n
    where n.id = a.id(+)
    order by n.id;
    ID                     DECODE(A.ABBREV,NULL,N.FULLNAME,A.ABBREV)
    1                      Sr                                       
    2                      Jr                                       
    3                      Mr                                       
    4                      Senor                                    
    5                      Ms                                       
    5 rows selectedEdited by: tk-7381344 on Nov 17, 2008 1:31 PM

  • Excel tables... columns and row formatting after I update the indesign page

    When my excel table gets updated in indesign I lose formatting (hight/wide) for the columns&rows. There are 26 columns and each one is a difference size. Do I have to formatting (hight&wide) each column and row every time the excel table is updated?

    We have many publications with statistical tables, which are done in excel. We want to try to do some publications with only tables and do it in-house. The problem is when we place the table in indesign and finish formatting the table. We will get a updated table that needs to be updated in indesign. But when we do we update we lose all of the indesign formatting. Fixing the fonts, type size, etc is easy but how do we get back the all column widths.

  • Group by with column alias does not work?

    Hello,
    The column alias is not working in the group clause?
    select col1,col2-col3 "col23", sum(col4)
    from table1
    group by col1,col23
    Error is col23 is invalid identifier.
    Thank you.

    I guess it's the double quotes around bonus:
    SQL> select empno, deptno, sum(bonus)
      2  from
      3  (
      4     select empno, (sal + 500) bonus, deptno
      5     from emp
      6  )
      7  group by empno, deptno
      8  ;
                   EMPNO               DEPTNO           SUM(BONUS)
                    7900                   30                 1450
                    7369                   20                 1300
                    7499                   30                 2100
                    7521                   30                 1750
                    7566                   20                 3475
                    7654                   30                 1750
                    7698                   30                 3350
                    7782                   10                 2950
                    7788                   20                 3500
                    7839                   10                 5500
                    7844                   30                 2000
                    7876                   20                 1600
                    7902                   20                 3500
                    7934                   10                 1800
    14 rows selected.

  • Table section with 3 header rows pagination issue

    Hi experts.
    I have a table section pagination issue. In my case the table section combines 3 header rows.
    Down bellow the series of screenshots I hope they describe my example well (click on screenshots to enlarge).
    1) The data context
    2) Layout elements
    Here is my issue (table header output at the end of the page but there is no data row):
    As you can see on the first page there is no more place for a data row but the header still exists.
    if I set keep with next flag on the pagination tab for all header rows the result will be:
    Is it possible somehow to fix it?
    I would like to have the header row output on the page only if a data row exists bellow the header, the footer should only output if a data row exists above.
    Here is PDF output:
    https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B4wQz1XhRuysMzhiN2EyYzM tMDdjZS00Yzc3LWIyNTgtODUzZWRhY2MwYjMx&hl=en_US
    https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B4wQz1XhRuysNmYxNGFlOTk tZGQ2MS00MDQ3LTgyMWUtZTg4YmEwYWRmMWQ4&hl=en_US

    The solutions is easy. You´d better create the corresponding DDIC objects hierarchy in the backend and then use the form to PRINT the prepared data ONLY. I mean:
    In your backend:
    in a row there is a dataset (table) and a optional dataset (table) == DDIC structure with two "fields" of type "table" = row A
    use this "row" to create the "outer" table == DDIC table type with row A
    Then you can just drag and drop this structure in your adobe form and will have do difficult with formatting.
    Regards Otto

  • Can you convert a variable text (spanning multiple rows) but fixed

    Hi all,
    I have a PDF table with 5 columns, couple of title rows at the top and four lines per row table into Excel? I'd want each excel row to have four lines as four combined rows. Think of each column as a date, an ID, a mailing address, an amount and a comment. It looks like a typical form, but on multiple pages (about 27) and I want all the info as an Excel table. Can I convert this PDF doc into Excel?
    Any pointers and/or solutions welcome... Please help.
    Thanks much in advance,
    Nash

    No, there isn't. Pages can't break within a row, only between rows.
    If you not are going to print the document you can change the paper size to something larger/longer. File > Page Setup > Paper Size > Manage custom sizes

  • ImportTextData fails with an error: row not found

    In am using Acrobat XI.  In a js script in an action wizard the statement this.importTextData("mypath", 0) continues to return a 3 "error: row not found".  I have checked the path and it is correct.  The text file was created by Access 2013 and is tab delimitated.  What am I doing wrong?  The top row in the txt file is the column names and there are 3 rows of data. 

    What happens when you try to import from the data file manually?
    If you have a field named "A.0" as you said, you have to have a matching column header, but you said you just have "A", "B", and "C".

Maybe you are looking for

  • Email PDF Convertion problem

    Hi, Thanks to the DIS, I'm able to check-in e-mail in my Content Server; As for Word, Excel and Powerpoint files, I would like to convert this incoming e-mail in PDF. As indicated in the PDF COnvertor documentation, it is possible to convert e-mail m

  • How can i add formula to waveform data type?

    I want to interpolate my acquired data in terms of voltage to temperature. For this i need to use polynomial equation, but i am not able to directly attach formula node to the waveform data type. I want to know how can i add formula node to waveform

  • Uninstall current video drivers

    Good afternoon all: I just purchased a HP Envy Phoenix 810-160.  I want to replace the current video card (NVIDIA GeForce GT 640 graphics) and replace it with an EVGA GeForce GTX760 FTW.  The EVGA website recommends uninstalling all current video dri

  • Webservice Client with Secure WSDL?

    I have a WSDL which is user id and password protected. How do I generate the web services client for this secure wsdl? weblogic clientgen ant task doesn't seem to accept the user id and password. Any suggestions? Appreciate your help.

  • Using CIF for non-SAP APS

    Hello world, we would like to use CIF for master data, but our company is using NSKEP, a non-SAP APS. This has a datahub included, which can be used for middleware purposes (mapping, etc.) Since in the future we could change to APO, we think CIF woul