Nested queries?

I have a database that contains a table PERSONNEL and a table PLANETS..and some others....
I'm trying to get a list that shows every personnel in the database, and the name of the planet they come from (they are included in the PERSONNEL table). I would like to include planets that do not appear in the personnel table but are listed in the planets table. Should I use a nested query for this or some type of join? I apologize for the noob question but i am just beginning to learn SQL. Any help would be greatly appreciated!

Check how Personnel each Planet have
SELECT pl.planet_name
,nvl(count(ps.personnel_id),0) "No Of Personnel"
from planets pl, personnel ps
where pl.planet_id=ps.planet_id(+)
group by pl.planet_name;
List all Planets with or without Personnel
select pl.planet_name
,nvl(ps.personnel_name,'Has No Personnel') Personnel
from planets pl, personnel ps
where pl.planet_id=ps.planet_id(+);
Note: I have not tested this, so correct any typos where necessary

Similar Messages

  • SQL Parser supporting nested queries

    Hi,
    I require a SQL parser that supprt nested queries. JavaCC doesnt support nested queries so that one is out. If anyone knows of any open sourse parser, please enlighten me. I have already looked enough on Google but not of much use.
    thanks,
    abulkd

    | 1. as suggested , i was able to get the oraclexmlsql.jar
    | from the servlet zip and loading it solved the problem of
    | the jdbc string being printed int he cursor syntax . it
    | works from the xmlgen utility withing pl/sql. but when
    | using OracleXML in a java prog the results still printout
    | the jdbc string.. any ideas...
    Could only be a CLASSPATH problem difference in your two
    tests.
    | 2. Is there anyway to supress the rownum attribute tag in
    | the subquery (cursor) results...that is the
    | setRowIdAttrName .... w/o using xslt
    Not at this time. Rownum supression on the subquery should
    probably follow your settings on the main query. I'll
    suggest to the devs.
    | 3. We are implementing a solution using these tools.... we
    | wanted to know which were the production versions.
    XDK Components for XML and XSLT are production.
    XML SQL Utility and XSQL Servlet are still Technical
    Previews and as such are not yet production.
    null

  • Xsql ... select variable to avoid multiple nested queries

    Hi,
    I want to have one .xsql file which processes quite a few queries.
    I want to be able to save a column result from a query into something similar to a variable. That way, later in my xsql file, I can use the variable result in the where clauses of other queries.
    I know I can do this with a bunch of nested queries, but it would take longer to process the results than if I could use a straight out variable from a previous query.
    Anybody have ideas on how I could do this with xsql?
    dgiles
    null

    Simplest way to do this at present is to write a custom handler that take a query and sets an attribute on the document element of the XSQL page to the value selected from the database. Then the normal {@paramname} sytnax will work to reference it's value later in the page.

  • Connect By not working with nested queries in from clause.

    Using Connect By on a query which has a nested from clause(The from clause fetches around 100k records) gives incorrect results but if the same nested queries are used to build a table and the Connect By is used on the table then the output is correct.
    I put the nested queries in a 'WITH' clause and got the correct output also.
    I am not sure how to give the code here as you would need dump to make them work.
    I am giving the a sample code:
    --Non Working Code
    SELECT     con_item, prod_item, compsite, bcsite, ibrsite, res
          FROM (SELECT con_item, prod_item, compsite, bcsite, ibrsite, res
                  FROM (SELECT bd.item AS con_item, bd.fromid AS compsite,
                               bd.toid AS bcsite, bd.toid AS ibrsite,
                               bd.bodname AS ID, bd.item AS prod_item,
                               'BOD' AS res
                          FROM TABLE1 bd
                        UNION
                        SELECT bc.item AS con_item,
                               bc.componentsiteid AS compsite,
                               bc.siteid AS bcsite, ibr.siteid AS ibrsite,
                               ibr.routingid AS ID, ibr.item AS prod_item,
                               op.resourcename AS res
                          FROM TABLE2 ibr,
                               TABLE3 bc,
                               TABLE4 op
                         WHERE ibr.bomid = bc.bomid
                           AND ibr.siteid = bc.siteid
                           AND ibr.routingid = op.routingid(+))
                 WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
                   AND ibrsite LIKE 'CRCW%HSM')
    START WITH ibrsite = 'CRCW_QA_HSM' AND prod_item = 'SWXCD0S9B'
    CONNECT BY PRIOR con_item = prod_item AND PRIOR compsite = bcsiteWorking Code:
    --The table TEST_V is constructed on the from clause of above query
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES
          FROM TEST_V
    START WITH IBRSITE = 'CRCW_QA_HSM' AND PROD_ITEM = 'SWXCD0S9B'
    CONNECT BY PRIOR CON_ITEM = PROD_ITEM AND PRIOR COMPSITE = BCSITEAlso another working code:
    WITH SUB AS
         (SELECT BD.ITEM AS CON_ITEM, BD.FROMID AS COMPSITE, BD.TOID AS BCSITE,
                 BD.TOID AS IBRSITE, BD.BODNAME AS ID, BD.ITEM AS PROD_ITEM,
                 'BOD' AS RES
            FROM TABLE1 BD
          UNION
          SELECT BC.ITEM AS CON_ITEM, BC.COMPONENTSITEID AS COMPSITE,
                 BC.SITEID AS BCSITE, IBR.SITEID AS IBRSITE, IBR.ROUTINGID AS ID,
                 IBR.ITEM AS PROD_ITEM, OP.RESOURCENAME AS RES
            FROM TABLE2 IBR, TABLE3 BC, TABLE4 OP
           WHERE IBR.BOMID = BC.BOMID
             AND IBR.SITEID = BC.SITEID
             AND IBR.ROUTINGID = OP.ROUTINGID(+))
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES, LEVEL
          FROM SUB
    START WITH PROD_ITEM = 'SWXCD0S9B' AND IBRSITE = 'CRCW_QA_HSM'
    CONNECT BY PRIOR COMPSITE = BCSITE AND PRIOR CON_ITEM = PROD_ITEMI am sorry if I am giving incorrect syntax, please let me know if my giving the dump of table be of any help.
    Regards,
    Vikram
    Edited by: BluShadow on 11-Jan-2012 11:05
    fixed {noformat}{noformat} tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi, Vikram,
    Welcome to the forum!
    user2765706 wrote:
    Using Connect By on a query which has a nested from clause(The from clause fetches around 100k records) gives incorrect results but if the same nested queries are used to build a table and the Connect By is used on the table then the output is correct.
    I put the nested queries in a 'WITH' clause and got the correct output also.What exactly is the problem? Why not use one of the queries that gives the correct output? I find that WITH clauses are a lot easier to understand and debug than in-ine views, anyway.
    Are you just wondering why one of the queries doesn't work?
    I am not sure how to give the code here as you would need dump to make them work. You're absolutely right! You need to post some sample data and the results you want from that data. Without that, it's much harder for people to understand what the problem is, or how to fix it.
    I am giving the a sample code:
    --Non Working CodeLet's call this Query 1.
    SELECT     con_item, prod_item, compsite, bcsite, ibrsite, res
    FROM (SELECT con_item, prod_item, compsite, bcsite, ibrsite, res
    FROM (SELECT bd.item AS con_item, bd.fromid AS compsite,
    bd.toid AS bcsite, bd.toid AS ibrsite,
    bd.bodname AS ID, bd.item AS prod_item,
    'BOD' AS res
    FROM TABLE1 bd
    UNION
    SELECT bc.item AS con_item,
    bc.componentsiteid AS compsite,
    bc.siteid AS bcsite, ibr.siteid AS ibrsite,
    ibr.routingid AS ID, ibr.item AS prod_item,
    op.resourcename AS res
    FROM TABLE2 ibr,
    TABLE3 bc,
    TABLE4 op
    WHERE ibr.bomid = bc.bomid
    AND ibr.siteid = bc.siteid
    AND ibr.routingid = op.routingid(+))
    WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
    AND ibrsite LIKE 'CRCW%HSM')
    START WITH ibrsite = 'CRCW_QA_HSM' AND prod_item = 'SWXCD0S9B'
    CONNECT BY PRIOR con_item = prod_item AND PRIOR compsite = bcsite
    [\CODE]
    Working Code:Let's call this Query 2.
    --The table TEST_V is constructed on the from clause of above query
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES
    FROM TEST_V
    START WITH IBRSITE = 'CRCW_QA_HSM' AND PROD_ITEM = 'SWXCD0S9B'
    CONNECT BY PRIOR CON_ITEM = PROD_ITEM AND PRIOR COMPSITE = BCSITE
    [\CODE]Why does Query 1 not do the same thing as Query 2? That depends on what is in test_v. Only you know what test_v is, so only you can say. If you'd post the code that created test_v, maybe somebody else could help.
    Also another working code:Let's call this Query 3.
    WITH SUB AS
    (SELECT BD.ITEM AS CON_ITEM, BD.FROMID AS COMPSITE, BD.TOID AS BCSITE,
    BD.TOID AS IBRSITE, BD.BODNAME AS ID, BD.ITEM AS PROD_ITEM,
    'BOD' AS RES
    FROM TABLE1 BD
    UNION
    SELECT BC.ITEM AS CON_ITEM, BC.COMPONENTSITEID AS COMPSITE,
    BC.SITEID AS BCSITE, IBR.SITEID AS IBRSITE, IBR.ROUTINGID AS ID,
    IBR.ITEM AS PROD_ITEM, OP.RESOURCENAME AS RES
    FROM TABLE2 IBR, TABLE3 BC, TABLE4 OP
    WHERE IBR.BOMID = BC.BOMID
    AND IBR.SITEID = BC.SITEID
    AND IBR.ROUTINGID = OP.ROUTINGID(+))
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES, LEVEL
    FROM SUB
    START WITH PROD_ITEM = 'SWXCD0S9B' AND IBRSITE = 'CRCW_QA_HSM'
    CONNECT BY PRIOR COMPSITE = BCSITE AND PRIOR CON_ITEM = PROD_ITEM
    [\CODE]Why does Query 1 not do the same thing as Query 3? Query 1 has these conditions:
    ...           WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
                    AND ibrsite LIKE 'CRCW%HSM'but Query 3 does not.
    I am sorry if I am giving incorrect syntax, please let me know if my giving the dump of table be of any help.Yes, that always helps. Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data. Simplify the problem as much as possible. For example, if you have the same problem when you leave out one of the tables, then don't include that table in the problem.
    Always say what version of Oracle you're using. This is especially important with CONNECT BY queries, because every version since Oracle 7 has had major improvements in this area.

  • How to write nested queries using DB Adapter?

    I want to write following nested query using DB Adapter can any one help...
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID =(
    (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE  (INVOICE_ID = ‘12345’)));
    Thanks,
    Ram.

    Hi Ram,
    Most likely it is the semicolon at the end of the SQL statement that's causing the db adapter to throw the error; just enter the custom sql statement without a semicolon at the end.
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID = (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE INVOICE_ID = '12345')

  • Nested Queries in SQL Utility/Prod versions

    Can you tell which XML product versions are in production....
    we are implementing a custom XML solution for a B2B client, and are using
    the 8i and the tools from oracle with quite a bit of custom code...
    I have a couple of questions.
    1. as suggested , i was able to get the oraclexmlsql.jar from the servlet zip and loading
    it solved the problem of the jdbc string being printed int he cursor
    syntax . it works from the xmlgen utility withing pl/sql. but when using OracleXML in a java prog the
    results still printout the jdbc string..
    any ideas...
    2. Is there anyway to supress the rownum attribute tag in the subquery (cursor) results...that is the setRowIdAttrName .... w/o using xslt
    3. We are implementing a solution using these tools.... we wanted to know which were the production versions.
    thanks.
    jayant

    | 1. as suggested , i was able to get the oraclexmlsql.jar
    | from the servlet zip and loading it solved the problem of
    | the jdbc string being printed int he cursor syntax . it
    | works from the xmlgen utility withing pl/sql. but when
    | using OracleXML in a java prog the results still printout
    | the jdbc string.. any ideas...
    Could only be a CLASSPATH problem difference in your two
    tests.
    | 2. Is there anyway to supress the rownum attribute tag in
    | the subquery (cursor) results...that is the
    | setRowIdAttrName .... w/o using xslt
    Not at this time. Rownum supression on the subquery should
    probably follow your settings on the main query. I'll
    suggest to the devs.
    | 3. We are implementing a solution using these tools.... we
    | wanted to know which were the production versions.
    XDK Components for XML and XSLT are production.
    XML SQL Utility and XSQL Servlet are still Technical
    Previews and as such are not yet production.
    null

  • How to use dual table in ODI in source side for nested queries?

    Hi,
    Any idea how to use dual table in source for more than once. I want to build a ODI interface for the following source query
    SELECT ACTV_TYP.ACTV_TYP_SRC_CD, ACTV_TYP.ACTV_TYP, PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS,
    (SELECT 1 ACTV_TYP_SRC_CD, '?????' ACTV_TYP FROM DUAL
    UNION ALL
    SELECT 2 ACTV_TYP_SRC_CD, '???????' ACTV_TYP FROM DUAL) ACTV_TYP
    Regards

    If the below query is equivalent , it seems you don't need dual table at all , just default the values in the interface.
    You are using dual tables to populate values ACTV_TYP.ACTV_TYP_SRC_CD, ACTV_TYP.ACTV_TYP values. Look at your query in the following manner :
    SELECT '1', '?????', PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS
    UNION
    SELECT 2 , '??????', PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS
    Now you can use dataset to make UNION.

  • Multi page html table, by letter, then by number ... possible to handle nested queries?

    I had seen a worked example of handling html tables spread across multiple pages where there was a logical number on each page here: http://www.powerpivotblog.nl/nba-team-spending-and-their-results-with-excel-powerpivot-and-data-explorer/
    Which requires a two-step solution:
    1) to alter the query to use Number.ToText
    (page) =>let
        Source = Web.Page(Web.Contents("http://website_url/a-z/a/" & Number.ToText(page))),
        Data0 = Source{0}[Data],
        ChangedType = Table.TransformColumnTypes(Data0,{{ etc etc}})
    in
        ChangedType
    and then 2) to supply a {1..X} parameter on a separate sheet.
    let
        Source = Table.Combine(List.Transform({1..30}, Query))
    in
        Source
    In my example URL above (http://website_url/a-z/a/1), there is also a changing letter component /a-z/a/1, 2, 3, then /a-z/b/1,2,3 etc...
    Is there an equivalent way of setting an {a..z} parameter as an outer loop and combine it with the {1..30} loop, by any chance?
    Thanks for your help.
    Colum

    Here are two ways you can reduce the number of privacy prompts:
    1) Use the trick Curt mentions here about reducing the number of prompts.
    Basically, add a query that uses a formula like:
    = {Web.Contents("http://website/"), Web.Contents("http://someOthersite/")}
    Then, set the privacy level of http://website/ to Public. After saving the privacy level, you can discard the query.
    2) You can enable Fast Combine, which will disable the privacy checks. I do not recommend this approach in general, and you should only enable Fast Combine if you are certain that you can trust your data sources. Also, be extremely cautious about enabling
    Fast Combine on workbooks you did not create.
    I recommend the first approach.
    Sorry, I did not include the navigation and transformation steps in my approach above. To include those steps, it will be nicer to go with the two-step approach to prevent the last function in Websites from being too messy.
    For the first step, we can create a function which, given a letter and a page number, grabs the data from the website and performs some transformations on it. It might look something like this:
    let
        Source = (letter, pageNumber) => let
            Page = Web.Page(Web.Contents("http://website/" & letter & "/" & Number.ToText(pageNumber))),
            Data0 = Page{0}[Data],
            ChangedType = Table.TransformColumnTypes(Data0,{{"FIELD1", type text}, {"FIELD2", type text}, {"FIELD3", type text}, {"FIELD4", type text}, {"FIELD5", type text}})
        in
            ChangedType
    in
        Source
    Let's call this query GetWebsiteContents.
    For the second step we can generate all of the letter and number combinations we need, and then call GetWebsiteContents on each combination. That may look like this:
    let
         Numbers = {1..5},
         Letters = {"a", "b", "c"},
         CreatePair = (page) => List.Generate(() => 0, each _ < List.Count(Letters), each _ + 1, each {Letters{_}, page}),
         LetterNumberPairs = List.Combine(List.Generate(() => 0, each _ < List.Count(Numbers), each _ + 1, each CreatePair(Numbers{_}))),
         Websites = List.Generate(() => 0, each _ < List.Count(LetterNumberPairs), each _ + 1, each GetWebsiteContents(LetterNumberPairs{_}{0}, LetterNumberPairs{_}{1}))
     in
         Websites
    I hope this helps.
    -Alejandro (MSFT)

  • Multiple select queries for JDBC sender

    I am working on JDBc to IDOC scenario.
    I need to process two select queries in PI where output of 1st query becomes the input of second.
    Now i need to map the output of second to IDOC through XSL mapping also i need to use BPM to process(without using the stored procedure) the scenario.
    In my JDBC communication channel i have option for only one select query and second query should fetch the data through BPM.
    In BPM i have used the following sequence mentioned below:
    Start --> Receive step ( receives all the header lines) --> Transformation (to split the header messages to single message) --> Block Start( To processEachRecord) --> Send Syn (to map the request message i,e. output of first query with Response i,e. structure of the second query)  --> Send Asyn (to send the output of second query to XSLT mapping) -->Block End --> stop
    Output of XSLT mapping is the input for IDOC
    Now i need to understand how to process the second query?

    >> I need to process two select queries in PI where output of 1st query becomes the input of second
    Use SQL Nested Queries. 
    Example:
    SELECT Model FROM Product WHERE ManufacturerID IN (SELECT ManufacturerID FROM Manufacturer
    WHERE Manufacturer = 'Dell')
    Here first table is Manufacturer .. we do select query in manufacturer to return data and pass it to the first table Product.
    >> Now i need to understand how to process the second query?
    You dont need at all. In your sender jdbc channel, write sql statement nested query and you will get only output of the second table. you map the second table output to the idoc.
    Note: Dont know why do you need BPM for this case..
    Jdbc sender adapter  help links
    http://help.sap.com/saphelp_srm40/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Check this thread for update statement in jdbc cc
    Re: sender jdbc adapter

  • Nested query value used as comparison in second nested query

    Hi,
    What would be the best way of writing the following:
    I have a simple SELECT statement which includes two nested queries used to get the start and end dates from two different tables (if the first date from the first table and the second from a different table), there is not real direct relationship between
    those two seperate tables.  However the result of the first date nested select would determine part of the WHERE statement in the second nested statement.
    I need a way of using the value returned as a part of first nested select in the where statement of the second.
    I know exactly how to do this using something like ASP.NET C# but that involved running them as seperate queries and storing the values in variables before running a new statement for example and I would prefer to run a single query with the nested selects
    and get the results as required.
    Can anyone point me in the right direction of the best way of running this kind of thing?
    Cheers for any replies!

    Hello,
    Please provide DML for the tables, some sample data and the expected result. Just with your description we could only guess.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • 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

  • Nested CFQuery Uses Wrong Datasource

    I'm using CF MX 7.0.2, and it's come to my attention that there is a problem with how CF handles nested queries. To illustrate it simply:
    <cfquery name="insert" datasource="one">
         <cfquery name="select" datasource="two">
           select * from table
         </cfquery>
         insert into test values('blah')
    </cfquery>
    This set of code will attempt to insert the 'blah' value into datasource "two"! Not the expected "one". While this seems like a terrible way to make things, consider a more common scenario:
    <cfquery name="insert" datasource="one">
       insert into test values('#myfunction()#')
    </cfquery>
    <cffunction name="myfunction">
      <cfquery name="select" datasource="two">
        select * from table
      </cfquery>
      <cfreturn "blah">
    </cffunction>
    Again, this will attempt to insert into datasource "two". Please tell me there's a hotfix I can't find for this...

    I'm not sure what you gain by nesting the queries and not keeping them separate but thought you'd might like to know that the two scenarios you described function the same in CF8 as you note for CF7.
    The following code works fine for me on both CF7 and 8:
    Opt 1:
    <cfquery name="q1" datasource="dsn1">
    select role from end_users
    </cfquery>
    <cfquery name="q2" datasource="dsn2">
    insert into role (id) values('#q1.role#')
    </cfquery>
    Opt 2:
    <cfscript>
    myStr = testFunc();
    </cfscript>
    <cfquery name="q1" datasource="dsn1">
    insert into role (id) values('#myStr#')
    </cfquery>
    <cffunction name="testFunc" returntype="string">
    <cfquery name="q2" datasource="dsn2">
    select role from end_users
    </cfquery>
    <cfreturn q2.role />
    </cffunction>
    Doesn't seem like either one would be a significant rewrite or movement of your code.
    Anyway, I thought you'd might like to know that both your scenarios work the same in 8 as 7 and, as a result, I don't think there would be a hotfix for CF7.

  • SQL NESTED Query

    i just wanna know whether the JSP can support nested queries such as this:
    SELECT     family_name, employee_id
    FROM         EMPLOYEE
    WHERE     EXISTS
                              (SELECT     *
                                FROM          UserAccess
                                WHERE      UsrGrp = 'ITS/Admin' AND EMPLOYEE.employee_id = UserAccess.EmplID)???

    hmm.. i'm using microsoft sql server.. when i execute the above query in the database.. it works.. but when i tried to execute the query using JSP... it prompt me an error.. shown below..
    [2/15/05 10:25:41:611 GMT+08:00] 60286b8 WebGroup E SRVE0026E: [Servlet Error]-[[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index]: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6057)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6214)
         at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3292)
         at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5416)
         at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:343)
         at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:400)
         at org.apache.jsp._add3._jspService(_add3.java:187)
         at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:598)
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:696)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
         at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
         at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
         at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
         at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
    why is that so?? :<

  • Custom report outer-join display problem

    I have written a custom report for Grid that produces info on database options, combined with info on the hardware of the servers where the databases reside. It is a customer requirement that all output be displayed as one huge table, with duplicate cells where logic dictates... so I've used a couple of nested queries + outer joins.
    My SQL query provides the correct data, however Grid appears to be acting clever, and instead of displaying one big table with duplicate values where required, it is splitting the output into a series of tables.
    It might look neater, but it's not what I've been asked to provide.
    Is there anything I can do to prevent this, and force Grid to display the info as one table?
    Thanks,
    Chris

    Hello Chris,
    did you already try to create a View based on your query and use this view in a Report Element?
    Regards
    Rob
    For more info, tips and tricks on oem gc check: http://oemgc.wordpress.com

  • Access 2010 on 64 Bit Windows 7 Access "Not Responding" when changing from forms view to design view and back

    I am running
    Windows 7 64 bit
    Access 2010 32 bit
    Developing an application with a split FE BE with both files local but continue to have the message "Not Responding" when switching from forms view to design view and back as well as if I try to connect to a subform or object on the sub form.

    I have seen this behavior when the form's RecordSource is a complex query such as a crosstab or a query with several nested queries. To test if this is your case, remove the RecordSource and see if the form starts acting normal again.
    Then again, if the form has several subforms they might be slowing up the loading time.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

Maybe you are looking for

  • Usage of delivery without reference to sales order

    Hi , I want to know in which business scenarios we will create the delivery document without reference by usiing VL01NO followed by billing document. Anticipating a positive response Best Regards, Goutham

  • Procurement Of Imported Material From Trader

    hi,     i am purchasing one imported material from a trader,in this case excise treatment is different     *MATERIAL        QUANTITY   RATE/UNIT   RATE OF  DUTY/UNIT    EX-DUTY&CESS*       AMOUNT                                                       

  • Dynamic columns in file

    hi, my requirement is to upload file from presentation server. that file is .txt file. the file contains field names in the first row and from second row actual data will be.. if the columns of the file interchanges the program shuld work as it is..i

  • Just now i am installed latest version of Flash Player but it still showing same message An Error occurred

    i have already posted a question and you send a answer to my mail and them i am updated flash plater but is still showing an error in youtube but in other browsers those liks are working

  • What cable is required to tether from Iphone?

    Hi there i will be receiving my Ipad next week and will be looking to tether my 3G signal from my Iphone. Can anyone confirm what cable is required so i can plug the Iphone into the Ipad and use the signal. Thanks in advance. Andy