Nested selects in finder query

Hi!
Does anyone know whether one can express nested selects
with WL QL or EJB QL?
E.g. if one wants to express something like this in a
deployment descriptor for an CMP EJB:
SELECT * FROM tableA WHERE someID IN
     (SELECT someID FROM tableB WHERE someColumn = ?)
cheers
-jo

Hi!
Does anyone know the status of this issue?
cheers
-jo
On Wed, 02 May 2001 16:31:49 -0700, thorick <[email protected]>
wrote:
Hi
SubQueries are currently not supported. We targeting support for them
in
our next Major release (after the next Minor release that's due out
next)
thorick

Similar Messages

  • DB Adapter Query - Polling using nested select

    When polling a table to initiate a BPEL process, can I use a nested select in the expression.

    The visual expression builder does not currently support this so you need to specify the raw sql directly.
    If you use the DeletePollingStrategy there is a way you can specify the exact sql string for both the 'select' and the after read 'delete'. So if you write the where clause yourself it can contain nested selects.
    This is the readme from the new PureSQLSelect database adapter sample. Also you may want to look at the PureSQLPolling sample.
    This sample shows you how you can bypass the designer's visual where clause builder to specify arbitrarily complex sql strings for your selects.
    Like the other samples, this sample uses the basic Movies schema.
    The Steps:
    Create a basic select. Made sure it has the same name and number of input parameters as you will need for your sql string. In this case create a single input parameter and call it 'genre_param'.
    Create a trivial where clause in the wizard expression builder using genre_param. I.e. genre.like(genre_param)
    Ideally run the sample once just to make sure everything else works and to get a template SQL. The select ... FROM ... part will be the same.
    Open the toplink_mappings.xml file. Look for an element called <database-query>. There will likely only be one. A sample is presented here:
    <query-manager>
    <descriptor-query-manager>
    <existence-check>Check cache</existence-check>
    <descriptor-named-queries>
    <database-query>
    <query-name>selectByGenreSelect</query-name>
    <query-should-maintain-cache>true</query-should-maintain-cache>
    <cascade-policy>1</cascade-policy>
    <should-bind-all-parameters>undefined</should-bind-all-parameters>
    <should-cache-statement>undefined</should-cache-statement>
    <should-use-wrapper-policy>true</should-use-wrapper-policy>
    <query-timeout>0</query-timeout>
    <query-arguments>
    <string>genre_param</string>
    </query-arguments>
    <query-argument-types>
    <values>java.lang.String</values>
    </query-argument-types>
    <reference-class>PureSQLSelect.Movies</reference-class>
    <refresh-identity-map>false</refresh-identity-map>
    <cache-usage>2</cache-usage>
    <lock-mode>0</lock-mode>
    <distinct-state>0</distinct-state>
    <query-indirection>
    <in-memory-query-indirection>
    <policy>0</policy>
    </in-memory-query-indirection>
    </query-indirection>
    <main-expression>
    <expression>
    <operator-type>AND</operator-type>
    <expression-list>
    <expression>
    <operator-type>Like</operator-type>
    <first-argument>
    <argument>
    <query-key-name>genre</query-key-name>
    <outer-join>false</outer-join>
    <to-many>false</to-many>
    <argument-class>oracle.toplink.tools.workbench.expressions.QueryableArgumentRepresentation</argument-class>
    </argument>
    </first-argument>
    <second-argument>
    <argument>
    <parameter-name>genre_param</parameter-name>
    <argument-class>oracle.toplink.tools.workbench.expressions.ParameterArgumentRepresentation</argument-class>
    </argument>
    </second-argument>
    <expression-class>oracle.toplink.tools.workbench.expressions.BinaryExpressionRepresentation</expression-class>
    </expression>
    </expression-list>
    <expression-class>oracle.toplink.tools.workbench.expressions.CompoundExpressionRepresentation</expression-class>
    </expression>
    </main-expression>
    <type>oracle.toplink.queryframework.ReadAllQuery</type>
    </database-query>
    </descriptor-named-queries>
    </descriptor-query-manager>
    </query-manager>
    We want to switch this query from using a high-level expression to a pure sql string. You will remove the <main-expression> element and replace it with a <sql-string> element of your own devising.
    Your replacement should look something like this:
    <query-manager>
    <descriptor-query-manager>
    <existence-check>Check cache</existence-check>
    <descriptor-named-queries>
    <database-query>
    <query-name>selectByGenreSelect</query-name>
    <query-should-maintain-cache>true</query-should-maintain-cache>
    <cascade-policy>1</cascade-policy>
    <should-bind-all-parameters>undefined</should-bind-all-parameters>
    <should-cache-statement>undefined</should-cache-statement>
    <should-use-wrapper-policy>true</should-use-wrapper-policy>
    <query-timeout>0</query-timeout>
    <sql-string>SELECT DELETED, DIRECTOR, GENRE, LAST_UPDATED, RATED, RATING, RELEASE_DATE, RUN_TIME, SEQUENCENO, STARRING, STATUS, SYNOPSIS, TITLE, TOTAL_GROSS, VIEWER_RATING FROM MOVIES WHERE (upper(GENRE) LIKE upper(concat(concat('%', #genre_param), '%'))) ORDER BY TOTAL_GROSS desc</sql-string>
    <query-arguments>
    <string>genre_param</string>
    </query-arguments>
    <query-argument-types>
    <values>java.lang.String</values>
    </query-argument-types>
    <reference-class>PureSQLSelect.Movies</reference-class>
    <refresh-identity-map>false</refresh-identity-map>
    <cache-usage>2</cache-usage>
    <lock-mode>0</lock-mode>
    <distinct-state>0</distinct-state>
    <query-indirection>
    <in-memory-query-indirection>
    <policy>0</policy>
    </in-memory-query-indirection>
    </query-indirection>
    <type>oracle.toplink.queryframework.ReadAllQuery</type>
    </database-query>
    </descriptor-named-queries>
    </descriptor-query-manager>
    </query-manager>
    Gotchas:
    The tempation to start writing pure sql may be terrible to some, but it was intentionally left out of the wizard for good reasons. Please be wary of the following when specifying pure sql:
    -There is a way to set the pure sql string in the Mapping Workbench, but when you edit the partnerlink to refresh the toplink_mappings.xml you may get an exception due to the query being in a pure sql format. For this reason you need to manually edit the toplink_mappings.xml, and again every time your run the wizard and hit finish after that.
    -The #genre_param is a TopLink convention for writing a sql string which still takes parameters. At runtime if you enter 'Action' in the bpel console, you will see this sql:
    SELECT DELETED, DIRECTOR, GENRE, LAST_UPDATED, RATED, RATING, RELEASE_DATE, RUN_TIME, SEQUENCENO, STARRING, STATUS, SYNOPSIS, TITLE, TOTAL_GROSS, VIEWER_RATING FROM SYSTEM.MOVIES WHERE (GENRE LIKE ?)
    bind => [Action]
    The #genre_param gets replaced with the value of the input parameter genre_param.
    -When specifying pure sql you should be aware of the following:
    -maintenance issues
    -loss of database platform independence
    -The sql needs to conform with the way TopLink works. It is recommended that you do not change the SELECT ... FROM ... part of the query. TopLink's design is to read from one table at a time. If an Employee has an Address, then the Address is read with a hidden relationship query. There are two advanced TopLink features which optimize reading from multiple tables, called joinedAttribute and batchAttribute reading, but the combination of these features with raw sql was not explored here. So to avoid danger you can only really affect the top level query, and only rewrite the where clause.
    -The pure sql route does not interact with most TopLink features, especially batch reading (on by default), and can not be combined with the following:
    -LogicalDeletePollingStrategy
    -SequencingPollingStrategy (LastUpdated, LastReadId, File)
    These features extend the selection criteria at runtime.

  • Sql Query Error (9i) nested select with OleDB

    I have the following query which works fine when used with Sqlplus, but fails when called from within crytal reports (using an OleDB connection). I saw an open Oracle bug number 3025605 on some website, but haven't been able to look up any additional information on the error. The query fails with Ora-00972.
    SELECT "CLIENTS"."CLTFIRSTNAME",
    "CLIENTS"."CLTLASTNAME",
    "CLIENTS"."CLTMIDDLENAME",
    "SCHEDULE"."SCSESSIONDATE",
    (SELECT r.REMPFIRSTNAME||' '||r.REMPLASTNAME
    FROM REFAGENCYEMPLOYEES R WHERE "R"."REMPLOYEEID" = "SCHEDULE"."SCREFPERSON1ID") REFAGENT1,
    (SELECT r.REMPFIRSTNAME||' '||r.REMPLASTNAME
    FROM REFAGENCYEMPLOYEES R WHERE "R"."REMPLOYEEID" = "SCHEDULE"."SCREFPERSON2ID") REFAGENT2,
    "CODELOOKUP"."CODELISTNAME"
    FROM "POBJS"."CLIENTS" "CLIENTS",
    "POBJS"."SCHEDULE" "SCHEDULE",
    "POBJS"."CODELOOKUP" "CODELOOKUP"
    WHERE ("CLIENTS"."CLIENTID"="SCHEDULE"."SCCLIENTID")
    AND ("SCHEDULE"."SCEXAMTYPE"="CODELOOKUP"."CODEVALUE")
    AND "CODELOOKUP"."CODELISTNAME"='EXAM TYPES'
    Thanks for any help.

    Thanks for the information. I worked around the problem by calling a function that basically runs the nested select statement and returns a value.
    pobjs.getrname("SCHEDULE"."SCREFPERSON1ID") AS AGENT1,
    "CODELOOKUP"."CODELISTNAME"
    FROM "POBJS"."CLIENTS" "CLIENTS", ........

  • Is it possible to nest SELECT statements?

    Greetings community,
    Another newbie’s question it is. Looking tutorials and some posts here I’ve been advised not to pull entire table through the local network, and torture client machines’ processors and memory. It’s been said that better solution is to
    pull just one part of the table.
    So, imagine this: you want to make a part of your app that would allow your user to view list of orders. So you put one data grid view on the form, pull last 20 headers from the table into it and leave to user to choose one to be opened
    in another form. If user doesn’t find header they want, they press page up for example and previous 20 headers are loaded into data grid view. Of course, user could filter headers list by customer, or by distribution lane (having all customers residing in
    one part of the town), or whatever more, but let’s not complicate things at this moment, because I’m practically in the beginning.
    I’m trying to make a stored procedure that would load penultimate 20 headers when user presses page up. So, not knowing any better, I created table variable that has the same structure as Orders table with one difference: OrderID column,
    which is identity (auto incremented) in Orders table, here is simply defined as bigint not null. Community member Visakh16 warned me few months ago it’s the bad practice to put self-incrementing columns in table variables.
    At this moment there’s a query on my screen, which waits to become store procedure. After boring part with table variable definition, it goes like this:
    INSERT INTO @OrdersTemp SELECT TOP 40 * FROM dbo.Orders ORDER BY OrderID DESC
    SELECT TOP 20 * FROM @OrdersTemp ORDER BY OrderID ASC
    To put that simply, I pull last 40 headers into table variable, and then pull first 20 from there. This thing works, and I just have to replace 40 with parameter, for every page up or down.
    Now I have few questions.
    -Is there some better way (considering performance) to achieve that? Here is the place where I wanted to ask the question from the title of the post. I don’t know much about T-SQL, and I’m not sure about the proper syntax to nest SELECT
    statements, if something like that is even possible
    -Is there any better way (some built-in function) to find about the count of the rows in one table than
    SELECT COUNT(OrdersID) FROM dbo.Orders
    Thanks for any suggestions.

    Hi Erland,
    Sorry for the very late reply, but I said that I would start another thread when I find more free time to dedicate it to this, so I didn’t really expected you to reply anymore. I didn’t really check here for more than a week, and I glanced
    at mail accidentally.
    As for the negative result I got, its measurement unit is microsecond, so it doesn’t go out of margins you had experienced.
    As for the number of cores, you got me surprised there. I use express edition of SQL server. Last time I checked was SQL server 2012 express, and in specifications it said that express edition is limited to 1 processor core, 1GB of RAM
    and creates up to 10GB database file. I don’t believe they changed any of those specifications. It was generous enough when they doubled size of DB file few editions ago. Still, it appears that “one processor core for express edition” statement has some gray
    areas in it.
    However, at this moment I’m just learning, and I just wanted some way to test how efficient my queries are. I don’t have a real biz problem to solve. I don’t expect that any real performance problem should rise in years of everyday work
    of populating database. What I expect is performance impact when it comes to creating reports, but after all, I don’t think that my boss would create reports by himself. I believe that creating reports would be my task, and I will be doing it after hours,
    being the only user at the moment. Or maybe I could make de-normalized copy of database that would be populated after hours to make it possible for my boss to get his reports faster by himself, as I’ve heard that was the way of making BI in older non-express
    editions.
    So, I do suggest that we finally close this thread for sake of other readers. I’ll start another one with this subject when I find the time to do it.
    Again, thanks for being with me along this journey.

  • Constant Selection in BEx Query Designer on BI7

    Hi guys
    According to this blog <a href="/people/prakash.darji/blog/2006/09/19/the-hidden-secret-of-constant-selection Selection</a>, we can create constant selection on both Characteristics and Key figures. I understand how to do it with restricted key figures.
    Can anyone give me a step by step guide on how to create constant selection for a Characteristic in BEx Query Designer on BI7. I can't find options for 'constant selection'
    Or is this the same thing when you include or exclude values?
    Message was edited by:
            jimi ogun

    Thanks Krishna
    I am actually using a Multiprovider for my queries but business requirements mean I need to create joins.
    I am trying to avoid Infosets and I believe another way is to use the Constant Selection feature in Query Designer.
    Going back to my previous posting, I know how this is done with a restricted KF but I don't know how when it comes to characteristics.
    Can anyone help?

  • How to use multi select in a query report

    I defined a lov. This lov retuns name and a id. I want to use the result of this multi select in my query.
    I always get invalid number when I choose two items of the select. When I debug I see that the return value of the multi select is 1:2. How can I change the seperator : in , I tried the following but this does't work.
    if :P26_PRODUCTTYPE IS NOT NULL then
    l_sql := l_sql ||' and producttype in
    (REPLACE(:p26_producttype,'':'','','' ))';
    end if;

    as you're finding, multiple values selected from html db multi-select list items (and checkboxes) are stored as a single, colon-delimited string. i explained an easy way to handle this via pl/sql in...
    Multiple select list
    ...that post shows you how to throw the selected values into a pl/sql table and step through them as needed. it also showed how to use an instr to parse through the string if you want to go that route. you could use that same instr logic right in your sql query. so let's say your lov for your multi-select item (P1_MY_MULTISELECT, we'll call it) was defined as...
    select ename, empno from emp order by 1
    ...and your user selected KING, FORD, and JONES. :P1_MY_MULTISELECT would store those values as...
    7839:7902:7566
    ...you could then write a query to return the selected enames with something like...
    select ename, job
    from emp
    where insrt (':'||:P1_MY_MULTISELECT||':',':'||empno||':') != 0
    ...hope this helps,
    raj

  • Prompting for user input in nested select statements

    I recently rewrote a query to use a nested select statement instead of specifying every SELECT field on the GROUP BY line.  Here's the query which works perfectly with hard-coded values of '030', '01/01/11', and '12/31/11'.
    SELECT T0.[CardName] AS Customer, T0.[CardCode] as 'Cust ID', T0.[Phone1] as Phone, T0.[CntctPrsn] as 'Contact Person', T0.[Address], T0.[City], T0.[State1] as State, T0.[ZipCode] as 'Zip Code', T0.[Country],  T1.[TotalSales]
    FROM OCRD T0 
    INNER JOIN
       (SELECT I.[CardCode] AS CardCode, SUM(I.[DocTotal]) AS TotalSales
        FROM OINV I
        WHERE left (I.[CardCode], 3) = '030' AND (I.[DocDate] >= '01/01/11' AND I.[DocDate] <= '12/31/11')
        GROUP BY I.[CardCode]) T1
    ON T0.[CardCode] = T1.[CardCode]
    ORDER BY T0.[CardName]
    When I try to prompt for the left 3 characters of the CardCode (or the dates), ie.
        WHERE left (I.[CardCode], 3) = [%0] AND (I.[DocDate] >= '01/01/11' AND I.[DocDate] <= '12/31/11')
    I get an error "Column 'OCRD.CardName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause".
    It's like putting a user variable in the inner SELECT made it part of the outer SELECT which is exactly what I was trying to avoid by re-writing this query with the inner SELECT.
    Can anyone explain what SQL Server is doing here and how to fix it?

    Thanks Gordon.  That's how I originally wrote the query and it works fine.  But I was disturbed that I had to GROUP BY every field in my SELECT statement when I really only wanted to group by CardCode.  So I did some research and came up with this where the inner select still groups by only CardCode and still takes user input.  I don't really understand why you need the commented SELECT statements in the SET lines, but you do.  Something about using real table fields for variables.
    DECLARE @startDate datetime
    DECLARE @endDate datetime
    DECLARE @rep varchar(10)
    SET @rep /* SELECT T0.[CardCode] FROM ORDR T0 WHERE T0.[CardCode] */ = '[%0]'
    SET @startDate /* SELECT T0.[DocDate] FROM OINV T0 WHERE T0.[DocDate] */ = '[%1]'
    SET @endDate /* SELECT T0.[DocDate] FROM OINV T0 WHERE T0.[DocDate] */ = '[%2]'
    SELECT T0.[CardName] AS Customer, T0.[CardCode] as 'Cust ID', T0.[Phone1] as Phone, T0.[CntctPrsn] as 'Contact Person', T0.[Address], T0.[City], T0.[State1] as State, T0.[ZipCode] as 'Zip Code', T0.[Country],  T1.[TotalSales]
    FROM OCRD T0 
    INNER JOIN
       (SELECT I.[CardCode] AS CardCode, SUM(I.[DocTotal]) AS TotalSales
        FROM OINV I
        WHERE left (I.[CardCode], 3) = @rep AND (I.[DocDate] >= @startDate AND I.[DocDate] <= @endDate)
        GROUP BY I.[CardCode]) T1
    ON T0.[CardCode] = T1.[CardCode]
    ORDER BY T0.[CardName]
    FOR BROWSE

  • Enable fiscal year/quarter selection in a query

    Hello all,
    I want to have an characteristic fiscal year/quarter similar to fiscal year/period (0FISCPER) in my query. Unfortunately I can not find such a characteristic in the time infoObjects in my cube and in the administrator workbench.
    Our Fiscal year starts in July. So the first quarter is July - September. The BW release is 3.5.
    How canI enable a fiscal yearquarter selection in my query?
    Any ideas would be great.
    Thanks upfront and Best regards,
    Stefanos from Munich/Bavaria/Germany

    Stefanos ...
    A couple of options for the same :
    1. Have 0FISCPER in your cube and map the same to the custom characteristic in the update rules.
    2. Have the custom characteristic in the cube in a separate dimension
    3. If you have the same in the cube - have a variable against that and execute your query...
    By doing the above you can get the same in the query.
    Arun
    Assign points if useful

  • Ref cursor based on join or nested select is empty

    Hi ,
    We have a Stored procedure which returns 27 ref cursors.
    We are populating this data into a suitable data set using OracleDataAdapter (.fill).
    Refcursors that the data they hold is from a join or nested select are result empty.
    The other refcursors are fine.
    If running the stored procedure in the database (from another SP for instance) all refcursors are full of data.
    Can someone direct me for a solution or even working work around ?
    Thanks

    Hi Again ,
    No, The cursors are not any of group by with some aggregations of any sort. Just plain and simple joins or nested queries (Select... from ... where ... in (select ...). Some of the data is taken from temporary tables.
    For the last question i am using the production ODP with the last oraMTS.
    This problem is really stopping us from going to production in early march ....
    A possible work around we thought about (but cost dearly ...) is to fill the data from the tables into a temporary one and then base the cursor on a query on this table. This workaround can last only a few weeks at the customer.
    Regards

  • Find query from workbook

    I want to change a sheet in workbook (i.e I want to insert selections for only one sheet) but when I goto that sheet and then goto change query global def it shows "please select the query".Please tell me how to find out from where the data is coming on that sheet and how to change that.

    Seacrch in metadata repository with your workbook name.You will find Query used.
    and Query sheet is hidden in your workbook?
    format>sheet>unhide>select Query.Then place the cursor on Query output>change Query global definition.
    <i>"want to change a sheet in workbook (i.e I want to insert selections for only one sheet)"</i>  what are you trying to do exactly?

  • Regarding nested selects...........

    Hi friends,
    i want to use one query in that i have to use neseted selects.
    can any one tel me example with considering performane also.
    regards,
    madhu.

    Hi madhu,
      SELECT tabname
               INTO ls_dd02l
               FROM dd02l
               WHERE tabname LIKE c_feld
               AND   buffered IS NOT NULL.
          SELECT tabname fieldname keyflag position
                 INTO CORRESPONDING FIELDS OF ls_dd03l
                 FROM dd03l
                 WHERE tabname   = ls_dd02l-tabname
                 AND   fieldname IN ('MANDT', 'CLIENT', 'CLNT')
                 AND   keyflag   = 'X'.
            IF ( sy-subrc EQ 0 ).
              wa-tabname   = ls_dd03l-tabname.
              wa-fieldname = ls_dd03l-fieldname.
              wa-keyflag   = ls_dd03l-keyflag.
              wa-position  = ls_dd03l-position.
              APPEND wa TO itab.
            ENDIF.
          ENDSELECT.
        ENDSELECT.
    There are no practical limits to nested SELECTs, but as other repliers have already pointed out they quickly become a performance hog. I have stopped using them for years, and when I teach ABAP performance classes I also quote them as one of the top "don'ts". With nested selects, the number of calls to the DBMS can easily become enormous, putting the database server under stress.
    A good alternative - the one I favour most myself - is to use SELECT INTO TABLE for the"outer" select, followed by appropriate SELECT FOR ALL ENTRIES statements to handle the inner levels.
    ABAP joins are another alternative. When properly written, a join will be faster than a nested select. The problem is however that very often joins are not properly written. SELECT statements should always respect the KISS principle (keep it simple, stupid) and with a join it is very easy to violate that rule. A join over 2 tables should probably be OK, but with 3 or more tables you want to be very careful. If you really want to code a complex join, I recommend that you also code the same logic with different means (INTO TABLE/FOR ALL ENTRIES or even nested selects) and then compare that with the join.
    regards,
    Jayan.

  • How to put variable selection and the query result the same screen

    Dear all,
       how can I put the variable selection and the query result in the same screen? Please advise. Thanks.
    Jin Ming

    Not sure if you are saying you want the prompts on the same page as the results... however in 7.0 with BEx Analyzer, you can insert a text object from the design toolbar and assign it to the variable.... this way, lets say you run query for period 6, then the text object will display "6" on the same area where the query results are.

  • 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

  • Using nested select in oracle functions

    hi, im new to oracle functions, and im trying to write a function using a nested select statment, but i get the error
    Error: PLS-00428: an INTO clause is expected in this SELECT statement
    can anyone help point out what i am doing wrong, The sql select statment works on a worksheet, so i guess its the way i am using the function
    create or replace function Media_Object_Name(Detail_id Number) return varchar2 as
    Result varchar2(300);
    begin
    select promo_name from promo where promo_id =
    (select promo_id from promo_plan where promo_plan_id =
    (select promo_plan_id from event_promotion where detail_id = Detail_id)) into ;
    return(Result);
    end Media_Object_Name;
    thanks
    james

    The into clause should go here:
    SELECT promo_name
      INTO Result
      FROM promo
    WHERE promo_id = (SELECT promo_id
                         FROM promo_plan
                        WHERE promo_plan_id = (SELECT promo_plan_id
                                                 FROM event_promotion
                                                WHERE detail_id = detail_id));I don't know about your data modell, but are you sure you need nested selects?
    C.

  • When to use SELECT and END SELECT in the query.

    hi all,
    When to use SELECT and END SELECT in the query.
    regads,
    Venkata Suresh Penke.

    Hi Suresh..
    When do we need to use SELECT .. ENDSELECT
    Usually we will never use SELECT .. ENDSELECT as it gives very poor performance.
    But whenever we read a single Record we will use it as an alternative for SELECT SINGLE in some scenarios.
    Eg: When the Full primary key is not specified in the WHERE clause.
    SELECT * FROM MARC INTO WA_MARC UP TO 1 ROWS WHERE MATNR = P_MATNR.
    ENDSELECT.
    And other scenario is when we perform AGGREGATE OPERATIONS.when the Result is only one row.
    SELECT SUM( LABST ) FROM MARD INTO V_LABST UP TO 1 ROWS
    WHERE MATNR = P_MATNR.
    ENDSELECT.
    Note: In The Above scenario we cannot use SELECT SINGLE..
    <b>REWARD IF HELPFUL.</b>

Maybe you are looking for