Problems with dynamic table

When i run the following code I get these exceptions. the exceptions appear when i enter something in the table. And i can't find out wat i'm doing wrong!!Could you please help me out with this problem.
code:
MyTableModel myModel = new MyTableModel();
JTable table = new JTable(myModel);
JScrollPane scrollPane = new JScrollPane(table);
this.getContentPane().add(scrollPane, new XYConstraints(22, 130, 580, 198));
//opmaak van de kolommen optie en commentaar
setUpOptieColumn(table.getColumnModel().getColumn(0));
setUpCommentaarColumn(table.getColumnModel().getColumn(1));
publiic void setUpOptieColumn(TableColumn optieColumn) {...}
public void setUpCommentaarColumn(TableColumn commentaarColumn) {...}
public void setValueAt(String value, int row, int column)
System.out.println("value: " + value);
System.out.println("Row: "+ row);
System.out.println("column: "+ column);
if (column == 0)
System.out.println("value: " + value);
System.out.println("Row: "+ row);
System.out.println("column: "+ column);
code = value;
myModel.data.add(row,new tabelgegevens (code,"",false));
if (column == 1)
System.out.println("value: " + value);
System.out.println("Row: "+ row);
System.out.println("column: "+ column);
myModel.data.add(row,new tabelgegevens (code,value,false) );
table.tableChanged(new javax.swing.event.TableModelEvent(myModel));
- MyTableModel -
class MyTableModel extends DefaultTableModel
protected static int NUM_COLUMNS = 3;
protected static int START_NUM_ROWS = 1;
protected int nextEmptyRow = 0;
public int numRows = 1;
static final public String code = "Code";
static final public String omschrijving = "Omschrijving";
static final public String wissen = "Wissen";
public Vector data = null;
/*final String[] columnNames = {"Code",
"Omschrijving","Wissen","test"};*/
/*Object[][] data = {{" "," ",new Boolean(false)," "}};*/
public MyTableModel()
data = new Vector(0,1);
data.addElement(new tabelgegevens ("","",false));
public int getColumnCount() {
return NUM_COLUMNS;
public int getRowCount() {
return numRows;
public String getColumnName(int column) {
switch (column)
case 0:
return code;
case 1:
return omschrijving;
case 2:
return wissen;
return "";
public Object getValueAt(int row, int column)
try{
tabelgegevens tg = (tabelgegevens) data.elementAt(row);
switch (column)
case 0:
return (Object)tg.code;
case 1:
return (Object)tg.omschrijving;
case 2:
if (tg.wissen)
return (Object)"true";
else
return (Object)"false";
}catch (Exception e)
return "";
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
public boolean isCellEditable(int row, int col)
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if (col > 2) {
return false;
} else {
return true;
exceptions:
Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
     at java.util.Vector.elementAt(Vector.java:417)
     at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:674)
     at javax.swing.JTable.setValueAt(JTable.java:1737)
     at javax.swing.JTable.editingStopped(JTable.java:2992)
     at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:112)
     at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:242)
     at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:176)
     at javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(DefaultCellEditor.java:251)
     at javax.swing.JComboBox.fireActionEvent(JComboBox.java:870)
     at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:894)
     at javax.swing.JComboBox.contentsChanged(JComboBox.java:950)
     at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:79)
     at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:86)
     at javax.swing.JComboBox.setSelectedItem(JComboBox.java:415)
     at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:455)
     at javax.swing.plaf.basic.BasicComboPopup$ListMouseHandler.mouseReleased(BasicComboPopup.java:582)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
     at java.awt.Component.processMouseEvent(Component.java:3715)
     at java.awt.Component.processEvent(Component.java:3544)
     at java.awt.Container.processEvent(Container.java:1164)
     at java.awt.Component.dispatchEventImpl(Component.java:2593)
     at java.awt.Container.dispatchEventImpl(Container.java:1213)
     at java.awt.Component.dispatchEvent(Component.java:2497)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
     at java.awt.Container.dispatchEventImpl(Container.java:1200)
     at java.awt.Window.dispatchEventImpl(Window.java:914)
     at java.awt.Component.dispatchEvent(Component.java:2497)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
thx
lanfeust79

I agree that creating a vector with size 0 isn't very useful. I've changed it, but i'm still getting the same exception.
I think the problem is in the 'getValueAt' method, although i can't figure out where it is.
I'm sorry i'm such a pain in the ass but i appriciate a lot your help.

Similar Messages

  • Problem with Dynamic Table Name

    Hello all,
    I am having trouble using a dynamic table name. I have the following code.....
    declare l_cur sys_refcursor;
    l_ID int;
    l_tableName varchar(30);
    BEGIN
    open l_cur for
    select hkc.ColumnID, mapping from &HKAPPDB_Schema_Name..doctablemapping ddm
    inner join &HKDB_Schema_Name..HKColumns hkc on hkc.doctablemappingid = ddm.id
    where ddm.id > 0;
    LOOP
         FETCH l_cur into l_ID, l_tableName;
         EXIT WHEN l_cur%notfound;
         -- update missing VerbID in DocumentDocMapping table
         UPDATE &HKAPPDB_Schema_Name..IndexedDocument
         SET VerbID = (SELECT t.VerbID
                             FROM (SELECT DocRef, VerbID, DateUpdated
                                  FROM &HKAPPDB_Schema_Name..l_tableName dd        - this is where the dynamic table name is used
                                  WHERE dd.VerbID is not NULL))
         WHERE HKColumnID = l_ID AND VerbID is NULL;
    END loop;
    end;
    /When I try to execute this i get an error
    ORA-00942: table or view does not exist
    What am I doing wrong?
    Regards,
    Toby

    redeye wrote:
    I only started about 6 weeks ago, with no tutorials and learning it on the fly; Same here.. only my introduction was to a 12 node Oracle OPS cluster all those years ago.. and required a whole new mind set after using SQL-Server extensively. But it was fun. Still is. :-)
    but thats what you get when a company throws you in at the deep end with a ridiculous time constraint to migrate a whole MSSQL DB.Migrating SQL-Server to Oracle is not a simple thing. A lot of best practices in SQL-Server are absolutely worse practices in Oracle - they are that different. Simple example is lock escalation - an issue in SQL-Server. In Oracle, the concept of a lock being escalated into a page lock simply does not exist.
    In terms of getting the migration done as quickly and painlessly as possible I try to reuse all the logic as it appears in the MSSQL code - in this case it was using dynamic table names. I do not doubt that i am probably shooting myself in the foot in the long run.....As long as you do not splatter too much blood on us here.. not a problem :D
    Seriously though - just keep in mind that what works in SQL-Server may not work as well (or even at all) in Oracle. So do not hesitate to refactor (from design to code to SQL) mercilessly when you think it is warranted.

  • Problem with dynamic table

    As users write a lot in text fields of, the table jumps to another page (it doesn't look nice) and overflows. Users can't see the rest of the table.
    The problem seems to be the subform below. Do you have any ideas to avoid this without changing much the interface?
    Cheers,
    Edigo
    PS: I couldn't find the attachment button to upload the form..it used to be at the bottom!!
    Please check here for the form
    http://www.megaupload.com/?d=OKGA03VE

    Edigo,
        Here is the updated file for the issue with the Overall Field.
    https://acrobat.com/#d=gDwYFDJIa6zSQ9JAtAaXUQ
        See if the suggessitions column is working as per your requirement..
    One thing is if you enter more text in any of the field, the Table/Row will do a page break if it extends beyond the height of the page.
    Then if you enter a smaller length text in another field, then it will be displayed on the first page but since the row has been "Page Broken", if you click on the same field in second row it will also display the same text. (Once you remove your mouse from that field second page, the text will disappear. But it will be displayed in the first page all the time. The text in this field was not "Page Broken", that's the reason for this kind of behaviour).
    Hope I explained it better for you..
    Let me know if you need more help..
    Thanks
    Srini

  • Problem with Dynamic table having row map.

    Hi,
    I need to create a table dynamically based on following inputs:
    a.)Name and number of columns will be decided dynamically at run-time.
    b.) Each row will contain a map of column values ,which will be dynamically generated by some other class.
    In the same way multiple tables need to be created dynamically.
    I tried created table for the same as following:
    RichTable tb=new RichTable();
    tb.setId("trs");
    tb.setValue(UICredRowList.getMapListforRows());
    for(Iterator itr=header.iterator();itr.hasNext();)
    String headerKey = (String) itr.next();
    RichColumn myCol = new RichColumn();
    ExpressionFactory efact = FacesContext.getCurrentInstance(). getApplication().getExpressionFactory();
    ValueExpression valExpr1 = efact.createValueExpression( elContext1,"#{row["+headerKey+"]}",Object.class);
    resolveExpression("#{row["+headerKey+"]}") ;
    myCol.setId("tc1");
    myCol.setSortable(false);
    myCol.setWidth("250");
    myCol.setHeaderText(headerKey);
    RichOutputText rot1 = new RichOutputText();
    rot1.setValueExpression("value", valExpr1);
    myCol.getChildren().add(rot1);
    tb.getChildren().add(myCol);
    Here when I checked the column value from Expression I am getting value as null.
                        Can someone help me how can I handle this type of table.Example will be highly appreciated.
    Thanks in Advance
    Sunil

    Which JDeveloper version do you use, if you use 12c or 11R2 you should find this option when you drag and drop the table to auto generate columns dynamically.

  • Problems with a table in PDF`S footer

    Dear sirs,
    We are having problems when trying to run a PDF with Adobe LiveCycle Designer tool.
    We are working with a PDF which is composed of a header, the main body and a footer. We have created a table (table1) at the footer and
    another one at the main body (table2). This last table (table2) may overflow therefore it will genarate two pages for our PDF.
    On both pages appear the header and the footer correctly but in the last page it does not write the data from the table included in the footer (table1).
    We have no problems with the table included in the main body
    In the attachments, I send you the screenshots of both pages in which I have marked in red the part where we have error.
    May you help us to solve our problem?
    Thanks in advance your help.
    Edited by: emgaitan on Mar 16, 2010 2:18 PM

    Wardell,
    Check the data in RSA3 for the extractor that you use to bring data .
    You must be using the data source 0CO_OM_CCA_09. Check the data and reconcile and you will get it.
    Let me know if you need anything else.
    Thanks
    Ravi Thothadri
    [email protected]

  • I am getting problem with internal table & work area declaration.

    I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
    TYPES : BEGIN OF ty_makt,
             matnr TYPE makt-matnr,
             spras TYPE makt-spras,
             maktx TYPE makt-maktx,
             maktg TYPE makt-maktg,
             celltab TYPE lvc_t_styl,
           END OF ty_makt.
    DATA : i_makt TYPE TABLE OF ty_makt.
    DATA : wa_makt TYPE ty_makt .
        But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
    i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.

    Hi Nagasankar,
    TYPES : BEGIN OF TY_MATNR,
                  MATNR TYPE MAKT-MATNR,
                  SPRAS TYPE MAKT-SPRAS,
                  MAKTX TYPE MAKT-MAKTX,
                  MAKTX TYPE MAKT-MAKTG,
                  CELLTAB TYPE LVC_T_STYL,  " Its Working perfectly fine..
                 END OF TY_MAKT.
    DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
              WA_MAKT TYPE TY_MAKT.
    Its working perfectly fine. if still you are facing any issue post your complete code.
    Thanks,
    Sandeep

  • Problem with a table control

    Hi gurus,
    I´ve a problem with a table control. It has 3 columns which one is a checkbox.
    I can fill all fields but in the moment I mark the checkbox this line must be unwritable. How can I do it?
    Thanks for all
    Dani

    Assign a function code to the checkbox column....
    so when u check / uncheck any entry, PAI + PBO will be triggered....
    In the PBO during the loop of table control, check the checkbox field value. if it is 'X', make the row readonly
    by looping at screen and setting screen-input = 0 for rest of the columns.
    like ...
    LOOP AT tc_itab
           WITH CONTROL tc_test
           CURSOR tc_test-current_line.
       module set_row_readonly. " loop at screen and set input = '0' if checkbox is checked...
    ENDLOOP.

  • Problem with maintain table views SM30 Transaction

    Hello All,
    i have a problem with the table maintenance view SM30, it doesn't permit me to modify the rows in the table.
    we have added a field into the table and when i tried to change the table view from menu: Utilities ==> table maintenance generator==> change the system propose me a message that the screen 0001 will be deleted and recreated...but the system has deleted the screen and doesn't recreate it...in somewehere on internet we find that we should use the transaction SE55 menu:
    Environment==> modification ==> Maintenance screen ==> button Layout which open the tool Screen Painter and from that we have created our screen with 4 fields of our table...our result that the screen is created and i can see it from the SM30 transaction but i can't insert rows in the table...when i try to go to maintain table: menu: Utilities ==> Table maintenance generator to try if i can modify something the system give me a message: "set the compare flag dialog ZIV_DP_PLCHAR_LA"
    the ZIV_DP_PLCHAR_LA is the name of my table...
    can you give me some advices please how should i do to fix this problem to insert rows in table throughout the transaction
    SM30 "maintain table views: initial screen"
    if i want to delete the screen from the SE55 transaction to recreate it newly what should i do to take care about some options
    to have a new screen?
    thanks for all
    Bilal

    Hi
    First delete the old table maintainence generator.
    Now Recreate the screen and your table is good to go..
    These error messages come when we add new fields and different version of the table maintainence generator in database.

  • Problem with Pivot Table with Graph: Line Bar Combo

    Hello people!
    I have a problem with pivot table and line bar combo (all in the same view (pivot table))
    I have some measures and one dimension in my report.
    --------------measure1---measure2---measure3
    Dim A.1
    Dim A.2
    Dim A.3
    If I choose my graph line bar combo automatically choose "line" measure 3 (last measure in "Show Controls"). How can I do if I want my measure1 for line and I don't want modify my pivot table?
    Thank you very much!

    Ok, I'll explain my problem again. In my pivot table I add graph vision and I want in the same view (Pivot table). My graph is "Line Bar Combo" and I don't know how but the last of my measures belongs to right AXIS, if I change order of my measures I can see in my graph the measure that I want in my right axis BUT also it changes the order of my pivot table.
    This is my problem. I think that I can do that with different views but I lose my selector view to view graphic and my pivot table at the same time.

  • Problem with truncate table in procedure ora -00054

    hi do anybody know where is mistake ???
    the procedure has problem with truncate table
    ora - 00054: resource busy and acquire with NOWAIT specified
    ora - 06512 at "POVAPSYS.HMAN_P_REFRESH", line 6
    ora - 06512 at "POVAPSYS.POVAPSYS", line 6
    ora - 06512 at line 1
    this is my procedure....
    AS
    BEGIN
    execute immediate 'TRUNCATE TABLE hman_t_max';
    INSERT INTO hman_t_max SELECT * FROM hman_v_max;
    COMMIT;
    END;

    2.MAKE SURE THAT OTHER THAN YOU ANYBODY IS TRYING TO
    COMPILE AND RUN THE PROCEDUREShould he make sure that anybody is running the procedure?
    3.MAKE SURE THAT ANY PARALLEL QUERY IS RUNNING IN THE
    SERVER SIDE,THATS KEEPS THE RESOURCE BUSYShould he make sure any parallel query is running in the server side to keep the resource busy?
    Gita,
    I COULDN'T RESIST HAVING ONE SUGGESTION FOR YOU. Please look at the impact of your English in the reply before posting. Check if that sends reverse message!
    Cheers
    Sarma.

  • Problems with partition tables

    Hi all,
    I've got some problems with partition tables. The script at the bottom run but when I wanna insert some values it returns me an error
    (ORA-06550: line 1, column 30: PL/SQL: ORA-06552: PL/SQL: Compilation unit analysis terminated
    ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored)
    and I can't understand why!
    There's something incorrect in the script or not?
    Please help me
    Thanks in advance
    Steve
    CREATE TABLE TW_E_CUSTOMER_UNIFIED
    ID_CUSTOMER_UNIFIED VARCHAR2 (27) NOT NULL ,
    START_VALIDITY_DATE DATE NOT NULL ,
    END_VALIDITY_DATE DATE ,
    CUSTOMER_STATUS VARCHAR2 (255)
    PARTITION BY RANGE (START_VALIDITY_DATE)
    SUBPARTITION BY LIST (END_VALIDITY_DATE)
    PARTITION M200909 VALUES LESS THAN (TO_DATE('20091001','YYYYMMDD'))
    (SUBPARTITION M200909_N VALUES (NULL), SUBPARTITION M200909_NN VALUES (DEFAULT)),
    PARTITION M200910 VALUES LESS THAN (TO_DATE('20091101','YYYYMMDD'))
    (SUBPARTITION M200910_N VALUES (NULL), SUBPARTITION M200910_NN VALUES (DEFAULT)),
    PARTITION M200911 VALUES LESS THAN (TO_DATE('20091201','YYYYMMDD'))
    (SUBPARTITION M200911_N VALUES (NULL), SUBPARTITION M200911_NN VALUES (DEFAULT)),
    PARTITION M200912 VALUES LESS THAN (TO_DATE('20100101','YYYYMMDD'))
    (SUBPARTITION M200912_N VALUES (NULL), SUBPARTITION M200912_NN VALUES (DEFAULT)),
    PARTITION M201001 VALUES LESS THAN (TO_DATE('20100201','YYYYMMDD'))
    (SUBPARTITION M201001_N VALUES (NULL), SUBPARTITION M201001_NN VALUES (DEFAULT)),
    PARTITION M201002 VALUES LESS THAN (TO_DATE('20100301','YYYYMMDD'))
    (SUBPARTITION M201002_N VALUES (NULL), SUBPARTITION M201002_NN VALUES (DEFAULT)),
    PARTITION M210001 VALUES LESS THAN (MAXVALUE))
    (SUBPARTITION M210001_N VALUES (NULL), SUBPARTITION M210001_NN VALUES (DEFAULT))
    ;

    Hi Hoek,
    the DB version is 10.2 (italian version, then SET is correct).
    ...there's something strange: now I can INSERT rows but I can't update them!
    I'm using this command string:
    UPDATE TW_E_CUSTOMER_UNIFIED SET END_VALIDITY_DATE = TO_DATE('09-SET-09', 'DD-MON-RR') WHERE
    id_customer_unified = '123' and start_validity_date = TO_DATE('09-SET-09', 'DD-MON-RR');
    And this is the error:
    Error SQL: ORA-14402: updating partition key column would cause a partition change
    14402. 00000 - "updating partition key column would cause a partition change"
    *Cause:    An UPDATE statement attempted to change the value of a partition
    key column causing migration of the row to another partition
    *Action:   Do not attempt to update a partition key column or make sure that
    the new partition key is within the range containing the old
    partition key.
    I think that is impossible to use a PARTITION/SUBPARTITION like that: in fact the update of "END_VALIDITY_DATE" cause a partition change.
    Do u agree or it's possible an update on a field that implies a partition change?
    Regards Steve

  • After Effects won't close/Problems with dynamic links

    When I quit After Effects the icon still shows up and it says that it is still open, even force quit will not work. Also having problems with dynamically linked files between after effects and Premiere pro. Rendering in Premiere doesn't work unless I go to AE, save the project, then go back to Premiere. I have OSX Mavericks 10.9.2, a late 2012 mac pro, and AE CC 12.2.1.5

    Kevin: would appreciate further thoughts on this.
    I am using Pr2014, version 8.0.0 I am using AE2014, version 13.0.2.3. When I was on earlier versions of each, I had no problem importing AE comps into Pr. I'd choose import in Pr, then select the AE project, then select the comp. But with my new and improved versions of AE and Pr, I keep getting "importer reported a generic error."
    I also tried to go the other way. I selected in Pr the clips I wanted to work on in AE, and then tried "replace with AE comp" but got the "generic error" message again..
    Finally, I attempted to create a Dynamic Link from Pr via the File menu, but with each of the options from there, I got "failed to connect to AE Dynamic Link"
    Any advice you can share, would be most welcome.

  • Problem with the table control BDC in FV60 transaction

    Hi All,
    I got the problem with the table control in FV60 transaction.
    This is working for 900 line items.After 900 line items it is giving the problem like it is 1000th line item.You can post only 999 line items.
    I know we can post only 999 line items,but in my file only 920 line items.
    Please give me solution,if anybody come across this situation.
    Thanks & regards,
    rakesh.

    Hello Rakesh ,
    your file may have only 920 line items , but based on those line items, SAP may create few more  new lines ( based on the clearing recon accounts , inter company transaction ...etc )...
    regards
    Prabhu

  • Problem using DELETE ADJACENT DUPLICATES with dynamic table

    Hello All,
       In my program i have to delete duplicate records from dynamic table.
    I tried using  DELETE ADJACENT DUPLICATES FROM <DYN_TABLE> COMPARING <fieldname1> <fieldname2> but it fails in syntax check, then i tried like below:
      DATA string type string.
      string = '<fieldname1> <fieldname2>.........'.
      DELETE ADJACENT DUPLICATES FROM <DYN_TABLE> COMPARING (string).
    It also got failed at runtime.
    Please suggest how can i achieve this....
    Regards
    Munish Garg

    Hi,
    this code is worked truly.
    You can try this.
    Regards.
    DATA itab LIKE STANDARD TABLE OF mard.
    SELECT * FROM mard INTO TABLE itab UP TO 100 ROWS.
    * You define max number of the field that you need
    data : cmp01  TYPE string,
    cmp02 TYPE string,
    cmp03 TYPE string,
    cmp04 TYPE string,
    cmp05 TYPE string.
    * You fill the fields that you need, others is clear.
    cmp01  = 'MATNR'.
    cmp02 = 'WERKS'.
    CLEAR : cmp03,cmp04,cmp05.
    SORT itab BY (cmp01) (cmp02) (cmp03) (cmp04) (cmp05).
    DELETE ADJACENT DUPLICATES FROM itab COMPARING (cmp01) (cmp02) (cmp03)
    (cmp04) (cmp05).

  • Problem with dynamic LOV and function

    Hello all!
    I'm having a problem with a dynamic lov in APEX 3.0.1.00.08. Hope you can help me!
    I have Report and Form application. On the Form page i have a Page Item (Popup Key LOV (Displays description, returns key value)).
    When i submit the sql code in the 'List of vaules defention' box. I get the following message;
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    When i excecute the code below in TOAD or in the SQL Workshop it returns the values i want to see. But somehow APEX doesn't like the sql....
    SELECT REC_OMSCHRIJVING d, REC_DNS_ID r FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    returns_dns_lov_fn is a function, code is below;
    CREATE OR REPLACE FUNCTION DRSSYS.return_dns_lov_fn (p2_dns_id number)
    RETURN dns_table_type
    AS
    v_data dns_table_type := dns_table_type ();
    BEGIN
    IF p2_dns_id = 2
    THEN
    FOR c IN (SELECT dns_id dns, omschrijving oms
    FROM d_status dst
    WHERE dst.dns_id IN (8, 10))
    LOOP
    v_data.EXTEND;
    v_data (v_data.COUNT) := dns_rectype (c.dns, c.oms);
    END LOOP;
    RETURN v_data;
    END IF;
    END;
    and the types;
    CREATE OR REPLACE TYPE DRSSYS.dns_rectype AS OBJECT (rec_dns_id NUMBER, rec_omschrijving VARCHAR2(255));
    CREATE OR REPLACE TYPE DRSSYS.dns_table_type AS TABLE OF dns_rectype;
    I tried some things i found on this forum, but they didn't work as well;
    SELECT REC_OMSCHRIJVING display_value, REC_DNS_ID result_display FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    SELECT REC_OMSCHRIJVING display_value d, REC_DNS_ID result_display r FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    SELECT a.REC_OMSCHRIJVING display_value, a.REC_DNS_ID result_display FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) a order by 1
    Edited by: rajan.arkenbout on 8-mei-2009 14:41
    Edited by: rajan.arkenbout on 8-mei-2009 14:51

    I just had the same problem when I used a function in a where clause.
    I have a function that checks if the current user has acces or not (returning varchar 'Y' or 'N').
    In where clause I have this:
    where myFunction(:user, somePK) = 'Y'
    It seems that when APEX checked if my query was valid, my function triggered and exception.
    As Varad pointed out, check for exception that could be triggered by a null 'p2_dns_id'
    Hope that helped you out.
    Max

Maybe you are looking for