Clause TYPE return value ghost

SQL gurus

In the past you have helped me and I hope to take advantage of your knowledge again: I created a select depreciation that dampens the loans based on a table of loan information. The problem is this: when I run an ITERATION on the numbers, the select statement returns a value, but the ITERATION seems to be reading of zero. This leads to a lot of zeros in the resulting table.



DROP TABLE MORTGAGE_FACTS

CREATE TABLE mortgage_facts)
C_USER1 CHAR (15),
C_USER9 NUMBER,
C_USER11 NUMBER,
C_USER10 NUMBER,
C_B1 NUMBER (19.2).
C_B2 NUMBER (19.2).
C_BUDGET NUMBER (19.2).
C_USER12 NUMBER (19.2));

INSERT INTO mortgage_facts VALUES ("Jones", 131828.81, 3,348, 72, 0, 0, 0, 0)


-BEGIN DEPRECIATION

SELECT
P,
C_USER1,
C_USER9,
C_USER11,
C_USER10,
C_B1,
C_B2,
C_BUDGET,
CASE WHEN C_USER12 > 0 then C_USER12
ANOTHER ROUND)
(C_USER9 * (C_USER11/12/100) * ((1+C_USER11/12/100), C_USER10 power) / (Power ((1+C_USER11/12/100), C_USER10) - 1)), 2).
end C_USER12
OF MORTGAGE_FACTS
MODEL
PARTITION (C_USER1)
DIMENSION (p) 0)
MEASURES (C_USER9, C_USER10, C_USER11, C_USER12, C_B1 0, C_B2 0, C_BUDGET)
REGULATION SEQUENCE
ITERATE (1000) UP TO (ITERATION_NUMBER + 1 = C_USER10 [0])
(
C_BUDGET [0] = C_USER9 [0];
C_USER11 [ITERATION_NUMBER + 1] = C_USER11 [0];
C_USER9 [ITERATION_NUMBER + 1] = C_USER9 [0];
C_USER10 [ITERATION_NUMBER + 1] = C_USER10 [0];
C_USER12 [ITERATION_NUMBER + 1] = C_USER12 [0];
C_B1 [ITERATION_NUMBER + 1] = Round (C_BUDGET [CV () - 1] * C_USER11 [0] / 1200,2).
C_B2 [ITERATION_NUMBER + 1] = Round (C_USER12 [CV () - 1] - C_B1 [CV ()], 2),
C_BUDGET [ITERATION_NUMBER + 1] = C_BUDGET [ITERATION_NUMBER] - C_B2 [CV ()]
)
ORDER OF C_USER1, C_USER11, P


The first two results look like this:

P C_USER1 C_USER9 C_USER11 C_USER10 C_B1 C_B2 C_BUDGET C_USER12
0 Jones 131828.81 3,348 72 0 0 131828,81 2023.55
Jones 0 131828.81 3,348 1 367, 8 - 132196,61 367.8 2023.55


As you can see, in the column C - B2, despite that references the C_USER12 column, which should have 2023.55 as a value in it, he's back the mirror in front of C_B1 which leads me to believe that the system reads a ZERO in the column despite the 2023.55 display.

I'm stumped, any ideas would be much appreciated

If you put the CASE for C_USER12 statement in the ACTION clause instead of the select list, it should work. I think I came across an explanation in the documentation somewhere, but I'll have to go back and check.

The result would be

SELECT
P,
C_USER1,
C_USER9,
C_USER11,
C_USER10,
C_B1,
C_B2,
C_BUDGET,
C_USER12
FROM MORTGAGE_FACTS
MODEL
PARTITION BY (C_USER1)
DIMENSION BY (0 p)
MEASURES (C_USER9, C_USER10, C_USER11
, CASE WHEN C_USER12 > 0 then C_USER12
ELSE ROUND(
( C_USER9 * (C_USER11/12/100)*Power((1+C_USER11/12/100), C_USER10)/(Power((1+C_USER11/12/100),C_USER10)-1)), 2)
end C_USER12
, 0 C_B1, 0 C_B2, C_BUDGET)
RULES SEQUENTIAL ORDER
ITERATE(1000) UNTIL (ITERATION_NUMBER+1 = C_USER10[0])
(
C_BUDGET[0]=C_USER9[0],
C_USER11[ITERATION_NUMBER+1]=C_USER11[0],
C_USER9[ITERATION_NUMBER+1]=C_USER9[0],
C_USER10[ITERATION_NUMBER+1]=C_USER10[0],
C_USER12[ITERATION_NUMBER+1]=C_USER12[0],
C_B1[ITERATION_NUMBER+1] = Round(C_BUDGET[CV()-1] * C_USER11[0]/1200,2),
C_B2[ITERATION_NUMBER+1] = Round(C_USER12[CV()-1] - C_B1[CV()],2),
C_BUDGET[ITERATION_NUMBER+1] = C_BUDGET[ITERATION_NUMBER]- C_B2[CV()]
)
ORDER BY C_USER1, C_USER11, P

Another option is to wrap select another selection. i.e.

SELECT * FROM (
SELECT
P,
C_USER1,
C_USER9,
C_USER11,
C_USER10,
C_B1,
C_B2,
C_BUDGET,
CASE WHEN C_USER12 > 0 then C_USER12
ELSE ROUND(
( C_USER9 * (C_USER11/12/100)*Power((1+C_USER11/12/100), C_USER10)/(Power((1+C_USER11/12/100),C_USER10)-1)), 2)
end C_USER12
FROM MORTGAGE_FACTS
)
MODEL ...

Kind regards
Bob

Tags: Database

Similar Questions

  • method toComp on the puppet pin position property returns values ghosts

    To try to fake this girl character, I had a strange behavior came. I was able to work around it fairly easily, but it happened to me that there is something I don't understand. My level of experience with expressions is relatively low, but I have some experience with Javascript for the principles are clear.

    What is annoying me, is that my procedure works fine in a simple scene created entirely in AE. However when I import a .psd file (using composition - keep the sizes of layer), the same approach becomes useless. I feel I'm missing something on the sizes of layer with respect to the compositions or something, or come across a bug.

    OK, this is my first post and it is a bit involved. I was always able to find answers by searching online or in the documentation. Here goes.

    I'm trying to implement a character using puppet pin, I'll link to NULL values as part of a more complex setup on the road. My general approach is to implement the ankles first and see how it moves manually before creating nulls and connect the pins to the positions of NULL values. So far, so simple. To get my NULL values to the exact position of my ankles, I pickwhip the position even in the position of the PIN, see what are the coords, then delete and put in the coords manually to null. Once NULL and the pins are aligned, I just link the pins to the NULL values of an expression in the property of spindles 'position '.

    This all works very well in my simple scene consisting of a solid layer with applied puppet pins and NULL values. Null values align with the pins perfectly, and I don't have to convert the coordinates of PIN for model space or whatever it is. The coords pins seem to be in the computer space already. Then I can link the pins to my NULL values and all is well.

    However, in my complex scene that is generated from an any .psd, the PIN coords do not match the model space. They are very weak and seem to live up to the layer of that the puppet effect has been applied. If the null ends up far to the top left of the model.

    No problem. We just run toComp on the position of the axis, and we should get the model space pin coords. But I did not. I get something off path.

    Why does not the positions of pins match to the model space automatically my comp psd-based, as they did with the simple model?

    It is even possible to successfully run the toComp in the following way

    toComp (thisComp.layer("R_Arm") .deform ("Puppet Pin 1") .position.effect("Puppet").arap.mesh ("Mesh 1"));

    or is the return of the

    thisComp.layer("R_Arm") .deform ("Puppet Pin 1").effect("Puppet").arap.mesh ("Mesh 1") .position;

    not the right to be an argument of toComp data type?

    The coordinated pins just layer based coordinate as another or are there other factors involved?

    I would like to be able to set up the pins where I would like them and bind them with corresponding NULL values exactly the coordinates so that the work is not jumping when I their link.

    More generally, is there any attribute of a psd file that can affect the coordinate system of a model generated when importing. The file in question contained all the regular layers, plus a group of 3 (which came as a demo the full size of the main computer, as expected), no effect of layer or anything like that of other fish.

    Someone more experienced with the expressions and coordinated spaces in AE have an idea of what I'm missing?

    MacBook Pro 2011 beginning 15 "i7 2.2Ghz

    16 GB of RAM

    AMD Radeon 6750 1 GB

    10.9.2 OSX

    12.2.1.5 AE

    I think it would be something like this:

    L = thisComp.layer ("blue solid 1");

    L.toComp (L.effect("Puppet").arap.mesh ("Mesh 1").deform("Puppet_Pin_1").position)

    Dan

  • type of return value

    Hello

    I use JDeveloper 11.1.1.7.

    I have a method in the java file of the application module ("AppModuleImpl") that returns a string.

    Because I want to return an integer and a whole oracle.jbo.domain.Date

    I change the type of value returned to Object []. But when I do, I don't see this method in the interface of the module from the application of the customer. Why?

    Can I do it? or ADF does not return a table of object?

    Thank you.

    You mean like this in the ApplicationModuleImpl

    public getIntDateResult() {} IntDate

    Id IntDate = new IntDate();

    id.setMyDate (new oracle.jbo.domain.Date ());

    id.setMyInt (15);

    return the id;

    }

    Timo

  • Max value return value despite where clause is not not really looking for the reason

    Hello

    Using oracle 11.2.0.3

    Select 'A '.

    of the double

    where 1 = 2

    No returns no row, as expected

    Select max ('A')

    of the double

    where 1 = 2 - that is to say isn't true

    Returns the line with null

    Why is this?

    Thank you

    Hello

    user5716448 wrote:

    Hello

    Thanks for the reply.

    I guess that's rule ageneral wait even if no line because of the place where the condition.

    where 1 = 2 - that is to say isn't true

    Thank you

    Yes, if there are no rows in the table, or no line meets the conditions in the WHERE clause, it would be logical that the query return lines exactly 0, but it is also logical that the query returns exactly 1 row.  People who have designed SQL apperantly thought return 1 row was most helpful.

    If you want the query to return 0 rows when there is no data, you can GROUP BY a constant.  For example:

    SELECT MAX (hiredate) AS last_hitedate

    FROM scott.emp

    WHERE deptno = & deptno_wanted

    GROUP 0

    ;

    If there are any rows that meet the condition in the WHERE clause, then the query will produce 1 row, but if no rows meet this condition, then the query will return 0 rows.

    Personally, I'm happy that they designed this way SQL.  I find it rather convenient that the aggregates without GROUP BY clause will return 1 row.  I do things like

    SELECT COUNT (*)

    FROM table_x;

    often, when I want to know if a table has been filled or not.  Seeing a 0 for the output is much clearer that does not get any results.

  • GetMetaData returns parameters ghosts

    I'm playing with GetMetaData to do a little introspection of my CFC when I came across an anomaly that I don't understand.

    My CFC has multiple nested functions.  One of these functions is defined as follows:

    <cffunction name="getMyDenied" access="public" returntype="query">
      <cfargument name="userid" type="string" required="yes">
      <cfargument name="environment" type="string" required="no" default="0" hint="Pass in 0 for Development and 1 for Production">
    ...
    </CFFUNCTION>
    

    When I test the CFC using GetMetaData, I get this result for the getMyDenied function:

    getMyDenied.JPG

    The thing that confuses me is why the setting of the FLAG appears in the username argument.

    The strange thing about this is if I test the INDICATOR parameter using #Len (TRIM ([cc] CFC_Functions.functions. Parameters [1]. (Hint)) # get the number 6. If I copy the value into a new array or structure, then CFDUMP results it looks like an "empty string".

    Then in the CFC, even I also have this feature:

    <cffunction name="getMyPurchaseOrders" access="public" returntype="query">
      <cfargument name="userid" type="numeric" required="yes"> 
      <cfargument name="environment" type="string" required="no" default="0" hint="Pass in 0 for Development and 1 for Production">
      ...
    </CFFUNCTION>
    

    When I test the CFC using GetMetaData, I get this result for the getMyPurchaseOrders function:

    getMyPurchaseOrders.JPG

    So my two questions are:

    1. Why is the function getMyPurchaseOrders returns correctly where as the function getMyDenied returns a ghost HINT setting?
    2. How to trap the ghost HINT setting?  What I can say is:
      • If I run IsValid ('String', CFC_Functions.functions [cc]. Parameters [xx]. Hint) against the variable that the return is set to TRUE.
      • < CFSET z = ToString (CFC_Functions.functions [cc]. Parameters [xx]. Hint) > #Len (TRIM (z)) # returns 6.
      • < CFC_Functions.functions [cc CFIF]. Parameters [xx]. Council EQ ' ' > WTF < CFELSE > Nada < / CFIF > returns still Nada, even if I entered 6 places in the EQ clause.

    Any ideas or suggestions are welcome!

    @BKBK, I use the CF 9,0,0,251028 server.  I was expecting to see something similar to what you posted too, that's why I was confused.

    Was still not sure why the GetMetaData call returns the parameter ghost, but I finally understood it as the return value.  Of course once the fire came I felt a bit like a dumba$ $.  : O

    Question: Which takes 6 characters to display a space empty? Answer: "& nbsp;"  (without the spaces, so it is displayed in this form) of course.  Once I built my trap to look for these 6 characters, I was able to manage programmatically with the ghost parameter.

  • How to use the clause type conditionally create new lines

    This question is just for learning - no object other than to start real world to create versions of some queries known to learn how to measure the performance of the MODEL clause clause of the MODEL versions.

    The question is: How can you write a STANDARD clause that pivots (updates) ONLY the lines that actually need to rotate and do NOT change the lines that have no value and cannot be rotated.

    I found a good site that has about two dozen example articles on different pieces. This first link is the beginning of the series.

    SQL features tutorials - Clause TYPE

    http://www.sqlsnippets.com/en/topic-11663.html

    This link is to a clause of FAQ of BluShadow MODEL version "how to convert rows to columns."

    Line - MODEL method string

    http://www.sqlsnippets.com/en/topic-11987.html

    The solution to this link uses this line of source:

    POSITION KEY VAL

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

    R08 0 v1, v2, v3,.

    and this result set:

    POSITION KEY VAL

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

    R08 1 v1

    R08 2 v2

    R08 3 v3

    The reason why it produces that result set is this clause of the statement of MODEL

    RETURN THE UPDATED LINES

    If you comment on this article, you will see that the original lines are all in position 0. This means that the solution reproduced EACH SOURCE LINE even if there is only one item in the list of values.

    Thus, even a line source with a single value (for example, the r01 'a') will be updated and updated this line is returned.

    For a large number of data sources with only a few lines that actually need to rotate it would be a great performance of infringement.

    This is the sample data source

    with t as (button 1, 'a' value 'abc' col2, col3 'def' of the double
    Select Union all 2, 'b', 'ghi', 'jkl' from dual
    Union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Union all select 4, 'f', 'stu', 'vwx' from dual
    )
    Select the key, value, col2, col3
    t

    KEY, VALUE, COL2, COL3
    1, a, abc, def
    2, b, GHI, jkl
    3, "c, d, e, mno, pqr.
    4, f, stu, vwx

    Lines 1, 2 and 4 only have a value of (a, b, c respectively.

    Only line 3 must rotate. It contains "c, d, e" and which must become 3 lines in the result set

    Value of the key, col2 col3
    1 an abc def
    2B ghi jkl
    3 c mno, pqr
    3 d mno, pqr
    3 e mno, pqr
    4 f stu vwx

    The nut of the problem is that if the clause 'RETURN UPDATED ROWS' is used, then the lines 1, 2 and 4 must be updated in order to be returned in the result set. And if this clause is NOT used, then line 3 must be updated by 'c', d, e 'c' and two new product lines: one line for a ' and one for 'e '.

    How can you do this with the TYPE clause without the help of the clause "Return LINES UPDATE"? I don't have a solution to sample showing what I tried because I can't understand what it takes to even try.

    I have a solution that uses "RETURN UPDATED ROWS" but I want to compare this performance to the exercise, when this clause is NOT used.

    We ask BluShadow to add the solution of MODEL clause to this FAQ with other similar solutions.

    Like this?

    SQL > with t as
    () 2
    3 select the 1 key, 'a' val, 'abc' col2, col3 'def' of the double


    Select 4 Union all 2, 'b', 'ghi', 'jkl' from dual
    5 union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Select 6 Union all the 4 'f', 'stu', 'vwx' from dual
    7)
    8. Select the key
    9, key_1
    10, val
    11, regexp_substr (val, ' [^,] +', 1, key_1) val_new
    12, col2
    13, col3
    14 t
    model 15
    16 partition by (key)
    dimension (1 key_1) 17
    18 measures (val, col2, col3, (length (val) - length (replace (val, ",")) + 1) as len)
    19 rules
    (20)
    21 val [for 1 to increment of len key_1 [1] 1] = val [1]
    22, col2 [for 1 to increment of len key_1 [1] 1] = col2 [1]
    23, col3 [for 1 to increment of len key_1 [1] 1] = col3 [1]
    24)
    25 order
    26 by key
    27, key_1;

    KEY KEY_1 VAL VAL_N NECK NECK
    ---------- ---------- ----- ----- --- ---
    1 1 has an abc def
    2 b 1 b ghi jkl
    3 1 c, d, e c mno pqr
    3 2 c, d, e d mno pqr
    3 3 c, d, e e mno pqr
    4 1 f f stu vwx

    6 selected lines.

  • Cell in the clause type assignments

    Hello

    I have a table TEST_DATA with the YEAR, FIELD VALUE, in the form of columns.
    Value1, value2, VALUE 3 columns are determined based on field values. If the data is as follows

    THE YEAR FIELD VALUE
    ------------------------------------------
    11111 1 2010
    22222 2 2010
    33333 3 2010
    . . .
    . . .
    . . .
    Can I get the following output using clause type.

    YEAR VALUE1 VALUE2 VALUE3
    ------ ----------- ----------- -----------
    2010 11111 222222 333333
    2009 23243 533635 343434
    2008--34343 364653 343434
    2007 34345 789879 343434

    I don't want to use pivot, because I have to do some calculations on columns of value above. So I tried the following query using the type clause
    and value1, value2, value3 to come in 3 different lines.
    How can I write cell assignments for the value 1, a value of 2, the value 3 in the same line?

    SELECT YEAR, VALUE OF 1, THE VALUE 2, VALUE 3
    OF TEST_FIN_DATA
    MODEL
    RETURN THE UPDATED LINES
    Single KEY
    PARTITION OF (YEAR)
    DIMENSION BY (FIELD)
    MEASURES (VALUE1, VALUE VALUE2, VALUE3 VALUE VALUE)
    RULES
    (value1 ['1'] = value1 ['1'],)
    value [('2 '] = value ['2'],
    value ['3'] = value ['3']);

    Here is an example that you might find interesting:
    http://technology.AMIS.nl/2004/12/16/pivoting-in-SQL-using-the-10G-model-clause/

  • Possibility to get a popup to display the display value "" and not the "return value".

    Version - Application Express 3.2.1.00.11

    I have a list of values that exceed 1500 files and am so impossible to use a Select list.

    When you use a popup lov after choosing the recording, apex displays the return value (in my case a number). Is it possible to let him use the display value (in my case, a text string).

    Concerning

    Ben

    Benton says:

    Version - Application Express 3.2.1.00.11

    I have a list of values that exceed 1500 files and am so impossible to use a Select list.

    When you use a popup lov after choosing the recording, apex displays the return value (in my case a number). Is it possible to let him use the display value (in my case, a text string).

    See limiting the number of values in a LOV

    If it comes to a page element, and then change the type of Popup LOV key.

    If there is a control in a table, it's another reason to upgrade to a supported version, or the tabular form will need to be converted to be manually generated and processed in order to allow the appropriate control be returned using the apex_item.popupkey_from_lov method

  • get the return value of a method of the application module in the workflow

    Hello

    I use jdeveloper 11.1.1.7.0

    I defined a method (return type is useful java card) in the Module of the Application and add this method to the client interface.

    also I have a workflow and in this TF firstly I should execute this method and put the return value for the pageFlowScope parameter. I know that to use this method as a methodCall and set it as an activity by default, but I don't know how to get the return value before entering the jsff page and set the pageFlowScope parameter.

    Habib

    Concerning

    When you add the activity to the way to deal, there are 'Return value' property that you can set to #{pageFlowScope.yourVariable}

    Dario

  • Calling a function multiple return values...

    Hello

    I wrote a simple function 2 return values. It comes to my own understanding.

    create or replace function func1 (empid number)

    Return number

    is

    number of SAL;

    number of deptID;

    Start

    Select the wage in sal of employees where employee_id = empid;

    Select department_id from deptid from employees where employee_id = empid;

    return of sal;

    deptid return;

    end;

    I tried to call the function like below: -.

    declare

    number of performance(1);

    Result2 number;

    Start

    performance(1): = func1 (101);

    Result2: = func2 (101);

    dbms_output.put_line(result ||) '' || Result2);

    end;

    output:-1700 1700

    the salary was posted twice.

    I understand that the second query has not been taken into account.

    Please let me know how this can be achieved.

    Thanks and greetings

    Here is an example of functions Oracle return multiple values - dBforums:

    CREATE or REPLACE TYPE pmc_tab AS TABLE OF NUMBER;

    CREATE TABLE v_stats_daily (start_date date, number of Field1, Field2 number, field3 number);

    INSERT INTO v_stats_daily VALUES('08-OCT-2003',10,20,30);

    INSERT INTO v_stats_daily VALUES('08-OCT-2003',40,50,60);

    INSERT INTO v_stats_daily VALUES('08-OCT-2003',70,80,90);

    CREATE OR REPLACE FUNCTION PMC_STATS

    (pStatDate Date) IS BACK pmc_tab

    MyArray pmc_tab;

    NUMBER of vstat1;

    NUMBER of vstat2;

    NUMBER of vstat3;

    BEGIN

    MyArray: = pmc_tab();

    SELECT sum (Field1), sum (field2), sum (field3)

    IN vstat1, vstat2, vstat3

    OF v_stats_daily

    WHERE the arguments start_date = pStatDate;

    MyArray.EXTEND;

    MyArray (1): = vstat1;

    MyArray.EXTEND;

    MyArray (2): = vstat2;

    MyArray.EXTEND;

    MyArray (3): = vstat3;

    RETURN MyArray;

    END;

    /

    Set serveroutput ON

    DECLARE

    MyDate DATE;

    MyArray pmc_tab;

    I have SEVERAL;

    numOut NUMBER;

    BEGIN

    MyArray: = pmc_stats('08-OCT-2003');

    dbms_output.put_line (' number of Table: ' | to_char (myArray.Count));

    FOR i IN 1.MyArray.last LOOP

    numOut: = MyArray (i);

    -If numOut is null then

    dbms_output.put_line (' value: ' | to_char (numOut));

    -end if;

    END LOOP;

    END;

    /

    /

    Table number: 3

    Value: 120

    Value: 150

    Value: 180

    PL/SQL procedure successfully completed.

    /

    Post edited by: Elya

  • too many return values for a single node

    I have a table with two columns

    the table structure
    ----------------------
    string school_name type
    xmltype obj_xml

    Row1
    ----------
    abc_school,
    < student >
    < student >
    < id > 101 / < ID >
    < teacher > CBA < / teacher >
    < / student >
    < student >
    < id > 102 / < ID >
    XYZ < teacher > < / teacher >
    ONP < teacher > < / teacher >
    RSM < teacher > < / teacher >
    < / student >
    < / students >

    row2
    -----------
    def_school,
    < student >
    < student >
    < id > 301 / < ID >
    pqr < teacher > < / teacher >
    < / student >
    < student >
    < id > 302 / < ID >
    XYZ < teacher > < / teacher >
    < / student >
    < / students >


    is it possible to display data in the format using a query oracle below.
    ---------------------------------------------------------------------------------------------------
    teacher id school_name
    --------------------- ------- ------------
    abc_school 101 abc
    abc_school 102 xyz
    abc_school 102 onp
    RSM abc_school 102


    I used the slot request, throwing an error - too many return values for a single node

    SELECT school_name, teacher
    ExtractValue (value (x), ' / / key ') like student_id
    extractValue (value (x), ' / / value ') AS teacher
    SCHOOL t,.
    TABLE)
    XMLSequence (extract (obj_xml, ' / students/pupils '))
    ) x

    Please post How can I modify this query, the teacher tags may vary for each student

    Published by: user7955917 on May 8, 2012 04:00

    As mentioned in your other thread today, it would be helpful if you could post your exact version of db.
    Samples of work would be appreciated too, the XML data, you gave are not correct.

    I would do it with two XMLTables, like this:

    SQL> SELECT school_name
      2       , x1.id
      3       , x2.teacher
      4  FROM school t
      5     , XMLTable('/students/student'
      6         passing t.obj_xml
      7         columns id       number   path 'id'
      8               , teachers xmltype  path 'teacher'
      9       ) x1
     10     , XMLTable('/teacher'
     11         passing x1.teachers
     12         columns teacher  varchar2(30) path '.'
     13       ) x2
     14  ;
    
    SCHOOL_NAME                            ID TEACHER
    ------------------------------ ---------- ------------------------------
    abc_school                            101 abc
    abc_school                            102 xyz
    abc_school                            102 onp
    abc_school                            102 rsm
    def_school                            301 pqr
    def_school                            302 xyz
    
    6 rows selected
     
    
  • LOV query is not valid, a display and a return value is necessary, column n

    Hello

    I AM FACING
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, 
    the first FROM clause in the SQL statement must not belong to the in-line query.
    with two table, I create lov

    the tables are
    CREATE TABLE  "CRM_SALES_DEPARTMENT" 
       (     "DEPT_ID" NUMBER NOT NULL ENABLE, 
         "CUSTOMER_ID" NUMBER NOT NULL ENABLE, 
         "DEPT_CODE" VARCHAR2(50) NOT NULL ENABLE, 
          CONSTRAINT "CRM_SALES_DEPARTMENT_PK" PRIMARY KEY ("DEPT_ID") ENABLE
       )
    CREATE TABLE  "CRM_SALES_CUSTOMERS" 
       (     "ID" NUMBER, 
         "CUSTOMER_NAME" VARCHAR2(255), 
         "CUSTOMER_ADDRESS1" VARCHAR2(255), 
          PRIMARY KEY ("ID") ENABLE
       )
    I USE QUARY
    select (SELECT CS.CUSTOMER_NAME FROM CRM_SALES_CUSTOMERS CS WHERE CS.ID=SD.CUSTOMER_ID) AD D, SD.CUSTOMER_ID R  
    from CRM_SALES_DEPARTMENT SD where SD.DEPT_CODE=:P16_MARKET 
    But who show me LOV query is not valid, a display and a return value is needed, the column names must be
    different. If your query contains a query online, the first CLAUSE in the SQL statement must not belong to the query online.

    How to solve this problem.

    Thank you

    Published by: 805629 on January 10, 2011 03:46

    Published by: 805629 on January 10, 2011 03:58

    Published by: 805629 on January 10, 2011 03:59

    ¿AD?
    Select (SELECTION of CS. CLIENT_NAME CS CRM_SALES_CUSTOMERS WHERE CS.ID = SD. CUSTOMER_ID) AD D, SD. CUSTOMER_ID R
    CRM_SALES_DEPARTMENT SD where SD DEPT_CODE =: P16_MARKET

    But the correct way is a join outher

    select CS.CUSTOMER_NAME D, SD.CUSTOMER_ID R
    from CRM_SALES_CUSTOMERS CS,
            CRM_SALES_DEPARTMENT SD
    where SD.DEPT_CODE=:P16_MARKET
    And CS.ID(+)=SD.CUSTOMER_ID
    
  • Apex 4 Cascading LOV s how to define a child LOV back to the null return value

    Hello

    My problem is that I use the new dynamic action to implement features of LOV cascading to the Apex 4 which means not having to submit the page to update child LOVs after parent LOV changes.

    What I find, is that when you change the value LOV parent, then the child LOV (which has a return value of zero) is not or by default in the return value zero (in my case no selection should return-1) if the list is filtered to a different set of values, which is not a selection valid. The LOV child is left without a choice when I need its default value to the return value zero (-1, which represents all values).

    Also, I expected to do before the page is sent and filtering to the bottom of the hierarchy of LOVs can work when the child is zero (-1, which means that all values) and in turn her child LOV (s) will also the child null filter.

    Any help would be appreciated.

    Thank you

    Hi 804641,

    I don't know if I get your problem and I tried to reproduce.

    http://Apex.Oracle.com/pls/Apex/f?p=2672:6 is my example with a LOV cascading where I also defined a dynamic action that is triggered when P6_EMPNO changes and it shows the current selection.

    Maybe it helps if install you an example on apex.oracle.com and provide space to work/user/pwd, so that I can have a look. I'm not sure about your sentence "help for a new dynamic to implement cascading LOV feature", because dynamic actions are not necessary for LOVs cascading. It is a characteristic of the types of items themselves where you just set the attribute "Cascading LOV Parent éléments".

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • error with function returning values 'multiple '.

    Hello

    I am trying to write a function to return values "multiple".

    However, he returned the following error when compiling

    Errors of compilation for the sch1.myfn FUNCTION

    Error: PLS-00382: expression is of the wrong type
    Online: 19
    Text: RETURN V_res;

    Error: PL/SQL: statement ignored
    Online: 19
    Text: RETURN V_res;


    question:

    is 1 - necessary to always declare an array? as he's going to return only a single record with multiple columns





    Create or REPLACE the TYPE as result_t table;

    CREATE or REPLACE TYPE result_t as object
    (comments of the user varchar2 (100), varchar2 (4000));



    FUNCTION to CREATE or REPLACE myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) result IS
    type V_res_t is RECORD (user varchar2 (100) comments varchar2 (4000));
    V_res V_res_t;
    BEGIN
    Select a.user, a.comment
    in V_res.user, V_res.comments
    from View1,.
    (select distinct id,
    begin_time,
    Max (Time) on max_time (order by times desc) of view2 b
    where id = IN_LOTID
    and begin_time = IN_BEGIN) b
    where a.id = b.id
    and a.begin_time = b.begin_time
    and a.time = max_time
    and a.id = IN_ID
    and a.begin_time = IN_BEGIN;

    RETURN V_res; -> This is the line that the system keep complaining
    END;

    Note: ignore pls if the results returned is correct, but I expect to always return one row

    pls advise

    TKS & rgds

    Forget your 'result' of tabular type of.

    SQL> CREATE OR REPLACE TYPE result_t as object
      2  (user# varchar2(100), comments varchar2(4000));
      3  /
    
    Type created.
    
    SQL>
    SQL> CREATE OR REPLACE FUNCTION myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) RETURN result_t IS
      2  user# varchar2(100);
      3  comments varchar2(4000);
      4  BEGIN
      5  RETURN result_t(user#,comments);
      6  END;
      7  /
    
    Function created.
    
    SQL>
    

    Nicolas.

  • Operate without any return value

    I had this function, it passes the pidm (pk), the idea is that if "REC1" records, "CVAES' emails code I want to return REC1, if records must CVAES ' and REC1
    "a null value, I want to return REC1"

    REC1 AND CVAES are codes associated with the email address, goremal_email_address, it is not for nothing.
    What's wrong?
    is there a better way to do...

    Thank you
    FUNCTION f_get_email_rec (p_pidm IN gurmail.gurmail_pidm%TYPE)
                                    RETURN VARCHAR2
       IS
    /***********************************************************************************
    Audit Trail:
    
    04/14/2009
    Creator:  
    Change History:
                   This function returns an email, if a recruit has 2 emails ('REC1','MICV') 
                   it WILL returns REC1 otherwise it will return MICV if the email is NULL 
                   it will returns null    
    
    ************************************************************************************/
          p_result   VARCHAR2 (30);
          v_pidm1           goremal.goremal_pidm%TYPE            := NULL;
          v_pidm2           goremal.goremal_pidm%TYPE            := NULL;
          v_email_address1  goremal.goremal_email_address%TYPE  := NULL;
          v_email_address2  goremal.goremal_email_address%TYPE  := NULL;
          v_code1           goremal.goremal_emal_code%TYPE      := NULL; 
          v_code2           goremal.goremal_emal_code%TYPE      := NULL; 
       
    
          CURSOR get_mail_rec1_CUR 
          IS
             SELECT 
               goremal_pidm,
                goremal_emal_code, 
               goremal_email_address
                FROM 
                 general.goremal
                WHERE 
               p_pidm = goremal_pidm 
              and goremal_emal_code = 'REC1'; 
             --- AND srbrecr_term_code = p_term;
              
         CURSOR get_mail_MIVC_CUR 
          IS
             SELECT 
               goremal_pidm,
                goremal_emal_code, 
               goremal_email_address
                FROM 
                 general.goremal 
                 WHERE 
               p_pidm = goremal_pidm 
              and goremal_emal_code = 'MIVC'; 
                            
              
       BEGIN
          IF get_mail_rec1_CUR%ISOPEN
          THEN
             CLOSE get_mail_rec1_CUR;
          END IF;
    
          OPEN get_mail_rec1_CUR;
    
          FETCH get_mail_rec1_CUR  
           INTO v_pidm1, v_code1, v_email_address1;
           
           
           IF get_mail_MIVC_CUR%ISOPEN
          THEN
             CLOSE get_mail_MIVC_CUR;
          END IF;
    
          OPEN get_mail_MIVC_CUR;
    
          FETCH get_mail_MIVC_CUR 
           INTO v_pidm2, v_code2, v_email_address2;
           
                  IF (v_code1 = 'REC1' AND v_code2 = 'MIVC') 
            THEN
             p_result := v_email_address1;
            ELSIF 
               (v_code2 = 'MIVC' AND v_code1 IS NULL)
               THEN  
               p_result := v_email_address2;            
                
          END IF;
    
          RETURN p_result;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             RETURN NULL;
          WHEN OTHERS
          THEN
             RAISE;
       END f_get_email_rec;
       
    Published by: user648177 on April 24, 2009 10:51

    damorgan wrote:
    One person here can try to do properly? A single? Stop writing PL/SQL, that you are paid by the number of CPU cycles, you lose.

    I do not wish to write in PL/SQL, and I read Tom Kyte.

    I just want to be sure on the required configuration or I'll make mine.

    Here you go

    SQL> select * from goremal;
    
          PIDM EMAIL EMAIL_ADDRESS
    ---------- ----- --------------------
             1 REC1  [email protected]
             1 MIVC  [email protected]
             2       [email protected]
             2 MIVC  [email protected]
    
    SQL> select  max( case nvl(email_code,'REC1')
      2    when 'REC1' then email_address end
      3  )
      4  from goremal where PIDM = 1
      5  /
    
    MAX(CASENVL(EMAIL_CO
    --------------------
    [email protected]
    
    SQL> select  max( case nvl(email_code,'REC1')
      2    when 'REC1' then email_address end
      3  )
      4  from goremal where PIDM = 2
      5  /
    
    MAX(CASENVL(EMAIL_CO
    --------------------
    [email protected]
    
    --- OTHER WAY
    SQL> select email_address
      2  from
      3  (select nvl(email_code,'REC1'), email_address,
      4   row_number() over (order by email_code desc) rn
      5  from goremal where pidm=1
      6  )
      7  where rn=1
      8  /
    
    EMAIL_ADDRESS
    --------------------
    [email protected]
    
    SQL>
    SQL> select email_address
      2  from
      3  (select nvl(email_code,'REC1'), email_address,
      4   row_number() over (order by email_code desc) rn
      5  from goremal where pidm=2
      6  )
      7  where rn=1
      8  /
    
    EMAIL_ADDRESS
    --------------------
    [email protected]
    

    SS

    Published by: Sanjay S on April 24, 2009 19:33

Maybe you are looking for

  • Qosmio X 500-116 will not play blue-ray discs

    Hello world bit of a newbie on laptops but my Qosmio dvd player won't play Blu - ray movies using the "Toshiba DVD Player", although it will play normal DVD movies no problem. I use the wrong software? search through programs pre-installed, I as ' nt

  • AirPrint for iphone

    I am unable to airprint for iphone 4 s. I installed and uninstalled, through installation, eprint is turned on, I am connected to the same WiFi with my iphone & PRTR, but when I go to print an e-mail I have rcv msg - no printer found airprint.

  • Installed Windows 7. can not see my iphone on itunes. I have reinstalled itunes.

    Installed Windows 7. can not see my iphone on itunes. I have reinstalled itunes. I had this problem when I was with Vista. Help, please!

  • Aspire error TSRI S7-392

    Hello, a newbie here. Bought an Aspire S7-392.   Upgrade to Windows 8.1.   Partitioned the SSD to 2 discs.   The Intel RST displays error that the SDD0 may have some errors that could cause data problems. I chatted with representatives of acer suppor

  • Language package, spell checking for Windows Mail 6.0

    I installed a new language by purchasing with a 2007 Office Language Pack, but the back of the tongue becomes unavailable under Windows Mail for spell checking. What can I do?Basic questions: Can the Language Pack Office support all the standard Wind