Looping on a method that returns a query

Hello

I have a method that returns a query, I convey in this method, an identification number, the query uses in where clause. Now I have another query that returns a list of identification numbers that I have to loop through the appellant the first method and passing in the ID number, for example

methodA

Browse the methodA results
Call methodB passing methodA.ID
results of methodB
close the loop

now, the problem I have is that methodB returns a query and I want to be able to return the results of methodB as a unique query structure. I don't know how many times I will do a loop through the results of methodA, maybe twice, he could by ten times. Thus, the results of calling methodB could be very large.
How can I add methodB results in a single query structure?

I finally had to create a monster query with joins in about three tables, but it works.

Tags: ColdFusion

Similar Questions

  • Method that returns the bb::cascades:Application?

    Hi, is there a method that returns the bb::cascades:Application?

    I solved the problem by simply passing the request of my class that needs it. If its solved because there is no such method I think.

  • ADF Faces: RicheTableau - how to create a richeTableau method of bean datacontrol object that returns a list of objects

    Build JDEVADF_12.1.2.0.0_GENERIC_130608.2330.6668

    I have a data bean control method that returns a list of SearchResultRow objects. Each SearchResultRow has a list of SearchResultColumn objects. SearchResultColumn is the attribute name, value, type of data.

    The method returned data looks like:

    SearchResultRow {col1, a1, string}, {col2, a2, date}, {col4, 13, number}, {col4, a4, string}

    SearchResultRow {col1, b1, string}, {col2, b2, date}, {col4, 23, number}, {col4, b4, string}

    SearchResultRow {col1, c1, string}, {col2, c2, date}, {col4, 33, number}, {col4, c4, string}

    I try to display searchResult table depending on whether it

    col1 col2 col3 col4

    A1 a2 a4 13

    B1 b2 b4 23

    C1 c2 c4 33

    I drag my return value of method to the jsf page to create a link to the tree.

    < Tree IterBinding = "retrieveSearchResultsIterator" id = "SearchResultRow" >

    < nodeDefinition DefName = 'model. SearchResultRow"name ="SearchResultRow0">

    < AttrNames >

    < item Value = "resultType" / >

    < / AttrNames >

    < accessors >

    < item Value = "searchResultColumns" / >

    < / accessors >

    < / nodeDefinition >

    < nodeDefinition DefName = 'model. ResultColumn"name ="SearchResultRow1">

    < AttrNames >

    < item Value = "name" / >

    < item Value = 'length' / >

    < item Value = "query" / >

    < item Value = 'type' / >

    < item Value = 'value' / >

    < / AttrNames >

    < / nodeDefinition >

    < / tree >

    On my jsf page, I added a table then reused the liaison of the tree.

    < af:table value = "#{bindings." SearchResultRow.collectionModel width}"= '100% '.

    var = "row" rowBandingInterval = "0" id = "t3" binding = "#{backingBeanScope.backing_Test4.t3}" partialTriggers ="": b1 ' columnStretching 'last' = > "

    My thought is in backing bean, loop through the table variable "line" which is my SearchResultRow and then loop SearchResultColumns of the line to build the RichColumn and add it to the table.

    My question is: is this feasible? How can I get hold of the var 'line' backing bean?

    Any other suggestions how to proceed?

    Thank you.

    I thought about it the adf table creation dynamically.

    This link is useful. ORACLE ADF (Application Development Framework): creating dynamic table

  • Request report - use the function that returns the cursor

    My requirement is to create a report, which the source will be a function that returns a cursor (the type of cursor is ref cursor).
    How this can be done?

    for example. function my_func (pol_no in number) return cur_type < ref cursor >

    Edited by: viveks on October 27, 2009 10:09

    Better to look at a function that returns a query, or use a hose to treat your cursor returned, because the APEX at the moment can NOT handle the sliders in reports...

    Thank you

    Tony Miller
    Webster, TX

  • Query that returns number 1 - Add additional columns based on percentages

    I have a query that returns a large number.  The return value will always be a single field (a column, a line, a single value).

    I need to have also three other columns in the return of this request: one that returns a number that is 50% of the original number, one that returns a number that is 75% of the original number, and one that is double the original number.  How is that possible?  If anyone can point me to examples, it would be a great help.  I got the results mixed by searching, so I'm not sure good practices.

    Thank you for the input in advance.

    Hello

    Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

    Explain, using specific examples, how you get these results from these data.

    If you show what you want to do using commonly available tables, like those of the scott schema, then you don't need to display the sample data; just results and explanations.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    I'm not sure that understand the question.

    If x is a number, then

    .50 * x is 50% of this number,

    .75 * x is 75% of that number, and

    2 * x is to double this figure.

    You can get them all in the same query, if you want to.  For example:

    SELECT ename

    sal

    .50 * sal AS p_50

    .75 * sal AS p_75

    2 * sal AS dbl

    FROM scott.emp;

    Output:

    ENAME SAL P_50 P_75 DBL

    ---------- ---------- ---------- ---------- ----------

    SMITH, 800, 400, 600, 1600

    1600 800 1200 3200 ALLEN

    1250 625 WARD 937,5 2500

    JONES 2975 1487.5 2231,25 5950

    1250 625 MARTIN 937,5 2500

    2850 1425 BLAKE 2137,5 5700

    2450 1225 CLARK 1837,5 4900

    3000 1500 2250 6000 SCOTT

    KING 5000 2500 3750 10000

    1500 750 1125 3000 TURNER

    1100 550 825 2200 ADAMS

    JAMES 950 475 712,5 1900

    FORD 3000 1500 2250 6000

    1300 650 975 2600 MILLER

    Is that what you ask?

  • [ADF, JDev12.1.3] Method in AM that returns a ViewRowImpl object. How...?

    Hallo,

    I need to create a method in the Module of the Application that returns a ViewRowImpl object.

    I want to call this method to a bean that will consume the returned line.

    I ask if this is possible, since in the AM configuration I don't see my method to expose it to the customer.

    What's wrong?

    Thank you

    Federico

    What's wrong?

    Documentation: https://docs.oracle.com/middleware/1213/adf/api-reference-model/oracle/jbo/server/ViewRowImpl.html

    "Client applications should not access this class on the client tier of an application. Instead, the Row interface must be used for access to the client tier. »

    In general, if you can use the class interface or application in a certain part of the code, always use interface.

    Dario

  • SQL QUERY THAT RETURNS THE PL/SQL

    Hello

    I'm putting in 4.2 below apex

    DECLARE

    date of frdate: =: P22_FROMDATE;

    date date: =: P22_TODATE;

    l_date1 varchar2 (11): = to_char(frdate,'dd-mon-yyyy');

    l_date2 varchar2 (11): = to_char(todate,'dd-mon-yyyy');

    v_sql varchar2 (32000);

    v_Name varchar2 (4000): = months_name (frdate, todate);

    char (1) of the v1: = q "[']";

    number of lbr1 (6): =: P22_FROMBRANCH;

    number of LBR2 (6): =: P22_TOBRANCH;

    number of M1 (6): = 11;

    Start

    v_sql: ='SELECT * FROM (SELECT LBRCODE, PRDACCTID, MN, AVGX FROM (SELECT LBRCODE, PRDACCTID, MN, SUM (BALL) BALL, COUNT (MN) DAYS, ROUND (SUM (BAL) count (MN), 2) AVGX ';))

    v_sql: = v_sql | "FROM (SELECT LBRCODE, PRDACCTID, TO_CHAR (BALDATE,'|)) CHR (39) | ' MM' | CHR (39) |') ' | ' ||'|| CHR (39) | » _'|| CHR (39) |' | ' || «TO_CHAR (BALDATE,'|)» CHR (39) | ' AAAA '. CHR (39) |') MN, BALL ';

    V_SQL: = V_SQL | "(SELECT Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE, T_OST_NEW (Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE) BALL ';

    V_SQL: = V_SQL | "FROM (select TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') baldate FROM DUAL Union all the ';

    V_SQL: = V_SQL |' select (TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') + level) double baldate ';

    V_SQL: = V_SQL |' connect by level < = (TO_DATE('||) Chr (39) | l_date2 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') -TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' Dd-mon-yyyy ' | CHR (39) |')) ) Q1,';

    V_SQL: = V_SQL | "(SELECT LBRCODE,'|) ' (rpad (prdcd, 8,'|)) V1 ||'' || v1 |') || LTRIM (rpad('|| v1 ||) » x'|| V1 | «, 25, » || v1 | » 0' || v1||'),'|| v1 | » x'|| v1 |')) prdacctid OF D009021 WHERE the LBRCODE between ' | : P22_FROMBRANCH |' and ' | : P22_TOBRANCH | "AND moduleinfo =' | TO_NUMBER(:P22_SELECTLIST);

    V_SQL: = V_SQL |') ((Q2)) GROUP BY LBRCODE, PRDACCTID, MN))';

    V_SQL: = V_SQL | "PIVOT (MAX (AVGX) (MN) IN (';))

    V_SQL: = V_SQL | V_NAME;

    V_SQL: = V_SQL |')) ORDER OF LBRCODE, PRDACCTID ';

    RETURN V_SQL;

    END;

    I created all the elements of the required page

    I get the error message like missing expression

    to test, I created a function to return the query, it works very well know to return a query that gives me desired report

    am I missing something?

    Help, please

    HEMU wrote:

    Hello Sir

    Sorry to bother you again

    I tried to use «function that returns colon-delimited topics»

    and I got following error

    unable to determine query headings: ORA-06550: line 1, column 138: PLS-00103: Encountered the symbol ";" when expecting one of the following:  . ( ) , * % & = - + < / > at in is mod remainder not rem =>  <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset The symbol ")" was substituted for ";" to continue.
    
    failed to parse SQL query:
    

    can take you a look at page901 once again please and a function named months_namex

    is it feasible that I'm looking for?

    The immediate cause of this error is simply incorrect report headings function call syntax:

    return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy')

    This should be:

    return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy'));

    However there is no months_namex function defined in the workspace.

  • Need help to write a MySQL query that returns only the peer matching records

    Because I don't know how to explain it easily, I use the table below as an example.

    I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.

    Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.

    How can I create a query that will do it?


    ID | col1 | col2
    --------------------
    1. ABC | DEF
    2. DEF | ABC
    3. ABC | IGS
    4. DEF | IGS
    5. IGS | DEF


    * Please let me know if you have no idea of what I'm trying to explain.

    I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.

    SELECT a.col1,
    a.col2
    FROM table_name AS a
    LEFT OUTER
    Table_name JOIN b
    ON b.col1 = a.col2
    AND a.col1 = b.col2
    WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '.

  • How to use a method described in a customer VO interface that returns a value

    ADF 11 g

    Hello

    I created a method on a view object that returns a Boolean value.
    I exposed the method of the interface to the customer of the view object
    I paste the method in my view through page links page.

    How to call the method of a bean and get the return value?

    Concerning
    Paul

    Paul,

    I do not have the parameter passed to the method, I spent just the binding of method name in the method getOperationBinding. If you want to pass parameter, you can do either via the operationBinding or using NamedData bean in pagedef

    Jean Lou

  • I need a query that returns the average amount of characters from text colum in MS SQL.

    I need a query that returns the average amount of characters from text colum in MS SQL.

    Could someone show me how?

    Sorting, I need of the

    DATALENGTH

    function

  • Selection of a function that returns a sys refcursor or alternative

    I have a query that returns a result set of three columns, namely the SSN, the PAID_YEAR and the PAID_TOTAL. This query, I can:

    1. Create a view and then question him.
    2. Create a function result set and return

    If I go the first way, that a simple request like this takes more than 20 seconds:

    SELECT PAID_YEAR,PAID_TOTAL FROM VIEW_1 WHERE SSN=12345678912882;

    I know it's because when I query a view engine first brings all the rows in the view and then filters the lines for the criteria provided.

    If I go the second way I can send only a parameter and make the engine look for only the rows that match the condition and the Recordset. But I don't know how then SELECT this result set returned. I took a look at the tables in pipeline, but do not understand how to their advantage. So my final question is if it is somehow possible to select from the result set returned by a function like this:

    SELECT * FROM FUNCTION_1(12132323232).

    If Yes, then how, if not, what would be another way?

    I know it's because when I query a view engine first brings all the rows in the view and then filters the lines for the criteria provided.

    No - you don't "know that" because it is not true. Just check out the plan of the command explain to yourself. Oracle can always use appropriate indexes so that only the needed rows are returned.

    So my final question is if it is somehow possible to select from the result set returned by a function like this:

    SELECT * FROM FUNCTION_1(12132323232).
    

    No - you can't do it like that. You must use the TABLE function to process the result of the function defined in a table:

    'SELECT * FROM TABLE(FUNCTION_1(12132323232)).

    -type to match record emp
    create or replace type emp_scalar_type as an object
    (EMPNO NUMBER 4,
    ENAME VARCHAR2 (10),
    USE VARCHAR2 (9).
    MGR NUMBER 4,
    HIREDATE DATE,
    NUMBER OF SAL (7, 2)
    NUMBER OF COMM (7, 2)
    DEPTNO NUMBER (2)
    )
    /

    -records of the emp table
    create or replace type emp_table_type to table of emp_scalar_type
    /

    -function of pipelined

    create or replace function get_emp (p_deptno number)
    return emp_table_type
    PIPELINED
    as
    TYPE EmpCurTyp IS REF CURSOR RETURN emp % ROWTYPE;
    emp_cv EmpCurTyp;
    l_rec emp % rowtype;
    Start
    Open emp_cv SELECT * from emp where deptno = p_deptno;
    loop
    extract the emp_cv in l_rec;
    When the output (emp_cv % notfound);
    line of conduct (emp_scalar_type (l_rec.empno, LOWER (l_rec.ename),
    l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno));
    end loop;
    return;
    end;
    /
     
    Select * from table (get_emp (20))

  • a function that returns the type with a table joint!

    Good day to all,
    I have a function that returns a type.

    so I select it as:
    Select * from table (function (param1, param2))

    now I want to combine this with a table so that the settings for the service we get from the join table. Is this possible? And how?
    I tried different options without success.

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Thanks in advance?

    user564819 wrote:

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Somehow...

    SQL> create or replace type TIntegers is table of integer;
      2  /
    
    Type created.
    
    SQL>
    SQL> --// our sample pipeline simply spews 2 numbers for eevry number input - simple
    SQL> --// to use for the testcase below
    SQL> create or replace function FooPipe( n number ) return TIntegers pipelined is
      2  begin
      3          pipe row( trunc(n) );
      4          pipe row( trunc(n)*-1 );
      5          return;
      6  end;
      7  /
    
    Function created.
    
    SQL>
    SQL> with dataset( n ) as(
      2          --// ignore this part as it only builts a base table
      3          --// for us to use to select values for input to
      4          --// to the pipeline - in "real world" use this table
      5          --// will already exist
      6          select
      7                  level
      8          from    dual
      9          connect by level <= 10
     10  ),
     11  pipe_line( n, array ) as(
     12          --// we run the pipeline as a nested table column
     13          --// in the SQL projection - the CAST is important
     14          --// in order to establish the nested table type
     15          select
     16                  d.n,
     17                  cast(
     18                          FooPipe(d.n) as TIntegers
     19                  )
     20          from    dataset d
     21  )
     22  --// we now use a standard query to unnest the nested table column
     23  select
     24          p.n,
     25          pipe_val.*
     26  from       pipe_line p, TABLE(p.array)  pipe_val
     27  /
    
             N COLUMN_VALUE
    ---------- ------------
             1            1
             1           -1
             2            2
             2           -2
             3            3
             3           -3
             4            4
             4           -4
             5            5
             5           -5
             6            6
             6           -6
             7            7
             7           -7
             8            8
             8           -8
             9            9
             9           -9
            10           10
            10          -10
    
    20 rows selected.
    
    SQL>
    

    Not sure I like it. What is the real problem that this method (driving a pipeline with input of a base table rows) is supposed to address? There may be a simpler and more elegant approach...

  • test a SP that returns a CURSOR

    I am using Oracle 11 and trying to use SQL Developer. However, I can't seem to get the DEBUGGING to work to test the call a SP that returns a cursor.

    I wrote a small test program to test, but they do not compile and I'm not sure why not. Can help you?

    the first code fragment is a package that I have that has a defined CURTYPE. It is used throughout my request, when you declare a cursor:
    create or replace
    PACKAGE          "SP_STATE" 
    Is
        type     curtype is ref cursor;
    ...
    now, here's the first part of the SP I want to test. Note that I've defined PriceCur as using the CURTYPE package.
    create or replace
    PROCEDURE          "USP_GETL_ACCOUNT_PRICES" (
      AcctNo          in     marketer_account.mka_last_full_css_acct_no%type,
      MktrNo          in     marketer_account.mka_mktr_no%type,
      Status                     in              varchar2 default null,     
      PriceCur          out            sp_state.curtype
      )
    as
    begin
    Open Pricecur For 
    Select 
    ...
    Now, here's my m.o.:
    Declare 
       Price_Cur  Sp_State.Curtype;
       price_rec  price_cur%rowtype;
    Begin
       Usp_Getl_Account_Prices('302189139000026', 11813,'A', price_cur);
       Open Price_Cur;
       Loop
          Fetch Price_Cur Into Price_Rec;
          Exit When Price_Cur%Notfound;
          dbms_output.put_line(price_cur%rowcount || ') ' || price_rec.apr_account_price_id);
       End Loop;
       close price_cur;
    end;
    They do not compile. What I'm doing here is call SP - pass 3 incoming parameters and retrieve a cursor.
    so I want to loop through the cursor and list some fields on...

    Where I'm going wrong? Any help would be greatly appreciated.

    Sean

    userLynx wrote:
    I get this error:

    Error report:
    ORA-06504: PL/SQL: return variables of the game results or the query types do not match
    ORA-06512: at line 7
    + 06504. 00000 - "PL/SQL: return of the variable result set or query types do not match." + "
    * Cause: Numbers or types of columns in a query does not match declared.
    return type of a variable result is defined or declared two result types
    Set of variables do not match.
    * Action: Change the program or the declaration statement. Check what query variable +.
    actually we want during execution.

    He doesn't like the var defined as varchar2. I can change that to a % rowType heart?

    When I proposed to modify the code according to your needs, I assume that you would like to change the instruction WRT Fetch your columns retrieved in the Refcursor; And so I suggest no changes in it.

    As riedelme says, a record would help for better maintainability. :)

    You do not experience other errors, you met earlier, right?

    Kind regards
    P

    Published by: Jen K on July 12, 2012 12:04 AM

  • How a plugin method can return an object of properties (javascript)

    Hello

    With VC0 4.1, I have a plugin method written in Java. I would like that this method returns an object which Orchestrator (VCO) will see as an object of Properties javascript directly without passing by the serialization or other treatment...

    To do:

    -What class of java object my plugin method must return?

    -What should I use as return-type attribute when my method declaration in the VSO.xml file?

    "< script-the method name = 'myMethod' java-name = 'myMethod' return-type ="?">"

    Thanks in advance.

    Arnaud

    Hi Arnaud,.

    You're right, the object that returns your method should be Hashtable (I actually thought that properties should also be valid since it extends from Hashtable).

    Try with:

    public Hashtable {getInfosInProperties()}
    Hashtable retMap = new Hashtable ();

    retMap.put ("key1", "value 1");
    retMap.put ("Key2", new Long (2));
    retMap.put ("key3", true);

    Return retMap;
    }

    The vso.xml file is very good with "Properties". And you will get an object from the vCO scripting API to script properties.

    I hope it helps.

    Sergio

  • Function returning the query takes longer to run in Apex4.0

    Hi all

    I've created a report using the function returns the query. The function returns the query based on parameters that returns the dynamic columns. When I run the query in sql developer the query generates and returns the result in 3mins. But in the apex, it takes 35 minutes maximum to return.

    The query returns about 10000 lines.

    What a performance problem in the query or Apex? can someone help plz

    Concerning
    REDA

    No it's just the first tranche of 500. You can run it in good old SQL * more and the total time of the time (be patient however)

Maybe you are looking for

  • Conflict of Bluetooth and WiDi: Intel Dual Band Wireless-AC 3160

    I have a HP Envy 17 laptop t-j100 with 4th generation CPU i7-4700mq as well as the NIC Intel Dual Band Wireless-AC 3160.  The Wifi and Bluetooth worked well. However, Bluetooth has stopped working and has disappeared from the list of devices in Devic

  • Blue stain on the pictures taken in the Sun

    Hello, I just bought a DSC-HX9v and if I take a picture with the Sun on the lens I get a blue dot on the picture. Have a friend who just bought the same camera and it also happens on their camera too. Tried most of the main parameters of the smart Au

  • Computer Toshiba laptop turns off after 3 seconds

    I can't understand what is happening with my computer, but I hope that this information will help you. Any ideas would be greatly appreciated. There are 3 computers involved. One is a Toshiba laptop Satellite L300D Vista I had in December 2008 and th

  • When I have my vista right click windows needs to restart

    When I click on my HP DV9700 laptop using the touchpad mouse or a USB external mouse Windows stops downs and application restart.  From time to time I have a chance and a right mouse click works but most of the time the computer resets.

  • C4400 all in one printer and windows 8

    Hi, problems with my printer. I have installed the correct drivers in windows 8, but when I try to print a document pg 4 it will print 2 pages then go back and print the same pages again or just to have a page. Any ideas on what is wrong?