How to use an element not DB in reports

Hi all
I want to use a DB element not in a report to retrieve a value from the database using a part of the DB in the data model
What should I do?
Create a column placeholder or a formula column?


I tried to do by creating this function:

FUNCTION CHAR INF_RET(PINF_NO IN NUMBER) IS BACK
INF_TEXT VARCHAR2 (100);
BEGIN
SELECT table_namr.information - information is a column of this table
in inf_text
from table_name
where table_name.information = PINF_NO;
RETURN INF_TEXT;
END;

create a placeholder column and then retrieves the value using the previuos as follows:

function INFFormula returns the Char type is
INF varchar2 (100);
Start
SELECT INF_RET(:information_sid) - an element DB
IN: inf_P - it's the placeholder column
DOUBLE;
end;

But it gives me the following error:
"Function INF_RET cannot be used in SQL.

Hello

You cannot use a local function in SQL.

Possible solutions:

Join your Select used directly in your local function in the query (this is the best, because he needs without code and will be the best for performance).

Create a column formula in the same group where your field: information_sid is located, in what form-function, make your selection and return the result as a result of the formula-function. Then you can use this formula column in page layout as part of the 'normal' query

Tags: Oracle Development

Similar Questions

  • How to use resource element in the xml file in the workflow?

    Good afternoon

    In my workflow, I put a parameter of the attribute with the element of resource type and the value of the attribute is an xml file.

    And I had a problem with xml files in my workflow, I would like to use the information in the xml file to store in the variable...

    Example: in the xml file, I put some information about the number of VLAN ID, and in my script task, I would like to know how is used with myvariable.portgroup [0].spec.vlanId?

    Best regards.

    Like this:

    var myXml = new XML(resource.getContentAsMimeAttachment().content);
    

    You can then access your nodes like this:

    myXml.node.subnode

    Google for e4X to get the syntax complete.

  • How to use Google fonts not in an H tag?

    How are you?

    I ask this question because Im printing h tags have attributes that come with to make it as a paragraph, right?

    I'm looking to make a few words - a Google font and a legend. How would this apply to a div? Inline? Or a new css rule? Both?

    I'm not good at handcoding CSS, so that is why I ask.

    I have the Google font in my CSS and call a few HTML headers h1, h2, h2 him fine. How to set the text not in a tag: police in Google?

    (Yes, I think it's a great answer, but not too knowledgeable on this subject)

    In addition, DW CS5 doesn't have some kind of support to make the Google font a selectable in the menu drop-down?

    Use the CSS classes.

    . Google {}

    Google font rules go here...

    }

    HTML:

    This section uses google police

    This topic uses google police

    This topic uses the standard font

    This section uses standard fonts

    CSS classes appear in the drop-down list in your properties panel.

    Nancy O.

    ALT-Web Design & Publishing

    Web | Graphics | Print | Media specialists

    http://ALT-Web.com/

    http://Twitter.com/ALTWEB

  • How o use an icon in a standard report to display the details by using a hyperlink with APEX 5.0

    Hello

    I work with APEX 5.0.

    I would like a report (classic) display a report of details (also classical report) using a hyperlink, but not a "text-hyperlink" like 'click here for details'.

    Instead, I want to use a small icon which will occur the same result when you click on.

    It works fine, when the hyperlink is defined as text like: 'click here for details'.

    When I try to use an image, I don't get the desired result.

    Here's what I tried to Hare:

    1)

    Link-> Link attributes, then filled column: src = "& WORKSPACE_IMAGES. "" #ICON_NAME # "width ="40"height = 40 ' or img src =" & WORKSPACE_IMAGES. " "" #ICON_NAME # "width ="40"height = 40.

    = > no picture for the items in the column, but the link already created for each column of the remains (and works)

    2)

    Formatting of column-> HTML Expression, then filled: < img src = "& WORKSPACE_IMAGES. "" #ICON_NAME # "width ="40"height = 40" >

    = > the image appears for each column element, but the hyperlink is gone.

    Somone has idea how to use a picture/icon to have a hyperling in screens reported a detail?

    Thank you in advance for sharing your experience.

    Kimd cordially

    Hi Patrick,

    Link to the column-> then filled:

    Link text = #ICON_IS #

    Link attributes =.

    Target = this Application Page

    Page = 5

    Article 1 = P5_DEPTNO

    Value 1 = #DEPTNO #.

    Article 2 = P5_DEPARTMENT

    Value 2 = #DNAME #.

    Put this   in the link text not in attributes of link

    Remove the code from the link attributes.

    I don't have how to make it the way that describe you.

    Apex. Oracle.com is a hosted version of application Express, you can build online applications.

    Go to this link and the application workspace https://apex.oracle.com/en/

    Hope this helps you,

    Kind regards

    Jitendra

  • How to use WITH Clause of Apex classic report

    Hello.

    I use Apex 4.2.1 on mod_plsq and Oracle 11 g 3.

    I need to create a report classic usiing a WITH clause in the SQL report.  Apex keeps throwing the error 'CAN finf SELECT statement.

    I then wrapped my report query in an envelope, SELECT * clause.  Apex then raises an error you need to use a variable LONG.

    How is - a uses a WITH clause in the report query.

    Here is my report query:

    SELECT *.

    Of

    (

    WITH W

    AS

    (

    SELECT

    MIN (W1. URMT_BTRS_PK URMT_BTRS_PK),

    MIN (W1. EARLIER_NOTICE_ID URMT_NOTICES_ID),

    TO_CHAR (MAX (W1. EARLIER_NOTICE_TYPE NOTICE_TYPE)),

    TO_CHAR (MAX (W1. NOTICE_TYPE)) | '- Day' EARLIER_NOTICE_TYPE_DESC,.

    MAX (W1. LATER_NOTICE_ID URMT_NOTICES_ID),

    TO_CHAR (MIN (W1. LATER_NOTICE_TYPE NOTICE_TYPE)),

    TO_CHAR (MIN (W1. NOTICE_TYPE)) | '- Day' LATER_NOTICE_TYPE_DESC,.

    W1. NOCHG_STATUS_ORDER,

    W1. CHG_STATUS_ORDER,

    W1. ADD_STATUS_ORDER,

    W1. REM_STATUS_ORDER

    Of

    (

    SELECT

    URMT_BTRS_PK,

    URMT_NOTICES_ID,

    NOTICE_TYPE,

    : P202_NOCHG_STATUS_ORDER AS NOCHG_STATUS_ORDER,

    : P202_CHG_STATUS_ORDER AS CHG_STATUS_ORDER,

    : P202_ADD_STATUS_ORDER AS ADD_STATUS_ORDER,

    : P202_REM_STATUS_ORDER AS REM_STATUS_ORDER

    Of

    V_URMT_COMPARE_NUCLIDE_DATA

    WHERE

    URMT_NOTICES_ID IN (TO_NUMBER(:P202_COMPARE_EARLER_NOTICE_ID), TO_NUMBER (:P202_COMPARE_LATER_NOTICE_ID))

    ) W1

    )

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

    SELECT

    CASE WHEN (X.STATUS IS NULL) THEN

    CASE WHEN (INSTR(X.MASS ||)

    X.NUCLIDE_FRACTION

    ((' *', 1, 1) > 0) THEN '< div class = "chg_highlight" >' | HTF. ESCAPE_SC (' changed (' |)) (SELECT EARLIER_NOTICE_TYPE |) ' => ' || LATER_NOTICE_TYPE | ((' W)) | "< / div >"

    Else 'no change '.

    END

    WHERE (X.STATUS = 'Added') THEN ' < div class = "add_highlight" > ' | HTF. ESCAPE_SC(X.STATUS ||) "To" | (BY SELECTING LATER_NOTICE_TYPE_DESC IN W)) || "< / div >"

    WHERE (X.STATUS = 'Deleted') THEN "< div class ="rem_highlight"> ' |" HTF. ESCAPE_SC(X.STATUS ||) 'From ' | (BY SELECTING EARLIER_NOTICE_TYPE_DESC IN W)) || "< / div >"

    OF OTHER X.STATUS

    END AS STATUS

    ----

    CASE WHEN (X.STATUS_ORDER IS NULL) THEN

    CASE WHEN (INSTR(X.MASS ||)

    X.NUCLIDE_FRACTION

    ((' *', 1, 1) > 0) THEN (SELECT CHG_STATUS_ORDER FROM W)

    OTHER (SELECT NOCHG_STATUS_ORDER FROM W)

    END

    OF OTHER X.STATUS_ORDER

    END AS STATUS_ORDER,

    ----

    X.NUCLIDE,

    ----

    CASE WHEN (X.STATUS IS NULL) THEN

    BOX WHEN (SUBSTR (X.MASS, 1, 1) = ' *') THEN SUBSTR (X.MASS, 2).

    OF OTHER X.MASS

    END

    OF OTHER X.MASS

    MASS OF THE END AS,

    ----

    CASE WHEN (X.STATUS IS NULL) THEN

    BOX WHEN (SUBSTR (X.NUCLIDE_FRACTION, 1, 1) = ' *') THEN SUBSTR (X.NUCLIDE_FRACTION, 2).

    OF OTHER X.NUCLIDE_FRACTION

    END

    OF OTHER X.NUCLIDE_FRACTION

    END AS NUCLIDE_FRACTION

    Of

    (

    -THE NUCLIDES EXIST IN * TWO * BEFORE AND AFTER VIEW.  SOME OF THEIR ATTRIBUTES (MASS, NUCLIDE_FRACTION, ETC.)  MAY HAVE CHANGED.

    SELECT

    STATUS AS NULL,

    VALUE NULL AS STATUS_ORDER,

    C.NUCLIDE,

    BOX WHEN (NVL (C.A_MASS, 'Null')! = NVL (C.B_MASS, 'Null')) THEN ' *' | '< div class = "chg_highlight" >' | HTF. ESCAPE_SC (NVL (C.A_MASS, 'Null') |) ' => ' || NVL (C.B_MASS, 'Null')) | "< / div >"

    Of ANOTHER NVL (C.B_MASS, 'Null')

    MASS OF THE END AS,

    ----

    BOX WHEN (NVL (C.A_NUCLIDE_FRACTION, 'Null')! = NVL (C.B_NUCLIDE_FRACTION, 'Null')) THEN ' *' | '< div class = "chg_highlight" >' | HTF. ESCAPE_SC (NVL (C.A_NUCLIDE_FRACTION, 'Null') |) ' => ' || NVL (C.B_NUCLIDE_FRACTION, 'Null')) | "< / div >"

    Of ANOTHER NVL (C.B_NUCLIDE_FRACTION, 'Null')

    END AS NUCLIDE_FRACTION

    Of

    (

    SELECT

    A.NUCLIDE,

    TO_CHAR(A.MASS, '999.99EEEE') AS A_MASS,

    TO_CHAR(A.NUCLIDE_FRACTION, '99999.999EEEE') AS A_NUCLIDE_FRACTION,

    ----

    TO_CHAR(B.MASS, '999.99EEEE') AS B_MASS,

    TO_CHAR(B.NUCLIDE_FRACTION, '99999.999EEEE') AS B_NUCLIDE_FRACTION

    Of

    V_URMT_COMPARE_NUCLIDE_DATA, A.

    V_URMT_COMPARE_NUCLIDE_DATA B

    WHERE

    1 = 1

    AND A.URMT_BTRS_PK = B.URMT_BTRS_PK

    AND A.NUCLIDE = B.NUCLIDE

    AND A.URMT_BTRS_PK = (SELECT URMT_BTRS_PK FROM W)-TO_NUMBER(:P202_URMT_BTRS_PK)

    AND A.URMT_NOTICES_ID = (SELECT EARLIER_NOTICE_ID FROM W) - TO_NUMBER(:P202_COMPARE_EARLER_NOTICE_ID) - PRIOR NOTICE (EXAMPLE: 30 DAYS)

    AND B.URMT_NOTICES_ID = (SELECT LATER_NOTICE_ID FROM W) - TO_NUMBER(:P202_COMPARE_LATER_NOTICE_ID) - FURTHER VIEWS (EXAMPLE: 7 DAYS.)  NOTE: PRIOR NOTICE IS COMPARED WITH OPINIONS LATER, FOR EXAMPLE, 30 DAYS IS COMPARED TO 7 DAYS)

    ) C

    UNION

    -ADDED NOTICE LATER NUCLIDES.  THEY DO NOT APPEAR IN THE EARLIER OPINION.

    SELECT

    "Added" AS the STATUS,

    (BY SELECTING ADD_STATUS_ORDER IN W) AS STATUS_ORDER,

    A.NUCLIDE,

    TO_CHAR(A.MASS, '999.99EEEE') AS A_MASS,

    TO_CHAR(A.NUCLIDE_FRACTION, '99999.999EEEE') AS A_NUCLIDE_FRACTION

    Of

    V_URMT_COMPARE_NUCLIDE_DATA HAS

    WHERE

    1 = 1

    AND A.URMT_BTRS_PK = (SELECT URMT_BTRS_PK FROM W)-TO_NUMBER(:P202_URMT_BTRS_PK)

    AND A.URMT_NOTICES_ID = (SELECT LATER_NOTICE_ID FROM W)-TO_NUMBER(:P202_COMPARE_LATER_NOTICE_ID)

    AND NOT EXISTS

    (SELECT NULL

    OF V_URMT_COMPARE_NUCLIDE_DATA B

    WHERE B.URMT_BTRS_PK = A.URMT_BTRS_PK

    AND B.NUCLIDE = A.NUCLIDE

    AND B.URMT_NOTICES_ID = (SELECT EARLIER_NOTICE_ID FROM W)-TO_NUMBER(:P202_COMPARE_EARLIER_NOTICE_ID)

    )

    UNION

    -DELETED THE PREVIOUS NOTICE NUCLIDES.  THEY DO NOT APPEAR IN THE NOTICE LATER.

    SELECT

    'Removed' AS the STATUS,

    (BY SELECTING REM_STATUS_ORDER IN W) AS STATUS_ORDER,

    A.NUCLIDE,

    TO_CHAR(A.MASS, '999.99EEEE') AS A_MASS,

    TO_CHAR(A.NUCLIDE_FRACTION, '99999.999EEEE') AS A_NUCLIDE_FRACTION

    Of

    V_URMT_COMPARE_NUCLIDE_DATA HAS

    WHERE

    1 = 1

    AND A.URMT_BTRS_PK = (SELECT URMT_BTRS_PK FROM W)-TO_NUMBER(:P202_URMT_BTRS_PK)

    AND A.URMT_NOTICES_ID = (SELECT EARLIER_NOTICE_ID FROM W)-TO_NUMBER(:P202_COMPARE_EARLER_NOTICE_ID)

    AND NOT EXISTS

    (SELECT NULL

    OF V_URMT_COMPARE_NUCLIDE_DATA B

    WHERE B.URMT_BTRS_PK = A.URMT_BTRS_PK

    AND B.NUCLIDE = A.NUCLIDE

    AND B.URMT_NOTICES_ID = (SELECT LATER_NOTICE_ID FROM W)-TO_NUMBER(:P202_COMPARE_LATER_NOTICE_ID)

    )

    ) X

    )

    I have searched this forum for clues but found nothing.

    Any help would be appreciated.

    Thank you.

    Elijah

    EEG wrote:

    I'll now try to place my report within a packaged procedure, and then run it from there.  You don't love doing cela, but seem to don't have is not a choice.

    Elijah

    Huh?  How can you put a SELECT statement in a procedure?  you return a cursor reference?

    You create VIEWS.  You have three sections.  Give an opinion on each of them.  Test them with SQL Developer (or SQL * more)

    Build from there.

    In fact, it looks like you are trying to compare two tables"and return a DIFF

    THINKING IN SETS

    Use the WITH clause to build a 'virtual' table for EARLIER_NOTICE and a 'virtual' table for LATER_NOTICE.

    Use FULL OUTER JOIN to compare the two.

    THE FORMAT OF THE EXAMPLE:

    select * from (
    with w as ( .... )
    ,table_A as ( -- build the Virtual Table for EARLIER_NOTICE
    SELECT *
     FROM
     V_URMT_COMPARE_NUCLIDE_DATA A1
       join W on (A1.urmt_btrs_pk, W.urmt_btrs_pk  and A1.earlier_notcie_id=W.earlier_notice_id)
    
    --  old code
    -- WHERE
    -- 1 = 1-- why???
    -- AND A.URMT_BTRS_PK     = (SELECT URMT_BTRS_PK FROM W)    --TO_NUMBER(:P202_URMT_BTRS_PK)
    -- AND A.URMT_NOTICES_ID = (SELECT EARLIER_NOTICE_ID FROM W)   --TO_NUMBER(:P202_COMPARE_EARLER_NOTICE_ID)
    ,table_b as ( -- build the Virtual Table for the LATER_NOTICE
    
     select *
     from
    
     V_URMT_COMPARE_NUCLIDE_DATA B1
       join W on (b1.urmt_btrs_pk = W.urmt_btrs_pk  and b1.urmt_notice_id=W.later_notice_id)
    )
    
    --/*** NOW - WE COMPARE THE TWO ***/
    select CASE
        when A.urmt_btrs_pk is null then 'ADDED'
        when B.urmt_btrs_pk is null then 'DELETED'
        else 'possibily updated'
    end CHANGES_MADE
      , A.*
      , B.*
    
    FROM TABLE_A A FULL OUTER JOIN B
    ON (
     A.URMT_BTRS_PK = B.URMT_BTRS_PK
    AND A.NUCLIDE = B.NUCLIDE )
    




  • How to use the elements in the array

    Hi, I am trying to automate a questionnaire using table.

    In the compositionReady for the scene

    SYM. Actual = 0;

    sym.arr = ['Hi', 'Love', 'You'] / / this is my picture of the issue.

    sym.checkArr = function() { / / this function I use to check the issue table whis I'll use.}

    sym. Question = arr [real];      I want to use the value 'Hi' and then increase my 'real' var and then use the value 'Love '.

    }

    In my symbol calendar, I use a trigger in the trigger that I use

    SYM. Stop();

    sym.quest = sym.getComposition () .getStage (). Question; / / I get the value of the Question;

    Sym. $("Ask") .html (quest);                                                        "Ask" is an empty textfield;

    sym.getComposition () .getStage (invested) ++;                    Increase 'real' for the nex time.

    But the code does not work, I think that the problem is the way I use the array index.

    Help, please!

    Thank you =)

    Hello

    chino_10 wrote:

    at the outbreak of timeline you why did you use a local variable?

    It is advisable to use local variables when possible. The quest variable apply only to this trigger, and it will not be postponed to another trigger in the same timeline. So when you use a trigger to set the HTML for a text element in the same timeline, I find cleaner to assign a new value of a local variable HTML.

    chino_10 wrote:

    and if you call the 'real' global variable of Manager compositionReady of why didn' there you call him with all the way like ' sym.getComposition () .getStage (invested) ++; '?

    I think I have didn't express it as clearly as I could have. When you declare sym.actual in compositionReady, you actually declared a variable whose scope is the symbol of the main stage - it is not a global variable. To declare a global variable (which is not always recommended), your code in compositionReady would be:

    real = 0;

    This real variable would now be accessible from any element/symbol in the composition simply by assigning a value to the membership. You can see how quickly this could be embarrassing.

    So back to the scope of variables: If you declare a symbol variable using sym.varName, any element in the same scope may call using sym.varName. If your main scenario triggers can call without using the full address of sym.getComposition () .getStage () invested ++. Instead, you can simply use ++ sym.actual. Less code and easier to read. But if you call from another symbol (outside), you need to use the full, addressing the address actually the variable, i.e., sym.getComposition () .getStage () invested ++.

    HTH,

    Joe

  • How to use photoshop elements easily 12 and bridge cs4?

    I use Bridge to organize my photos. I would buy photoshop elements 12 but I don't want to use the Organizer (I tried before, but all my pictures are in double XI the organizer and its take too much place in my mac!)

    is it possible to use the bridge and PES 12 easily?

    Thank you

    Well, Yes and no. You can use bridge CS4, but you can not update the raw converter, then you will not be able to see the pictures or make conversions from cameras raw files that are not old enough. But the bridge file types associations should automatically update to send pictures on PES 12 for editing.

    However, although I'm not a fan of the Organizer, is, there is something in your message which can be a misunderstanding:

    all my photos are in double XI the Organization

    The Organizer is just a database. It contains no pictures at all and the only time where only he never copy a picture without more precisely said to do is whent you import a picture from iphoto library, and then he does this to avoid writing in the iphoto iphoto library to the outside, which is a very bad thing to do. You should not use the bridge on your iphoto library, either.

  • How to use an option button in the report of the IR to redirect itself to view another report

    IHH team, I have a requirement where I have an IR report option button. By clicking this radio button, another report appears under the main report with few other details of the selected item. The idea was to have a zoom of report as seen in the Group of MS Excel.  However, I am stuck because I don't want the user to press the "submit" button each time after selection of a radio button. I want the result to Report2 to change on the selection radio button in report 1.

    Please notify.

    Kind regards

    Samar

    for example

    Report1 details

    RB col_id text1 text2 Text3

    1 . abc erd 45

    2 ghj dfgrt 67

    Suppose the user selects the first option button, the page displays another report with details below the main report

    Report1 details

    col1_id text1 text2 Text3

    RB1 1 abc erd 45

    2 RB2 ghj dfgrt 67

    Report2 details

    col1_id col2_id text1 text2 Text3

    1 11 ihj pkpk 78

    1 23 ljl kpk 45

    user6255521 wrote:

    Please update your forum profile with a real handle instead of 'user6255521': Video tutorial how to change username available

    When asking a question, always include the information referred to in these guidelines: How to get the answers from the forum

    I was able to achieve using the linl. I created a link on the col_id and it redirected to itself after you set the value of col2_id. I also changed the style of the button link and so col1_id looks like a button.

    However, I was interested to know if we can achieve this with a radio button and use the update form the Report2.

    You mean like this? It is very simple to implement using dynamic measurements.

    1. Add a column of radio group to the main report:

    select
        apex_item.radiogroup(1, d.department_id) rbg
      , d.*
    from
        oehr_departments d
    

    APEX 5.0, apply a static ID "rbg" to the column of radio group.

    2. create a hidden page unprotected element to maintain the value of the selected radio button to use as a filter in the detailed report. In the example, it is P31_DEPARTMENT_ID.

    3 refer to the element of filter in the WHERE clause of the report detail:

    select
        *
    from
        oehr_employees
    where
        department_id = :p31_department_id
    

    Set the Items property of the Page to send in the definition of report P31_DEPARTMENT_IDretail area.

    4. create a dynamic action of change on the Group of radio buttons:

    Event: Change

    Selection type: jQuery Selector

    jQuery Selector:td[headers="rbg"] input[type="radio"]

    Real Actions

    Seq: 10

    Action: Set value

    Type of value: Expression of JavaScript

    JavaScript expression:$(this.triggeringElement).val()

    Selection type: Article (s)

    Point: P31_DEPARTMENT_ID

    Seq: 20

    Action: Discount

    Selection type: Region

    Region:

    The best way to get help with something like that is for you to reproduce the problem with an example on apex.oracle.com. Set up as much as you can before posting here and when you post the question, share identification information of developer comments for the workspace so that we can see the example and work the solution directly.

  • How to use a repository in a new report

    Hello

    I'm starting to learn OBIEE and installed in my home. I installed OBIEE and used the RCU to install a deposit in an Oracle database.
    Then I used the tool of Administration of BI to do a "repository" that connects to my data (also in an Oracle database).
    In the Administration of BI tool, I now have a physical layer, a business model and mapping and a presentation layer. I saved it as a file on my HDD DPR.
    Then, in the Oracle BIEE home I choose 'new report '. But I can not find how do I choose my 'repository' with my data. I also tried to make a new datamodel, but here I am also not able to choose my deposit.

    How can I connect to my data in a report? How does it work?

    Many thanks in advance,
    Best regards
    André.

    You are totally getting confused...

    Have these figure everything out.

    You have installed DB.
    You will create the schema (two users) in DB with the remote control (repository creation utility: basically stores the metadata required for OBIEE).
    You install OBIEE and use these schema here.
    Above installation install weblogic and then deploy on weblogic BI files so that they work. To remember the password weblogic.

    Now when you open Admin tool - password repository must be "Admin123" (capital A) and username is weblogic and password must be the password weblogic.

    You will be able to open to the top of the RPD in online mode.

    I suggest you go first by the OBIEE Architecture then the installation and start the exercises.

    Mark correct or useful if it helps. Also let me know if you were able to open the RPD and answers.

    Kind regards
    Rayan Vieira

  • How to use BETWEEN function in calculation discoverer report?

    Hello

    I need discoverer report to:

    All part_numbers between SDK00 and SDK99 should have calculation (Pay_amount + 100)

    SQL for this is: PART_NUM between 'SDK00' and 'SDK99 '.

    * How can I get the function BETWEEN in Discoverer report level calculation in Discoverer Desktop or discoverer more? *

    Thanks in advance,
    Gayatri

    Published by: cool gayatri on June 24, 2009 08:32

    Hi Gayatri

    Did you not see my answer for the CASE because the CASE offer the use of the clause BETWEEN, but DECODE indeed does not work. Let me give you a quick summary of DECODE.

    In its simplest form, it takes 4 values and looks like this: DECODE (A, B, C, D)

    This basically means, IF A = B THEN C D OTHER

    The trick to solve ENTERS a DECODING is to work on algoriths where A = B. Because we do not know how values are from 00 to 99, although I could tell there were 100 we would of course 100 pieces in DECODING, but that would be awful. How about if we look at it another way and say this:

    IF PART_NUMBER< 'sdk00'="" then="">
    ELSE IF PART_NUMBER > 'SDK99' DO pay_AMOUNT
    ANOTHER pay_amount + 100

    This statement was only 2 hard coded values, but how do you DECODE work with less of? Easy, we use the function LESS. The LEAST function takes 2 values and returns the one with the lowest value. So I use LESS (PART_NUMBER, 'SDK00'), then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the inverse function more GRAND. Put it all together, then you can do this:

    DECODE (PART_NUMBER, BIGGER (PART_NUMBER, 'SDK00'), DECODE (PART_NUMBER, LESS (PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)

    In English it can be read as follows:

    IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0

    Best wishes
    Michael

  • How to use swivel to cross a tabular report with external business logic

    Hello gurus,

    I have it here is the Emp_Hist table, which is usually audit table for the Emp table.

    For each record, we maintain version whenever it updated there.

    ENo EName Sal job DOB Version Tstamp

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

    1 Sanjiv 1000 committed 12/10/89 1 02/03/12 13:00

    1 Sanjiv 1000 committed 12/10/89 2 02/03/12 14:00

    1 Sanjeev 1900 committed 12/10/89 3 02/03/12 15:00

    2 Scott 2000 analyst 22/10/85 1 02/05/12 13:00

    2 Scott 2000 analyst 22/10/85 2 02/05/12 14:00

    2 Scott 3000 lead 22/10/85 3 02/05/12 15:00

    Smith 4000 lead 13/11/81 1 3 06/02/12 13:00

    Smith 5000 lead 13/11/81 2 3 02/06/12 14:00

    3 Smith 5500 lead 13/11/81 3 06/02/12 16:00

    3 Smith 8000 CTO 13/11/81 5 02/06/12 17:00

    4 Tom 4000 lead 13/11/81 1 02/07/12-13:00

    4 Tom 5000 lead 13/11/81 2 07/02/12 14:00

    4 Tom 5500 lead 13/11/81 3 02/07/12 15:00

    Tom 4 8000 CTO 13/11/81 4 02/07/12-16:00

    CREATE

    TABLE Emp_Hist

    (

    ENo NUMBER,

    EName VARCHAR2 (20).

    SAL NUMBER,

    Use VARCHAR2 (20).

    DATE OF BIRTH,

    Version NUMBER,

    Tstamp DATE

    );

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (1, 'Sanjiv', 1000, 'Clerk', to_date (December 10, 1989 "," DD-MON-RRRR'), 1, to_date (March 2, 2012 13:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (1, 'Sanjiv', 1000, 'Clerk', to_date (December 10, 1989 "," DD-MON-RRRR'), 2, to_date (March 2, 2012 14:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (1, 'Sanjeev', 1900, 'Clerk', to_date (December 10, 1989 "," DD-MON-RRRR'), 3, to_date (March 2, 2012 15:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (2, 'Scott', 2000, 'Analyst', to_date (October 22, 1985 "," DD-MON-RRRR'), 1, to_date (May 2, 2012 13:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (2, 'Scott', 2000, 'Analyst', to_date (October 22, 1985 "," DD-MON-RRRR'), 2, to_date (May 2, 2012 14:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (2, 'Scott', 3000, 'Lead', to_date (October 22, 1985 "," DD-MON-RRRR'), 3, to_date (May 2, 2012 15:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (3, 'Smith', 4000, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 1, to_date (June 2, 2012 13:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (3, 'Smith', 5000, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 2, to_date (June 2, 2012 14:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (3, 'Smith', 5500, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 3, to_date (June 2, 2012 15:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (3, 'Smith', 8000, 'CTO', to_date (22 October 1981 "," DD-MON-RRRR'), 5, to_date (June 2, 2012 17:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (4, 'Tom', 4000, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 1, to_date (July 2, 2012 13:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (4, 'Tom', 5000, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 2, to_date (2 July 2012 14:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (4, 'Tom', 5500, 'Lead', to_date (22 October 1981 "," DD-MON-RRRR'), 3, to_date (July 2, 2012 15:00 ',' DD-MON-RRRR hh24:mm'));

    Insert into EMP_HIST (ENO, ENAME, SAL, JOB, DOB, VERSION)

    values (4, 'Tom', 8000, 'CTO', to_date (22 October 1981 "," DD-MON-RRRR'), 4, to_date (July 2, 2012 16:00 ',' DD-MON-RRRR hh24:mm'));

    I want to display changes (current value and previous value)

    for each column as below.

    PK_Value Column_Name Previous_value Current_Value

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

    1         ENo                1                        1

    1 Ename Sanjiv Sanjeev

    1 1000 1900 sal

    1 committed post clerk

    1 DATE OF BIRTH 12/10/89-12/10/89

    2         ENo                2                        2

    2 Ename Scott Scott

    2 sal 2000 3000

    2 senior analyst job

    2 DATE OF BIRTH 12/10/89-12/10/89

    3         ENo                3                        3

    3 Ename Smith Smith

    3 5500 8000 sal

    3         Job                         Lead                  CTO

    3 DATE OF BIRTH 12/10/89-12/10/89

    Solution for above requirement is query below.

    WITH

    got_r_num AS

    (

    SELECT

    Eno,

    Ename,

    To_char (sal) AS sal,

    employment,

    To_char (dob, 'DD-MON-YYYY') AS date of birth,

    ROW_NUMBER () OVER (PARTITION BY eno ORDER BY version DESC) AS r_num

    Of

    emp_hist

    )

    SELECT

    *

    Of

    (got_r_num) PIVOT UNPIVOT (str FOR column_name IN (ename, sal, job, birth date))

    MIN (str) FOR r_num IN (2 AS previous_val, 1 AS)

    current_val))

    ORDER BY

    Eno,

    Column;

    But there are a few changes to the rquirement as below

    There is a table that maintains the version the most recent/maximum for each employee.

    Table EMP_AUD_LOOKUP have structure below

    CREATE

    TABLE emp_aud_lookup

    (

    ENo NUMBER,

    Version NUMBER

    );

    Insert into emp_aud_lookup (ENO, VERSION) values (1.3);

    Insert into emp_aud_lookup (ENO, VERSION) values (2,3);

    Insert into emp_aud_lookup (ENO, VERSION) values (3.6);

    Insert into emp_aud_lookup (ENO, VERSION) values (4.6);

    version of Eno

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

    1 3

    2 3

    3 6

    4 6

    maximum/later in the EMP_AUD_LOOKUP table.

    For emp = 1, version the most recent/maximum is 3

    For emp = 2, version the most recent/maximum is 3

    For emp = 3, version the most recent/maximum is 6, if it's 5 emp_hist table but the matching record in

    Table 6 (since it can be changed in other tables to load of the EMP_AUD_LOOKUP

    that is the case has changed in child table thats why he is 6)

    For emp = 4, version the most recent/maximum is 6, if it is 4 emp_hist table but the matching record in

    Table 6 (since it can be changed in other tables to load of the EMP_AUD_LOOKUP

    that is the case has changed in child table thats why he is 6)

    Updated the result will be like

    PK_Value Column_Name Previous_value Current_Value

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

    1         ENo                1                        1

    1 Ename Sanjiv Sanjeev

    1 1000 1900 sal

    1 committed post clerk

    1 DATE OF BIRTH 12/10/89-12/10/89

    2         ENo                2                        2

    2 Ename Scott Scott

    2 sal 2000 3000

    2 senior analyst job

    2 DATE OF BIRTH 12/10/89-12/10/89

    3         ENo                3                        3

    3 Ename Smith Smith

    3 8000 8000 sal

    3         Job                         CTO                   CTO

    3 DATE OF BIRTH 12/10/89-12/10/89

    4         ENo                4                        4

    4 Tom Tom Ename

    4 8000 8000 sal

    4         Job                         CTO                   CTO

    4 DATE OF BIRTH 12/10/89-12/10/89

    In the case of ENo = 1, will be later

    SELECT version in v_latest OF EMP_AUD_LOOKUP where Eno = 1;

    v_latest = 3

    Latest = > max (version) of emp_hist < = v_latest or 3 < = 3 so 3

    Previous = > max (version) of emp_hist < v_latest-1 or 2 < = 2 so 2

    In the case of ENo = 2, will be later

    SELECT version in v_latest OF EMP_AUD_LOOKUP where Eno = 2;

    v_latest = 3

    Latest = > max (version) of emp_hist < = v_latest or 3 < = 3 so 3

    Previous = > max (version) of emp_hist < v_latest-1 or 2 < = 2 so 2

    In the case of ENo = 3, will be later

    SELECT version in v_latest OF EMP_AUD_LOOKUP where Eno = 3;

    v_latest = 6

    Latest = > max (version) of emp_hist < = v_latest or 5 < = 6 so 5

    Previous = > max (version) of emp_hist < v_latest-1 is 5 < = 5 so 5

    In the case of ENo = 4, will be later

    SELECT version in v_latest OF EMP_AUD_LOOKUP where Eno = 4;

    v_latest = 6

    Latest = > max (version) of emp_hist < = v_latest or 4 < = 6 so 4

    Previous = > max (version) of emp_hist < v_latest - 1 = 4 < = 5 so 4

    Can we make changes above with a modified respect logic based on the id of the most recent version of the other table.

    either we can manipulate in row_number() function.

    Hello.. Try the below...

    WITH qry1 AS (SELECT eno,

    Ename,

    SAL,

    employment,

    Date of birth

    Version

    Max (version) OVER (PARTITION BY eno) mx_ver

    Of emp_hist).

    qry2 AS

    (SELECT eno1,

    To_char (Eno) eno,

    Ename,

    To_char (SAL) sal,

    employment,

    Date of birth to_char(DOB,'DD-mon-YYYY'),

    To_char (ld_eno) ld_eno,

    ld_ename,

    To_char (ld_sal) ld_sal,

    ld_job,

    To_char(DOB,'DD-mon-YYYY') ld_dob

    FROM (SELECT q1.eno, eno1,

    Q1. Nwe eno,

    Ename,

    SAL,

    employment,

    Date of birth

    INF. ROW_NUMBER() over (PARTITION BY q1.eno ORDER BY q1.version),

    Lead (Q1. Eno, 1, Q1. ENO) OVER (PARTITION BY q1.eno ORDER BY q1.version) ld_eno,.

    Lead(Ename,1,Ename) OVER (PARTITION BY q1.eno ORDER BY q1.version) ld_ename,

    Lead(SAL,1,SAL) OVER (PARTITION BY q1.eno ORDER BY q1.version) ld_sal,

    Lead(Job,1,Job) OVER (PARTITION BY q1.eno ORDER BY q1.version) ld_job,

    Lead(DOB,1,DOB) OVER (PARTITION BY q1.eno ORDER BY q1.version) ld_dob,

    version Q1.version

    OF qry1 q1 emp_aud_lookup eal

    WHERE q1.eno = eal.eno

    AND (q1.mx_ver = eal.version AND (q1.version = q1.mx_ver OR q1.version = q1.mx_ver - 1))

    OR(Q1.mx_ver <> EAL.version and Q1.version = Q1.mx_ver)))

    WHERE rn = 1)

    SELECT eno1 eno,

    CASE WHEN lvl = 1 THEN 'ENO '.

    ONCE lvl = 2 THEN 'ENAME '.

    ONCE lvl = 3 THEN 'SAL '.

    ONCE lvl = 4 THEN "JOB."

    ONCE lvl = 5 THEN 'DOB '.

    ELSE 'N/A '.

    END as col_name,

    CASE WHEN lvl = 1 THEN eno

    ONCE lvl = 2 THEN ename

    ONCE lvl = 3 sal THEN

    ONCE lvl = 4 THEN employment

    ONCE lvl = 5 THEN dob

    END as previous_value,

    CASE WHEN lvl = 1 THEN ld_eno

    ONCE lvl = 2 THEN ld_ename

    ONCE lvl = 3 THEN ld_sal

    ONCE lvl = 4 THEN ld_job

    ONCE lvl = 5 THEN ld_dob

    END AS current_value

    OF qry2, (lvl SELECT LEVEL FROM dual CONNECT BY LEVEL<=>

    ORDER BY eno, lvl;

    OUTPUT:-

    -------

    ENO COL_N PREVIOUS_VALUE CURRENT_VALUE

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

    1 1 1 ENO

    1 ENAME Sanjiv Sanjeev

    1 1000 1900 SAL

    1 committed POST clerk

    1 DOB DECEMBER 10, 1989 10 DECEMBER 1989

    2 2 2 ENO

    2 ENAME Scott Scott

    2 SAL 2000 3000

    2 senior analyst JOB

    2 DATE OF BIRTH 22 OCTOBER 1985 OCTOBER 22, 1985

    3 3 3 ENO

    3 ENAME Smith Smith

    3 8000 8000 SAL

    3 USE CTO CTO

    3 DATE OF BIRTH 22 OCTOBER 1981 OCTOBER 22, 1981

    ENO 4 4 4

    4 Tom Tom ENAME

    4 8000 8000 SAL

    4 JOB CTO CTO

    4 DATE OF BIRTH 22 OCTOBER 1981 OCTOBER 22, 1981

    20 selected lines.

  • Problems using an element variable in a report query

    Hello

    Apex 4.2

    Topic: jQuery Mobile

    I have a page with 2 regions.  A region of html with a selection list that fills a component called P1_RESIDENT and below a report region that displays lines depends on what is selected in the above select list.

    My definition of the selection list is:

    Select alias as display_value, id like return_value

    resident

    order by 1

    The query in my report is:

    Select decodes (two_person_lift, 'Y' ", ' 2 person Lift" ', ' 1 person up ") as" elevator 2 people.

    resident

    where id =: P1_RESIDENT

    My expectation is the user will choose a person from the list and a name will be displayed and P1_RESIDENT will start with the return_value of id.  The region of report can run and display lines.

    Unfortunately all I get in the region of report is the following:

    & "DECODE (TWO_PERSON_LIFT, 'Y', '2PERSONLIFT', '1PERSONLIFT')".

    What I am doing wrong?

    Thank you

    Steve.

    Yes, the app is on apex.oracle.com:

    Workspace: dagarin_trial

    App: acr_mobile

    Well I guess to answer your questions, that I fixed it.  I changed my report classic list view type and it works.  I'm not sure though, why list failed.

    Thank you

    Steve.

  • How to use the background rim start page: allowInvokeParams

    Hello

    How to use the element of the rim: background? what it is?

    1. To run javascript? openBISPushListener?
    2. Can you pass parameters between it and the content page?
    3. How to pass parameters between it and the content page?

    It defines a page will be loaded in the background when your application starts.  This page is intended to run any startup logic (for example starting listeners - Push is an excellent example) that your application may need to depend on, without any user interface.

    This background page is WITHOUT user interface.  Any attempt to interact with the user interface (for example change the DOM, calling alert() statements, etc.) will result in no action.  Nor will calls to redirect, since the background page does not interact with the pages of foregroud - if no query string.

    To answer your question - ' How do you pass parameters between it and the content page.  I suggest using a technique of storage like localStorage, WebDB, or same file offline.

  • How to use CLOB in OBIEE 11 g (11115) Reporting

    Hi all

    I have a CLOB object. I need to use it in the report.

    It comes only from the text. I challenged it in SPR as LONGVARCHAR or OBJECT, but it did not work.

    I tried to use evaluate with TO_CLOB but I am getting below error any time

    incompatible data types: expected - got CLOB call OCIStmtExecute OIC. [nQSError: 17010] Prepare the SQL statement failed.

    Please give me an idea how to use a CLOB column in the report.

    I see a rittmen blog that uses lookup, but I do not have this option.

    Please let me know what wrong I do.

    Thanks in advance.

    KN

    Thank you all for your suggestions.

    I raised a SR and learned to know that use of BLOB/CLOB/NCLOB directly in the report is set to 11.1.1.8 version.

    Oops, Yes, I have to wait then need to use the options proposed by srini/nanou.

    Thank you

    KN

  • How to use setTint()?

    Hi, if you know how to use the setTint() feature, please drop me and example code!

    What I try to do is black tint to 60% thumbnails (Sprites), it should be 60% of Persian, I use a black shape on a Sprite on top of the image and the color of the shape the alpha value of 60% to the black but I saw setTint that I want to use it, or how I can do the same thing using colorTransform , which I don't know how to use, but do not know how to adjust the values to do things.

    Thanks for your time!

    rS

    You must use the colortransform. settint is a method of the color class and instance color property is set to a colortransform to your processing of the object. something like:

    yourColor.setTint (0 x 000000,.5);
    yourObject.transform.colorTransform = yourColor;

Maybe you are looking for