Parsing of select query "select col1 from temp PARTITION(P01)" is failing.

Hi there,
create table temp (col1 varchar(255)) parallel partition by hash(col1) (partition p01, partition p02 ,partition p03)
"select col1 from temp PARTITION(P01)"
The above select query is failing while parsing in antlr-2.7.5.jar.
Caused by: com.database.sqlparser.InvalidSQLException:
     at com.database.sqlparser.SQLParserHelper.doParseSelectQuery(SQLParserHelper.java:95)
     at com.database.sqlparser.SQLParserHelper.parseSelectQuery(SQLParserHelper.java:26)
     at com.database.jdbc.JDBCQuery.executeQuery(JDBCQuery.java:40)
     at com.tasks.TempTask.call(TempTask.java:92)
     at com.tasks.TempTask.call(LDCProcessorThread.java:1)
     at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
     at java.util.concurrent.FutureTask.run(Unknown Source)
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
     ... 1 more
Caused by: line 1:70: unexpected token: (
     at com.database.sqlparser.ANSISQLParser.select_query(ANSISQLParser.java:277)
     at com.database.sqlparser.SQLParserHelper.doParseSelectQuery(SQLParserHelper.java:91)
     ... 9 more
Thanks,
Sid
Edited by: user1945932 on Apr 5, 2010 7:33 AM

It would appear that the java backtrace here came from either client or middle tier java rather than java running in the database server. If so, this isn't the appropriate forum for this question. The JVM forum is for questions related to the Oracle proprietary Java VM that runs in the database server. Unfortunately I can't suggest a more appropriate forum as I don't recognize the code that appears to be in use.

Similar Messages

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Select rows from a partition

    Hi All,
    I have a table D_POSITION with partition created on record_date, key1 with Range-hash partition.
    Previously I use to get the data by following this query.
    SELECT * FROM D_POSITION PARTITION (P_20080331)
    Recently I truncated the table and reinserted from the backup table.
    Now this is giving me the 0 records. But for this partition we have more than 60000 records.
    Please let me know where it went wrong....

    SELECT * FROM D_POSITION PARTITION (P_20080331)[/i]
    It's not advisable to use the partition clause in the query. You should use the predicate(where clause) that will make Oracle choose the appropriate partition.

  • Select time from view

    i have a doubt as will a select based on a view will take more time than a select on 2 tables with a union.
    View will be:-
    create view1 as
    select column1 from table1
    union
    select column1 from table2
    so, will a
    select * from view1
    take more time than a
    select column1 from table1
    union
    select column1 from table2
    Please help in solving the doubt as it is urgent.
    regards.

    If it's that urgent why didn't you just rustle up a test case for yourself? You could have done that in the time it took you to post, let alone wait for my slow fingers to type one up and compose this reply. We are all volunteers here and there's no SLA.
    Here is a test case. Obviously the stats are different, that's because of the data in the buffer cache, but the EXPLAIN PLAN is identical (except for the VIEW bit), so the two queries should execute in a similar timeframe.
    Cheers, APC
    SQL> SET autotrace TRACEONLY
    SQL> SELECT col1 FROM t_10K
      2  UNION
      3  SELECT col1 FROM t_5k1
      4  /
    10000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=43 Card=15000 Bytes=
              60000)
       1    0   SORT (UNIQUE) (Cost=43 Card=15000 Bytes=60000)
       2    1     UNION-ALL
       3    2       INDEX (FAST FULL SCAN) OF 'T10K_PK' (UNIQUE) (Cost=3 C
              ard=10000 Bytes=40000)
       4    2       TABLE ACCESS (FULL) OF 'T_5K1' (Cost=3 Card=5000 Bytes
              =20000)
    Statistics
            750  recursive calls
              0  db block gets
            213  consistent gets
             71  physical reads
              0  redo size
         132870  bytes sent via SQL*Net to client
           7825  bytes received via SQL*Net from client
            668  SQL*Net roundtrips to/from client
             16  sorts (memory)
              0  sorts (disk)
          10000  rows processed
    SQL> CREATE VIEW v1 AS
      2  SELECT col1 FROM t_10K
      3  UNION
      4  SELECT col1 FROM t_5k1
      5  /
    View created.
    SQL> SELECT * FROM v1
      2  /
    10000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=43 Card=15000 Bytes=
              195000)
       1    0   VIEW OF 'V1' (Cost=43 Card=15000 Bytes=195000)
       2    1     SORT (UNIQUE) (Cost=43 Card=15000 Bytes=60000)
       3    2       UNION-ALL
       4    3         INDEX (FAST FULL SCAN) OF 'T10K_PK' (UNIQUE) (Cost=3
               Card=10000 Bytes=40000)
       5    3         TABLE ACCESS (FULL) OF 'T_5K1' (Cost=3 Card=5000 Byt
              es=20000)
    Statistics
             19  recursive calls
              0  db block gets
             54  consistent gets
              0  physical reads
              0  redo size
         132870  bytes sent via SQL*Net to client
           7825  bytes received via SQL*Net from client
            668  SQL*Net roundtrips to/from client
              3  sorts (memory)
              0  sorts (disk)
          10000  rows processed
    SQL>

  • Select problem from view.

    Hi everyone,
    <br><br>
    I have constructed the following view,
    <br><br>
    SELECT b.eml_id
         , a.email "FROM"    
         , to_address.name
         , to_address.role
         , to_address.email "TO"
         , to_address.subject
         , to_address.header
         , to_address.footer   
      FROM mySchema.sct_parties a    
         , mySchema.sct_email_notify b
         , mySchema.sct_assign_email_notify c
         , (SELECT e.eml_id
                 , c.name "ROLE"
                 , initcap(a.first || ' ' || a.last) "NAME"            
                 , a.email
                 , e.subject
                 , e.header
                 , e.footer
              FROM mySchema.sct_parties a
                 , mySchema.sct_assign_roles b
                 , mySchema.sct_roles c
                 , mySchema.sct_assign_email_notify d
                 , mySchema.sct_email_notify e
             WHERE a.par_id = b.par_id
               AND b.rle_id = c.rle_id
               AND c.rle_id = d.rle_id
               AND d.eml_id = e.eml_id
               AND d.rle_id = 6
               AND e.status = 'CURRENT') to_address
    WHERE a.par_id = b.par_id
       AND to_address.eml_id = b.eml_id
       AND b.eml_id = 1
       AND b.status = 'CURRENT'When I do a
    <br><br>
    select * from viewName
    <br><br>
    no worries I get the record returned as expected, but when I
    <br><br>
    select a.to from viewName a I get the following error
    <br><br>
    Error starting at line 1 in command:
    SELECT a.to
      FROM mySchema.viewName a
    Error at Command Line:1 Column:9
    Error report:
    SQL Error: ORA-01747: invalid user.table.column, table.column, or column specification
    01747. 00000 -  "invalid user.table.column, table.column, or column specification"
    *Cause:   
    *Action:<br><br>
    Could someone tell me what the problem is.
    <br><br>
    Ben

    Double quotes may be confusing if the case is not consistent. Also, Oracle will use upper case in the data dictionary, by default, unless you use double quotes.
    SQL> create table t("col1" number, col2 number)
    Table created.
    SQL> insert into t(col1) values (1)
    ORA-00904: "COL1": invalid identifier
    SQL> insert into t(col2) values (2)
    1 row created.
    SQL> select col1 from t
    ORA-00904: "COL1": invalid identifier
    SQL> select col2 from t
          COL2
             2
    1 row selected.
    SQL> select column_name from user_tab_columns
    where table_name = 'T'
    and column_name like 'COL%'
    COLUMN_NAME                  
    COL2                         
    1 row selected.

  • Selecting data from single table with different condition in single query

    Hi everybody...
    I have one table with col1, col2, col3, col4, col5... as columns.
    I want to select col1, col2, col3 with condition (x=y and a=b and c=d)
    I want to select col4, col5 with condition (x=y and a=b and m=n )
    in single query...
    Thanx for ur help

    Given this data set...
    SQL> select * from oddity
      2  /
          COL1       COL2       COL3       COL4       COL5 A X C M
             1          2          3          4          5 B Y   M
             1          2          3          4          5 A Y C N
             1          2          3          4          5 A Y D M
             1          2          3          4          5 A Y D N
             1          2          3          4          5 B Y D N
             1          2          3          4          5 B Y D U
    6 rows selected.
    SQL>The following query meets the requirements. Of course, the requirements as stated are incomplete. I ahave assumed that we select all five columns if C=D andM=N.
    SQL> SELECT decode(c, 'D', col1, '0') AS col1
      2         , decode(c, 'D', col2, '0') AS col2
      3         , decode(c, 'D', col3, '0') AS col3
      4          , decode(m, 'N', col4, '-8') AS col4
      5           , decode(m, 'N', col5, '-8') AS col5
      6  FROM oddity
      7  WHERE a = 'B'
      8  AND  x = 'Y'
      9  /
          COL1       COL2       COL3       COL4       COL5
             0          0          0         -8         -8
             1          2          3          4          5
             1          2          3         -8         -8
    SQL> Cheers, APC

  • How to select data from an aggregate in a customer exit for a query?

    Hi,
    I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
    Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
    My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
    SELECT
        F~KEY_1000041 AS K____035
         F~KEY_1000271 AS K____035
         F~QUANT_B AS K____051
         F~VALUE_LC AS K____052
    INTO (xdoc_date, xval1, xqty1)
    UP TO 1 ROWS
    FROM
    FROM
    */BIC/E100004 AS F JOIN
    /BIC/E100027 AS F JOIN
    /BIC/DZMM_CGRNU AS DU
    ON FKEY_ZMM_CGRNU = DUDIMID
    JOIN /BI0/SUNIT AS S1
    ON  DUSID_0BASE_UOM = S1SID
    JOIN /BI0/SCURRENCY AS S2
    ON DUSID_0LOC_CURRCY = S2SID
    JOIN /BI0/SMATERIAL AS S3
    *ON FKEY_1000042 = S3SID
    ON FKEY_1000272 = S3SID
    JOIN /BI0/SMOVETYPE AS S4
    *ON FKEY_1000043 = S4SID
    ON FKEY_1000273 = S4SID
    JOIN /BI0/SPLANT AS S5
    *ON FKEY_1000044 = S5SID
    ON FKEY_1000274 = S5SID
    JOIN /BIC/D100004P AS DP
    *ON FKEY_100004P = DPDIMID
    ON FKEY_100027P = DPDIMID
    WHERE
    WHERE
    ( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
    ( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
             S3~MATERIAL = <l_0material> ) ) AND  ( (
                s2~movetype BETWEEN '101' AND '102' OR
             s4~movetype BETWEEN '921' AND '922' OR
             s4~movetype BETWEEN '105' AND '106' OR
             s4~movetype BETWEEN '701' AND '701' OR
             s4~movetype BETWEEN '632' AND '632' ) ) AND  ( (
             S5~PLANT = <l_0plant> ) ) AND  ( (
             DP~SID_0RECORDTP = 0  ) ) ) )
    GROUP BY
        ORDER BY F~KEY_1000271 DESCENDING.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
        ENDSELECT.
    How do I transport the code and make it work?
    Whats the reason that the two key fields are different.
    I had transported the aggregate from development to production. Activated it and filled the data.
    What is the way out? Please help.
    Regards,
    Annie.

    Hi Sonu,
    The main task is to move the contents of the one internal table to another with some condition.
    First sort and delete the duplicate entries from the First Internal table like below : 
    sort it_tab by material ascending date_modified descending.
    delete adjacent duplicates from it_tab.
    Then move that Internal table contents to another internal table.
    Define another internal table with the same structure as you have first internal table and then
    Second Step :
    it_itab1 = it_itab.
    If you are using seperate Header line and Body then you can do like below :
           it_itab1[] = it_itab[].
    This will fix the issue.
    Please let me know if you need any further explonation.
    Regards,
    Kittu
    Edited by: Kittu on Apr 24, 2009 12:21 PM

  • Select list from query in report

    Hello everybody,
    I want to include a select list from a query in a report's colomn, but the select list should only be displayed conditionally. I wanted to do this with the help of "case when" in the corresponding SQL statement.
    The select list itsself works, but when I combine it with "case when" I always get the error message:
    ORA-01427: single-row subquery returns more than one row
    The select statement is as following:
    select
    htmldb_item.checkbox(1,rownum) " ",
    x.idee,
    x.stunden_ilp,
    x.stunden_ild,
    x.stunden_ilm,
    x.stunden_ief,
    x.stunden_ir,
    x.pe_id,
    x.l_art_id,
    x.version_id
    from (
    select
    (select case
    when (select name from cn_pl_projektidee s01
    where s01.idee_id = '2') IS NULL then
    (select distinct htmldb_item.select_list_from_query(5,name,'select distinct name from cn_pl_projektidee') name from cn_pl_projektidee s01
    where s01.idee_id = t1.idee_id)
    else
    (select distinct htmldb_item.text(5,name) name from cn_pl_projektidee s01
    where  s01.idee_id = t1.idee_id)
    END from cn_pl_std_peplanung t1) Idee,
    from cn_pl_std_peplanung t1, cn_pl_projektelemente z1, cn_pl_version u1, cn_pl_projektidee s1
    where t1.version_id = '&P6_VERSION_WAHL.'
    and t1.pe_id ='&P6_HELP_PRODET.' 
    and t1.l_art_id ='&P6_L_ART_ID.'
    group by t1.pe_id, t1.version_id, t1.idee_id, t1.l_art_id) x
    order by x.ideeDoes anybody know what could be the problem or what other solutions I could try??
    Greetings!
    Patrick

    Found 2 ways to solve it:
    *1. dynamic action (JQuery)*
    $("#f20_1234 option[value=13]").attr('selected', 'selected');
    *2. process*
    BEGIN
    HTP.p('<script type="text/javascript">');
    --HTP.p('problem()');
    HTP.p('html_SetSelectValue(''f20_903'',188)');
    HTP.p('html_SetSelectValue(''f20_903'',189)');
    HTP.p('</script>');
    END;

  • Display select list from query on manual tabular form

    Hello,
    I'm trying to display a select list from query on a manual tabular form. I'm using a collection to store the data. I can't seem to get the query to work. I can display the item as a text item. Any help would be appreciated. Thanks, Elizabeth.
    SELECT
    -- Notice how I'm keeping the idx value the same as the column value in the collection. This helps to keep things organized
    -- I also apply an id to each entry
    -- I append the error value to the empname and sal
    -- The Seq_id. Usefull when hiding rows (for delete) and then submitting from
    apex_item.hidden(1,x.seq_id, null, x.seq_id || '_seq_id') ||
    -- The Primary Key of the column
    apex_item.hidden(2, x.ceah_people_id, null, x.seq_id || '_ceah_people_id') || x.ceah_people_id ceah_people_id,
    -- Employee Name
    case when x.seq_id = -1
    then
    apex_item.select_list_from_query (3,
    NULL,
    'select distinct language_name d, '
    || 'language_id r from foreign_language',
    'style="width:170px" ' ,
    'YES',
    '0',
    '- Select Language -',
    'x.seq_id_' || LPAD (9900 + LEVEL, 4, '0'),
    NULL,
    'NO'
    else
    apex_item.text (3,(select language_name from foreign_language where x.language_id = foreign_language.language_id),
    80,
    100,
    'style="width:170px" readonly="readonly"',
    'f32_' || LPAD (ROWNUM, 4, '0')
    end
    || err.language_id language_id,
    /* apex_item.text(3,x.language_id,null, null, null, x.seq_id || '_language_id') || err.language_id language_id,
    -- Employee Salary
    apex_item.text(4,x.proficiency, null, null, null, x.seq_id || '_proficiency') || err.proficiency ||
    -- Store the sql action type as well.
    apex_item.hidden(50,x.sql_action_typ, null, x.seq_id || '_sql_action_typ_id') proficiency,
    -- Last but not least the row error
    err.row_error
    FROM (SELECT ac.c001 seq_id,
    ac.c002 ceah_people_id,
    ac.c003 language_id,
    ac.c004 proficiency,
    ac.c049 modifiable_flag,
    ac.c050 sql_action_typ
    FROM apex_collections ac
    WHERE ac.collection_name = 'DATA_COLLECTION'
    ORDER BY ac.seq_id) x,
    -- Error Collection
    (SELECT ac.seq_id seq_id,
    ac.c002 ceah_people_id,
    ac.c003 language_id,
    ac.c004 proficiency,
    ac.c050 row_error -- Useful when individual data is correct, however the row of data is not. Ex: start/end dates
    FROM apex_collections ac
    WHERE ac.collection_name = 'ERROR_COLLECTION'
    ORDER BY ac.seq_id) err
    WHERE x.seq_id = err.seq_id(+)

    I got so frustrated I started over. I'm following the how to create a manual form.
    http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html#MANUAL
    The problem I'm now having is even though I display items as hidden, there is a column holder on the report for them. If I go into the report attributes and toggle the show attribute off I cannot reference an items value in my logic. I used /&nbsp/ for the column heading but I still get the little sort arrow where the column heading should be. I tried to toggle the sort attribute off but the sort arrow still shows up. How can I use the apex_item.hidden and not get a place holder for the column on a report? Thanks, Elizabeth
    Here is the code I'm using to generate the report:
    select x.ceah_people_lang_id,
    x.language_id,
    x.proficiency,
    x.ceah_people_id
    from (
    select apex_item.hidden(1,ceah_people_lang_id) ceah_people_lang_id,
    apex_item.select_list_from_query(2,language_id,'select language_name, language_id from foreign_language') language_id,
    apex_item.select_list_from_query(3,proficiency,'select name, id from proficiency') proficiency,
    apex_item.hidden(4,ceah_people_id) ceah_people_id
    from ceah_people_language where ceah_people_language.ceah_people_id = :P152_person_id
    union all
    select apex_item.hidden(1,null) ceah_people_lang_id,
    apex_item.select_list_from_query(2,null,'select language_name, language_id from foreign_language') language_id,
    apex_item.select_list_from_query(3,null,'select name, id from proficiency') proficiency,
    apex_item.hidden(4,null) ceah_people_id
    from dual) x

  • Simple CQL query error - Invalid statement: select one from inputChannel

    Hi,
    I am new to oracle cep, I wrote a simple query....
    "select * from inputChannel RETAIN 5 EVENTS" but some how it shows the error as .
    Invalid statement: "select one from >>inputChannel RETAIN<< 5 EVENTS"
    Cause: generic syntax error
    Action: The syntax expects '[', as, match_recognize, xmltable, end-of-file, ')', ',', where, group,
    having, order, left, right, partition, on, primary token
    Any help is greatly appreciated.
    Thanks,
    S.Vishal

    Oracle CEP CQL Reference : http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e12048/toc.htm
    Also you can check the other documents about Oracle CEP at : http://download.oracle.com/docs/cd/E14571_01/nav/portal_booklist.htm .

  • ABAP SQL Query (Select data from intervals)

    Hi All,
    From    To      Temp
    101      200     1111
    201      300     2222
    301      400     3333
    401      500     4444
    501      600     5555
    From, To & Temp are three Fields.
    Consider the above table, if i enter input as 150, need to pick 1111.
    If the input is inbetween of From & To values means I want to pick the exact
    Data from temp field.
    Thanks
    Hema
    Edited by: hema prabakaran on Jan 19, 2009 7:54 AM
    Edited by: hema prabakaran on Jan 19, 2009 8:30 AM

    Hi
    Data: itab type table of tbl with header line.
    select * from tbl into table itab.
    if sy-subrc eq 4.
    Message E000(YJK).
    else.
            loop at itab.
             if v_temp between itab-from and itab-to.
                   write itab-temp.
                   exit.
             else.
                  continue.
            endif.
            endloop.
    endif.
    You can use the above code.
    It is not possible to use select stmt with your i/p variable in the where clause as that field is not present in table.
    hope this helps
    Regards,
    Jayanthi.K

  • Query Issue with select level from dual

    Hi,
    I have a question regarding this query. The problem seems that when selecting level from dual while including another table the rows returned seem to increase exponentially.
    I can add distinct and get the correct number of rows but am worried that this will cause a possible performance issue. Am I using the level option wrong?
    I have included details below.
    There are 4 rows in tbl_incidents
    When I run the following queries I get rows returned based on the total number of rows
    select start_date + level - 1, tbl_incidents.incident_id, level
    from dual, tbl_incidents
    where incident_id = 6
    connect by level <= 1;
    returns 1 row
    select start_date + level - 1, tbl_incidents.incident_id, level
    from dual, tbl_incidents
    where incident_id = 6
    connect by level <= 2;
    returns 5 rows
    select start_date + level - 1, tbl_incidents.incident_id, level
    from dual, tbl_incidents
    connect by level <= 3 and incident_id = 6;
    returns 21 rows
    select start_date + level - 1, tbl_incidents.incident_id, level
    from dual, tbl_incidents
    connect by level <= 4 and incident_id = 6;
    returns 85 rows
    select start_date + level - 1, tbl_incidents.incident_id, level
    from dual, tbl_incidents
    connect by level <= 5 and incident_id = 6;
    returns 341 rows
    So with
         r being the number of rows in tbl_incidents and
         l being the number used in the connect by for level and
         q being the number of rows returned by the query
         it appears that
    q(l) = r * q(l-1) + 1
    level 2:     4 * 1 + 1 = 5
    level 3:     4 * 5 + 1 = 21
    level 4:     4 * 21 + 1 = 85
    level 5:     4 * 85 + 1 = 341
    Thanks much,
    Nora

    Hi,
    The dual table is used when you want to do something in SQL when you are not otherwise using a table.
    Generating a "counter table" of the integers 1, 2, 3,..., X is an example
    SELECT  LEVEL   AS n
    FROM    dual
    WHERE   LEVEL   <= x;There is never any point in joining dual to another table, as in
    select  start_date + level - 1
    ,       tbl_incidents.incident_id
    ,       level
    from    dual
    ,       tbl_incidents
    where    incident_id = 6
    connect by  level <= x;You will always get the same more easily by just eliminating dual:
    select  start_date + level - 1
    ,       incident_id
    ,       level
    from    tbl_incidents
    where    incident_id = 6
    connect by  level <= x;It is quite useful and common to join a counter-table to a real table, like this cross-join:
    WITH    counter_table  AS
        SELECT  LEVEL   AS n
        FROM    dual
        WHERE   LEVEL   <= x
    select  start_date + n - 1
    ,       incident_id
    ,       n
    from    tbl_incidents
    ,       counter_table
    where    incident_id = 6

  • PL/SQL select list from query

    Hello,
    I am trying to modifying a PL/SQL process. Wherever there was a reference to the Application ID, I wanted to change it to refer to the Application Alias.
    Here is the original code:
    declare
       cursor app_cur is
          select aa.application_id||' - '||aa.application_name app_name,
                 aa.application_id
            from apex_applications aa
           where exists (select 1
                           from profiles p
                          where p.application_id = aa.application_id);
       cursor user_app_cur (p_user number, p_app number) is
          select to_char(profile_id)
            from user_app_profiles
           where user_id = p_user
             and application_id = p_app;
       v_profile   varchar2(10);
       v_count     number := 0;
       v_class     varchar2(15);
    begin
       htp.p('<table class="t3standardalternatingrowcolors" cellpadding="0" cellspacing="0">');
       htp.p('<tr><th class="t3header" >Application</th><th class="t3header" >Profile</th></tr>');
       for app in app_cur loop
          v_count := v_count + 1;
          if mod(v_count,2) = 1 then
             v_class := 't3dataalt';
          else
             v_class := 't3data';
          end if;
          open  user_app_cur(:P3_USER_ID, app.application_id);
          fetch user_app_cur
           into v_profile;
          if user_app_cur%notfound then
             v_profile := 'NONE';
          end if;
          close user_app_cur;
          htp.p('<tr><td class="'||v_class||'">'||app.app_name||
                '</td><td class="'||v_class||'">'||
                apex_item.select_list_from_query(40, v_profile,
                  'select description, profile_id from profiles where application_id = '||app.application_id,
               null, 'YES', 'NONE', 'No Profile Assigned', null, null, 'NO')||
                apex_item.hidden(41,app.application_id) ||
              '</td></tr>');
       end loop;
       htp.p('</table>');
    end;Here is my revised code:
    declare
       cursor app_cur is
          select aa.alias||' - '||aa.application_name app_name,
                 aa.alias
            from apex_applications aa
           where exists (select 1
                           from profiles p
                          where p.application_alias = aa.alias);
       cursor user_app_cur (p_user number, p_app varchar2) is
          select to_char(profile_id)
            from user_app_profiles
           where user_id = p_user
             and application_alias = p_app;
       v_profile   varchar2(10);
       v_count     number := 0;
       v_class     varchar2(15);
    begin
       htp.p('<table class="t3standardalternatingrowcolors" cellpadding="0" cellspacing="0">');
       htp.p('<tr><th class="t3header" >Application</th><th class="t3header" >Profile</th></tr>');
       for app in app_cur loop
          v_count := v_count + 1;
          if mod(v_count,2) = 1 then
             v_class := 't3dataalt';
          else
             v_class := 't3data';
          end if;
          open  user_app_cur(:P3_USER_ID, app.alias);
          fetch user_app_cur
           into v_profile;
          if user_app_cur%notfound then
             v_profile := 'NONE';
          end if;
          close user_app_cur;
          htp.p('<tr><td class="'||v_class||'">'||app.app_name||
                '</td><td class="'||v_class||'">'||
                apex_item.select_list_from_query(40, v_profile,
                  'select description, profile_id from profiles where application_alias = '||app.alias,
               null, 'YES', 'NONE', 'No Profile Assigned', null, null, 'NO')||
                apex_item.hidden(41,app.alias) ||
              '</td></tr>');
       end loop;
       htp.p('</table>');
    end;Here is the error:
    ORA-06550: line 1, column 153: PL/SQL: ORA-00904: "F109NEWNAME": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
    I think that the problem is in the table/LOV generation near the end, but I don't fully understand the apex_item.select_list_from_query function as it is written (I didn't write it).
    Any help is greatly appreciated.
    Thanks,
    Matt

    Hi Matt,
    This line:
    'select description, profile_id from profiles where application_alias = '||app.aliaswould become:
    select description, profile_id from profiles where application_alias = F109NEWNAMEif F109NEWNAME was the app_alias. SQL would see F109NEWNAME as a variable as it is not in quotes. Therefore, you should change the line to:
    'select description, profile_id from profiles where application_alias = ''' || app.alias || ''''to end up with:
    select description, profile_id from profiles where application_alias = 'F109NEWNAME'which would make more sense
    Andy

  • SELECT {data} FROM (SELECT...) query. Can anyone explain the logic to me? PLEASE!!!!

    I've seen an example of this but I don't understand the logic behind this concept. I would really appreciate if someone could help me out with this.

    Hi Shawn Jefferson
    ============================================
    EXAMPLE 1
    ============================================
    select 1 from (select * from dual)
    1
    1
    ============================================
    Please see the above example. the second select statement execute and return only one record. so the first select based on the result of the second statement.The first select execute and return only 1 record.
    ============================================
    EXAMPLE 2
    ============================================
    now see this
    select 1 from (select * from emp)
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    14 records.
    it return the 14 records. because the second select statement I apply on table emp. and emp table return the 14 records . so first select statement execute 14 times.
    Regards
    ASIF RASHID

  • Whats the meaning of plus in query : select employeename from emp where emp

    Hi All,
    Can someone please explain me whats the meaning of plus sign in following SQL. I have nevercome across this syntax
    select employeename from emp where empid(+) >= 1234.

    Example of equivalent queries using oracle syntax and ansi syntax
    SQL> ed
    Wrote file afiedt.buf
      1  select d.deptno, d.dname, e.ename
      2  from dept d, emp e
      3* where d.deptno = e.deptno (+)
    SQL> /
        DEPTNO DNAME          ENAME
            20 RESEARCH       SMITH
            30 SALES          ALLEN
            30 SALES          WARD
            20 RESEARCH       JONES
            30 SALES          MARTIN
            30 SALES          BLAKE
            10 ACCOUNTING     CLARK
            20 RESEARCH       SCOTT
            10 ACCOUNTING     KING
            30 SALES          TURNER
            20 RESEARCH       ADAMS
            30 SALES          JAMES
            20 RESEARCH       FORD
            10 ACCOUNTING     MILLER
            40 OPERATIONS
    15 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  select d.deptno, d.dname, e.ename
      2* from dept d left outer join emp e on (d.deptno = e.deptno)
    SQL> /
        DEPTNO DNAME          ENAME
            20 RESEARCH       SMITH
            30 SALES          ALLEN
            30 SALES          WARD
            20 RESEARCH       JONES
            30 SALES          MARTIN
            30 SALES          BLAKE
            10 ACCOUNTING     CLARK
            20 RESEARCH       SCOTT
            10 ACCOUNTING     KING
            30 SALES          TURNER
            20 RESEARCH       ADAMS
            30 SALES          JAMES
            20 RESEARCH       FORD
            10 ACCOUNTING     MILLER
            40 OPERATIONS
    15 rows selected.
    SQL>

Maybe you are looking for

  • Possible to format {pubDate}  in RSS demo?

    Is there a way to format {pubDate} in the RSS demo? From my understanding, the setColumnType only serves as a means to be able to sort date values. Is there a way to format the date results in a more friendly manner? (ie mm/dd/yyyy). thanks!

  • Radius Authentication for FWSM

    Hello, this is my first posting so I apologize if I accidentally disobeyed any posting rules. Thank you to any and all that respond. My problem is setting up Authentication to my FWSM through my Radius server. My Radius server is set up by the ASDM,

  • Video - maximum size

    Whats the biggest file size of a mp4-video embedded? I want to upload a 130 MB file.

  • Bright Spot on Macbook Display

    My Macbook is just over 3 months old and has developed a bright spot in the display - where the pixilation color is a faded and does not show full color, creating a white spot when viewing certain colors. Has anyone ran into this problem before? Shou

  • Edit-in-place but still prompt to cache

    Hi, I have my media stored on a SAN. The assets are there and media & Library devices, are set to edit-in-place URI's file://localhost/Volumes/Fibre 1/IDTV YV/Final Cut Server/Media resp. /Library. But on dragging an asset to Final Cut Pro I still ge